Skip to content

fix: don't miss blocks on batcher updates #529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 2, 2025
Merged
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
11 changes: 10 additions & 1 deletion crates/op-rbuilder/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,16 @@ where
// Adding 0.5 seconds as wiggle room since block times are shorter here.
// TODO: A better long-term solution would be to implement cancellation logic
// that cancels existing jobs when receiving new block building requests.
let deadline = job_deadline(attributes.timestamp()) + Duration::from_millis(500);
//
// When batcher's max channel duration is big enough (e.g. 10m), the
// sequencer would send an avalanche of FCUs/getBlockByNumber on
// each batcher update (with 10m channel it's ~800 FCUs at once).
// At such moment it can happen that the time b/w FCU and ensuing
// getPayload would be on the scale of ~2.5s. Therefore we should
// "remember" the payloads long enough to accommodate this corner-case
// (without it we are losing blocks). Postponing the deadline for 5s
// (not just 0.5s) because of that.
let deadline = job_deadline(attributes.timestamp()) + Duration::from_millis(5000);

let deadline = Box::pin(tokio::time::sleep(deadline));
let config = PayloadConfig::new(Arc::new(parent_header.clone()), attributes);
Expand Down
Loading