-
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
Verify raw Wasm in cargo contract verify
#1551
Conversation
let mut reader = BufReader::new(file); | ||
let mut buffer: [u8; 32] = [0; 32]; | ||
reader | ||
.read_exact(&mut buffer) | ||
.context(format!("Failed to read contract binary {}", path.display()))?; | ||
|
||
let output_code_hash = CodeHash(buffer); |
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.
Why are you only reading the first 32 bytes of the Wasm binary here and then assume it's the hash?
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.
As commented, the whole files should be compared not just the first 32 bytes.
Also would be good to add to the existing integration test here.
In the issue it says:
We should add a argument --wasm that allows passing a binary obtained via e.g. cargo contract info --contract … --binary > contract.wasm.
If that is the common use case then it would be great to fetch that automatically, so you can just specify the account id in the verify
command. @cmichi
Co-authored-by: Andrew Jones <[email protected]>
Summary
Closes #1539
ink
orpallet-contracts
?Adds a raw verification of the contract against the reference wasm binary.
The command executes the code in the
Release
mode by default and then compares the wasm output with the reference contract.Checklist before requesting a review
CHANGELOG.md