Move BankIncrementalSnapshotPersistence (#31236)
* Move BankIncrementalSnapshotPersistence * Update bank serialize ABI digest
This commit is contained in:
parent
f5fe2607b6
commit
2164a50d00
|
@ -14,7 +14,7 @@ use {
|
|||
AccountsHash, AccountsHashEnum, CalcAccountsHashConfig, HashStats,
|
||||
IncrementalAccountsHash,
|
||||
},
|
||||
bank::BankIncrementalSnapshotPersistence,
|
||||
serde_snapshot::BankIncrementalSnapshotPersistence,
|
||||
snapshot_config::SnapshotConfig,
|
||||
snapshot_package::{
|
||||
self, retain_max_n_elements, AccountsPackage, AccountsPackageType, SnapshotPackage,
|
||||
|
|
|
@ -64,7 +64,7 @@ use {
|
|||
rent_collector::{CollectedInfo, RentCollector},
|
||||
rent_debits::RentDebits,
|
||||
runtime_config::RuntimeConfig,
|
||||
serde_snapshot::{SerdeAccountsHash, SerdeIncrementalAccountsHash},
|
||||
serde_snapshot::BankIncrementalSnapshotPersistence,
|
||||
snapshot_hash::SnapshotHash,
|
||||
sorted_storages::SortedStorages,
|
||||
stake_account::{self, StakeAccount},
|
||||
|
@ -217,25 +217,6 @@ struct RentMetrics {
|
|||
count: AtomicUsize,
|
||||
}
|
||||
|
||||
/// Incremental snapshots only calculate their accounts hash based on the account changes WITHIN the incremental slot range.
|
||||
/// So, we need to keep track of the full snapshot expected accounts hash results.
|
||||
/// We also need to keep track of the hash and capitalization specific to the incremental snapshot slot range.
|
||||
/// The capitalization we calculate for the incremental slot will NOT be consistent with the bank's capitalization.
|
||||
/// It is not feasible to calculate a capitalization delta that is correct given just incremental slots account data and the full snapshot's capitalization.
|
||||
#[derive(Serialize, Deserialize, AbiExample, Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct BankIncrementalSnapshotPersistence {
|
||||
/// slot of full snapshot
|
||||
pub full_slot: Slot,
|
||||
/// accounts hash from the full snapshot
|
||||
pub full_hash: SerdeAccountsHash,
|
||||
/// capitalization from the full snapshot
|
||||
pub full_capitalization: u64,
|
||||
/// hash of the accounts in the incremental snapshot slot range, including zero-lamport accounts
|
||||
pub incremental_hash: SerdeIncrementalAccountsHash,
|
||||
/// capitalization of the accounts in the incremental snapshot slot range
|
||||
pub incremental_capitalization: u64,
|
||||
}
|
||||
|
||||
pub type BankStatusCache = StatusCache<Result<()>>;
|
||||
#[frozen_abi(digest = "GBTLfFjModD9ykS9LV4pGi4S8eCrUj2JjWSDQLf8tMwV")]
|
||||
pub type BankSlotDelta = SlotDelta<Result<()>>;
|
||||
|
|
|
@ -10,7 +10,7 @@ use {
|
|||
accounts_hash::AccountsHash,
|
||||
accounts_index::AccountSecondaryIndexes,
|
||||
accounts_update_notifier_interface::AccountsUpdateNotifier,
|
||||
bank::{Bank, BankFieldsToDeserialize, BankIncrementalSnapshotPersistence, BankRc},
|
||||
bank::{Bank, BankFieldsToDeserialize, BankRc},
|
||||
blockhash_queue::BlockhashQueue,
|
||||
builtins::Builtins,
|
||||
epoch_accounts_hash::EpochAccountsHash,
|
||||
|
@ -85,6 +85,28 @@ pub struct AccountsDbFields<T>(
|
|||
Vec<(Slot, Hash)>,
|
||||
);
|
||||
|
||||
/// Incremental snapshots only calculate their accounts hash based on the
|
||||
/// account changes WITHIN the incremental slot range. So, we need to keep track
|
||||
/// of the full snapshot expected accounts hash results. We also need to keep
|
||||
/// track of the hash and capitalization specific to the incremental snapshot
|
||||
/// slot range. The capitalization we calculate for the incremental slot will
|
||||
/// NOT be consistent with the bank's capitalization. It is not feasible to
|
||||
/// calculate a capitalization delta that is correct given just incremental
|
||||
/// slots account data and the full snapshot's capitalization.
|
||||
#[derive(Serialize, Deserialize, AbiExample, Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct BankIncrementalSnapshotPersistence {
|
||||
/// slot of full snapshot
|
||||
pub full_slot: Slot,
|
||||
/// accounts hash from the full snapshot
|
||||
pub full_hash: SerdeAccountsHash,
|
||||
/// capitalization from the full snapshot
|
||||
pub full_capitalization: u64,
|
||||
/// hash of the accounts in the incremental snapshot slot range, including zero-lamport accounts
|
||||
pub incremental_hash: SerdeIncrementalAccountsHash,
|
||||
/// capitalization of the accounts in the incremental snapshot slot range
|
||||
pub incremental_capitalization: u64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize, PartialEq, Eq, AbiExample)]
|
||||
struct BankHashInfo {
|
||||
accounts_delta_hash: SerdeAccountsDeltaHash,
|
||||
|
|
|
@ -721,7 +721,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 = "6JEjZCVdbC7CgpEexb9BKEtyMBL6aTHNZrjEWmhzmgp3")]
|
||||
#[frozen_abi(digest = "GbEcrk8sgqbQ5kJ8mAaHTh2REmHyESQ6GXnGWxkGbxDe")]
|
||||
#[derive(Serialize, AbiExample)]
|
||||
pub struct BankAbiTestWrapperNewer {
|
||||
#[serde(serialize_with = "wrapper_newer")]
|
||||
|
|
|
@ -9,7 +9,7 @@ use {
|
|||
accounts_index::AccountSecondaryIndexes,
|
||||
accounts_update_notifier_interface::AccountsUpdateNotifier,
|
||||
append_vec::AppendVec,
|
||||
bank::{Bank, BankFieldsToDeserialize, BankIncrementalSnapshotPersistence, BankSlotDelta},
|
||||
bank::{Bank, BankFieldsToDeserialize, BankSlotDelta},
|
||||
builtins::Builtins,
|
||||
hardened_unpack::{
|
||||
streaming_unpack_snapshot, unpack_snapshot, ParallelSelector, UnpackError,
|
||||
|
@ -17,7 +17,8 @@ use {
|
|||
},
|
||||
runtime_config::RuntimeConfig,
|
||||
serde_snapshot::{
|
||||
bank_from_streams, bank_to_stream, fields_from_streams, SerdeStyle, SnapshotStreams,
|
||||
bank_from_streams, bank_to_stream, fields_from_streams,
|
||||
BankIncrementalSnapshotPersistence, SerdeStyle, SnapshotStreams,
|
||||
},
|
||||
shared_buffer_reader::{SharedBuffer, SharedBufferReader},
|
||||
snapshot_archive_info::{
|
||||
|
|
Loading…
Reference in New Issue