Skip to content

Commit

Permalink
cfg param max_concurrent_seals
Browse files Browse the repository at this point in the history
  • Loading branch information
ZanCorDX committed Sep 26, 2024
1 parent 00602cc commit 6eb7f5f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
2 changes: 2 additions & 0 deletions config-live-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<dyn BidMaker + Send + Sync> = 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<dyn SlotBidder> = self.bidding_service.create_slot_bidder(
slot_data.block(),
slot_data.slot(),
slot_data.timestamp(),
Box::new(sealer),
sealer,
cancel.clone(),
);

Expand Down
13 changes: 9 additions & 4 deletions crates/rbuilder/src/live_builder/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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<i64>,

/// 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<EnvOrValue<String>>")]
pub cl_node_url: Vec<EnvOrValue<String>>,
Expand All @@ -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,
}
}
}
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 6eb7f5f

Please sign in to comment.