Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 0 additions & 4 deletions core/tests/snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ fn restore_from_snapshot(
let old_bank_forks = old_bank_forks.read().unwrap();
let old_last_bank = old_bank_forks.get(old_last_slot).unwrap();

let check_hash_calculation = false;
let full_snapshot_archive_path = snapshot_utils::build_full_snapshot_archive_path(
&snapshot_config.full_snapshot_archives_dir,
old_last_bank.slot(),
Expand All @@ -143,7 +142,6 @@ fn restore_from_snapshot(
None,
None,
None,
check_hash_calculation,
false,
false,
false,
Expand Down Expand Up @@ -552,7 +550,6 @@ fn restore_from_snapshots_and_check_banks_are_equal(
false,
false,
false,
false,
Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
None,
Arc::default(),
Expand Down Expand Up @@ -770,7 +767,6 @@ fn test_snapshots_with_background_services(verify_snapshot_hash_kind: VerifySnap
false,
false,
false,
false,
Some(accounts_db_config),
None,
exit.clone(),
Expand Down
1 change: 0 additions & 1 deletion ledger/src/bank_forks_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ fn bank_forks_from_snapshot(
process_options.accounts_db_skip_shrink,
process_options.accounts_db_force_initial_clean,
process_options.verify_index,
false, // verify_index. This will be removed separately.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh... looks like this was wrong before! Luckily these should all be false, but this is clearly an example of what happens when a function has a ton of parameters and they are all the same type...

process_options.accounts_db_config.clone(),
accounts_update_notifier,
exit,
Expand Down
2 changes: 0 additions & 2 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5014,11 +5014,9 @@ impl Bank {
/// calculation and could shield other real accounts.
pub fn verify_snapshot_bank(
&self,
_test_hash_calculation: bool,
skip_shrink: bool,
force_clean: bool,
latest_full_snapshot_slot: Slot,
_base: Option<(Slot, /*capitalization*/ u64)>, // will be removed next
duplicates_lt_hash: Option<Box<DuplicatesLtHash>>,
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the initial/main change: removing the unused params.

) -> bool {
// If we verify the accounts using the lattice-based hash *and* with storages (as opposed
Expand Down
2 changes: 0 additions & 2 deletions runtime/src/bank/accounts_lt_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,6 @@ mod tests {
false,
false,
false,
false,
Some(accounts_db_config),
None,
Arc::default(),
Expand Down Expand Up @@ -1160,7 +1159,6 @@ mod tests {
false,
false,
false,
false,
Some(accounts_db_config),
None,
Arc::default(),
Expand Down
1 change: 0 additions & 1 deletion runtime/src/bank/serde_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ mod tests {
false,
false,
false,
false,
Some(solana_accounts_db::accounts_db::ACCOUNTS_DB_CONFIG_FOR_TESTING),
None,
Arc::default(),
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/bank/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2288,11 +2288,11 @@ fn test_verify_snapshot_bank() {
bank.freeze();
add_root_and_flush_write_cache(&bank);
bank.update_accounts_hash_for_tests();
assert!(bank.verify_snapshot_bank(true, false, false, bank.slot(), None, None,));
assert!(bank.verify_snapshot_bank(false, false, bank.slot(), None));

// tamper the bank after freeze!
bank.increment_signature_count(1);
assert!(!bank.verify_snapshot_bank(true, false, false, bank.slot(), None, None,));
assert!(!bank.verify_snapshot_bank(false, false, bank.slot(), None));
}

// Test that two bank forks with the same accounts should not hash to the same value.
Expand Down
30 changes: 0 additions & 30 deletions runtime/src/snapshot_bank_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ pub fn bank_from_snapshot_archives(
debug_keys: Option<Arc<HashSet<Pubkey>>>,
additional_builtins: Option<&[BuiltinPrototype]>,
limit_load_slot_count_from_snapshot: Option<usize>,
test_hash_calculation: bool,
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then here in bank_from_snapshot_archives() we can also remove test_hash_calculation now, and update its callers (the majority of this PR's changes).

accounts_db_skip_shrink: bool,
accounts_db_force_initial_clean: bool,
verify_index: bool,
Expand Down Expand Up @@ -278,29 +277,11 @@ pub fn bank_from_snapshot_archives(
snapshot_archive_info.hash,
)?;

let base = if bank.is_snapshots_lt_hash_enabled() {
None
} else {
incremental_snapshot_archive_info.is_some().then(|| {
let base_slot = full_snapshot_archive_info.slot();
let base_capitalization = bank
.rc
.accounts
.accounts_db
.get_accounts_hash(base_slot)
.expect("accounts hash must exist at full snapshot's slot")
.1;
(base_slot, base_capitalization)
})
};

let mut measure_verify = Measure::start("verify");
if !bank.verify_snapshot_bank(
test_hash_calculation,
accounts_db_skip_shrink || !full_snapshot_archive_info.is_remote(),
accounts_db_force_initial_clean,
full_snapshot_archive_info.slot(),
base,
info.duplicates_lt_hash,
) && limit_load_slot_count_from_snapshot.is_none()
{
Expand Down Expand Up @@ -350,7 +331,6 @@ pub fn bank_from_latest_snapshot_archives(
debug_keys: Option<Arc<HashSet<Pubkey>>>,
additional_builtins: Option<&[BuiltinPrototype]>,
limit_load_slot_count_from_snapshot: Option<usize>,
test_hash_calculation: bool,
accounts_db_skip_shrink: bool,
accounts_db_force_initial_clean: bool,
verify_index: bool,
Expand Down Expand Up @@ -382,7 +362,6 @@ pub fn bank_from_latest_snapshot_archives(
debug_keys,
additional_builtins,
limit_load_slot_count_from_snapshot,
test_hash_calculation,
accounts_db_skip_shrink,
accounts_db_force_initial_clean,
verify_index,
Expand Down Expand Up @@ -1123,7 +1102,6 @@ mod tests {
false,
false,
false,
false,
Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
None,
Arc::default(),
Expand Down Expand Up @@ -1224,7 +1202,6 @@ mod tests {
false,
false,
false,
false,
Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
None,
Arc::default(),
Expand Down Expand Up @@ -1326,7 +1303,6 @@ mod tests {
false,
false,
false,
false,
Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
None,
Arc::default(),
Expand Down Expand Up @@ -1446,7 +1422,6 @@ mod tests {
false,
false,
false,
false,
Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
None,
Arc::default(),
Expand Down Expand Up @@ -1556,7 +1531,6 @@ mod tests {
false,
false,
false,
false,
Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
None,
Arc::default(),
Expand Down Expand Up @@ -1686,7 +1660,6 @@ mod tests {
false,
false,
false,
false,
Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
None,
Arc::default(),
Expand Down Expand Up @@ -1746,7 +1719,6 @@ mod tests {
false,
false,
false,
false,
Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
None,
Arc::default(),
Expand Down Expand Up @@ -2123,7 +2095,6 @@ mod tests {
false,
false,
false,
false,
Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
None,
Arc::default(),
Expand Down Expand Up @@ -2298,7 +2269,6 @@ mod tests {
false,
false,
false,
false,
Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
None,
Arc::default(),
Expand Down
1 change: 0 additions & 1 deletion runtime/src/snapshot_minimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,6 @@ mod tests {
false,
false,
false,
false,
Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
None,
Arc::default(),
Expand Down
Loading