diff --git a/config-live-example.toml b/config-live-example.toml index 2b6836b2..b3c4f03e 100644 --- a/config-live-example.toml +++ b/config-live-example.toml @@ -27,6 +27,8 @@ dry_run_validation_url = "http://localhost:8545" ignore_cancellable_orders = true +max_concurrent_seals = 4 + sbundle_mergeabe_signers = [] # slot_delta_to_start_submits_ms is usually negative since we start bidding BEFORE the slot start # slot_delta_to_start_submits_ms = -5000 diff --git a/crates/rbuilder/src/live_builder/block_output/block_sealing_bidder_factory.rs b/crates/rbuilder/src/live_builder/block_output/block_sealing_bidder_factory.rs index 9c90fbb1..ece99d7c 100644 --- a/crates/rbuilder/src/live_builder/block_output/block_sealing_bidder_factory.rs +++ b/crates/rbuilder/src/live_builder/block_output/block_sealing_bidder_factory.rs @@ -10,8 +10,9 @@ use tracing::error; use super::{ bid_value_source::interfaces::{BidValueObs, BidValueSource}, bidding::{ - interfaces::{BiddingService, SlotBidder}, + interfaces::{BidMaker, BiddingService, SlotBidder}, parallel_sealer_bid_maker::ParallelSealerBidMaker, + sequential_sealer_bid_maker::SequentialSealerBidMaker, wallet_balance_watcher::WalletBalanceWatcher, }, relay_submit::BuilderSinkFactory, @@ -90,17 +91,24 @@ impl UnfinishedBlockBuildingSinkFactory for BlockSealingBidderFactory { self.competition_bid_value_source.clone(), cancel.clone(), ); - let sealer = ParallelSealerBidMaker::new( - self.max_concurrent_seals, - Arc::from(finished_block_sink), - cancel.clone(), - ); + let sealer: Box = if self.max_concurrent_seals == 1 { + Box::new(SequentialSealerBidMaker::new( + Arc::from(finished_block_sink), + cancel.clone(), + )) + } else { + Box::new(ParallelSealerBidMaker::new( + self.max_concurrent_seals, + Arc::from(finished_block_sink), + cancel.clone(), + )) + }; let slot_bidder: Arc = self.bidding_service.create_slot_bidder( slot_data.block(), slot_data.slot(), slot_data.timestamp(), - Box::new(sealer), + sealer, cancel.clone(), ); diff --git a/crates/rbuilder/src/live_builder/config.rs b/crates/rbuilder/src/live_builder/config.rs index 1daa675f..b0112c5d 100644 --- a/crates/rbuilder/src/live_builder/config.rs +++ b/crates/rbuilder/src/live_builder/config.rs @@ -65,8 +65,8 @@ const DEFAULT_SLOT_DELTA_TO_START_SUBMITS: time::Duration = time::Duration::mill /// We initialize the wallet with the last full day. This should be enough for any bidder. /// On debug I measured this to be < 300ms so it's not big deal. pub const WALLET_INIT_HISTORY_SIZE: Duration = Duration::from_secs(60 * 60 * 24); -/// Number of sealing processes to run in parallel for each builder algorithm. -pub const SEALING_PROCESSES_PER_BUILDER_ALGORITHM: usize = 2; +/// 1 is easier for debugging. +pub const DEFAULT_MAX_CONCURRENT_SEALS: u64 = 1; /// This example has a single building algorithm cfg but the idea of this enum is to have several builders #[derive(Debug, Clone, Deserialize, PartialEq, Eq)] @@ -117,9 +117,13 @@ pub struct L1Config { /// If true all optimistic submissions will be validated on nodes specified in `dry_run_validation_url` pub optimistic_prevalidate_optimistic_blocks: bool, - // See [`SubmissionConfig`] + /// See [`SubmissionConfig`] slot_delta_to_start_submits_ms: Option, + /// How many seals we are going to be doing in parallel. + /// Optimal value may change depending on the roothash computation caching strategies. + pub max_concurrent_seals: u64, + ///Name kept singular for backwards compatibility #[serde_as(deserialize_as = "OneOrMany>")] pub cl_node_url: Vec>, @@ -138,6 +142,7 @@ impl Default for L1Config { optimistic_prevalidate_optimistic_blocks: false, slot_delta_to_start_submits_ms: None, cl_node_url: vec![EnvOrValue::from("http://127.0.0.1:3500")], + max_concurrent_seals: DEFAULT_MAX_CONCURRENT_SEALS, } } } @@ -302,7 +307,7 @@ impl LiveBuilderConfig for Config { sink_sealed_factory, Arc::new(NullBidValueSource {}), wallet_balance_watcher, - SEALING_PROCESSES_PER_BUILDER_ALGORITHM * self.builders.len(), + self.l1_config.max_concurrent_seals as usize, )); let payload_event = MevBoostSlotDataGenerator::new(