Skip to content

Commit 4c05ff8

Browse files
committed
feat: continuous flashblock building
1 parent 440183b commit 4c05ff8

File tree

6 files changed

+353
-72
lines changed

6 files changed

+353
-72
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,14 @@ pub struct FlashblocksArgs {
157157
)]
158158
pub flashblocks_calculate_state_root: bool,
159159

160+
/// Should we calculate state root for each flashblock
161+
#[arg(
162+
long = "flashblocks.enable-continuous-building",
163+
default_value = "true",
164+
env = "FLASHBLOCKS_ENABLE_CONTINUOUS_BUILDING"
165+
)]
166+
pub flashblocks_enable_continuous_building: bool,
167+
160168
/// Flashblocks number contract address
161169
///
162170
/// This is the address of the contract that will be used to increment the flashblock number.

crates/op-rbuilder/src/builders/context.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use alloy_consensus::transaction::TxHashRef;
12
use alloy_consensus::{Eip658Value, Transaction, conditional::BlockConditionalAttributes};
23
use alloy_eips::Typed2718;
34
use alloy_evm::Database;
@@ -326,10 +327,11 @@ impl<ExtraCtx: Debug + Default> OpPayloadBuilderCtx<ExtraCtx> {
326327
Ok(info)
327328
}
328329

329-
/// Executes the given best transactions and updates the execution info.
330+
/// Simulates the given best transactions.
331+
/// The simulation updates the execution info and commit changes to the db
330332
///
331333
/// Returns `Ok(Some(())` if the job was cancelled.
332-
pub(super) fn execute_best_transactions<E: Debug + Default>(
334+
pub(super) fn simulate_best_transactions<E: Debug + Default>(
333335
&self,
334336
info: &mut ExecutionInfo<E>,
335337
db: &mut State<impl Database>,

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ pub struct FlashblocksConfig {
3434
/// Should we calculate state root for each flashblock
3535
pub calculate_state_root: bool,
3636

37+
/// Whether to enable continuous flashblock building or not
38+
pub enable_continuous_building: bool,
39+
3740
/// The address of the flashblocks number contract.
3841
///
3942
/// If set a builder tx will be added to the start of every flashblock instead of the regular builder tx.
@@ -63,6 +66,7 @@ impl Default for FlashblocksConfig {
6366
leeway_time: Duration::from_millis(50),
6467
fixed: false,
6568
calculate_state_root: true,
69+
enable_continuous_building: true,
6670
flashblocks_number_contract_address: None,
6771
p2p_enabled: false,
6872
p2p_port: 9009,
@@ -90,6 +94,8 @@ impl TryFrom<OpRbuilderArgs> for FlashblocksConfig {
9094

9195
let calculate_state_root = args.flashblocks.flashblocks_calculate_state_root;
9296

97+
let enable_continuous_building = args.flashblocks.flashblocks_enable_continuous_building;
98+
9399
let flashblocks_number_contract_address =
94100
args.flashblocks.flashblocks_number_contract_address;
95101

@@ -99,6 +105,7 @@ impl TryFrom<OpRbuilderArgs> for FlashblocksConfig {
99105
leeway_time,
100106
fixed,
101107
calculate_state_root,
108+
enable_continuous_building,
102109
flashblocks_number_contract_address,
103110
p2p_enabled: args.flashblocks.p2p.p2p_enabled,
104111
p2p_port: args.flashblocks.p2p.p2p_port,

0 commit comments

Comments
 (0)