-
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
[15/n] Make MoveVM stateless, remove environment, refactor sessions #16088
Conversation
⏱️ 38m total CI duration on this PR
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
6c5d6aa
to
8348561
Compare
7b92864
to
d9497d3
Compare
8348561
to
8f6c66e
Compare
8f6c66e
to
08749a2
Compare
08749a2
to
482fb3a
Compare
api/src/transactions.rs
Outdated
@@ -38,7 +38,7 @@ use aptos_types::{ | |||
vm_status::StatusCode, | |||
AptosCoinType, CoinType, | |||
}; | |||
use aptos_vm::{AptosSimulationVM, AptosVM}; | |||
use aptos_vm::{AptosSimulationVM, AptosVm}; |
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.
I think VM makes sense, since it's not one word but abbreviation
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.
I think main motivation is when you have AptosVmBlockExecutor
this reads nicer than AptosVMBlockExecutor
so hence the change, I think in one of @igor-aptos's PR we discussed that some time ago. But I do not have an opinion here, @gelash would you prefer VM
over Vm
?
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.
To me it's logical because it's an abbreviation, there are cases also where it looks arguably better but yeah in VMBlock something a bit worse. Sorry, didn't remember or follow the other discussion, if we had decided that way I'm totally okay w. it. But since we are doing it now, we can also tag @zekun000 :) see what everyone thinks
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.
There is also things like VMError etc, we should most likely do a separate PR even if we do change to Vm
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.
Ok, rolled back VM --> Vm
for now - we can decide here and rename separately, so that this PR is not blocked on naming :)
.map_err(|e| e.finish(Location::Undefined))?; | ||
|
||
// locals should not be dropped until all return values are serialized | ||
drop(dummy_locals); |
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.
any benefit to explicitly dropping here?
Also, it's a lot cleaner now - great refactor. it's moved so a bit harder to review side by side (nothing two windows can't fix). But please do point out when things aren't just copy-paste (e.g. add a comment inline) so reviewers don't miss.
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.
I think this method was full copy paste (hence not addressing some minor nits initially, so it is easier to compare). Same for the drop - kept it like in the original code.
I think here the intention was to make sure locals are live past serialization, but here rust should drop them there anyway, so not sure
482fb3a
to
151745f
Compare
151745f
to
25be810
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
Refactoring:
MoveVM
is now fully stateless. RemovedVMRuntime
moving methods to (de) serialize arguments to themove_vm.rs
file. Wrapper calls to execute things are removed, and sessions callexecute_loaded_function
directly.MoveVM
(it is stateless anyway), this allows to get rid of some lifetimes throughout the code. IIRC, the VM was added there purely for module access, which is now moved out.MoveVMExt
no longer ownsMoveVM
: it just uses its session creation methods.With this change the Move VM is now completely stateless, and we should be able to swap the implementation easily.
Also, some basic renaming.
How Has This Been Tested?
Existing tests.
Key Areas to Review
Type of Change
Which Components or Systems Does This Change Impact?
Checklist