Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add full_snapshot to hash config #26811

Merged
merged 1 commit into from
Jul 28, 2022
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
2 changes: 2 additions & 0 deletions core/src/accounts_hash_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ impl AccountsHashVerifier {
epoch_schedule: &accounts_package.epoch_schedule,
rent_collector: &accounts_package.rent_collector,
store_detailed_debug_info_on_failure: false,
full_snapshot: None,
},
&sorted_storages,
timings,
Expand All @@ -164,6 +165,7 @@ impl AccountsHashVerifier {
rent_collector: &accounts_package.rent_collector,
// now that we've failed, store off the failing contents that produced a bad capitalization
store_detailed_debug_info_on_failure: true,
full_snapshot: None,
},
&sorted_storages,
HashStats::default(),
Expand Down
1 change: 1 addition & 0 deletions runtime/src/accounts_background_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ impl SnapshotRequestHandler {
epoch_schedule: snapshot_root_bank.epoch_schedule(),
rent_collector: snapshot_root_bank.rent_collector(),
store_detailed_debug_info_on_failure: false,
full_snapshot: None,
},
).unwrap();
assert_eq!(previous_hash, this_hash);
Expand Down
3 changes: 3 additions & 0 deletions runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6742,6 +6742,7 @@ impl AccountsDb {
epoch_schedule,
rent_collector,
store_detailed_debug_info_on_failure: false,
full_snapshot: None,
},
expected_capitalization,
)
Expand Down Expand Up @@ -7023,6 +7024,7 @@ impl AccountsDb {
epoch_schedule,
rent_collector,
store_detailed_debug_info_on_failure: false,
full_snapshot: None,
},
None,
)?;
Expand Down Expand Up @@ -11626,6 +11628,7 @@ pub mod tests {
epoch_schedule: &EPOCH_SCHEDULE,
rent_collector: &RENT_COLLECTOR,
store_detailed_debug_info_on_failure: false,
full_snapshot: None,
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions runtime/src/accounts_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use {
solana_sdk::{
hash::{Hash, Hasher},
pubkey::Pubkey,
slot_history::Slot,
sysvar::epoch_schedule::EpochSchedule,
},
std::{
Expand All @@ -27,6 +28,15 @@ pub struct PreviousPass {
pub lamports: u64,
}

#[derive(Debug)]
#[allow(dead_code)]
pub struct FullSnapshotAccountsHashInfo {
/// accounts hash over all accounts when the full snapshot was taken
hash: Hash,
/// slot where full snapshot was taken
slot: Slot,
}

/// parameters to calculate accounts hash
#[derive(Debug)]
pub struct CalcAccountsHashConfig<'a> {
Expand All @@ -45,6 +55,8 @@ pub struct CalcAccountsHashConfig<'a> {
pub rent_collector: &'a RentCollector,
/// used for tracking down hash mismatches after the fact
pub store_detailed_debug_info_on_failure: bool,
/// `Some` if this is an incremental snapshot which only hashes slots since the base full snapshot
pub full_snapshot: Option<FullSnapshotAccountsHashInfo>,
}

impl<'a> CalcAccountsHashConfig<'a> {
Expand Down