-
Notifications
You must be signed in to change notification settings - Fork 25
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
chore(blockifier): share syscall handler's fields #2251
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2251 +/- ##
===========================================
+ Coverage 40.10% 68.58% +28.48%
===========================================
Files 26 109 +83
Lines 1895 13931 +12036
Branches 1895 13931 +12036
===========================================
+ Hits 760 9555 +8795
- Misses 1100 3965 +2865
- Partials 35 411 +376 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
f067e47
to
5847aba
Compare
5847aba
to
b0ee29f
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.
Prep for syscall code sharing
Reviewable status: 0 of 6 files reviewed, all discussions resolved (waiting on @dorimedini-starkware and @meship-starkware)
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.
Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @dorimedini-starkware, @meship-starkware, and @Yoni-Starkware)
-- commits
line 2 at r1:
even though this is a refactor, it would have been better to split this PR. I should have asked you to split before I started reviewing
Code quote:
- b0ee29f: chore(blockifier): share syscall handler's fields
crates/blockifier/src/execution/syscalls/syscall_base.rs
line 36 at r1 (raw file):
// Additional information gathered during execution. pub read_values: Vec<Felt>, pub accessed_keys: HashSet<StorageKey, RandomState>,
why does this have a different type than in SyscallHintProcessor
?
Code quote:
pub accessed_keys: HashSet<StorageKey, RandomState>,
crates/blockifier/src/execution/syscalls/syscall_base.rs
line 43 at r1 (raw file):
// The original storage value of the executed contract. // Should be moved back `context.revert_info` before executing an inner call. pub original_values: HashMap<StorageKey, Felt>,
NativeSyscallHandler
didn't have this, right, as far as I can see - is this because revert in native is only implemented now?
Code quote:
pub original_values: HashMap<StorageKey, Felt>,
crates/blockifier/src/execution/native/syscall_handler.rs
line 60 at r1 (raw file):
}; use crate::execution::syscalls::{exceeds_event_size_limit, syscall_base}; use crate::state::state_api::State;
why does this have to stay here instead of moving to base?
Code quote:
pub unrecoverable_error: Option<SyscallExecutionError>,
crates/blockifier/src/execution/native/syscall_handler.rs
line 70 at r1 (raw file):
) -> NativeSyscallHandler<'state> { NativeSyscallHandler { base: syscall_base::SyscallHandlerBase::new(call, state, context),
why not import SyscallHandlerBase
instead of using syscall_base::
?
non blocking
Code quote:
base: syscall_base::SyscallHandlerBase::new(call, state, context),
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.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @dorimedini-starkware, @meship-starkware, and @Yoni-Starkware)
crates/blockifier/src/execution/syscalls/syscall_base.rs
line 23 at r1 (raw file):
/// This file is for sharing common logic between Native and VM syscall implementations. pub struct SyscallHandlerBase<'state> {
Are there any methods which can move here?
Code quote:
pub struct SyscallHandlerBase<'state> {
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.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @amosStarkware, @dorimedini-starkware, and @meship-starkware)
crates/blockifier/src/execution/native/syscall_handler.rs
line 60 at r1 (raw file):
Previously, amosStarkware wrote…
why does this have to stay here instead of moving to base?
Native cannot return rust errors. The VM can.
We are handling this by keeping this field. It might be a good idea to share this behaviour with the VM, but not now - it is still under dev (in particular, we need to make the stack traces compatible with the VM's)
crates/blockifier/src/execution/native/syscall_handler.rs
line 70 at r1 (raw file):
Previously, amosStarkware wrote…
why not import
SyscallHandlerBase
instead of usingsyscall_base::
?
non blocking
Leftovers of the prev design (bundle of functions instead of a shared impl)
I'm removing this in a future PR in the stack
crates/blockifier/src/execution/syscalls/syscall_base.rs
line 23 at r1 (raw file):
Previously, amosStarkware wrote…
Are there any methods which can move here?
Sure, next PRs
crates/blockifier/src/execution/syscalls/syscall_base.rs
line 36 at r1 (raw file):
Previously, amosStarkware wrote…
why does this have a different type than in
SyscallHintProcessor
?
IDK why native did that explicitly. Maybe for safety. You can see that this is the default state for hash sets:
pub struct HashSet<T, S = RandomState>
crates/blockifier/src/execution/syscalls/syscall_base.rs
line 43 at r1 (raw file):
Previously, amosStarkware wrote…
NativeSyscallHandler
didn't have this, right, as far as I can see - is this because revert in native is only implemented now?
Right
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.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dorimedini-starkware, @meship-starkware, and @Yoni-Starkware)
crates/blockifier/src/execution/syscalls/syscall_base.rs
line 36 at r1 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
IDK why native did that explicitly. Maybe for safety. You can see that this is the default state for hash sets:
pub struct HashSet<T, S = RandomState>
The default RandomState
is different:
https://doc.rust-lang.org/std/collections/hash_map/struct.RandomState.html
please check why it needs it be different / if it's ok that SyscallHintProcessor
will now also use this type.
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.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @amosStarkware, @dorimedini-starkware, and @meship-starkware)
crates/blockifier/src/execution/syscalls/syscall_base.rs
line 36 at r1 (raw file):
Previously, amosStarkware wrote…
The default
RandomState
is different:
https://doc.rust-lang.org/std/collections/hash_map/struct.RandomState.html
please check why it needs it be different / if it's ok thatSyscallHintProcessor
will now also use this type.
It's the same struct - I checked
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.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @amosStarkware, @dorimedini-starkware, and @meship-starkware)
crates/blockifier/src/execution/syscalls/syscall_base.rs
line 36 at r1 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
It's the same struct - I checked
It's not needed. I'll remove it in the next PR
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware, @meship-starkware, and @Yoni-Starkware)
No description provided.