-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat(blockifier): add syscall counting for native syscall handler #1555
Conversation
Artifacts upload triggered. View details here |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1555 +/- ##
===========================================
+ Coverage 40.10% 68.51% +28.41%
===========================================
Files 26 102 +76
Lines 1895 13687 +11792
Branches 1895 13687 +11792
===========================================
+ Hits 760 9378 +8618
- Misses 1100 3908 +2808
- Partials 35 401 +366 ☔ View full report in Codecov by Sentry. |
07bffd8
to
985a98a
Compare
Artifacts upload triggered. View details here |
6815d18
to
a3166cf
Compare
985a98a
to
147c1d3
Compare
Artifacts upload triggered. View details here |
147c1d3
to
ded98cf
Compare
Artifacts upload triggered. View details here |
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 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @noaov1 and @rodrigo-pino)
crates/blockifier/src/execution/native/entry_point_execution.rs
line 79 at r1 (raw file):
gas_consumed, }, resources: syscall_handler.resources.clone(),
Why are we no longer using default resources?
Code quote:
resources: syscall_handler.resources.clone(),
crates/blockifier/src/execution/native/syscall_handler.rs
line 68 at r1 (raw file):
let syscall_count = self.syscall_counter.entry(*selector).or_default(); *syscall_count += n }
Why are we increasing by n and not by 1? Are there cases where we want to increase it with a different number?
Code quote:
fn increment_syscall_count_by(&mut self, selector: &SyscallSelector, n: usize) {
let syscall_count = self.syscall_counter.entry(*selector).or_default();
*syscall_count += n
}
Artifacts upload triggered. View details here |
7e3b4f6
to
ded98cf
Compare
Artifacts upload triggered. View details here |
a3166cf
to
eb637b2
Compare
ded98cf
to
6427073
Compare
Artifacts upload triggered. View details here |
eb637b2
to
84006d8
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.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @noaov1 and @rodrigo-pino)
84006d8
to
75e935f
Compare
6427073
to
43f4d6e
Compare
Artifacts upload triggered. View details here |
75e935f
to
586415b
Compare
43f4d6e
to
d025422
Compare
a7b6c44
to
d5cc8ec
Compare
60e2392
to
538df34
Compare
Artifacts upload triggered. View details here |
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 1 of 2 files at r4, all commit messages.
Reviewable status: 2 of 3 files reviewed, 4 unresolved discussions (waiting on @noaov1 and @rodrigo-pino)
ce5b163
to
48fdf7a
Compare
538df34
to
861b3c2
Compare
Artifacts upload triggered. View details here |
861b3c2
to
ffba45f
Compare
Artifacts upload triggered. View details here |
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 1 of 2 files at r4.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @rodrigo-pino)
ffba45f
to
0849060
Compare
Artifacts upload triggered. View details here |
0849060
to
b49b010
Compare
Artifacts upload triggered. View details here |
b49b010
to
139d79d
Compare
Artifacts upload triggered. View details here |
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: 1 of 3 files reviewed, 3 unresolved discussions (waiting on @meship-starkware and @noaov1)
crates/blockifier/src/execution/native/entry_point_execution.rs
line 79 at r1 (raw file):
Previously, noaov1 (Noa Oved) wrote…
When running cairo native, the only resource that matters is the gas counter. Please revert.
Done, i've change it default to ChargedResources
crates/blockifier/src/execution/native/entry_point_execution.rs
line 65 at r3 (raw file):
Previously, meship-starkware (Meshi Peled) wrote…
WDYM?
No longer relevant
crates/blockifier/src/execution/native/entry_point_execution.rs
line 74 at r3 (raw file):
Previously, noaov1 (Noa Oved) wrote…
WDYM?
I think doesn't show up in the code anymore
crates/blockifier/src/execution/native/syscall_handler.rs
line 68 at r1 (raw file):
Previously, noaov1 (Noa Oved) wrote…
Currently, we need
n
that is potentially greater for one in the keccak syscall.
Yes, that's it. Didn't want to add an increment_syscall_count_by_one
, but if you prefer it that way we can add a specialized function
crates/blockifier/src/execution/native/syscall_handler.rs
line 110 at r3 (raw file):
Previously, noaov1 (Noa Oved) wrote…
With this change the method can no linger be called
substract_syscall_gas_cost
. Consider renaming it or, alternatively, removing this functionality.
Done, tell me what you think!
a.xadfas
line at r3 (raw file):
Previously, meship-starkware (Meshi Peled) wrote…
What is this file? Can you remove it?
Oooooops! Removed!
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 1 of 2 files at r4, 2 of 2 files at r5, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @meship-starkware and @rodrigo-pino)
crates/blockifier/src/execution/native/syscall_handler.rs
line 100 at r5 (raw file):
/// handling all gas-related logics and additional metadata such as `SyscallCounter`). The /// difference for native execution is that we need to explicitly call this method at the /// beginning of each syscall.
Suggestion:
/// Handles all gas-related logics and additional metadata such as `SyscallCounter`. In native,
/// we need to explicitly call this method at the
/// beginning of each syscall.
crates/blockifier/src/execution/native/entry_point_execution.rs
line 73 at r5 (raw file):
gas_consumed, }, charged_resources: ChargedResources::default(),
We charge according to the gas consumed in the native run
Suggestion:
charged_resources: ChargedResources {
vm_resources: ExecutionResources::default(),
gas_for_fee: GasAmount(gas_consumed),
},
,
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 @rodrigo-pino)
crates/blockifier/src/execution/native/syscall_handler.rs
line 68 at r1 (raw file):
Previously, rodrigo-pino (Rodrigo) wrote…
Yes, that's it. Didn't want to add an
increment_syscall_count_by_one
, but if you prefer it that way we can add a specialized function
No, that's ok. I think it is better this way.
139d79d
to
3d4ab3d
Compare
Artifacts upload triggered. View details here |
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: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @noaov1)
crates/blockifier/src/execution/native/entry_point_execution.rs
line 73 at r5 (raw file):
Previously, noaov1 (Noa Oved) wrote…
We charge according to the gas consumed in the native run
Done
crates/blockifier/src/execution/native/syscall_handler.rs
line 100 at r5 (raw file):
/// handling all gas-related logics and additional metadata such as `SyscallCounter`). The /// difference for native execution is that we need to explicitly call this method at the /// beginning of each syscall.
Done Love the writing tips :)
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 2 of 2 files at r5.
Reviewable status: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @noaov1)
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 2 of 2 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @noaov1)
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 2 of 2 files at r6, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @rodrigo-pino)
No description provided.