This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Uses Bank::new_for_tests() instead of new_for_tests_with_config() #34587
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
for _ in 0..10 { | ||
let blockhash = bank.last_blockhash(); | ||
|
@@ -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()); | ||
|
@@ -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, | ||
)); | ||
|
@@ -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); | ||
|
@@ -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! | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a function called
Bank::new_with_bank_forks_for_tests
that does exactly this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! I have follow up PRs planned for more refactors to consolidate the constructors.
I prefer these simpler PR with a single change. It's easy to see they are all the same. And this is correct as is.