* Add accounts_data_len to bank snapshot (#23714) (cherry picked from commit 7ff8c80e25cbd1fa35542cb0805d0c2a460e2f30) # Conflicts: # runtime/src/serde_snapshot/tests.rs * fix frozen abi hash Co-authored-by: Brooks Prumo <brooks@solana.com>
This commit is contained in:
parent
da6bb66475
commit
08f4b19a21
@ -905,6 +905,7 @@ pub(crate) struct BankFieldsToDeserialize {
|
||||
pub(crate) stakes: Stakes,
|
||||
pub(crate) epoch_stakes: HashMap<Epoch, EpochStakes>,
|
||||
pub(crate) is_delta: bool,
|
||||
pub(crate) accounts_data_len: u64,
|
||||
}
|
||||
|
||||
// Bank's common fields shared by all supported snapshot versions for serialization.
|
||||
@ -943,6 +944,7 @@ pub(crate) struct BankFieldsToSerialize<'a> {
|
||||
pub(crate) stakes: &'a StakesCache,
|
||||
pub(crate) epoch_stakes: &'a HashMap<Epoch, EpochStakes>,
|
||||
pub(crate) is_delta: bool,
|
||||
pub(crate) accounts_data_len: u64,
|
||||
}
|
||||
|
||||
// Can't derive PartialEq because RwLock doesn't implement PartialEq
|
||||
@ -2009,6 +2011,20 @@ impl Bank {
|
||||
bank.fee_calculator
|
||||
);
|
||||
}
|
||||
|
||||
datapoint_info!(
|
||||
"bank-new-from-fields",
|
||||
(
|
||||
"accounts_data_len-from-snapshot",
|
||||
fields.accounts_data_len as i64,
|
||||
i64
|
||||
),
|
||||
(
|
||||
"accounts_data_len-from-generate_index",
|
||||
accounts_data_len as i64,
|
||||
i64
|
||||
),
|
||||
);
|
||||
bank
|
||||
}
|
||||
|
||||
@ -2048,6 +2064,7 @@ impl Bank {
|
||||
stakes: &self.stakes_cache,
|
||||
epoch_stakes: &self.epoch_stakes,
|
||||
is_delta: self.is_delta.load(Relaxed),
|
||||
accounts_data_len: self.load_accounts_data_len(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,7 @@ struct DeserializableVersionedBank {
|
||||
ns_per_slot: u128,
|
||||
genesis_creation_time: UnixTimestamp,
|
||||
slots_per_year: f64,
|
||||
#[allow(dead_code)]
|
||||
unused: u64,
|
||||
accounts_data_len: u64,
|
||||
slot: Slot,
|
||||
epoch: Epoch,
|
||||
block_height: u64,
|
||||
@ -78,6 +77,7 @@ impl From<DeserializableVersionedBank> for BankFieldsToDeserialize {
|
||||
ns_per_slot: dvb.ns_per_slot,
|
||||
genesis_creation_time: dvb.genesis_creation_time,
|
||||
slots_per_year: dvb.slots_per_year,
|
||||
accounts_data_len: dvb.accounts_data_len,
|
||||
slot: dvb.slot,
|
||||
epoch: dvb.epoch,
|
||||
block_height: dvb.block_height,
|
||||
@ -116,7 +116,7 @@ struct SerializableVersionedBank<'a> {
|
||||
ns_per_slot: u128,
|
||||
genesis_creation_time: UnixTimestamp,
|
||||
slots_per_year: f64,
|
||||
unused: u64,
|
||||
accounts_data_len: u64,
|
||||
slot: Slot,
|
||||
epoch: Epoch,
|
||||
block_height: u64,
|
||||
@ -153,7 +153,7 @@ impl<'a> From<crate::bank::BankFieldsToSerialize<'a>> for SerializableVersionedB
|
||||
ns_per_slot: rhs.ns_per_slot,
|
||||
genesis_creation_time: rhs.genesis_creation_time,
|
||||
slots_per_year: rhs.slots_per_year,
|
||||
unused: u64::default(),
|
||||
accounts_data_len: rhs.accounts_data_len,
|
||||
slot: rhs.slot,
|
||||
epoch: rhs.epoch,
|
||||
block_height: rhs.block_height,
|
||||
|
@ -305,7 +305,7 @@ mod test_bank_serialize {
|
||||
|
||||
// This some what long test harness is required to freeze the ABI of
|
||||
// Bank's serialization due to versioned nature
|
||||
#[frozen_abi(digest = "HVyzePMkma8T54PymRW32FAgDXpSdom59K6RnPsCNJjj")]
|
||||
#[frozen_abi(digest = "4ErcJ2QhDjq9ieZC2LzbaX3r9R4ZwdANT3cnS4u5tzVn")]
|
||||
#[derive(Serialize, AbiExample)]
|
||||
pub struct BankAbiTestWrapperNewer {
|
||||
#[serde(serialize_with = "wrapper_newer")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user