-
Notifications
You must be signed in to change notification settings - Fork 240
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
Simd 118: add recalculation method and use when booting from snapshot #1159
Simd 118: add recalculation method and use when booting from snapshot #1159
Conversation
d411cdd
to
a547820
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1159 +/- ##
========================================
Coverage 82.1% 82.1%
========================================
Files 886 886
Lines 236439 236581 +142
========================================
+ Hits 194252 194379 +127
- Misses 42187 42202 +15 |
point_value, | ||
thread_pool, | ||
reward_calc_tracer, | ||
&mut RewardsMetrics::default(), // This is required, but not reporting anything at the moment |
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.
Seems useful to report these metrics, are you planning to add this later?
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.
Yep. I want to take a look at the metrics separately with the whole implementation in mind. The reporting cadence will need to change, and I don't think all the fields will still be relevant.
a547820
to
dc3d2b2
Compare
Rebased to pick up tip of master; changes all in the new, last 4 commits |
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! Just a couple of tiny things, can be addressed separately if more convenient
1e8d4d4
to
f138560
Compare
Thanks! Went ahead and pushed those here as the last commit. Rebasing to ensure nothing weird upstream. |
Problem
As per SIMD-0118, partitioned rewards should be recalculated on boot from snapshot. Partition and initial calculation info is available in the EpochRewards sysvar, and as of #1138,
Bank::get_epoch_reward_calculate_param_info
provides vote-accountcredits_observed
from the EpochStakes cache. This is everything needed to recalculate undistributed stake-reward partitions.Summary of Changes
Add
Bank::recalculate_partitioned_rewards
method. Recalculated partitions could differ from the original calculation in two ways:credits_observed
are updated to the new amount, so subsequent calculations determine no distribution needed.) Since only upcoming partitions need action (distribution), this is fine.Use recalculate_partitioned_rewards in
Bank::new_from_fields
to populateBank::epoch_reward_status