Skip to content

Commit

Permalink
Simd 118: add recalculation method and use when booting from snapshot (
Browse files Browse the repository at this point in the history
…#1159)

* Add recalculate_partitioned_rewards method

* Pass starting block height into set_epoch_reward_status_active

* Store recalculated rewards in Bank

* Populate Bank::epoch_reward_status from recalculation

* Skip allocating epoch_reward_status to immediately replace it

* Add calc test ability to customize rewards per block

* Add unit tests for recalculate_stake_rewards

* Add unit test for recalculate_partitioned_rewards

* Remove now-erroneous snapshot test cases

* Remove unused metrics timer

* Calc review comments

* Refactor test harness to dedupe advancing to epoch boundary

* Update test

* Review suggestions: improve comments
  • Loading branch information
CriesofCarrots authored May 8, 2024
1 parent 5d54b72 commit 9b1bae0
Show file tree
Hide file tree
Showing 6 changed files with 475 additions and 221 deletions.
8 changes: 7 additions & 1 deletion runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ impl Bank {
accounts_data_size_initial,
accounts_data_size_delta_on_chain: AtomicI64::new(0),
accounts_data_size_delta_off_chain: AtomicI64::new(0),
epoch_reward_status: fields.epoch_reward_status,
epoch_reward_status: EpochRewardStatus::default(),
transaction_processor: TransactionBatchProcessor::default(),
check_program_modification_slot: false,
// collector_fee_details is not serialized to snapshot
Expand All @@ -1653,6 +1653,12 @@ impl Bank {
HashSet::default(),
);

let thread_pool = ThreadPoolBuilder::new()
.thread_name(|i| format!("solBnkNewFlds{i:02}"))
.build()
.expect("new rayon threadpool");
bank.recalculate_partitioned_rewards(null_tracer(), &thread_pool);

bank.finish_init(
genesis_config,
additional_builtins,
Expand Down
Loading

0 comments on commit 9b1bae0

Please sign in to comment.