Skip to content

Commit

Permalink
Uses Bank::new_for_tests() instead of new_for_tests_with_config() (so…
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Dec 26, 2023
1 parent d500eb6 commit 6b76ec1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 27 deletions.
8 changes: 3 additions & 5 deletions core/tests/epoch_accounts_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use {
AbsRequestHandlers, AbsRequestSender, AccountsBackgroundService, DroppedSlotsReceiver,
PrunedBanksRequestHandler, SnapshotRequestHandler,
},
bank::{epoch_accounts_hash_utils, Bank, BankTestConfig},
bank::{epoch_accounts_hash_utils, Bank},
bank_forks::BankForks,
genesis_utils::{self, GenesisConfigInfo},
runtime_config::RuntimeConfig,
Expand Down Expand Up @@ -113,10 +113,8 @@ impl TestEnvironment {
..snapshot_config
};

let bank_forks = BankForks::new_rw_arc(Bank::new_for_tests_with_config(
&genesis_config_info.genesis_config,
BankTestConfig::default(),
));
let bank_forks =
BankForks::new_rw_arc(Bank::new_for_tests(&genesis_config_info.genesis_config));
bank_forks
.write()
.unwrap()
Expand Down
14 changes: 4 additions & 10 deletions runtime/src/bank/serde_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ mod tests {
use {
crate::{
bank::{
epoch_accounts_hash_utils, test_utils as bank_test_utils, Bank, BankTestConfig,
EpochRewardStatus, StartBlockHeightAndRewards,
epoch_accounts_hash_utils, test_utils as bank_test_utils, Bank, EpochRewardStatus,
StartBlockHeightAndRewards,
},
genesis_utils::activate_all_features,
runtime_config::RuntimeConfig,
Expand Down Expand Up @@ -340,10 +340,7 @@ mod tests {
for epoch_reward_status_active in [None, Some(vec![]), Some(vec![sample_rewards])] {
let (genesis_config, _) = create_genesis_config(500);

let bank0 = Arc::new(Bank::new_for_tests_with_config(
&genesis_config,
BankTestConfig::default(),
));
let bank0 = Arc::new(Bank::new_for_tests(&genesis_config));
bank0.squash();
let mut bank = Bank::new_from_parent(bank0.clone(), &Pubkey::default(), 1);

Expand Down Expand Up @@ -533,10 +530,7 @@ mod tests {
solana_logger::setup();
let (genesis_config, _) = create_genesis_config(500);

let bank0 = Arc::new(Bank::new_for_tests_with_config(
&genesis_config,
BankTestConfig::default(),
));
let bank0 = Arc::new(Bank::new_for_tests(&genesis_config));
bank0.squash();
let mut bank = Bank::new_from_parent(bank0.clone(), &Pubkey::default(), 1);
add_root_and_flush_write_cache(&bank0);
Expand Down
17 changes: 5 additions & 12 deletions runtime/src/bank/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2130,8 +2130,7 @@ fn test_purge_empty_accounts() {
let (genesis_config, mint_keypair) = create_genesis_config(sol_to_lamports(1.));
let amount = genesis_config.rent.minimum_balance(0);
let (mut bank, bank_forks) =
Bank::new_for_tests_with_config(&genesis_config, BankTestConfig::default())
.wrap_with_bank_forks_for_tests();
Bank::new_for_tests(&genesis_config).wrap_with_bank_forks_for_tests();

for _ in 0..10 {
let blockhash = bank.last_blockhash();
Expand Down Expand Up @@ -3769,10 +3768,7 @@ fn test_bank_update_sysvar_account() {
for feature_id in FeatureSet::default().inactive {
activate_feature(&mut genesis_config, feature_id);
}
let bank1 = Arc::new(Bank::new_for_tests_with_config(
&genesis_config,
BankTestConfig::default(),
));
let bank1 = Arc::new(Bank::new_for_tests(&genesis_config));
if pass == 0 {
add_root_and_flush_write_cache(&bank1);
assert_eq!(bank1.calculate_capitalization(true), bank1.capitalization());
Expand Down Expand Up @@ -6960,10 +6956,7 @@ fn test_add_precompiled_account() {
let program_id = solana_sdk::pubkey::new_rand();

let bank = Arc::new(Bank::new_from_parent(
Arc::new(Bank::new_for_tests_with_config(
&genesis_config,
BankTestConfig::default(),
)),
Arc::new(Bank::new_for_tests(&genesis_config)),
&Pubkey::default(),
slot,
));
Expand Down Expand Up @@ -7005,7 +6998,7 @@ fn test_add_precompiled_account_inherited_cap_while_replacing() {
// and then want to continue modifying the bank
for pass in 0..4 {
let (genesis_config, mint_keypair) = create_genesis_config(100_000);
let bank = Bank::new_for_tests_with_config(&genesis_config, BankTestConfig::default());
let bank = Bank::new_for_tests(&genesis_config);
let program_id = solana_sdk::pubkey::new_rand();

bank.add_precompiled_account(&program_id);
Expand Down Expand Up @@ -7039,7 +7032,7 @@ fn test_add_precompiled_account_inherited_cap_while_replacing() {
fn test_add_precompiled_account_squatted_while_not_replacing() {
for pass in 0..3 {
let (genesis_config, mint_keypair) = create_genesis_config(100_000);
let bank = Bank::new_for_tests_with_config(&genesis_config, BankTestConfig::default());
let bank = Bank::new_for_tests(&genesis_config);
let program_id = solana_sdk::pubkey::new_rand();

// someone managed to squat at program_id!
Expand Down

0 comments on commit 6b76ec1

Please sign in to comment.