remove expected rent collection and rehashing completely (#28422)
This commit is contained in:
parent
fed0c12468
commit
28a89a1d99
|
@ -125,7 +125,6 @@ fn main() {
|
||||||
&ancestors,
|
&ancestors,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
);
|
);
|
||||||
time.stop();
|
time.stop();
|
||||||
let mut time_store = Measure::start("hash using store");
|
let mut time_store = Measure::start("hash using store");
|
||||||
|
@ -137,7 +136,6 @@ fn main() {
|
||||||
None,
|
None,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
false,
|
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
time_store.stop();
|
time_store.stop();
|
||||||
|
|
|
@ -232,7 +232,6 @@ impl AccountsHashVerifier {
|
||||||
rent_collector: &accounts_package.rent_collector,
|
rent_collector: &accounts_package.rent_collector,
|
||||||
store_detailed_debug_info_on_failure: false,
|
store_detailed_debug_info_on_failure: false,
|
||||||
full_snapshot: None,
|
full_snapshot: None,
|
||||||
enable_rehashing: accounts_package.enable_rehashing,
|
|
||||||
},
|
},
|
||||||
&sorted_storages,
|
&sorted_storages,
|
||||||
timings,
|
timings,
|
||||||
|
@ -255,7 +254,6 @@ impl AccountsHashVerifier {
|
||||||
rent_collector: &accounts_package.rent_collector,
|
rent_collector: &accounts_package.rent_collector,
|
||||||
store_detailed_debug_info_on_failure: false,
|
store_detailed_debug_info_on_failure: false,
|
||||||
full_snapshot: None,
|
full_snapshot: None,
|
||||||
enable_rehashing: accounts_package.enable_rehashing,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
info!(
|
info!(
|
||||||
|
@ -275,7 +273,6 @@ impl AccountsHashVerifier {
|
||||||
// now that we've failed, store off the failing contents that produced a bad capitalization
|
// now that we've failed, store off the failing contents that produced a bad capitalization
|
||||||
store_detailed_debug_info_on_failure: true,
|
store_detailed_debug_info_on_failure: true,
|
||||||
full_snapshot: None,
|
full_snapshot: None,
|
||||||
enable_rehashing: accounts_package.enable_rehashing,
|
|
||||||
},
|
},
|
||||||
&sorted_storages,
|
&sorted_storages,
|
||||||
HashStats::default(),
|
HashStats::default(),
|
||||||
|
@ -564,7 +561,6 @@ mod tests {
|
||||||
accounts: Arc::clone(&accounts),
|
accounts: Arc::clone(&accounts),
|
||||||
epoch_schedule: EpochSchedule::default(),
|
epoch_schedule: EpochSchedule::default(),
|
||||||
rent_collector: RentCollector::default(),
|
rent_collector: RentCollector::default(),
|
||||||
enable_rehashing: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
AccountsHashVerifier::process_accounts_package(
|
AccountsHashVerifier::process_accounts_package(
|
||||||
|
|
|
@ -320,7 +320,6 @@ fn test_epoch_accounts_hash_basic(test_environment: TestEnvironment) {
|
||||||
rent_collector: bank.rent_collector(),
|
rent_collector: bank.rent_collector(),
|
||||||
store_detailed_debug_info_on_failure: false,
|
store_detailed_debug_info_on_failure: false,
|
||||||
full_snapshot: None,
|
full_snapshot: None,
|
||||||
enable_rehashing: true,
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -99,7 +99,6 @@ fn test_accounts_hash_bank_hash(bencher: &mut Bencher) {
|
||||||
&ancestors,
|
&ancestors,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
);
|
);
|
||||||
let test_hash_calculation = false;
|
let test_hash_calculation = false;
|
||||||
bencher.iter(|| {
|
bencher.iter(|| {
|
||||||
|
@ -112,7 +111,6 @@ fn test_accounts_hash_bank_hash(bencher: &mut Bencher) {
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
true,
|
|
||||||
false,
|
false,
|
||||||
))
|
))
|
||||||
});
|
});
|
||||||
|
@ -137,7 +135,6 @@ fn test_update_accounts_hash(bencher: &mut Bencher) {
|
||||||
&ancestors,
|
&ancestors,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -787,7 +787,6 @@ impl Accounts {
|
||||||
debug_verify: bool,
|
debug_verify: bool,
|
||||||
epoch_schedule: &EpochSchedule,
|
epoch_schedule: &EpochSchedule,
|
||||||
rent_collector: &RentCollector,
|
rent_collector: &RentCollector,
|
||||||
enable_rehashing: bool,
|
|
||||||
) -> u64 {
|
) -> u64 {
|
||||||
let use_index = false;
|
let use_index = false;
|
||||||
let is_startup = true;
|
let is_startup = true;
|
||||||
|
@ -804,7 +803,6 @@ impl Accounts {
|
||||||
epoch_schedule,
|
epoch_schedule,
|
||||||
rent_collector,
|
rent_collector,
|
||||||
is_startup,
|
is_startup,
|
||||||
enable_rehashing,
|
|
||||||
)
|
)
|
||||||
.1
|
.1
|
||||||
}
|
}
|
||||||
|
@ -822,7 +820,6 @@ impl Accounts {
|
||||||
rent_collector: &RentCollector,
|
rent_collector: &RentCollector,
|
||||||
ignore_mismatch: bool,
|
ignore_mismatch: bool,
|
||||||
store_detailed_debug_info: bool,
|
store_detailed_debug_info: bool,
|
||||||
enable_rehashing: bool,
|
|
||||||
use_bg_thread_pool: bool,
|
use_bg_thread_pool: bool,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
if let Err(err) = self.accounts_db.verify_bank_hash_and_lamports_new(
|
if let Err(err) = self.accounts_db.verify_bank_hash_and_lamports_new(
|
||||||
|
@ -834,7 +831,6 @@ impl Accounts {
|
||||||
rent_collector,
|
rent_collector,
|
||||||
ignore_mismatch,
|
ignore_mismatch,
|
||||||
store_detailed_debug_info,
|
store_detailed_debug_info,
|
||||||
enable_rehashing,
|
|
||||||
use_bg_thread_pool,
|
use_bg_thread_pool,
|
||||||
) {
|
) {
|
||||||
warn!("verify_bank_hash failed: {:?}, slot: {}", err, slot);
|
warn!("verify_bank_hash failed: {:?}, slot: {}", err, slot);
|
||||||
|
|
|
@ -340,8 +340,6 @@ impl SnapshotRequestHandler {
|
||||||
rent_collector: snapshot_root_bank.rent_collector(),
|
rent_collector: snapshot_root_bank.rent_collector(),
|
||||||
store_detailed_debug_info_on_failure: false,
|
store_detailed_debug_info_on_failure: false,
|
||||||
full_snapshot: None,
|
full_snapshot: None,
|
||||||
enable_rehashing: snapshot_root_bank
|
|
||||||
.bank_enable_rehashing_on_accounts_hash(),
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -46,7 +46,6 @@ use {
|
||||||
cache_hash_data::CacheHashData,
|
cache_hash_data::CacheHashData,
|
||||||
contains::Contains,
|
contains::Contains,
|
||||||
epoch_accounts_hash::EpochAccountsHashManager,
|
epoch_accounts_hash::EpochAccountsHashManager,
|
||||||
expected_rent_collection::{ExpectedRentCollection, SlotInfoInEpoch},
|
|
||||||
pubkey_bins::PubkeyBinCalculator24,
|
pubkey_bins::PubkeyBinCalculator24,
|
||||||
read_only_accounts_cache::ReadOnlyAccountsCache,
|
read_only_accounts_cache::ReadOnlyAccountsCache,
|
||||||
rent_collector::RentCollector,
|
rent_collector::RentCollector,
|
||||||
|
@ -1988,26 +1987,22 @@ trait AppendVecScan: Send + Sync + Clone {
|
||||||
/// These would have been captured in a fn from within the scan function.
|
/// These would have been captured in a fn from within the scan function.
|
||||||
/// Some of these are constant across all pubkeys, some are constant across a slot.
|
/// Some of these are constant across all pubkeys, some are constant across a slot.
|
||||||
/// Some could be unique per pubkey.
|
/// Some could be unique per pubkey.
|
||||||
struct ScanState<'a, T: Fn(Slot) -> Option<Slot> + Sync + Send + Clone> {
|
struct ScanState<'a> {
|
||||||
/// slot we're currently scanning
|
/// slot we're currently scanning
|
||||||
current_slot: Slot,
|
current_slot: Slot,
|
||||||
/// accumulated results
|
/// accumulated results
|
||||||
accum: BinnedHashData,
|
accum: BinnedHashData,
|
||||||
/// max slot (inclusive) that we're calculating accounts hash on
|
|
||||||
max_slot_info: SlotInfoInEpoch,
|
|
||||||
bin_calculator: &'a PubkeyBinCalculator24,
|
bin_calculator: &'a PubkeyBinCalculator24,
|
||||||
bin_range: &'a Range<usize>,
|
bin_range: &'a Range<usize>,
|
||||||
config: &'a CalcAccountsHashConfig<'a>,
|
config: &'a CalcAccountsHashConfig<'a>,
|
||||||
mismatch_found: Arc<AtomicU64>,
|
mismatch_found: Arc<AtomicU64>,
|
||||||
stats: &'a crate::accounts_hash::HashStats,
|
|
||||||
find_unskipped_slot: &'a T,
|
|
||||||
filler_account_suffix: Option<&'a Pubkey>,
|
filler_account_suffix: Option<&'a Pubkey>,
|
||||||
range: usize,
|
range: usize,
|
||||||
sort_time: Arc<AtomicU64>,
|
sort_time: Arc<AtomicU64>,
|
||||||
pubkey_to_bin_index: usize,
|
pubkey_to_bin_index: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Fn(Slot) -> Option<Slot> + Sync + Send + Clone> AppendVecScan for ScanState<'a, T> {
|
impl<'a> AppendVecScan for ScanState<'a> {
|
||||||
fn set_slot(&mut self, slot: Slot) {
|
fn set_slot(&mut self, slot: Slot) {
|
||||||
self.current_slot = slot;
|
self.current_slot = slot;
|
||||||
}
|
}
|
||||||
|
@ -2029,26 +2024,6 @@ impl<'a, T: Fn(Slot) -> Option<Slot> + Sync + Send + Clone> AppendVecScan for Sc
|
||||||
|
|
||||||
let balance = loaded_account.lamports();
|
let balance = loaded_account.lamports();
|
||||||
let loaded_hash = loaded_account.loaded_hash();
|
let loaded_hash = loaded_account.loaded_hash();
|
||||||
let new_hash = self
|
|
||||||
.config
|
|
||||||
.enable_rehashing
|
|
||||||
.then(|| {
|
|
||||||
ExpectedRentCollection::maybe_rehash_skipped_rewrite(
|
|
||||||
loaded_account,
|
|
||||||
&loaded_hash,
|
|
||||||
pubkey,
|
|
||||||
self.current_slot,
|
|
||||||
self.config.epoch_schedule,
|
|
||||||
self.config.rent_collector,
|
|
||||||
self.stats,
|
|
||||||
&self.max_slot_info,
|
|
||||||
self.find_unskipped_slot,
|
|
||||||
self.filler_account_suffix,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.flatten();
|
|
||||||
let loaded_hash = new_hash.unwrap_or(loaded_hash);
|
|
||||||
|
|
||||||
let source_item = CalculateHashIntermediate::new(loaded_hash, balance, *pubkey);
|
let source_item = CalculateHashIntermediate::new(loaded_hash, balance, *pubkey);
|
||||||
|
|
||||||
if self.config.check_hash
|
if self.config.check_hash
|
||||||
|
@ -6759,8 +6734,6 @@ impl AccountsDb {
|
||||||
let total_lamports = Mutex::<u64>::new(0);
|
let total_lamports = Mutex::<u64>::new(0);
|
||||||
let stats = HashStats::default();
|
let stats = HashStats::default();
|
||||||
|
|
||||||
let max_slot_info = SlotInfoInEpoch::new(max_slot, config.epoch_schedule);
|
|
||||||
|
|
||||||
let get_hashes = || {
|
let get_hashes = || {
|
||||||
keys.par_chunks(chunks)
|
keys.par_chunks(chunks)
|
||||||
.map(|pubkeys| {
|
.map(|pubkeys| {
|
||||||
|
@ -6793,24 +6766,7 @@ impl AccountsDb {
|
||||||
.get_loaded_account()
|
.get_loaded_account()
|
||||||
.and_then(
|
.and_then(
|
||||||
|loaded_account| {
|
|loaded_account| {
|
||||||
let find_unskipped_slot = |slot: Slot| {
|
|
||||||
self.find_unskipped_slot(slot, config.ancestors)
|
|
||||||
};
|
|
||||||
let loaded_hash = loaded_account.loaded_hash();
|
let loaded_hash = loaded_account.loaded_hash();
|
||||||
let new_hash = config.enable_rehashing
|
|
||||||
.then(|| ExpectedRentCollection::maybe_rehash_skipped_rewrite(
|
|
||||||
&loaded_account,
|
|
||||||
&loaded_hash,
|
|
||||||
pubkey,
|
|
||||||
*slot,
|
|
||||||
config.epoch_schedule,
|
|
||||||
config.rent_collector,
|
|
||||||
&stats,
|
|
||||||
&max_slot_info,
|
|
||||||
find_unskipped_slot,
|
|
||||||
self.filler_account_suffix.as_ref(),
|
|
||||||
)).flatten();
|
|
||||||
let loaded_hash = new_hash.unwrap_or(loaded_hash);
|
|
||||||
let balance = loaded_account.lamports();
|
let balance = loaded_account.lamports();
|
||||||
if config.check_hash && !self.is_filler_account(pubkey) { // this will not be supported anymore
|
if config.check_hash && !self.is_filler_account(pubkey) { // this will not be supported anymore
|
||||||
let computed_hash =
|
let computed_hash =
|
||||||
|
@ -6895,7 +6851,6 @@ impl AccountsDb {
|
||||||
ancestors: &Ancestors,
|
ancestors: &Ancestors,
|
||||||
epoch_schedule: &EpochSchedule,
|
epoch_schedule: &EpochSchedule,
|
||||||
rent_collector: &RentCollector,
|
rent_collector: &RentCollector,
|
||||||
enable_rehashing: bool,
|
|
||||||
) -> (Hash, u64) {
|
) -> (Hash, u64) {
|
||||||
self.update_accounts_hash_with_index_option(
|
self.update_accounts_hash_with_index_option(
|
||||||
true,
|
true,
|
||||||
|
@ -6906,7 +6861,6 @@ impl AccountsDb {
|
||||||
epoch_schedule,
|
epoch_schedule,
|
||||||
rent_collector,
|
rent_collector,
|
||||||
false,
|
false,
|
||||||
enable_rehashing,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6920,7 +6874,6 @@ impl AccountsDb {
|
||||||
None,
|
None,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
false,
|
|
||||||
true,
|
true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -7339,7 +7292,6 @@ impl AccountsDb {
|
||||||
epoch_schedule: &EpochSchedule,
|
epoch_schedule: &EpochSchedule,
|
||||||
rent_collector: &RentCollector,
|
rent_collector: &RentCollector,
|
||||||
is_startup: bool,
|
is_startup: bool,
|
||||||
enable_rehashing: bool,
|
|
||||||
) -> (Hash, u64) {
|
) -> (Hash, u64) {
|
||||||
let check_hash = false;
|
let check_hash = false;
|
||||||
let (hash, total_lamports) = self
|
let (hash, total_lamports) = self
|
||||||
|
@ -7355,7 +7307,6 @@ impl AccountsDb {
|
||||||
rent_collector,
|
rent_collector,
|
||||||
store_detailed_debug_info_on_failure: false,
|
store_detailed_debug_info_on_failure: false,
|
||||||
full_snapshot: None,
|
full_snapshot: None,
|
||||||
enable_rehashing,
|
|
||||||
},
|
},
|
||||||
expected_capitalization,
|
expected_capitalization,
|
||||||
)
|
)
|
||||||
|
@ -7391,22 +7342,15 @@ impl AccountsDb {
|
||||||
let range = bin_range.end - bin_range.start;
|
let range = bin_range.end - bin_range.start;
|
||||||
let sort_time = Arc::new(AtomicU64::new(0));
|
let sort_time = Arc::new(AtomicU64::new(0));
|
||||||
|
|
||||||
let find_unskipped_slot = |slot: Slot| self.find_unskipped_slot(slot, config.ancestors);
|
|
||||||
|
|
||||||
let max_slot_info =
|
|
||||||
SlotInfoInEpoch::new(storage.max_slot_inclusive(), config.epoch_schedule);
|
|
||||||
let scanner = ScanState {
|
let scanner = ScanState {
|
||||||
current_slot: Slot::default(),
|
current_slot: Slot::default(),
|
||||||
accum: BinnedHashData::default(),
|
accum: BinnedHashData::default(),
|
||||||
bin_calculator: &bin_calculator,
|
bin_calculator: &bin_calculator,
|
||||||
config,
|
config,
|
||||||
mismatch_found: mismatch_found.clone(),
|
mismatch_found: mismatch_found.clone(),
|
||||||
max_slot_info,
|
|
||||||
find_unskipped_slot: &find_unskipped_slot,
|
|
||||||
filler_account_suffix,
|
filler_account_suffix,
|
||||||
range,
|
range,
|
||||||
bin_range,
|
bin_range,
|
||||||
stats,
|
|
||||||
sort_time: sort_time.clone(),
|
sort_time: sort_time.clone(),
|
||||||
pubkey_to_bin_index: 0,
|
pubkey_to_bin_index: 0,
|
||||||
};
|
};
|
||||||
|
@ -7603,7 +7547,6 @@ impl AccountsDb {
|
||||||
test_hash_calculation: bool,
|
test_hash_calculation: bool,
|
||||||
epoch_schedule: &EpochSchedule,
|
epoch_schedule: &EpochSchedule,
|
||||||
rent_collector: &RentCollector,
|
rent_collector: &RentCollector,
|
||||||
enable_rehashing: bool,
|
|
||||||
use_bg_thread_pool: bool,
|
use_bg_thread_pool: bool,
|
||||||
) -> Result<(), BankHashVerificationError> {
|
) -> Result<(), BankHashVerificationError> {
|
||||||
self.verify_bank_hash_and_lamports_new(
|
self.verify_bank_hash_and_lamports_new(
|
||||||
|
@ -7615,7 +7558,6 @@ impl AccountsDb {
|
||||||
rent_collector,
|
rent_collector,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
enable_rehashing,
|
|
||||||
use_bg_thread_pool,
|
use_bg_thread_pool,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -7632,7 +7574,6 @@ impl AccountsDb {
|
||||||
rent_collector: &RentCollector,
|
rent_collector: &RentCollector,
|
||||||
ignore_mismatch: bool,
|
ignore_mismatch: bool,
|
||||||
store_hash_raw_data_for_debug: bool,
|
store_hash_raw_data_for_debug: bool,
|
||||||
enable_rehashing: bool,
|
|
||||||
use_bg_thread_pool: bool,
|
use_bg_thread_pool: bool,
|
||||||
) -> Result<(), BankHashVerificationError> {
|
) -> Result<(), BankHashVerificationError> {
|
||||||
use BankHashVerificationError::*;
|
use BankHashVerificationError::*;
|
||||||
|
@ -7652,7 +7593,6 @@ impl AccountsDb {
|
||||||
rent_collector,
|
rent_collector,
|
||||||
store_detailed_debug_info_on_failure: store_hash_raw_data_for_debug,
|
store_detailed_debug_info_on_failure: store_hash_raw_data_for_debug,
|
||||||
full_snapshot: None,
|
full_snapshot: None,
|
||||||
enable_rehashing,
|
|
||||||
},
|
},
|
||||||
None,
|
None,
|
||||||
)?;
|
)?;
|
||||||
|
@ -11646,14 +11586,12 @@ pub mod tests {
|
||||||
&ancestors,
|
&ancestors,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
),
|
),
|
||||||
accounts.update_accounts_hash(
|
accounts.update_accounts_hash(
|
||||||
latest_slot,
|
latest_slot,
|
||||||
&ancestors,
|
&ancestors,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -11937,7 +11875,6 @@ pub mod tests {
|
||||||
&Ancestors::default(),
|
&Ancestors::default(),
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let accounts = f(accounts, current_slot);
|
let accounts = f(accounts, current_slot);
|
||||||
|
@ -11957,7 +11894,6 @@ pub mod tests {
|
||||||
true,
|
true,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -12293,7 +12229,6 @@ pub mod tests {
|
||||||
rent_collector: &RENT_COLLECTOR,
|
rent_collector: &RENT_COLLECTOR,
|
||||||
store_detailed_debug_info_on_failure: false,
|
store_detailed_debug_info_on_failure: false,
|
||||||
full_snapshot: None,
|
full_snapshot: None,
|
||||||
enable_rehashing: true,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12362,7 +12297,6 @@ pub mod tests {
|
||||||
true,
|
true,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
Ok(_)
|
Ok(_)
|
||||||
|
@ -12377,7 +12311,6 @@ pub mod tests {
|
||||||
true,
|
true,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
Err(MissingBankHash)
|
Err(MissingBankHash)
|
||||||
|
@ -12401,7 +12334,6 @@ pub mod tests {
|
||||||
true,
|
true,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
Err(MismatchedBankHash)
|
Err(MismatchedBankHash)
|
||||||
|
@ -12431,7 +12363,6 @@ pub mod tests {
|
||||||
true,
|
true,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
Ok(_)
|
Ok(_)
|
||||||
|
@ -12454,14 +12385,13 @@ pub mod tests {
|
||||||
true,
|
true,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
Ok(_)
|
Ok(_)
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_matches!(
|
assert_matches!(
|
||||||
db.verify_bank_hash_and_lamports(some_slot, &ancestors, 10, true, &EpochSchedule::default(), &RentCollector::default(), true, false,),
|
db.verify_bank_hash_and_lamports(some_slot, &ancestors, 10, true, &EpochSchedule::default(), &RentCollector::default(), false,),
|
||||||
Err(MismatchedTotalLamports(expected, actual)) if expected == 2 && actual == 10
|
Err(MismatchedTotalLamports(expected, actual)) if expected == 2 && actual == 10
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -12488,7 +12418,6 @@ pub mod tests {
|
||||||
true,
|
true,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
Ok(_)
|
Ok(_)
|
||||||
|
@ -12533,7 +12462,6 @@ pub mod tests {
|
||||||
true,
|
true,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
Err(MismatchedBankHash)
|
Err(MismatchedBankHash)
|
||||||
|
@ -13144,7 +13072,6 @@ pub mod tests {
|
||||||
&no_ancestors,
|
&no_ancestors,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
);
|
);
|
||||||
accounts
|
accounts
|
||||||
.verify_bank_hash_and_lamports(
|
.verify_bank_hash_and_lamports(
|
||||||
|
@ -13154,7 +13081,6 @@ pub mod tests {
|
||||||
true,
|
true,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -13168,7 +13094,6 @@ pub mod tests {
|
||||||
true,
|
true,
|
||||||
&EpochSchedule::default(),
|
&EpochSchedule::default(),
|
||||||
&RentCollector::default(),
|
&RentCollector::default(),
|
||||||
true,
|
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -56,8 +56,6 @@ pub struct CalcAccountsHashConfig<'a> {
|
||||||
pub rent_collector: &'a RentCollector,
|
pub rent_collector: &'a RentCollector,
|
||||||
/// used for tracking down hash mismatches after the fact
|
/// used for tracking down hash mismatches after the fact
|
||||||
pub store_detailed_debug_info_on_failure: bool,
|
pub store_detailed_debug_info_on_failure: bool,
|
||||||
/// true if hash calculation can rehash based on skipped rewrites
|
|
||||||
pub enable_rehashing: bool,
|
|
||||||
/// `Some` if this is an incremental snapshot which only hashes slots since the base full snapshot
|
/// `Some` if this is an incremental snapshot which only hashes slots since the base full snapshot
|
||||||
pub full_snapshot: Option<FullSnapshotAccountsHashInfo>,
|
pub full_snapshot: Option<FullSnapshotAccountsHashInfo>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,6 @@ use {
|
||||||
cost_tracker::CostTracker,
|
cost_tracker::CostTracker,
|
||||||
epoch_accounts_hash::{self, EpochAccountsHash},
|
epoch_accounts_hash::{self, EpochAccountsHash},
|
||||||
epoch_stakes::{EpochStakes, NodeVoteAccounts},
|
epoch_stakes::{EpochStakes, NodeVoteAccounts},
|
||||||
expected_rent_collection::{ExpectedRentCollection, SlotInfoInEpoch},
|
|
||||||
inline_spl_associated_token_account, inline_spl_token,
|
inline_spl_associated_token_account, inline_spl_token,
|
||||||
message_processor::MessageProcessor,
|
message_processor::MessageProcessor,
|
||||||
rent_collector::{CollectedInfo, RentCollector},
|
rent_collector::{CollectedInfo, RentCollector},
|
||||||
|
@ -5204,13 +5203,6 @@ impl Bank {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If we are skipping rewrites for bank hash, then we don't want to
|
|
||||||
/// allow accounts hash calculation to rehash anything.
|
|
||||||
/// We should use whatever hash found for each account as-is.
|
|
||||||
pub fn bank_enable_rehashing_on_accounts_hash(&self) -> bool {
|
|
||||||
true // this will be governed by a feature later
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Collect rent from `accounts`
|
/// Collect rent from `accounts`
|
||||||
///
|
///
|
||||||
/// This fn is called inside a parallel loop from `collect_rent_in_partition()`. Avoid adding
|
/// This fn is called inside a parallel loop from `collect_rent_in_partition()`. Avoid adding
|
||||||
|
@ -6415,22 +6407,7 @@ impl Bank {
|
||||||
ancestors: &Ancestors,
|
ancestors: &Ancestors,
|
||||||
pubkey: &Pubkey,
|
pubkey: &Pubkey,
|
||||||
) -> Option<(AccountSharedData, Slot)> {
|
) -> Option<(AccountSharedData, Slot)> {
|
||||||
match self.rc.accounts.load_with_fixed_root(ancestors, pubkey) {
|
self.rc.accounts.load_with_fixed_root(ancestors, pubkey)
|
||||||
Some((mut account, storage_slot)) => {
|
|
||||||
ExpectedRentCollection::maybe_update_rent_epoch_on_load(
|
|
||||||
&mut account,
|
|
||||||
&SlotInfoInEpoch::new_small(storage_slot),
|
|
||||||
&SlotInfoInEpoch::new_small(self.slot()),
|
|
||||||
self.epoch_schedule(),
|
|
||||||
self.rent_collector(),
|
|
||||||
pubkey,
|
|
||||||
&self.rewrites_skipped_this_slot,
|
|
||||||
);
|
|
||||||
|
|
||||||
Some((account, storage_slot))
|
|
||||||
}
|
|
||||||
None => None,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_program_accounts(
|
pub fn get_program_accounts(
|
||||||
|
@ -6734,7 +6711,6 @@ impl Bank {
|
||||||
let cap = self.capitalization();
|
let cap = self.capitalization();
|
||||||
let epoch_schedule = self.epoch_schedule();
|
let epoch_schedule = self.epoch_schedule();
|
||||||
let rent_collector = self.rent_collector();
|
let rent_collector = self.rent_collector();
|
||||||
let enable_rehashing = self.bank_enable_rehashing_on_accounts_hash();
|
|
||||||
if config.run_in_background {
|
if config.run_in_background {
|
||||||
let ancestors = ancestors.clone();
|
let ancestors = ancestors.clone();
|
||||||
let accounts = Arc::clone(accounts);
|
let accounts = Arc::clone(accounts);
|
||||||
|
@ -6757,7 +6733,6 @@ impl Bank {
|
||||||
&rent_collector,
|
&rent_collector,
|
||||||
config.ignore_mismatch,
|
config.ignore_mismatch,
|
||||||
config.store_hash_raw_data_for_debug,
|
config.store_hash_raw_data_for_debug,
|
||||||
enable_rehashing,
|
|
||||||
// true to run using bg thread pool
|
// true to run using bg thread pool
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
@ -6780,7 +6755,6 @@ impl Bank {
|
||||||
rent_collector,
|
rent_collector,
|
||||||
config.ignore_mismatch,
|
config.ignore_mismatch,
|
||||||
config.store_hash_raw_data_for_debug,
|
config.store_hash_raw_data_for_debug,
|
||||||
enable_rehashing,
|
|
||||||
// fg is waiting for this to run, so we can use the fg thread pool
|
// fg is waiting for this to run, so we can use the fg thread pool
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
@ -6883,7 +6857,6 @@ impl Bank {
|
||||||
debug_verify,
|
debug_verify,
|
||||||
self.epoch_schedule(),
|
self.epoch_schedule(),
|
||||||
&self.rent_collector,
|
&self.rent_collector,
|
||||||
self.bank_enable_rehashing_on_accounts_hash(),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6946,7 +6919,6 @@ impl Bank {
|
||||||
self.epoch_schedule(),
|
self.epoch_schedule(),
|
||||||
&self.rent_collector,
|
&self.rent_collector,
|
||||||
is_startup,
|
is_startup,
|
||||||
self.bank_enable_rehashing_on_accounts_hash(),
|
|
||||||
);
|
);
|
||||||
if total_lamports != self.capitalization() {
|
if total_lamports != self.capitalization() {
|
||||||
datapoint_info!(
|
datapoint_info!(
|
||||||
|
@ -6972,7 +6944,6 @@ impl Bank {
|
||||||
self.epoch_schedule(),
|
self.epoch_schedule(),
|
||||||
&self.rent_collector,
|
&self.rent_collector,
|
||||||
is_startup,
|
is_startup,
|
||||||
self.bank_enable_rehashing_on_accounts_hash(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -37,7 +37,6 @@ pub mod cost_tracker;
|
||||||
pub mod epoch_accounts_hash;
|
pub mod epoch_accounts_hash;
|
||||||
pub mod epoch_stakes;
|
pub mod epoch_stakes;
|
||||||
pub mod execute_cost_table;
|
pub mod execute_cost_table;
|
||||||
mod expected_rent_collection;
|
|
||||||
pub mod genesis_utils;
|
pub mod genesis_utils;
|
||||||
pub mod hardened_unpack;
|
pub mod hardened_unpack;
|
||||||
pub mod in_mem_accounts_index;
|
pub mod in_mem_accounts_index;
|
||||||
|
|
|
@ -46,7 +46,6 @@ pub struct AccountsPackage {
|
||||||
pub accounts: Arc<Accounts>,
|
pub accounts: Arc<Accounts>,
|
||||||
pub epoch_schedule: EpochSchedule,
|
pub epoch_schedule: EpochSchedule,
|
||||||
pub rent_collector: RentCollector,
|
pub rent_collector: RentCollector,
|
||||||
pub enable_rehashing: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AccountsPackage {
|
impl AccountsPackage {
|
||||||
|
@ -117,7 +116,6 @@ impl AccountsPackage {
|
||||||
accounts: bank.accounts(),
|
accounts: bank.accounts(),
|
||||||
epoch_schedule: *bank.epoch_schedule(),
|
epoch_schedule: *bank.epoch_schedule(),
|
||||||
rent_collector: bank.rent_collector().clone(),
|
rent_collector: bank.rent_collector().clone(),
|
||||||
enable_rehashing: bank.bank_enable_rehashing_on_accounts_hash(),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +139,6 @@ impl AccountsPackage {
|
||||||
accounts: Arc::new(Accounts::default_for_tests()),
|
accounts: Arc::new(Accounts::default_for_tests()),
|
||||||
epoch_schedule: EpochSchedule::default(),
|
epoch_schedule: EpochSchedule::default(),
|
||||||
rent_collector: RentCollector::default(),
|
rent_collector: RentCollector::default(),
|
||||||
enable_rehashing: bool::default(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue