-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat(blockifier): panic on GasVector arithmetic overflow #1280
Conversation
Benchmark movements: |
9581f92
to
032b307
Compare
Benchmark movements: |
Codecov ReportAttention: Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
032b307
to
97c7f7f
Compare
bcdaa1f
to
a2c9f10
Compare
97c7f7f
to
0727af4
Compare
0727af4
to
c3a6890
Compare
a2c9f10
to
71afbf7
Compare
c3a6890
to
f291432
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 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:?}"
)
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: 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
?
- I didn't find something I liked; there is nothing built in
- what would the panic message look like?
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 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…
- I didn't find something I liked; there is nothing built in
- what would the panic message look like?
I want to save some code duplication with all those panics. Not in this PR though
This change is