Skip to content

fix(consensus): size sequencer catch-up buffer for fast block times (v1.5.4 backport) - #6321

Merged
niran merged 3 commits into
releases/v1.5.4from
backport/catchup-buffer-v1.5.2
Nov 5, 2026
Merged

niran merged 3 commits into
releases/v1.5.4from
backport/catchup-buffer-v1.5.2

Conversation

@niran

@niran niran commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Backport of #6320 to releases/v1.5.4, based on v1.5.3. The fix was first hand-ported in #6321.

Followers that restart under fast block times can fall outside the sequencer catch-up buffer and never finish catching up. The catch-up buffer and the regular-state external gossip gap both reused the shadow reconciliation cycle limit of 300 blocks: ten minutes at two-second blocks, one minute at 200 ms blocks. Derivation latency leaves a restarted follower's safe head more than 300 blocks behind the newest gossip, so the buffered suffix never connects.

Changes

  • Give the catch-up buffer its own capacity: a ten-minute window divided by the block interval, computed once from the rollup config (3,000 payloads at 200 ms, 300 at two-second blocks, at least one). The shadow cycle limit stays at 300.
  • Use the same capacity for the regular-state external gossip gap. It stays scaled to the block cadence, because keeping 300 blocks would be a liveness regression on fast-block chains.
  • Apply buffered catch-up payloads in batches of at most 300, cloning only the current batch, so the engine loop serves queued requests between batches. A failed batch resumes after the payloads the engine already applied.

Hand-port notes

The release-branch coordinator differs from main by about 650 lines, so the change was ported by hand rather than cherry-picked from main. The release branch's own structure is kept intact: it has no isolated-sequencer EL sync path, and it keeps its ConsolidateInput API. Only the sizing, the gap, and the batching were ported. The release buffer_payload trims both the payload and observation maps in one function, and the tests use a locally built L1-info deposit transaction in gossip payloads.

In a local validation branch, all three hand-port commits applied cleanly onto the v1.5.3 tag with no conflicts. The backport does not include a version bump.

Test plan

On the local v1.5.3-based backport:

  • cargo +nightly fmt --check: passed.
  • cargo test --locked -p base-consensus-node catchup -- --nocapture --test-threads=4: 30 passed.
  • cargo test --locked -p base-consensus-node -- --test-threads=4: 380 unit and 10 integration tests passed; one doctest ignored.
  • cargo test --locked -p base-consensus-engine -- --test-threads=4: 142 unit tests and one doctest passed; two doctests ignored.
  • cargo test --locked -p base-action-harness --test shadow_sequencer -- --test-threads=4: one action test passed.
  • Before the fix, the 301- and 2,999-block gossip gap tests failed, as did the 314-block catch-up test. The 3,001-block rejection was a passing negative control. All passed with the fix.
  • The original hand-port reported cargo clippy -p base-consensus-node --all-targets -- -D warnings clean; independent reviews of the main PR reported 419 library tests passing there. Clippy on the local v1.5.3-based backport was interrupted and remains to be run.
  • The full suite covers capacity per block time, bounded batches across the full window, and resuming after an applied prefix. Known P3 follow-up: actor-level coverage for the batching continuation, where the loop continues to the next batch without new traffic.

After merge

  • A successful merge triggers the next release candidate, currently expected to be v1.5.4-rc.2, and an independent artifact build.
  • Verify the release candidate using the release process before rollout.

type=emergency
risk=medium
impact=sev3

@depot-code-access

depot-code-access Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

✅ All benchmarks green — 14 within ±2% (deterministic instruction counts). View run

Benchmark details (14)
Benchmark Base (target) Head (this PR) Δ instructions
batch_queue/drain/drain_cached_span_batches 242,027 242,027 +0.0%
batch_transaction/encode_in_place/encode_in_place 4,199,759 4,199,759 +0.0%
batch_transaction/temporary_frame_buffers/temporary_frame_buffers 8,408,350 8,408,350 +0.0%
flashblock_decode/decode/brotli 3,296,484 3,296,484 +0.0%
flashblock_decode/decode/plain_json 2,280,194 2,280,194 +0.0%
flz/compress_len/real_contract_call 43,148 43,148 +0.0%
flz/compress_len/synthetic_0 38,205 38,205 +0.0%
flz/compress_len/synthetic_1 54,682 54,682 +0.0%
flz/compress_len/synthetic_2 147,976 147,976 +0.0%
flz/data_gas 43,059 43,059 +0.0%
flz/tx_estimated_size 43,056 43,056 +0.0%
frame_parse/decode/single_4kib 1,031 1,031 +0.0%
frame_parse/parse_frames/few_large 1,053,062 1,053,062 +0.0%
frame_parse/parse_frames/many_small 154,763 154,763 +0.0%

@depot-code-access

depot-code-access Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Acceptance Tests: ✅ Passed

3/3 checks passed · Checks & reports

Acceptance report
  • smoke / chain-identity — passed: chain identity matched
    • Expected: 84538453
    • Observed: 84538453
  • smoke / production — passed: head advanced
    • Expected: {"minimum_blocks":3}
    • Observed: {"delta":3,"from":13,"last":16,"required_delta":3}
  • smoke / validator-converges — passed: heads converged on a common canonical block
    • Expected: {"common_height_hash":true,"max_lag_blocks":5}
    • Observed: {"common_height":16,"hash":"0x1f996d0515ab41834997820301263b797cad4cc5e43afc345b92b0945e6f0b27","high":16,"lag":0,"low":16,"low_timestamp":1793380453,"maximum_lag":5,"minimum_timestamp":0}

@niran
niran marked this pull request as ready for review October 30, 2026 19:42
@github-actions

Copy link
Copy Markdown
Contributor

Review summary: No actionable findings.

The changes are well-scoped and correct:

  • Buffer sizing: max_payloads_for correctly computes a 10-minute window divided by block interval, with the block_time == 0 and Denim-scheduled cases handled, and .max(1) preventing a zero-capacity buffer. The Default impl (3,000) is only used in tests; production paths all go through new(catchup_capacity).
  • Batched application: The more_pending heuristic (len == MAX_APPLY_BATCH) is standard and the extra no-op iteration when the suffix is exactly 300 is harmless. The try_recv before continue prevents starvation of other request types during long catch-up runs.
  • Error-path correctness: On partial failure in insert_authoritative_payloads, the commit is skipped but the engine's published state already reflects applied payloads, so the next advance_canonical_catchup reads the updated unsafe head as anchor and correctly resumes from the right position.
  • Gossip gap widening: catchup_capacity as u64 is safe (max value 3,000), and admitted payloads are immediately enqueued to the engine rather than buffered, so this does not create an unbounded collection.
  • Block-production sensitivity: This PR touches the follower/shadow catch-up path, not the builder or payload-assembly path. The changes improve liveness for restarted followers under fast block times and cannot introduce new halt/stall triggers — the batching adds bounded yielding, and the widened window prevents the prior liveness regression.

Test coverage is thorough: the new tests validate capacity per block time, beyond-legacy-gap connectivity, bounded batching of the full window, retry after partial failure, and regular-state gossip gap admission/rejection at boundary values.

meyer9
meyer9 previously approved these changes Nov 2, 2026
@niran niran changed the title fix(consensus): size sequencer catch-up buffer for fast block times (v1.5.2 backport) fix(consensus): size sequencer catch-up buffer for fast block times (v1.5.4 backport) Nov 5, 2026
@niran
niran changed the base branch from releases/v1.5.2 to releases/v1.5.4 November 5, 2026 19:11
@niran
niran dismissed meyer9’s stale review November 5, 2026 19:11

The base branch was changed.

@niran
niran merged commit 29fc953 into releases/v1.5.4 Nov 5, 2026
35 checks passed
@niran
niran deleted the backport/catchup-buffer-v1.5.2 branch November 5, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants