diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index 8dc7d71df7574d..569b2bdd8b7cfe 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -34,9 +34,7 @@ use { rand::Rng, rayon::iter::{IntoParallelIterator, ParallelIterator}, rocksdb::{DBRawIterator, LiveFile}, - solana_accounts_db::hardened_unpack::{ - unpack_genesis_archive, MAX_GENESIS_ARCHIVE_UNPACKED_SIZE, - }, + solana_accounts_db::hardened_unpack::unpack_genesis_archive, solana_entry::entry::{create_ticks, Entry}, solana_measure::measure::Measure, solana_metrics::{ @@ -4963,6 +4961,22 @@ macro_rules! create_new_tmp_ledger { $crate::blockstore::create_new_ledger_from_name( $crate::tmp_ledger_name!(), $genesis_config, + $crate::macro_reexports::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE, + $crate::blockstore_options::LedgerColumnOptions::default(), + ) + }; +} + +#[macro_export] +macro_rules! create_new_tmp_ledger_with_size { + ( + $genesis_config:expr, + $max_genesis_archive_unpacked_size:expr $(,)? + ) => { + $crate::blockstore::create_new_ledger_from_name( + $crate::tmp_ledger_name!(), + $genesis_config, + $max_genesis_archive_unpacked_size, $crate::blockstore_options::LedgerColumnOptions::default(), ) }; @@ -4974,6 +4988,7 @@ macro_rules! create_new_tmp_ledger_fifo { $crate::blockstore::create_new_ledger_from_name( $crate::tmp_ledger_name!(), $genesis_config, + $crate::macro_reexports::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE, $crate::blockstore_options::LedgerColumnOptions { shred_storage_type: $crate::blockstore_options::ShredStorageType::RocksFifo( $crate::blockstore_options::BlockstoreRocksFifoOptions::new_for_tests(), @@ -4990,6 +5005,7 @@ macro_rules! create_new_tmp_ledger_auto_delete { $crate::blockstore::create_new_ledger_from_name_auto_delete( $crate::tmp_ledger_name!(), $genesis_config, + $crate::macro_reexports::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE, $crate::blockstore_options::LedgerColumnOptions::default(), ) }; @@ -5001,6 +5017,7 @@ macro_rules! create_new_tmp_ledger_fifo_auto_delete { $crate::blockstore::create_new_ledger_from_name_auto_delete( $crate::tmp_ledger_name!(), $genesis_config, + $crate::macro_reexports::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE, $crate::blockstore_options::LedgerColumnOptions { shred_storage_type: $crate::blockstore_options::ShredStorageType::RocksFifo( $crate::blockstore_options::BlockstoreRocksFifoOptions::new_for_tests(), @@ -5027,10 +5044,15 @@ pub(crate) fn verify_shred_slots(slot: Slot, parent: Slot, root: Slot) -> bool { pub fn create_new_ledger_from_name( name: &str, genesis_config: &GenesisConfig, + max_genesis_archive_unpacked_size: u64, column_options: LedgerColumnOptions, ) -> (PathBuf, Hash) { - let (ledger_path, blockhash) = - create_new_ledger_from_name_auto_delete(name, genesis_config, column_options); + let (ledger_path, blockhash) = create_new_ledger_from_name_auto_delete( + name, + genesis_config, + max_genesis_archive_unpacked_size, + column_options, + ); (ledger_path.into_path(), blockhash) } @@ -5041,13 +5063,14 @@ pub fn create_new_ledger_from_name( pub fn create_new_ledger_from_name_auto_delete( name: &str, genesis_config: &GenesisConfig, + max_genesis_archive_unpacked_size: u64, column_options: LedgerColumnOptions, ) -> (TempDir, Hash) { let ledger_path = get_ledger_path_from_name_auto_delete(name); let blockhash = create_new_ledger( ledger_path.path(), genesis_config, - MAX_GENESIS_ARCHIVE_UNPACKED_SIZE, + max_genesis_archive_unpacked_size, column_options, ) .unwrap(); diff --git a/ledger/src/lib.rs b/ledger/src/lib.rs index 62c274a74e4550..a7007b49fa4223 100644 --- a/ledger/src/lib.rs +++ b/ledger/src/lib.rs @@ -46,3 +46,8 @@ extern crate log; #[cfg_attr(feature = "frozen-abi", macro_use)] #[cfg(feature = "frozen-abi")] extern crate solana_frozen_abi_macro; + +#[doc(hidden)] +pub mod macro_reexports { + pub use solana_accounts_db::hardened_unpack::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE; +} diff --git a/local-cluster/src/local_cluster.rs b/local-cluster/src/local_cluster.rs index 9374e93770ba90..0666d9b2be3f61 100644 --- a/local-cluster/src/local_cluster.rs +++ b/local-cluster/src/local_cluster.rs @@ -18,7 +18,7 @@ use { contact_info::{ContactInfo, Protocol}, gossip_service::discover_cluster, }, - solana_ledger::{create_new_tmp_ledger, shred::Shred}, + solana_ledger::{create_new_tmp_ledger_with_size, shred::Shred}, solana_rpc_client::rpc_client::RpcClient, solana_runtime::{ genesis_utils::{ @@ -312,9 +312,13 @@ impl LocalCluster { .native_instruction_processors .extend_from_slice(&config.native_instruction_processors); - let (leader_ledger_path, _blockhash) = create_new_tmp_ledger!(&genesis_config); - let leader_contact_info = leader_node.info.clone(); let mut leader_config = safe_clone_config(&config.validator_configs[0]); + let (leader_ledger_path, _blockhash) = create_new_tmp_ledger_with_size!( + &genesis_config, + leader_config.max_genesis_archive_unpacked_size, + ); + + let leader_contact_info = leader_node.info.clone(); leader_config.rpc_addrs = Some(( leader_node.info.rpc().unwrap(), leader_node.info.rpc_pubsub().unwrap(), @@ -494,7 +498,10 @@ impl LocalCluster { let validator_pubkey = validator_keypair.pubkey(); let validator_node = Node::new_localhost_with_pubkey(&validator_keypair.pubkey()); let contact_info = validator_node.info.clone(); - let (ledger_path, _blockhash) = create_new_tmp_ledger!(&self.genesis_config); + let (ledger_path, _blockhash) = create_new_tmp_ledger_with_size!( + &self.genesis_config, + validator_config.max_genesis_archive_unpacked_size, + ); // Give the validator some lamports to setup vote accounts if is_listener {