From 4b8feb08bb5e438708e18455b98fe82a3b1e0a29 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Wed, 17 Aug 2022 11:21:17 -0500 Subject: [PATCH] pr feedback --- core/src/accounts_hash_verifier.rs | 2 +- core/tests/snapshots.rs | 6 +++--- runtime/src/bank.rs | 10 +++++----- runtime/src/serde_snapshot.rs | 6 +++--- runtime/src/serde_snapshot/newer.rs | 2 +- runtime/src/serde_snapshot/tests.rs | 4 ++-- runtime/src/snapshot_utils.rs | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/core/src/accounts_hash_verifier.rs b/core/src/accounts_hash_verifier.rs index 168ac3fda71f9f..118529dd983640 100644 --- a/core/src/accounts_hash_verifier.rs +++ b/core/src/accounts_hash_verifier.rs @@ -190,7 +190,7 @@ impl AccountsHashVerifier { accounts_package.snapshot_links.path(), accounts_package.slot, &accounts_hash, - &None, + None, ); datapoint_info!( "accounts_hash_verifier", diff --git a/core/tests/snapshots.rs b/core/tests/snapshots.rs index c164fcbd029d82..6e3b7869fac0d6 100644 --- a/core/tests/snapshots.rs +++ b/core/tests/snapshots.rs @@ -256,7 +256,7 @@ fn run_bank_forks_snapshot_n( accounts_package.snapshot_links.path(), accounts_package.slot, &last_bank.get_accounts_hash(), - &None, + None, ); let snapshot_package = SnapshotPackage::new(accounts_package, last_bank.get_accounts_hash()); snapshot_utils::archive_snapshot_package( @@ -492,7 +492,7 @@ fn test_concurrent_snapshot_packaging( accounts_package.snapshot_links.path(), accounts_package.slot, &Hash::default(), - &None, + None, ); let snapshot_package = SnapshotPackage::new(accounts_package, Hash::default()); pending_snapshot_package @@ -536,7 +536,7 @@ fn test_concurrent_snapshot_packaging( saved_snapshots_dir.path(), saved_slot, &Hash::default(), - &None, + None, ); snapshot_utils::verify_snapshot_archive( diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index e85101d903d96a..fcc4acf6aeae1a 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -1103,7 +1103,7 @@ impl PartialEq for Bank { accounts_data_size_delta_on_chain: _, accounts_data_size_delta_off_chain: _, fee_structure: _, - incremental_snapshot_hash: _, + incremental_snapshot_persistence: _, // Ignore new fields explicitly if they do not impact PartialEq. // Adding ".." will remove compile-time checks that if a new field // is added to the struct, this ParitalEq is accordingly updated. @@ -1358,7 +1358,7 @@ pub struct Bank { /// Transaction fee structure pub fee_structure: FeeStructure, - pub incremental_snapshot_hash: Option, + pub incremental_snapshot_persistence: Option, } struct VoteWithStakeDelegations { @@ -1489,7 +1489,7 @@ impl Bank { fn default_with_accounts(accounts: Accounts) -> Self { let mut bank = Self { - incremental_snapshot_hash: None, + incremental_snapshot_persistence: None, rewrites_skipped_this_slot: Rewrites::default(), rc: BankRc::new(accounts, Slot::default()), status_cache: Arc::>::default(), @@ -1789,7 +1789,7 @@ impl Bank { let accounts_data_size_initial = parent.load_accounts_data_size(); let mut new = Bank { - incremental_snapshot_hash: None, + incremental_snapshot_persistence: None, rewrites_skipped_this_slot: Rewrites::default(), rc, status_cache, @@ -2151,7 +2151,7 @@ impl Bank { } let feature_set = new(); let mut bank = Self { - incremental_snapshot_hash: fields.incremental_snapshot_hash, + incremental_snapshot_persistence: fields.incremental_snapshot_hash, rewrites_skipped_this_slot: Rewrites::default(), rc: bank_rc, status_cache: new(), diff --git a/runtime/src/serde_snapshot.rs b/runtime/src/serde_snapshot.rs index 7c0b7c17e5cb2b..5b42208d042e7c 100644 --- a/runtime/src/serde_snapshot.rs +++ b/runtime/src/serde_snapshot.rs @@ -194,7 +194,7 @@ trait TypeContext<'a>: PartialEq { stream_reader: &mut BufReader, stream_writer: &mut BufWriter, accounts_hash: &Hash, - incremental_snapshot_persistence: &Option, + incremental_snapshot_persistence: Option<&BankIncrementalSnapshotPersistence>, ) -> std::result::Result<(), Box> where R: Read, @@ -372,7 +372,7 @@ fn reserialize_bank_fields_with_new_hash( stream_reader: &mut BufReader, stream_writer: &mut BufWriter, accounts_hash: &Hash, - incremental_snapshot_persistence: &Option, + incremental_snapshot_persistence: Option<&BankIncrementalSnapshotPersistence>, ) -> Result<(), Error> where W: Write, @@ -395,7 +395,7 @@ pub fn reserialize_bank_with_new_accounts_hash( bank_snapshots_dir: impl AsRef, slot: Slot, accounts_hash: &Hash, - incremental_snapshot_persistence: &Option, + incremental_snapshot_persistence: Option<&BankIncrementalSnapshotPersistence>, ) -> bool { let bank_post = snapshot_utils::get_bank_snapshots_dir(bank_snapshots_dir, slot); let bank_post = bank_post.join(snapshot_utils::get_snapshot_file_name(slot)); diff --git a/runtime/src/serde_snapshot/newer.rs b/runtime/src/serde_snapshot/newer.rs index 92ac29c275669d..bdf2287110f0ab 100644 --- a/runtime/src/serde_snapshot/newer.rs +++ b/runtime/src/serde_snapshot/newer.rs @@ -339,7 +339,7 @@ impl<'a> TypeContext<'a> for Context { stream_reader: &mut BufReader, stream_writer: &mut BufWriter, accounts_hash: &Hash, - incremental_snapshot_persistence: &Option, + incremental_snapshot_persistence: Option<&BankIncrementalSnapshotPersistence>, ) -> std::result::Result<(), Box> where R: Read, diff --git a/runtime/src/serde_snapshot/tests.rs b/runtime/src/serde_snapshot/tests.rs index f9a6837f0f084b..1de6ee2a5d54c6 100644 --- a/runtime/src/serde_snapshot/tests.rs +++ b/runtime/src/serde_snapshot/tests.rs @@ -264,7 +264,7 @@ fn test_bank_serialize_style( temp_dir.path(), slot, &accounts_hash, - &incremental, + incremental.as_ref(), )); let previous_len = buf.len(); // larger buffer than expected to make sure the file isn't larger than expected @@ -333,7 +333,7 @@ fn test_bank_serialize_style( assert_eq!(dbank.get_balance(&key3.pubkey()), 0); assert_eq!(dbank.get_accounts_hash(), accounts_hash); assert!(bank2 == dbank); - assert_eq!(dbank.incremental_snapshot_hash, incremental); + assert_eq!(dbank.incremental_snapshot_persistence, incremental); } pub(crate) fn reconstruct_accounts_db_via_serialization( diff --git a/runtime/src/snapshot_utils.rs b/runtime/src/snapshot_utils.rs index 54782db8bb981b..f87eab2c87491b 100644 --- a/runtime/src/snapshot_utils.rs +++ b/runtime/src/snapshot_utils.rs @@ -2043,7 +2043,7 @@ pub fn package_and_archive_full_snapshot( accounts_package.snapshot_links.path(), accounts_package.slot, &bank.get_accounts_hash(), - &None, + None, ); let snapshot_package = SnapshotPackage::new(accounts_package, bank.get_accounts_hash()); @@ -2096,7 +2096,7 @@ pub fn package_and_archive_incremental_snapshot( accounts_package.snapshot_links.path(), accounts_package.slot, &bank.get_accounts_hash(), - &None, + None, ); let snapshot_package = SnapshotPackage::new(accounts_package, bank.get_accounts_hash());