-
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
Implement Wasm validation for known issues/markers #171
Conversation
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.
It would be possible to make it forward compatible if we wanted by adding these to an extra section in the generated metadata, though this would of course rely on the metadata being generated first.
This protocol should not exist in the contract metadata since it has absolutely no value beyond |
That makes sense. There is still a way at least to provide some forward compatibility by detecting the common prefix |
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
nice! 🚀
src/validate_wasm.rs
Outdated
.expect("error marker must exist as prefix"); | ||
let hex = serde_hex::from_hex(&encoded).expect("decoding hex failed"); | ||
let decoded = | ||
<EnforcedErrors as codec::Decode>::decode(&mut &hex[..]).expect("decoding object failed"); |
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.
This should probably still return a friendly string explaining that the EnforcedError
could not be decoded, and the probable cause (a mismatch between the ink!
version and the local definition).
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.
This could occur when e.g. ink!
adds a new variant, and someone is running an outdated version of cargo-contract
.
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
Closes #163.
Output currently looks like this: