Skip to content
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: always pass epoch reward status to snapshot as None #1253

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
7 changes: 0 additions & 7 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6659,13 +6659,6 @@ impl Bank {
Some(epoch_accounts_hash)
}

/// Return the epoch_reward_status field on the bank to serialize
/// Returns none if we are NOT in the reward interval.
pub(crate) fn get_epoch_reward_status_to_serialize(&self) -> Option<&EpochRewardStatus> {
matches!(self.epoch_reward_status, EpochRewardStatus::Active(_))
.then_some(&self.epoch_reward_status)
}

/// Convenience fn to get the Epoch Accounts Hash
pub fn epoch_accounts_hash(&self) -> Option<EpochAccountsHash> {
self.rc
Expand Down
10 changes: 4 additions & 6 deletions runtime/src/bank/serde_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,11 +531,9 @@ mod tests {
// Defaults to 0
assert_eq!(0, dbank.fee_rate_governor.lamports_per_signature);

// epoch_reward status should default to `Inactive`
let epoch_reward_status = dbank
.get_epoch_reward_status_to_serialize()
.unwrap_or(&EpochRewardStatus::Inactive);
assert_matches!(epoch_reward_status, EpochRewardStatus::Inactive);
// The snapshot epoch_reward_status always equals `None`, so the bank
// field should default to `Inactive`
assert_eq!(dbank.epoch_reward_status, EpochRewardStatus::Inactive);
}

#[cfg(RUSTC_WITH_SPECIALIZATION)]
Expand All @@ -544,7 +542,7 @@ mod tests {

// This some what long test harness is required to freeze the ABI of
// Bank's serialization due to versioned nature
#[frozen_abi(digest = "ENUEoDA5CYu9NLLCuaj23qpfKBZzCvxK3T5VsUFA9sti")]
#[frozen_abi(digest = "8pZwgyMdvxExLgN9GMKnCdofb5CQJgsZ8Dt88hfVd9bf")]
#[derive(Serialize, AbiExample)]
pub struct BankAbiTestWrapperNewer {
#[serde(serialize_with = "wrapper_newer")]
Expand Down
9 changes: 2 additions & 7 deletions runtime/src/serde_snapshot/newer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,6 @@ impl<'a> TypeContext<'a> for Context {
let ancestors = HashMap::from(&serializable_bank.bank.ancestors);
let fields = serializable_bank.bank.get_fields_to_serialize(&ancestors);
let lamports_per_signature = fields.fee_rate_governor.lamports_per_signature;
let epoch_reward_status = serializable_bank
.bank
.get_epoch_reward_status_to_serialize();
match get_serialize_bank_fields(
SerializableVersionedBank::from(fields),
SerializableAccountsDb::<'a, Self> {
Expand All @@ -221,7 +218,7 @@ impl<'a> TypeContext<'a> for Context {
.bank
.get_epoch_accounts_hash_to_serialize()
.map(|epoch_accounts_hash| *epoch_accounts_hash.as_ref()),
epoch_reward_status,
None, // epoch_reward_status always unpopulated
) {
BankFieldsToSerialize::WithoutEpochRewardStatus(data) => data.serialize(serializer),
BankFieldsToSerialize::WithEpochRewardStatus(data) => data.serialize(serializer),
Expand Down Expand Up @@ -380,7 +377,6 @@ impl<'a> TypeContext<'a> for Context {
let hard_forks = RwLock::new(std::mem::take(&mut rhs.hard_forks));
let lamports_per_signature = rhs.fee_rate_governor.lamports_per_signature;
let epoch_accounts_hash = rhs.epoch_accounts_hash.as_ref();
let epoch_reward_status = rhs.epoch_reward_status;

let bank = SerializableVersionedBank {
blockhash_queue: &blockhash_queue,
Expand Down Expand Up @@ -423,8 +419,7 @@ impl<'a> TypeContext<'a> for Context {
lamports_per_signature,
incremental_snapshot_persistence.cloned(),
epoch_accounts_hash.copied(),
matches!(epoch_reward_status, EpochRewardStatus::Active(_))
.then_some(&epoch_reward_status),
None, // epoch_reward_status always unpopulated
) {
BankFieldsToSerialize::WithoutEpochRewardStatus(data) => {
bincode::serialize_into(stream_writer, &data)
Expand Down
Loading