-
Notifications
You must be signed in to change notification settings - Fork 34
Fix inconsistent arithmetic operations in votor module #324
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
base: master
Are you sure you want to change the base?
Fix inconsistent arithmetic operations in votor module #324
Conversation
Fix master errors (anza-xyz#52)
PohService needs to set `use_alpenglow_tick_producer` flag on startup (anza-xyz#59)
Co-authored-by: yihau <[email protected]> Co-authored-by: carllin <[email protected]> Co-authored-by: Ashwin Sekar <[email protected]>
…all fashion. (anza-xyz#69) Co-authored-by: yihau <[email protected]> Co-authored-by: carllin <[email protected]> Co-authored-by: Ashwin Sekar <[email protected]>
Co-authored-by: carllin <[email protected]>
Co-authored-by: carllin <[email protected]>
…` or `CertificateMessage` (anza-xyz#304)
ksn6
left a comment
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.
Really appreciate the contribution here! One minor fix, and we're all set :)
|
@0xahzam - once merge conflicts are resolved, this should be good to land in |
|
@ksn6 perfect! thanks, should I try to resolve the conflict or someone else will pick it up? |
Co-authored-by: samkim-crypto <[email protected]> Co-authored-by: carllin <[email protected]>
|
@0xahzam - feel free to take a look at resolving the conflict; these should hopefully be pretty straightforward - don't hesitate to reach out if you run into any issues! |
fb6141b to
8995797
Compare
|
@ksn6 I think it should be fine now |
|
Is this PR still needed? |
Problem
The votor module contains inconsistent arithmetic operation patterns.
Specifically:
saturating_add()andchecked_add()for identical operations across filessaturating_vschecked_operations.unwrap()calls provide no debugging context when panics occurSummary of Changes
checked_add/checked_subwith overflow detectionchecked_operations.unwrap()calls with descriptive.expect()messages for better debuggingsaturating_operations for stats/stake calculations where overflow clamping is desiredFiles modified:
certificate_pool.rs: 3 slot arithmetic standardizationscertificate_pool/parent_ready_tracker.rs: 5 slot arithmetic standardizationscertificate_pool_service.rs: 1 slot arithmetic + error message improvementevent_handler.rs: 1 slot arithmetic standardizationskip_timer.rs: 6 timer arithmetic standardizations + error messagesRationale: Slot and timer overflow indicates consensus logic bugs. Better to crash explicitly with clear error messages than silently corrupt calculations.
Fixes #287