-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Compiler-v2][VM] add metadata check for script #14099
Conversation
aptos-move/aptos-vm/src/aptos_vm.rs
Outdated
.features() | ||
.is_enabled(FeatureFlag::REJECT_UNSTABLE_BYTECODE_FOR_SCRIPT) | ||
{ | ||
let script = match CompiledScript::deserialize_with_config( |
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.
Can we cache the deserialization of compiled scripts here by bundling it with verify_no_event_emission_in_script
(this also deserializes the script) under a single function which does the deserialization and then runs verification passes?
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.
done
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 else branch in the code below? I think having
// deserialize here
if feature_enabled {
self.reject_unstable_bytecode_for_script(&script)?;
}
verifier::event_validation::verify_no_event_emission_in_compiled_script(&script)?;
is sufficient?
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.
done
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14099 +/- ##
===========================================
- Coverage 70.7% 59.1% -11.7%
===========================================
Files 2338 827 -1511
Lines 466716 201015 -265701
===========================================
- Hits 330314 118830 -211484
+ Misses 136402 82185 -54217 ☔ View full report in Codecov by Sentry. |
5d6e8af
to
06aa2a8
Compare
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.
Looks good, only cone comment about if-else: I think you can just deserialise outside of if branch and then use a single if statement to make things nicer.
aptos-move/aptos-vm/src/aptos_vm.rs
Outdated
if metadata.unstable { | ||
return Err(PartialVMError::new(StatusCode::UNSTABLE_BYTECODE_REJECTED) | ||
.with_message("script marked unstable cannot be run on mainnet".to_string()) | ||
.finish(Location::Undefined)); |
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.
nit: probably can use Location::Script
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.
done
06aa2a8
to
48ccde9
Compare
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.
good
48ccde9
to
3a0bb8e
Compare
3a0bb8e
to
f87d6b4
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
Description
This PR adds a check in the VM when running bytecode generated by an unstable compiler or containing unstable language feature on mainnet
Type of Change
Which Components or Systems Does This Change Impact?
How Has This Been Tested?
Added an e2e move test
Key Areas to Review
Checklist