-
Notifications
You must be signed in to change notification settings - Fork 30
Convert warmup/cooldown rates to integers #152
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: main
Are you sure you want to change the base?
Conversation
joncinque
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.
Looks good overall! Mostly nits and a few suggestions
009dc87 to
9c0ba5c
Compare
joncinque
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.
This is looking really good! The proptests are excellent, just some bits about the deprecation strategy
|
Spending a bit of time thinking of this: // Overflowing u128 is not a realistic scenario except in tests. However, in that case
// it's reasonable to allow activation/deactivation of the account's entire portion.
None => account_portion,Going to run a few mainnet scenarios. I have a hunch we should saturate the numerators instead. |
joncinque
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.
This looks ready to me! Feel free to do any other testing you want
|
@joncinque can you have a look at the latest update? I think saturating the numerators is safer in the extreme cases versus defaulting to the entire |
joncinque
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.
Makes sense to me! Just a nit and a question
joncinque
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.
Looks great to me, thanks for addressing all the comments!
rustopian
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.
Excellent testing approach 🦾
This pull request implements SIMD-0391, replacing all floating-point (
f64) arithmetic in the Stake Program's warmup and cooldown logic with a fixed-point implementation using integer arithmetic. See SIMD for background rationale.What's new?
warmup_cooldown_allowancemoduleDelegationstruct has been updated to maintain backward compatibility with on-chain data. Thewarmup_cooldown_rate: f64field is replaced with_reserved: [u8; 8](preserves memory layout)