Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions crates/op-rbuilder/src/args/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,26 @@ pub struct FlashblocksArgs {
env = "FLASHBLOCK_BLOCK_TIME"
)]
pub flashblocks_block_time: u64,

/// Enabled dynamic flashblocks adjustment. This will allow account for late FCUs and produce
/// less flashblocks, while each flashblock would be bigger.
#[arg(
long = "flashblocks.dynamic",
default_value = "false",
env = "FLASHBLOCK_DYNAMIC"
)]
pub flashblocks_dynamic: bool,

/// Time by which blocks would be completed earlier in milliseconds.
///
/// This time used to account for latencies, this time would be deducted from total block
/// building time before calculating number of fbs.
#[arg(
long = "flashblocks.leeway-time",
default_value = "50",
env = "FLASHBLOCK_LEEWAY_TIME"
)]
pub flashblocks_leeway_time: u64,
}

impl Default for FlashblocksArgs {
Expand All @@ -137,4 +157,12 @@ pub struct TelemetryArgs {
/// OpenTelemetry headers for authentication
#[arg(long = "telemetry.otlp-headers", env = "OTEL_EXPORTER_OTLP_HEADERS")]
pub otlp_headers: Option<String>,

/// Inverted sampling frequency in blocks. 1 - each block, 100 - every 100th block.
#[arg(
long = "telemetry.sampling-ratio",
env = "SAMPLING_RATIO",
default_value = "100"
)]
pub sampling_ratio: u64,
}
21 changes: 20 additions & 1 deletion crates/op-rbuilder/src/builders/flashblocks/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,22 @@ pub struct FlashblocksConfig {
/// Each block will contain one or more flashblocks. On average, the number of flashblocks
/// per block is equal to the block time divided by the flashblock interval.
pub interval: Duration,

/// How much time would be deducted from block build time to account for latencies in
/// milliseconds
pub leeway_time: Duration,

/// Enables dynamic flashblocks number based on FCU arrival time
pub dynamic_adjustment: bool,
}

impl Default for FlashblocksConfig {
fn default() -> Self {
Self {
ws_addr: SocketAddr::new(Ipv4Addr::UNSPECIFIED.into(), 1111),
interval: Duration::from_millis(250),
leeway_time: Duration::from_millis(50),
dynamic_adjustment: false,
}
}
}
Expand All @@ -36,7 +45,17 @@ impl TryFrom<OpRbuilderArgs> for FlashblocksConfig {
args.flashblocks.flashblocks_addr.parse()?,
args.flashblocks.flashblocks_port,
);
Ok(Self { ws_addr, interval })

let leeway_time = Duration::from_millis(args.flashblocks.flashblocks_leeway_time);

let dynamic_adjustment = args.flashblocks.flashblocks_dynamic;

Ok(Self {
ws_addr,
interval,
leeway_time,
dynamic_adjustment,
})
}
}

Expand Down
Loading
Loading