Skip to content
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): define ChargedResources in CallInfo #1722

Merged

Conversation

TzahiTaub
Copy link
Contributor

No description provided.

@TzahiTaub TzahiTaub self-assigned this Oct 31, 2024
@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link

Artifacts upload triggered. View details here

@TzahiTaub TzahiTaub force-pushed the tzahi/blockifier/define_charged_resources_in_call_info branch from 2b0934b to eafa139 Compare October 31, 2024 12:10
Copy link

Artifacts upload triggered. View details here

Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 11 of 11 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @TzahiTaub)


crates/blockifier/src/execution/call_info.rs line 111 at r1 (raw file):

impl ChargedResources {
    pub fn from_execution_resources(resources: ExecutionResources) -> Self {
        Self { vm_resources: resources, gas_for_fee: GasAmount::default() }

Suggestion:

..Default::default()

crates/blockifier/src/execution/entry_point.rs line 363 at r1 (raw file):

    /// From the total amount of steps available for execution, deduct the steps consumed during
    /// validation and the overhead steps required, among the rest, for fee transfer.

better?

Suggestion:

charged resources required 

crates/blockifier/src/execution/native/entry_point_execution.rs line 79 at r1 (raw file):

            vm_resources: ExecutionResources::default(),
            gas_for_fee: GasAmount(gas_consumed),
        },

this is already an implementation, right?
please add @noaov1 as reviewer

Code quote:

        charged_resources: ChargedResources {
            vm_resources: ExecutionResources::default(),
            gas_for_fee: GasAmount(gas_consumed),
        },

@TzahiTaub TzahiTaub force-pushed the tzahi/blockifier/define_charged_resources_in_call_info branch from eafa139 to 4320ba8 Compare October 31, 2024 14:49
Copy link
Contributor Author

@TzahiTaub TzahiTaub left a 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, 3 unresolved discussions (waiting on @dorimedini-starkware and @noaov1)


crates/blockifier/src/execution/call_info.rs line 111 at r1 (raw file):

impl ChargedResources {
    pub fn from_execution_resources(resources: ExecutionResources) -> Self {
        Self { vm_resources: resources, gas_for_fee: GasAmount::default() }

Done.


crates/blockifier/src/execution/entry_point.rs line 363 at r1 (raw file):

Previously, dorimedini-starkware wrote…

better?

Nope. I didn't change this comment because of this PR change, it's a by the way change - the "overhead steps" mentioned in the comment aren't only fee transfer related (e.g., every call have some constant steps from VC we charge here) so I just wanted to make it clearer. Actually from looking at the code, I don't really understand the connection to the fee transfer - do you know if the execute_txs_inner mapping has the fee transfer cost embedded in it?

@TzahiTaub TzahiTaub requested a review from noaov1 October 31, 2024 14:50
Copy link

Artifacts upload triggered. View details here

Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a 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, 1 unresolved discussion (waiting on @noaov1)


crates/blockifier/src/execution/entry_point.rs line 363 at r1 (raw file):

Previously, TzahiTaub (Tzahi) wrote…

Nope. I didn't change this comment because of this PR change, it's a by the way change - the "overhead steps" mentioned in the comment aren't only fee transfer related (e.g., every call have some constant steps from VC we charge here) so I just wanted to make it clearer. Actually from looking at the code, I don't really understand the connection to the fee transfer - do you know if the execute_txs_inner mapping has the fee transfer cost embedded in it?

IDK, question for Noa or Meshi I think

Copy link

codecov bot commented Oct 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.25%. Comparing base (e3165c4) to head (f737291).
Report is 188 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1722       +/-   ##
===========================================
+ Coverage   40.10%   64.25%   +24.15%     
===========================================
  Files          26      135      +109     
  Lines        1895    17534    +15639     
  Branches     1895    17534    +15639     
===========================================
+ Hits          760    11267    +10507     
- Misses       1100     5475     +4375     
- Partials       35      792      +757     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor Author

@TzahiTaub TzahiTaub left a 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 @noaov1)


crates/blockifier/src/execution/entry_point.rs line 363 at r1 (raw file):

Previously, dorimedini-starkware wrote…

IDK, question for Noa or Meshi I think

@noaov1 if you may

@TzahiTaub TzahiTaub changed the title feat(blockifier): ChargedResources in CallInfo feat(blockifier): define ChargedResources in CallInfo Oct 31, 2024
Copy link

Artifacts upload triggered. View details here

Copy link
Collaborator

@noaov1 noaov1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 11 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @dorimedini-starkware and @TzahiTaub)

a discussion (no related file):
How do you plan to be backward compatible? Is that an issue?



crates/blockifier/src/execution/entry_point.rs line 363 at r1 (raw file):

Previously, TzahiTaub (Tzahi) wrote…

@noaov1 if you may

It does.


crates/blockifier/src/execution/entry_point_execution.rs line 413 at r2 (raw file):

    let full_call_resources = &*syscall_handler.resources - &previous_resources;
    let charged_resources = ChargedResources {
        vm_resources: full_call_resources.filter_unused_builtins(),

I'm a bit confused.
Do we always charge for the vm resources? What about when the tracked resource is a sierra gas?

Code quote:

 vm_resources: full_call_resources.filter_unused_builtins()

crates/blockifier/src/execution/native/entry_point_execution.rs line 79 at r1 (raw file):

Previously, dorimedini-starkware wrote…

this is already an implementation, right?
please add @noaov1 as reviewer

@TzahiTaub - why do you set here the gas_for_fee as the gas_consumed

Copy link
Collaborator

@noaov1 noaov1 left a 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, 3 unresolved discussions (waiting on @dorimedini-starkware and @TzahiTaub)


crates/blockifier/src/execution/native/entry_point_execution.rs line 79 at r1 (raw file):

Previously, noaov1 (Noa Oved) wrote…

@TzahiTaub - why do you set here the gas_for_fee as the gas_consumed

Opps, please ignore.

Copy link
Contributor Author

@TzahiTaub TzahiTaub left a 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, 3 unresolved discussions (waiting on @dorimedini-starkware and @noaov1)

a discussion (no related file):

Previously, noaov1 (Noa Oved) wrote…

How do you plan to be backward compatible? Is that an issue?

With what? txs with L2 gas are new for this version. The gas_consumed stays and before and is compatible with the OS. And VM mode txs will stay unchanged.



crates/blockifier/src/execution/entry_point.rs line 363 at r1 (raw file):

Previously, noaov1 (Noa Oved) wrote…

It does.

This is not related to the PR (but the comment) but does the fee_transfer resources cost change between transactions? Assuming it doesn't, why not have a separate resource constant for the fee transfer, instead of embedding it in every tx resources?


crates/blockifier/src/execution/entry_point_execution.rs line 413 at r2 (raw file):

Previously, noaov1 (Noa Oved) wrote…

I'm a bit confused.
Do we always charge for the vm resources? What about when the tracked resource is a sierra gas?

This is temporary, We'll have either vm_resources update or gas_for_fee update per call (gas_consumed will always be updated).

@TzahiTaub TzahiTaub force-pushed the tzahi/blockifier/define_charged_resources_in_call_info branch from 724f31d to f737291 Compare November 3, 2024 15:43
Copy link
Contributor Author

@TzahiTaub TzahiTaub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 7 of 11 files reviewed, 3 unresolved discussions (waiting on @dorimedini-starkware and @noaov1)


crates/blockifier/src/execution/native/entry_point_execution.rs line 79 at r1 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Opps, please ignore.

Done.

Copy link

github-actions bot commented Nov 3, 2024

Artifacts upload triggered. View details here

Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @noaov1)

Copy link
Collaborator

@noaov1 noaov1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 11 files at r1, 1 of 1 files at r2, 4 of 4 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @TzahiTaub)

a discussion (no related file):

Previously, TzahiTaub (Tzahi) wrote…

With what? txs with L2 gas are new for this version. The gas_consumed stays and before and is compatible with the OS. And VM mode txs will stay unchanged.

Oh, I see. Will only transactions that have signed non-trivial L2 gas bounds run in Sierra gas mode?
Where is this indicated here?



crates/blockifier/src/execution/entry_point.rs line 363 at r1 (raw file):

Previously, TzahiTaub (Tzahi) wrote…

This is not related to the PR (but the comment) but does the fee_transfer resources cost change between transactions? Assuming it doesn't, why not have a separate resource constant for the fee transfer, instead of embedding it in every tx resources?

I am not sure. It should not.
What will we benefit from the separation?


crates/blockifier/src/execution/entry_point_execution.rs line 413 at r2 (raw file):

Previously, TzahiTaub (Tzahi) wrote…

This is temporary, We'll have either vm_resources update or gas_for_fee update per call (gas_consumed will always be updated).

According to the tracked resources mode?

Copy link
Contributor Author

@TzahiTaub TzahiTaub left a 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 @noaov1)

a discussion (no related file):

Previously, noaov1 (Noa Oved) wrote…

Oh, I see. Will only transactions that have signed non-trivial L2 gas bounds run in Sierra gas mode?
Where is this indicated here?

It in a future PR (you're on it) - https://reviewable.io/reviews/starkware-libs/sequencer/1771#-



crates/blockifier/src/execution/entry_point.rs line 363 at r1 (raw file):

Previously, noaov1 (Noa Oved) wrote…

I am not sure. It should not.
What will we benefit from the separation?

One point of truth for the fee transfer cost, it will also be clear from the file what part is of the fee transfer and what cost comes directly from the tx "behavior".


crates/blockifier/src/execution/entry_point_execution.rs line 413 at r2 (raw file):

Previously, noaov1 (Noa Oved) wrote…

According to the tracked resources mode?

Yes, according to the tracked resource either the VM resource will be updated, or the fee_for_gas.

Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a 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 @noaov1)

Copy link
Collaborator

@noaov1 noaov1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @TzahiTaub)

@TzahiTaub TzahiTaub merged commit 3c5945a into main Nov 5, 2024
19 checks passed
@TzahiTaub TzahiTaub deleted the tzahi/blockifier/define_charged_resources_in_call_info branch November 5, 2024 08:47
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants