Skip to content

Commit ae738da

Browse files
committed
fix: don't miss blocks on batcher updates
1 parent c0f1007 commit ae738da

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

crates/op-rbuilder/src/generator.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,18 @@ where
255255
// Adding 0.5 seconds as wiggle room since block times are shorter here.
256256
// TODO: A better long-term solution would be to implement cancellation logic
257257
// that cancels existing jobs when receiving new block building requests.
258+
//
259+
// When batcher's max channel duration is big enough (e.g. 10m), the
260+
// sequencer would send an avalanche of FCUs/getBlockByNumber on
261+
// each batcher update (with 10m channel it's ~800 FCUs at once).
262+
// At such moment it can happen that the time b/w FCU and ensuing
263+
// getPayload would be on the scale of ~2.5s. Therefore we should
264+
// "remember" the payloads long enough to accommodate this corner-case
265+
// (without it we are losing blocks). Postponing the deadline for 5s
266+
// (not just 0.5s) because of that.
258267
let config = PayloadConfig::new(Arc::new(parent_header.clone()), attributes);
259268

260-
let until = job_deadline(config.attributes.timestamp()) + Duration::from_millis(500);
269+
let until = job_deadline(config.attributes.timestamp()) + Duration::from_millis(5000);
261270
let deadline = Box::pin(tokio::time::sleep_until(until));
262271

263272
let cached_reads = self.maybe_pre_cached(parent_header.hash());

0 commit comments

Comments
 (0)