Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Uses Bank::new_for_tests() instead of new_for_tests_with_config()
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo committed Dec 24, 2023
1 parent 1a00175 commit cd19d15
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 24 deletions.
6 changes: 2 additions & 4 deletions core/tests/epoch_accounts_hash.rs
Original file line number Diff line number Diff line change
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
10 changes: 2 additions & 8 deletions runtime/src/bank/serde_snapshot.rs
Original file line number Diff line number Diff line change
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 cd19d15

Please sign in to comment.