From f0f108905ec7859d8c243329537443d68b02f8d7 Mon Sep 17 00:00:00 2001 From: Brooks Prumo Date: Mon, 31 Oct 2022 17:48:18 -0400 Subject: [PATCH] Always verifies deserialized bank's slot and snapshot hash (#28688) --- runtime/src/snapshot_utils.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/runtime/src/snapshot_utils.rs b/runtime/src/snapshot_utils.rs index faebdedb85..2bbe8a99ac 100644 --- a/runtime/src/snapshot_utils.rs +++ b/runtime/src/snapshot_utils.rs @@ -1011,6 +1011,18 @@ pub fn bank_from_snapshot_archives( measure_rebuild.stop(); info!("{}", measure_rebuild); + verify_bank_against_expected_slot_hash( + &bank, + incremental_snapshot_archive_info.as_ref().map_or( + full_snapshot_archive_info.slot(), + |incremental_snapshot_archive_info| incremental_snapshot_archive_info.slot(), + ), + incremental_snapshot_archive_info.as_ref().map_or( + *full_snapshot_archive_info.hash(), + |incremental_snapshot_archive_info| *incremental_snapshot_archive_info.hash(), + ), + )?; + let mut measure_verify = Measure::start("verify"); if !bank.verify_snapshot_bank( test_hash_calculation, @@ -1127,18 +1139,6 @@ pub fn bank_from_latest_snapshot_archives( ), ); - verify_bank_against_expected_slot_hash( - &bank, - incremental_snapshot_archive_info.as_ref().map_or( - full_snapshot_archive_info.slot(), - |incremental_snapshot_archive_info| incremental_snapshot_archive_info.slot(), - ), - incremental_snapshot_archive_info.as_ref().map_or( - *full_snapshot_archive_info.hash(), - |incremental_snapshot_archive_info| *incremental_snapshot_archive_info.hash(), - ), - )?; - Ok(( bank, full_snapshot_archive_info,