Forráskód Böngészése

BankIncrementalSnapshotPersistence uses strong accounts hash types (#30502)

Brooks 2 éve
szülő
commit
64c7b401cd

+ 3 - 2
runtime/src/bank.rs

@@ -63,6 +63,7 @@ use {
         message_processor::MessageProcessor,
         rent_collector::{CollectedInfo, RentCollector},
         runtime_config::RuntimeConfig,
+        serde_snapshot::{SerdeAccountsHash, SerdeIncrementalAccountsHash},
         snapshot_hash::SnapshotHash,
         stake_account::{self, StakeAccount},
         stake_weighted_timestamp::{
@@ -242,11 +243,11 @@ pub struct BankIncrementalSnapshotPersistence {
     /// slot of full snapshot
     pub full_slot: Slot,
     /// accounts hash from the full snapshot
-    pub full_hash: Hash,
+    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: Hash,
+    pub incremental_hash: SerdeIncrementalAccountsHash,
     /// capitalization of the accounts in the incremental snapshot slot range
     pub incremental_capitalization: u64,
 }

+ 1 - 1
runtime/src/serde_snapshot.rs

@@ -62,7 +62,7 @@ mod utils;
 pub(crate) use tests::reconstruct_accounts_db_via_serialization;
 pub(crate) use {
     storage::SerializedAppendVecId,
-    types::{SerdeAccountsDeltaHash, SerdeAccountsHash},
+    types::{SerdeAccountsDeltaHash, SerdeAccountsHash, SerdeIncrementalAccountsHash},
 };
 
 #[derive(Copy, Clone, Eq, PartialEq)]

+ 3 - 3
runtime/src/serde_snapshot/tests.rs

@@ -310,9 +310,9 @@ fn test_bank_serialize_style(
     let incremental =
         incremental_snapshot_persistence.then(|| BankIncrementalSnapshotPersistence {
             full_slot: slot + 1,
-            full_hash: Hash::new(&[1; 32]),
+            full_hash: SerdeAccountsHash(Hash::new(&[1; 32])),
             full_capitalization: 31,
-            incremental_hash: Hash::new(&[2; 32]),
+            incremental_hash: SerdeIncrementalAccountsHash(Hash::new(&[2; 32])),
             incremental_capitalization: 32,
         });
 
@@ -719,7 +719,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 = "2TmCWJdi5zt6Y46PiNcfStrmW8ogqKut2ttRahD3SzMG")]
+    #[frozen_abi(digest = "6JEjZCVdbC7CgpEexb9BKEtyMBL6aTHNZrjEWmhzmgp3")]
     #[derive(Serialize, AbiExample)]
     pub struct BankAbiTestWrapperNewer {
         #[serde(serialize_with = "wrapper_newer")]