-
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
| #[test] | ||
| fn assert_warmup_cooldown_rate() { | ||
| assert_eq!(warmup_cooldown_rate(0, Some(0)), NEW_WARMUP_COOLDOWN_RATE); | ||
| } |
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.
Coverage in interface/src/warmup_cooldown_allowance.rs
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
| /// | ||
| /// This function allocates a share of the cluster's per-epoch deactivation allowance | ||
| /// proportional to the account's share of the previous epoch's total deactivating stake. | ||
| pub fn calculate_cooldown_allowance( |
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.
nit: just from a naming convention, this should be called calculate_deactivation_allowance to go with calculate_activation_allowance, ie let's be consistent with activation / deactivation or warmup / cooldown
009dc87 to
9c0ba5c
Compare
|
|
||
| pub fn stake_activating_and_deactivating<T: StakeHistoryGetEntry>( |
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.
Functions below are copy/pasting of the legacy versions with changes related to:
- Usage of new
calculate_*_allowance()helpers - Additional code comments for context
- Variable name changes for clarity
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)