-
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
[randomness] Add entry function annotation #12134
Conversation
07a894e
to
a8da2b5
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.
This comment has been minimized.
This comment has been minimized.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12134 +/- ##
=========================================
- Coverage 63.9% 63.9% -0.1%
=========================================
Files 807 812 +5
Lines 178311 180090 +1779
=========================================
+ Hits 114052 115116 +1064
- Misses 64259 64974 +715 ☔ View full report in Codecov by Sentry. |
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.
Amazing! 🙏
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.
This comment has been minimized.
This comment has been minimized.
let module_bytes = session.load_module(entry_fn.module())?; | ||
let module = CompiledModule::deserialize_with_config( | ||
&module_bytes, | ||
&session.get_vm_config().deserializer_config, | ||
) | ||
.map_err(|e| e.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.
Wonder if this would have perf issues
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.
Yeah, single node perf is failing
https://github.com/aptos-labs/aptos-core/actions/runs/7993394538/job/21829130781?pr=12134
Curious if there's a design doc, aip, or something here? I suspect the issue is we're depositing something like 1 storage slot fee and so if the app doesn't need it, it shouldn't be taken? do we actually need this? the devx is a bit frustrating. Imagine the case where I move from a pseudorandom function to our random function within a library, I would break every application that uses my library. Curious if we have evaluated other options, such as requiring the transaction sender to set a bit on randomness or just not doing this at all? An AIP would be useful to facilitate community feedback on devx. |
Storage fees? Do you mean the deposits? We had a discussion with @alinush @vgao1996 @zekun000 @danielxiangzl @igor-aptos @msmouse, but no real design doc (though there is a summary of the discussion). The goal is to make randomness unbiasable, but a good callout about AIP. Let's discuss on slack. If you set a bit, you cannot check it at runtime when you make randomness call (unless we expose it via context). Not doing at all leads to test and abort attack? |
@davidiw, this annotation is already part of AIP-41 here. |
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.
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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
69ae912
to
a37da25
Compare
a37da25
to
aee7614
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.
This comment has been minimized.
This comment has been minimized.
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.
like those tests!
) -> VMResult<bool> { | ||
let module = session | ||
.get_move_vm() | ||
.load_module(entry_fn.module(), resolver)?; |
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's a bit weird that this would require resolver, isn't the session already holding a module_store?
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.
Yes, I was trying to re-use it from the session, but I think the problem is that we store a trait object dyn AptosMoveResolver
in session, which rust doesn't allow to upcast to MoveResolver
(unless I add AsBaseMoveResolver
trait or similar), so I kept it this way. Will give it another try!
f96b325
to
91d4119
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.
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
|
Description
This adds
#[randomness]
annotation which should be used to mark entry functions which use randomness. For exampleThe attribute has the following semantics:
This attribute allows to specialise the prologue to deposit gas, simply by checking if this attribute exists. If not but randomness is used, we get a runtime failure. Otherwise, we use a deposit-refund prologue-epilogue (and it doesn't matter if function uses randomness or not).
Test Plan
Move e2e tests.