-
Notifications
You must be signed in to change notification settings - Fork 29
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): support reverted sierra gas tracking and charging #3011
Conversation
Artifacts upload workflows: |
Signed-off-by: Dori Medini <[email protected]>
aa9044a
to
28a4104
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.
Reviewable status: 0 of 10 files reviewed, 2 unresolved discussions (waiting on @dorimedini-starkware)
crates/blockifier/src/execution/entry_point.rs
line 179 at r1 (raw file):
context .sierra_gas_revert_tracker .set_gas_consumed_directly(GasAmount(call_info.execution.gas_consumed));
Note that the c-tor is calling this function. Setting the gas consumed directly should be done just for execute
entrypoint.
Suggestion: instead, update the remaining gas regularly with call_info.initial_gas + call_info.gas_consumed, and pass the call_info.tracked_resource as an argument. to the update func.
Code quote:
if call_info.execution.failed {
// For Cairo1 revert, need to explicitly set the amount of gas to revert from the
// call info.
context
.sierra_gas_revert_tracker
.set_gas_consumed_directly(GasAmount(call_info.execution.gas_consumed));
crates/blockifier/src/execution/syscalls/hint_processor.rs
line 493 at r1 (raw file):
// the current tracked value), or we will pass through another syscall before failing - // and by induction (we will reach this point again), the gas will be charged correctly. if self.base.context.tracked_resource_stack.last() == Some(&TrackedResource::CairoSteps) {
Suggestion:
Some(&TrackedResource::SierraGas) {
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: 0 of 10 files reviewed, 3 unresolved discussions (waiting on @dorimedini-starkware and @Yoni-Starkware)
crates/blockifier/src/execution/entry_point.rs
line 179 at r1 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
Note that the c-tor is calling this function. Setting the gas consumed directly should be done just for
execute
entrypoint.Suggestion: instead, update the remaining gas regularly with call_info.initial_gas + call_info.gas_consumed, and pass the call_info.tracked_resource as an argument. to the update func.
Done.
a discussion (no related file):
closed in favor of this stack
crates/blockifier/src/execution/syscalls/hint_processor.rs
line 493 at r1 (raw file):
// the current tracked value), or we will pass through another syscall before failing - // and by induction (we will reach this point again), the gas will be charged correctly. if self.base.context.tracked_resource_stack.last() == Some(&TrackedResource::CairoSteps) {
Done.
No description provided.