Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Check that current nightly matches that from contract
  • Loading branch information
HCastano committed Oct 20, 2022
commit b90f12639a009fe87dee6cb1078d9b6f5469bedb
17 changes: 17 additions & 0 deletions crates/cargo-contract/src/cmd/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,23 @@ impl VerifyCommand {
serde_json::from_value(build_info.clone().into()).unwrap();

// 2. Call `cmd::Build` with the given `BuildInfo`
let expected_rustc_version = build_info.rustc_version;
let rustc_version = rustc_version::version_meta()?;
let rustc_version = format!(
"{:?}-{}",
rustc_version.channel,
rustc_version.commit_date.expect("TODO")
)
.to_lowercase();

anyhow::ensure!(
rustc_version == expected_rustc_version,
"You are trying to `verify` a contract using the `{rustc_version}` toolchain.\n\
However, the original contract was built using `{expected_rustc_version}`. Please\n\
install the correct toolchain (`rustup install {expected_rustc_version}`) and\n\
re-run the `verify` command.",
);

let args = ExecuteArgs {
manifest_path: manifest_path.clone(),
verbosity: Default::default(),
Expand Down