Skip to content
This repository was archived by the owner on Jan 12, 2026. It is now read-only.

Commit 0be57a3

Browse files
committed
wip - track builder time for a txn sent to defined wallet
1 parent 4f1931b commit 0be57a3

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ pub struct OpRbuilderArgs {
5656
pub telemetry: TelemetryArgs,
5757
#[command(flatten)]
5858
pub flashtestations: FlashtestationsArgs,
59+
60+
/// The address to watch for in the block
61+
#[arg(long = "builder.dev-address", env = "DEV_ADDRESS")]
62+
pub dev_address: Option<String>,
5963
}
6064

6165
impl Default for OpRbuilderArgs {

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,30 @@ where
501501
.total_block_built_duration
502502
.record(total_block_built_duration.elapsed());
503503

504+
// builderTime is the time it takes for a transaction from the tx pool to be included into a block
505+
// builderTime = bestTxTime + txSimulationTime + blockBuildTime
506+
// we can use the elapsed `flashblock_build_start_time` to calculate the builderTime then
507+
if let Some(dev_wallet) = &self.config.dev_address {
508+
let dev_wallet = dev_wallet.parse::<Address>().unwrap();
509+
info!(target: "payload_builder", "dev_wallet: {:?}", dev_wallet);
510+
511+
// `info` is the executed sequencer transactions
512+
for (i, executed_sender) in info.executed_senders.iter().enumerate() {
513+
if *executed_sender == dev_wallet
514+
&& i < info.executed_transactions.len()
515+
{
516+
let executed_tx = &info.executed_transactions[i];
517+
info!(
518+
target: "payload_builder",
519+
tx_hash = ?executed_tx.tx_hash(),
520+
sender = ?executed_sender,
521+
total_builder_time_ms = ?flashblock_build_start_time.elapsed().as_millis(),
522+
"Dev wallet transaction builder time"
523+
);
524+
}
525+
}
526+
}
527+
504528
// Handle build errors with match pattern
505529
match build_result {
506530
Err(err) => {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ pub struct BuilderConfig<Specific: Clone> {
110110
/// Inverted sampling frequency in blocks. 1 - each block, 100 - every 100th block.
111111
pub sampling_ratio: u64,
112112

113+
/// The address to watch for in the block
114+
pub dev_address: Option<String>,
115+
113116
/// Configuration values that are specific to the block builder implementation used.
114117
pub specific: Specific,
115118
}
@@ -145,6 +148,7 @@ impl<S: Default + Clone> Default for BuilderConfig<S> {
145148
da_config: OpDAConfig::default(),
146149
specific: S::default(),
147150
sampling_ratio: 100,
151+
dev_address: None,
148152
}
149153
}
150154
}
@@ -164,6 +168,7 @@ where
164168
block_time_leeway: Duration::from_secs(args.extra_block_deadline_secs),
165169
da_config: Default::default(),
166170
sampling_ratio: args.telemetry.sampling_ratio,
171+
dev_address: args.dev_address.clone(),
167172
specific: S::try_from(args)?,
168173
})
169174
}

0 commit comments

Comments
 (0)