Skip to content

Commit 0febe22

Browse files
committed
Merge branch 'main' of github.com:flashbots/op-rbuilder into niven/fix-state-root
2 parents 148c8f5 + 7687bc4 commit 0febe22

15 files changed

Lines changed: 843 additions & 650 deletions

File tree

Cargo.lock

Lines changed: 87 additions & 558 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace.package]
2-
version = "0.2.13"
2+
version = "0.2.14"
33
edition = "2024"
44
rust-version = "1.88"
55
license = "MIT OR Apache-2.0"
@@ -161,9 +161,6 @@ alloy-trie = { version = "0.9.1" }
161161

162162
alloy-hardforks = "0.4.4"
163163

164-
# rollup-boost
165-
rollup-boost = { git = "https://github.com/flashbots/rollup-boost", tag = "v0.7.11" }
166-
167164
# optimism
168165
alloy-op-evm = { version = "0.23.0", default-features = false }
169166
alloy-op-hardforks = "0.4.4"

crates/op-rbuilder/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,12 @@ rand = "0.9.0"
125125
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
126126
shellexpand = "3.1"
127127
serde_yaml = { version = "0.9" }
128-
moka = "0.12"
128+
moka = { version = "0.12", features = ["future"] }
129129
http = "1.0"
130130
sha3 = "0.10"
131131
reqwest = "0.12.23"
132132
k256 = "0.13.4"
133133

134-
rollup-boost.workspace = true
135-
136134
nanoid = { version = "0.4", optional = true }
137135
reth-ipc = { workspace = true, optional = true }
138136
tar = { version = "0.4", optional = true }

crates/op-rbuilder/src/args/op.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub struct FlashblocksArgs {
144144
/// building time before calculating number of fbs.
145145
#[arg(
146146
long = "flashblocks.leeway-time",
147-
default_value = "75",
147+
default_value = "0",
148148
env = "FLASHBLOCK_LEEWAY_TIME"
149149
)]
150150
pub flashblocks_leeway_time: u64,
@@ -176,6 +176,35 @@ pub struct FlashblocksArgs {
176176
)]
177177
pub flashblocks_number_contract_use_permit: bool,
178178

179+
/// Build flashblock at the end of the flashblock interval
180+
#[arg(
181+
long = "flashblocks.build-at-interval-end",
182+
env = "FLASHBLOCK_BUILD_AT_INTERVAL_END",
183+
default_value = "false"
184+
)]
185+
pub flashblocks_build_at_interval_end: bool,
186+
187+
/// Offset in milliseconds for when to send flashblocks.
188+
/// Positive values send late, negative values send early.
189+
/// Example: -20 sends 20ms early, 20 sends 20ms late.
190+
#[arg(
191+
long = "flashblocks.send-offset-ms",
192+
env = "FLASHBLOCK_SEND_OFFSET_MS",
193+
default_value = "0",
194+
allow_hyphen_values = true
195+
)]
196+
pub flashblocks_send_offset_ms: i64,
197+
198+
/// Time in milliseconds to build the last flashblock early before the end of the slot
199+
/// This serves as a buffer time to account for the last flashblock being delayed
200+
/// at the end of the slot due to processing the final block
201+
#[arg(
202+
long = "flashblocks.end-buffer-ms",
203+
env = "FLASHBLOCK_END_BUFFER_MS",
204+
default_value = "0"
205+
)]
206+
pub flashblocks_end_buffer_ms: u64,
207+
179208
/// Flashblocks p2p configuration
180209
#[command(flatten)]
181210
pub p2p: FlashblocksP2pArgs,

crates/op-rbuilder/src/builders/flashblocks/config.rs

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,21 @@ pub struct FlashblocksConfig {
3737
/// The address of the flashblocks number contract.
3838
///
3939
/// If set a builder tx will be added to the start of every flashblock instead of the regular builder tx.
40-
pub flashblocks_number_contract_address: Option<Address>,
40+
pub number_contract_address: Option<Address>,
4141

4242
/// whether to use permit signatures for the contract calls
43-
pub flashblocks_number_contract_use_permit: bool,
43+
pub number_contract_use_permit: bool,
44+
45+
/// Build flashblock at the end of the flashblock interval
46+
pub build_at_interval_end: bool,
47+
48+
/// Offset in milliseconds for when to send flashblocks.
49+
/// Positive values send late, negative values send early.
50+
pub send_offset_ms: i64,
51+
52+
/// Time in milliseconds to build the last flashblock early before the end of the slot.
53+
/// This serves as a buffer time to account for the last flashblock being delayed.
54+
pub end_buffer_ms: u64,
4455

4556
/// Whether to enable the p2p node for flashblocks
4657
pub p2p_enabled: bool,
@@ -63,11 +74,14 @@ impl Default for FlashblocksConfig {
6374
Self {
6475
ws_addr: SocketAddr::new(Ipv4Addr::UNSPECIFIED.into(), 1111),
6576
interval: Duration::from_millis(250),
66-
leeway_time: Duration::from_millis(50),
77+
leeway_time: Duration::from_millis(0),
6778
fixed: false,
6879
disable_state_root: false,
69-
flashblocks_number_contract_address: None,
70-
flashblocks_number_contract_use_permit: false,
80+
number_contract_address: None,
81+
number_contract_use_permit: false,
82+
build_at_interval_end: false,
83+
send_offset_ms: 0,
84+
end_buffer_ms: 0,
7185
p2p_enabled: false,
7286
p2p_port: 9009,
7387
p2p_private_key_file: None,
@@ -94,20 +108,21 @@ impl TryFrom<OpRbuilderArgs> for FlashblocksConfig {
94108

95109
let disable_state_root = args.flashblocks.flashblocks_disable_state_root;
96110

97-
let flashblocks_number_contract_address =
98-
args.flashblocks.flashblocks_number_contract_address;
111+
let number_contract_address = args.flashblocks.flashblocks_number_contract_address;
99112

100-
let flashblocks_number_contract_use_permit =
101-
args.flashblocks.flashblocks_number_contract_use_permit;
113+
let number_contract_use_permit = args.flashblocks.flashblocks_number_contract_use_permit;
102114

103115
Ok(Self {
104116
ws_addr,
105117
interval,
106118
leeway_time,
107119
fixed,
108120
disable_state_root,
109-
flashblocks_number_contract_address,
110-
flashblocks_number_contract_use_permit,
121+
number_contract_address,
122+
number_contract_use_permit,
123+
build_at_interval_end: args.flashblocks.flashblocks_build_at_interval_end,
124+
send_offset_ms: args.flashblocks.flashblocks_send_offset_ms,
125+
end_buffer_ms: args.flashblocks.flashblocks_end_buffer_ms,
111126
p2p_enabled: args.flashblocks.p2p.p2p_enabled,
112127
p2p_port: args.flashblocks.p2p.p2p_port,
113128
p2p_private_key_file: args.flashblocks.p2p.p2p_private_key_file,

0 commit comments

Comments
 (0)