-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add verify
command
#1306
Add verify
command
#1306
Conversation
This should maybe be a warning instead of an error, but I'll need to experiment with this more.
Since releases of `cargo-contract` are now bundled with a `wasm-opt` library we can assume that equal versions of `cargo-contract` contain equal versions of `wasm-opt`.
git update-ref -d MERGE_HEAD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing: a lot of trust will be put into this command, therefore we should have integration tests here for both the positive and negative results of this command.
I doubt we will be able to simulate different OS environments, but minor changes in the code should work. |
tracing::debug!("Building contract in {}", project_dir.to_string_lossy()); | ||
cargo_contract(&project_dir) | ||
.arg("build") | ||
.arg("--release") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oddly, without the flag, the cargo contract build produces different wasm binaries even though the crate name and code are identical but places in differnt temp dirs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Might be good as a next step to be able to verify from a contract account id that it is an instance of the verified contract. Should be straightforward just by looking up the code hash and then comparing that.
Supersedes #696
Adds a
cargo contract verify <path to reference contract bundle>
command which allows to verify if the given contract code matches the reference bundle.In addition to the previous PR, I have added the support to verify "verifiable" contract. If the contract bundle specify
image
in metadata, then we build the target contract code in the container of the specified image and then verify.This PR also locks the version of
wasm-opt
crate which often is the cause of binary mismatch.