Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Skip creating reward partition account for --partitioned-epoch-rewards-force-enable-single-slot #34946

Merged
merged 7 commits into from
Jan 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 22 additions & 12 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1533,11 +1533,7 @@ impl Bank {
// After saving a snapshot of stakes, apply stake rewards and commission
let (_, update_rewards_with_thread_pool_time) = measure!(
{
if self.is_partitioned_rewards_feature_enabled()
|| self
.partitioned_epoch_rewards_config()
.test_enable_partitioned_rewards
{
if self.is_partitioned_rewards_code_enabled() {
self.begin_partitioned_rewards(
reward_calc_tracer,
&thread_pool,
Expand Down Expand Up @@ -1595,6 +1591,13 @@ impl Bank {
}
}

fn force_partition_rewards_in_first_block_of_epoch(&self) -> bool {
self.partitioned_epoch_rewards_config()
.test_enable_partitioned_rewards
&& self.get_reward_calculation_num_blocks() == 0
&& self.partitioned_rewards_stake_account_stores_per_block() == u64::MAX
}

/// Begin the process of calculating and distributing rewards.
/// This process can take multiple slots.
fn begin_partitioned_rewards(
Expand Down Expand Up @@ -3622,7 +3625,18 @@ impl Bank {
&solana_sdk::sysvar::id(),
)
.unwrap();
self.store_account_and_update_capitalization(&address, &new_account);

info!(
"create epoch rewards partition data account {} {address} \
{epoch_rewards_partition_data:?}",
self.slot
);

// Skip storing data account when we are testing partitioned
// rewards but feature is not yet active
if !self.force_partition_rewards_in_first_block_of_epoch() {
self.store_account_and_update_capitalization(&address, &new_account);
}
}

fn update_recent_blockhashes_locked(&self, locked_blockhash_queue: &BlockhashQueue) {
Expand Down Expand Up @@ -6993,12 +7007,8 @@ impl Bank {
fn hash_internal_state(&self) -> Hash {
let slot = self.slot();
let ignore = (!self.is_partitioned_rewards_feature_enabled()
&& (self
.partitioned_epoch_rewards_config()
.test_enable_partitioned_rewards
&& self.get_reward_calculation_num_blocks() == 0
&& self.partitioned_rewards_stake_account_stores_per_block() == u64::MAX))
.then_some(sysvar::epoch_rewards::id());
&& self.force_partition_rewards_in_first_block_of_epoch())
.then_some(sysvar::epoch_rewards::id());
let accounts_delta_hash = self
.rc
.accounts
Expand Down
Loading