rework bank::new_with_paths (#19087)
* rework bank::new_with_paths * missing 1 bench
This commit is contained in:
parent
8878f526ce
commit
ca37873e16
|
@ -110,7 +110,7 @@ mod tests {
|
|||
let snapshot_archives_dir = TempDir::new().unwrap();
|
||||
let mut genesis_config_info = create_genesis_config(10_000);
|
||||
genesis_config_info.genesis_config.cluster_type = cluster_type;
|
||||
let bank0 = Bank::new_with_paths(
|
||||
let bank0 = Bank::new_with_paths_for_tests(
|
||||
&genesis_config_info.genesis_config,
|
||||
vec![accounts_dir.path().to_path_buf()],
|
||||
&[],
|
||||
|
|
|
@ -406,7 +406,7 @@ pub fn process_blockstore(
|
|||
}
|
||||
|
||||
// Setup bank for slot 0
|
||||
let bank0 = Bank::new_with_paths(
|
||||
let bank0 = Bank::new_with_paths_production(
|
||||
genesis_config,
|
||||
account_paths,
|
||||
&opts.frozen_accounts,
|
||||
|
@ -3126,7 +3126,7 @@ pub mod tests {
|
|||
genesis_config: &GenesisConfig,
|
||||
account_paths: Vec<PathBuf>,
|
||||
) -> EpochSchedule {
|
||||
let bank = Bank::new_with_paths(
|
||||
let bank = Bank::new_with_paths_for_tests(
|
||||
genesis_config,
|
||||
account_paths,
|
||||
&[],
|
||||
|
|
|
@ -44,7 +44,7 @@ fn deposit_many(bank: &Bank, pubkeys: &mut Vec<Pubkey>, num: usize) -> Result<()
|
|||
#[bench]
|
||||
fn test_accounts_create(bencher: &mut Bencher) {
|
||||
let (genesis_config, _) = create_genesis_config(10_000);
|
||||
let bank0 = Bank::new_with_paths(
|
||||
let bank0 = Bank::new_with_paths_for_benches(
|
||||
&genesis_config,
|
||||
vec![PathBuf::from("bench_a0")],
|
||||
&[],
|
||||
|
@ -65,7 +65,7 @@ fn test_accounts_create(bencher: &mut Bencher) {
|
|||
fn test_accounts_squash(bencher: &mut Bencher) {
|
||||
let (mut genesis_config, _) = create_genesis_config(100_000);
|
||||
genesis_config.rent.burn_percent = 100; // Avoid triggering an assert in Bank::distribute_rent_to_validators()
|
||||
let mut prev_bank = Arc::new(Bank::new_with_paths(
|
||||
let mut prev_bank = Arc::new(Bank::new_with_paths_for_benches(
|
||||
&genesis_config,
|
||||
vec![PathBuf::from("bench_a1")],
|
||||
&[],
|
||||
|
|
|
@ -1065,7 +1065,7 @@ impl Bank {
|
|||
|
||||
pub fn new_for_tests(genesis_config: &GenesisConfig) -> Self {
|
||||
// this will diverge
|
||||
Self::new_with_paths(
|
||||
Self::new_with_paths_for_tests(
|
||||
genesis_config,
|
||||
Vec::new(),
|
||||
&[],
|
||||
|
@ -1079,7 +1079,7 @@ impl Bank {
|
|||
}
|
||||
|
||||
pub fn new_no_wallclock_throttle_for_tests(genesis_config: &GenesisConfig) -> Self {
|
||||
let mut bank = Self::new_with_paths(
|
||||
let mut bank = Self::new_with_paths_for_tests(
|
||||
genesis_config,
|
||||
Vec::new(),
|
||||
&[],
|
||||
|
@ -1102,7 +1102,7 @@ impl Bank {
|
|||
accounts_db_caching_enabled: bool,
|
||||
shrink_ratio: AccountShrinkThreshold,
|
||||
) -> Self {
|
||||
Self::new_with_paths(
|
||||
Self::new_with_paths_for_tests(
|
||||
genesis_config,
|
||||
Vec::new(),
|
||||
&[],
|
||||
|
@ -1174,7 +1174,55 @@ impl Bank {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_with_paths(
|
||||
pub fn new_with_paths_for_tests(
|
||||
genesis_config: &GenesisConfig,
|
||||
paths: Vec<PathBuf>,
|
||||
frozen_account_pubkeys: &[Pubkey],
|
||||
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||
additional_builtins: Option<&Builtins>,
|
||||
account_indexes: AccountSecondaryIndexes,
|
||||
accounts_db_caching_enabled: bool,
|
||||
shrink_ratio: AccountShrinkThreshold,
|
||||
debug_do_not_add_builtins: bool,
|
||||
) -> Self {
|
||||
Self::new_with_paths_production(
|
||||
genesis_config,
|
||||
paths,
|
||||
frozen_account_pubkeys,
|
||||
debug_keys,
|
||||
additional_builtins,
|
||||
account_indexes,
|
||||
accounts_db_caching_enabled,
|
||||
shrink_ratio,
|
||||
debug_do_not_add_builtins,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn new_with_paths_for_benches(
|
||||
genesis_config: &GenesisConfig,
|
||||
paths: Vec<PathBuf>,
|
||||
frozen_account_pubkeys: &[Pubkey],
|
||||
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||
additional_builtins: Option<&Builtins>,
|
||||
account_indexes: AccountSecondaryIndexes,
|
||||
accounts_db_caching_enabled: bool,
|
||||
shrink_ratio: AccountShrinkThreshold,
|
||||
debug_do_not_add_builtins: bool,
|
||||
) -> Self {
|
||||
Self::new_with_paths_production(
|
||||
genesis_config,
|
||||
paths,
|
||||
frozen_account_pubkeys,
|
||||
debug_keys,
|
||||
additional_builtins,
|
||||
account_indexes,
|
||||
accounts_db_caching_enabled,
|
||||
shrink_ratio,
|
||||
debug_do_not_add_builtins,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn new_with_paths_production(
|
||||
genesis_config: &GenesisConfig,
|
||||
paths: Vec<PathBuf>,
|
||||
frozen_account_pubkeys: &[Pubkey],
|
||||
|
@ -12211,7 +12259,7 @@ pub(crate) mod tests {
|
|||
feature_builtins: (vec![]),
|
||||
};
|
||||
|
||||
let bank0 = Arc::new(Bank::new_with_paths(
|
||||
let bank0 = Arc::new(Bank::new_with_paths_for_tests(
|
||||
&genesis_config,
|
||||
Vec::new(),
|
||||
&[],
|
||||
|
|
Loading…
Reference in New Issue