Skip to content

Commit

Permalink
Add xdr version to version subcommand output (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch authored Dec 6, 2022
1 parent 2d0d37d commit 36a0dd2
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions cmd/soroban-cli/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,29 @@ pub struct Cmd;
impl Cmd {
#[allow(clippy::unused_self)]
pub fn run(&self) {
println!("soroban {} ({})", env!("CARGO_PKG_VERSION"), GIT_REVISION,);
println!("soroban-env-interface-version: {}", meta::INTERFACE_VERSION);
println!("soroban {} ({})", env!("CARGO_PKG_VERSION"), GIT_REVISION);

let env = soroban_env_host::VERSION;
println!("soroban-env {} ({})", env.pkg, env.rev);
println!("soroban-env interface version {}", meta::INTERFACE_VERSION);

let xdr = soroban_env_host::VERSION.xdr;
println!(
"stellar-xdr {} ({})
xdr next ({})",
xdr.pkg, xdr.rev, xdr.xdr_next,
);
}
}

// Check that the XDR cannel in use is 'next' to ensure that the version output
// is not forgotten when we eventually update to using curr. This is a bit of a
// hack because of limits of what you can do in a constant context, but by being
// a constant context this is checked at compile time.
const _: () = {
#[allow(clippy::single_match)]
match soroban_env_host::VERSION.xdr.xdr.as_bytes() {
b"next" => (),
_ => panic!("xdr version channel needs updating"),
}
};

0 comments on commit 36a0dd2

Please sign in to comment.