-
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
fix(blockifier): bouncer_weights remove derives of add, addassign, sub. use 'checked' instead #2835
fix(blockifier): bouncer_weights remove derives of add, addassign, sub. use 'checked' instead #2835
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
6785874
to
df8829c
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 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @avivg-starkware, @noaov1, and @Yoni-Starkware)
crates/blockifier/src/bouncer.rs
line 116 at r1 (raw file):
*self = self.checked_add(other).expect("Addition overflow"); } }
you are making +
operations behave like "checked_add_or_panic".
is this what we want?
I prefer to be explicit, how painful would it be to replace all?
(if it helps, you can derive the arithmetic traits in testing mode)
Code quote:
impl std::ops::Add for BouncerWeights {
type Output = BouncerWeights;
fn add(self, other: BouncerWeights) -> BouncerWeights {
self.checked_add(other).expect("Addition overflow")
}
}
impl std::ops::AddAssign for BouncerWeights {
fn add_assign(&mut self, other: BouncerWeights) {
*self = self.checked_add(other).expect("Addition overflow");
}
}
df8829c
to
ec43cb6
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: complete! all files reviewed, all discussions resolved (waiting on @noaov1 and @Yoni-Starkware)
ec43cb6
to
7af5968
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 r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @avivg-starkware, @noaov1, and @Yoni-Starkware)
crates/blockifier/src/bouncer.rs
line 0 at r3 (raw file):
- do we want checked or saturating?
- if we want checked, please add more info in the
expect
message: (a) the text in the two cases should be different (easier to identify the source of panic) and (b) maybe also output the weights being added
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, 1 unresolved discussion (waiting on @noaov1 and @Yoni-Starkware)
crates/blockifier/src/bouncer.rs
line 116 at r1 (raw file):
Previously, dorimedini-starkware wrote…
you are making
+
operations behave like "checked_add_or_panic".
is this what we want?
I prefer to be explicit, how painful would it be to replace all?
(if it helps, you can derive the arithmetic traits in testing mode)
Done
crates/blockifier/src/bouncer.rs
line at r3 (raw file):
Previously, dorimedini-starkware wrote…
- do we want checked or saturating?
- if we want checked, please add more info in the
expect
message: (a) the text in the two cases should be different (easier to identify the source of panic) and (b) maybe also output the weights being added
@Yoni-Starkware WDYT? i would assume checked, if overflow is something that shouldn't happen. but perhaps saturating is sufficient?
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, 1 unresolved discussion (waiting on @dorimedini-starkware and @noaov1)
crates/blockifier/src/bouncer.rs
line at r3 (raw file):
Previously, avivg-starkware wrote…
@Yoni-Starkware WDYT? i would assume checked, if overflow is something that shouldn't happen. but perhaps saturating is sufficient?
lgtm
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: complete! all files reviewed, all discussions resolved (waiting on @noaov1)
…b. use 'checked' instead
7af5968
to
d149bc2
Compare
Previously, Yoni-Starkware (Yoni) wrote…
@dorimedini-starkware how does the info I've added looks to you? should I change anything? |
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 r4, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @noaov1)
crates/blockifier/src/bouncer.rs
line at r3 (raw file):
Previously, avivg-starkware wrote…
@dorimedini-starkware how does the info I've added looks to you? should I change anything?
lgtm
No description provided.