add epoch_schedule and rent_collector to hash calc (#24012)

This commit is contained in:
Jeff Washington (jwash)
2022-03-31 10:51:18 -05:00
committed by GitHub
parent da001d54e5
commit 9c8dad33c7
9 changed files with 217 additions and 58 deletions

View File

@ -13,6 +13,7 @@ use {
accounts_index::{AccountSecondaryIndexes, ScanConfig},
ancestors::Ancestors,
bank::*,
rent_collector::RentCollector,
},
solana_sdk::{
account::{AccountSharedData, ReadableAccount},
@ -20,6 +21,7 @@ use {
hash::Hash,
lamports::LamportsError,
pubkey::Pubkey,
sysvar::epoch_schedule::EpochSchedule,
},
std::{
collections::{HashMap, HashSet},
@ -107,7 +109,12 @@ fn test_accounts_hash_bank_hash(bencher: &mut Bencher) {
let slot = 0;
create_test_accounts(&accounts, &mut pubkeys, num_accounts, slot);
let ancestors = Ancestors::from(vec![0]);
let (_, total_lamports) = accounts.accounts_db.update_accounts_hash(0, &ancestors);
let (_, total_lamports) = accounts.accounts_db.update_accounts_hash(
0,
&ancestors,
&EpochSchedule::default(),
&RentCollector::default(),
);
let test_hash_calculation = false;
bencher.iter(|| {
assert!(accounts.verify_bank_hash_and_lamports(
@ -115,8 +122,8 @@ fn test_accounts_hash_bank_hash(bencher: &mut Bencher) {
&ancestors,
total_lamports,
test_hash_calculation,
None,
None,
&EpochSchedule::default(),
&RentCollector::default()
))
});
}
@ -135,7 +142,12 @@ fn test_update_accounts_hash(bencher: &mut Bencher) {
create_test_accounts(&accounts, &mut pubkeys, 50_000, 0);
let ancestors = Ancestors::from(vec![0]);
bencher.iter(|| {
accounts.accounts_db.update_accounts_hash(0, &ancestors);
accounts.accounts_db.update_accounts_hash(
0,
&ancestors,
&EpochSchedule::default(),
&RentCollector::default(),
);
});
}