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): panic on GasVector arithmetic overflow #1280

Conversation

dorimedini-starkware
Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware commented Oct 9, 2024

This change is Reviewable

Copy link

github-actions bot commented Oct 9, 2024

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [34.883 ms 34.934 ms 34.991 ms]
change: [-3.5495% -2.2480% -1.1386%] (p = 0.00 < 0.05)
Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
1 (1.00%) low mild
2 (2.00%) high mild
2 (2.00%) high severe

Copy link

github-actions bot commented Oct 9, 2024

Benchmark movements:
full_committer_flow performance improved 😺
full_committer_flow time: [29.871 ms 29.987 ms 30.123 ms]
change: [-3.1067% -2.0762% -1.1562%] (p = 0.00 < 0.05)
Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
4 (4.00%) high mild
8 (8.00%) high severe

Copy link

codecov bot commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 61.53846% with 35 lines in your changes missing coverage. Please review.

Project coverage is 81.17%. Comparing base (b0cfe82) to head (f291432).
Report is 341 commits behind head on main.

Files with missing lines Patch % Lines
crates/blockifier/src/fee/resources.rs 61.53% 16 Missing and 4 partials ⚠️
crates/blockifier/src/fee/gas_usage.rs 55.00% 7 Missing and 2 partials ⚠️
crates/starknet_api/src/execution_resources.rs 66.66% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1280      +/-   ##
==========================================
+ Coverage   74.18%   81.17%   +6.98%     
==========================================
  Files         359       93     -266     
  Lines       36240    12508   -23732     
  Branches    36240    12508   -23732     
==========================================
- Hits        26886    10153   -16733     
+ Misses       7220     1906    -5314     
+ Partials     2134      449    -1685     
Flag Coverage Δ
?

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@dorimedini-starkware dorimedini-starkware force-pushed the 10-09-feat_blockifier_panic_on_gasvector_arithmetic_overflow branch from 032b307 to 97c7f7f Compare October 9, 2024 14:46
@dorimedini-starkware dorimedini-starkware self-assigned this Oct 9, 2024
@dorimedini-starkware dorimedini-starkware force-pushed the 10-09-feat_blockifier_panic_or_saturate_fee_arithmetic_depending_on_natural_source_of_values branch from bcdaa1f to a2c9f10 Compare October 10, 2024 09:07
@dorimedini-starkware dorimedini-starkware force-pushed the 10-09-feat_blockifier_panic_on_gasvector_arithmetic_overflow branch from 97c7f7f to 0727af4 Compare October 10, 2024 09:07
@dorimedini-starkware dorimedini-starkware changed the base branch from 10-09-feat_blockifier_panic_or_saturate_fee_arithmetic_depending_on_natural_source_of_values to graphite-base/1280 October 10, 2024 11:44
@dorimedini-starkware dorimedini-starkware force-pushed the 10-09-feat_blockifier_panic_on_gasvector_arithmetic_overflow branch from 0727af4 to c3a6890 Compare October 10, 2024 11:44
@dorimedini-starkware dorimedini-starkware changed the base branch from graphite-base/1280 to main October 10, 2024 11:44
@dorimedini-starkware dorimedini-starkware force-pushed the 10-09-feat_blockifier_panic_on_gasvector_arithmetic_overflow branch from c3a6890 to f291432 Compare October 10, 2024 11:44
Copy link
Collaborator

@Yoni-Starkware Yoni-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 2 of 4 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: 5 of 7 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware)


crates/blockifier/src/fee/resources.rs line 310 at r2 (raw file):

                    "Message resources to starknet gas cost overflowed: tried to add \
                     {accumulator:?} to {cost:?}"
                )

Does rust have something like checked_sum?

Code quote:

        .iter()
        .fold(GasVector::ZERO, |accumulator, cost| {
            accumulator.checked_add(*cost).unwrap_or_else(|| {
                panic!(
                    "Message resources to starknet gas cost overflowed: tried to add \
                     {accumulator:?} to {cost:?}"
                )

Copy link
Collaborator Author

@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: 5 of 7 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware and @Yoni-Starkware)


crates/blockifier/src/fee/resources.rs line 310 at r2 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

Does rust have something like checked_sum?

  1. I didn't find something I liked; there is nothing built in
  2. what would the panic message look like?

Copy link
Collaborator

@Yoni-Starkware Yoni-Starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 4 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware)


crates/blockifier/src/fee/resources.rs line 310 at r2 (raw file):

Previously, dorimedini-starkware wrote…
  1. I didn't find something I liked; there is nothing built in
  2. what would the panic message look like?

I want to save some code duplication with all those panics. Not in this PR though

Copy link
Collaborator Author

dorimedini-starkware commented Oct 14, 2024

Merge activity

  • Oct 14, 3:01 AM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Oct 14, 3:02 AM EDT: A user merged this pull request with Graphite.

@dorimedini-starkware dorimedini-starkware merged commit 2b85854 into main Oct 14, 2024
22 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 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.

2 participants