Skip to content

Commit

Permalink
Moves Bank benches-only ctors in DCOU (solana-labs#34545)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Dec 20, 2023
1 parent d436352 commit d3cde6c
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
//! It offers a high-level API that signs transactions
//! on behalf of the caller, and a low-level API for when they have
//! already been signed and verified.
#[cfg(feature = "dev-context-only-utils")]
use solana_accounts_db::accounts_db::ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS;
#[allow(deprecated)]
use solana_sdk::recent_blockhashes_account;
pub use solana_sdk::reward_type::RewardType;
Expand Down Expand Up @@ -76,7 +78,7 @@ use {
accounts_db::{
AccountShrinkThreshold, AccountStorageEntry, AccountsDb, AccountsDbConfig,
CalcAccountsHashDataSource, VerifyAccountsHashAndLamportsConfig,
ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS, ACCOUNTS_DB_CONFIG_FOR_TESTING,
ACCOUNTS_DB_CONFIG_FOR_TESTING,
},
accounts_hash::{
AccountHash, AccountsHash, CalcAccountsHashConfig, HashStats, IncrementalAccountsHash,
Expand Down Expand Up @@ -952,10 +954,6 @@ pub(super) enum RewardInterval {
}

impl Bank {
pub fn new_for_benches(genesis_config: &GenesisConfig) -> Self {
Self::new_with_paths_for_benches(genesis_config, Vec::new())
}

/// Intended for use by tests only.
/// create new bank with the given configs.
pub fn new_with_runtime_config_for_tests(
Expand Down Expand Up @@ -1067,24 +1065,6 @@ impl Bank {
)
}

/// Intended for use by benches only.
/// create new bank with the given config and paths.
pub fn new_with_paths_for_benches(genesis_config: &GenesisConfig, paths: Vec<PathBuf>) -> Self {
Self::new_with_paths(
genesis_config,
Arc::<RuntimeConfig>::default(),
paths,
None,
None,
AccountSecondaryIndexes::default(),
AccountShrinkThreshold::default(),
false,
Some(ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS),
None,
Arc::default(),
)
}

#[allow(clippy::too_many_arguments)]
pub fn new_with_paths(
genesis_config: &GenesisConfig,
Expand Down Expand Up @@ -8252,6 +8232,28 @@ impl Bank {
)
}

pub fn new_for_benches(genesis_config: &GenesisConfig) -> Self {
Self::new_with_paths_for_benches(genesis_config, Vec::new())
}

/// Intended for use by benches only.
/// create new bank with the given config and paths.
pub fn new_with_paths_for_benches(genesis_config: &GenesisConfig, paths: Vec<PathBuf>) -> Self {
Self::new_with_paths(
genesis_config,
Arc::<RuntimeConfig>::default(),
paths,
None,
None,
AccountSecondaryIndexes::default(),
AccountShrinkThreshold::default(),
false,
Some(ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS),
None,
Arc::default(),
)
}

/// Prepare a transaction batch from a list of legacy transactions. Used for tests only.
pub fn prepare_batch_for_tests(&self, txs: Vec<Transaction>) -> TransactionBatch {
let transaction_account_lock_limit = self.get_transaction_account_lock_limit();
Expand Down

0 comments on commit d3cde6c

Please sign in to comment.