Skip to content

fix(sequencer): gate standalone fallback prune on build-start deadline#24488

Closed
spalladino wants to merge 1 commit into
merge-train/spartan-v5from
spl/a-1362-sequencer-fallback-can-send-standalone-prune-before-build
Closed

fix(sequencer): gate standalone fallback prune on build-start deadline#24488
spalladino wants to merge 1 commit into
merge-train/spartan-v5from
spl/a-1362-sequencer-fallback-can-send-standalone-prune-before-build

Conversation

@spalladino

Copy link
Copy Markdown
Contributor

Context

The proposer fallback tryVoteAndPruneWhenCannotBuild enqueued a standalone prune whenever it could propose, without checking the build-start deadline. On a transient pre-deadline sync miss (checkSync momentarily failing while the archiver caught up), the fallback fired a standalone prune that raced the imminent build — which bundles the prune inside propose on the happy path — and landed alone on L1, resetting the rollup checkpoint. This surfaced as a flake in proof_fails.parallel.test.ts (the test read checkpoint 0 after the standalone prune landed).

Approach

  • Gate the standalone prune on now > getBuildStartDeadline(targetSlot), so it only fires once building the target-slot checkpoint is genuinely no longer possible. A pre-deadline sync miss is treated as transient: retry and, if sync recovers, build normally (bundling any prune into propose).
  • Keep votes firing regardless of the deadline. Under proposer pipelining the target slot advances with the clock, so gating votes on the deadline can miss the fallback window; the build path already casts votes even when a propose drops, so votes are never lost.
  • Split the single per-slot fallback guard into separate lastSlotForFallbackVote and lastSlotForFallbackPrune guards. Without this, a persistently-stuck proposer — which ticks pre-deadline first every slot — would vote-only, set the shared guard, and be starved of the standalone prune that recovers a wedged pending chain. The prune block also re-reads the clock so a deadline crossed during the vote/publisher awaits still prunes in the same work-loop iteration.
  • Added unit coverage: sync failure before the deadline does not call enqueuePruneIfPrunable; and a pre-deadline vote pass followed by crossing the deadline in the same slot still enqueues the prune.

Fixes A-1362

The proposer fallback `tryVoteAndPruneWhenCannotBuild` enqueued a standalone
`prune` whenever it could propose, without checking the build-start deadline.
On a transient pre-deadline sync miss (`checkSync` momentarily failing while the
archiver caught up) the fallback fired a standalone prune that raced the
imminent build — which bundles the prune inside `propose` on the happy path —
and landed alone on L1, resetting the rollup checkpoint.

Gate the standalone prune on `now > getBuildStartDeadline(targetSlot)` so it
only fires once building the target-slot checkpoint is genuinely no longer
possible. Votes still fire regardless of the deadline (kept from before, since
under pipelining the target advances with the clock and gating votes on the
deadline can miss the fallback window).

Track votes and prune with separate per-slot guards (`lastSlotForFallbackVote`
and `lastSlotForFallbackPrune`) so a pre-deadline vote pass no longer consumes
the slot's later prune opportunity — otherwise a persistently-stuck proposer,
which ticks pre-deadline first every slot, would be starved of the standalone
prune that recovers a wedged pending chain. The prune block re-reads the clock
so a deadline crossed during the vote/publisher awaits still prunes in the same
work-loop iteration.
@spalladino

Copy link
Copy Markdown
Contributor Author

Closing in favor of #24504

@spalladino spalladino closed this Jul 3, 2026
PhilWindle pushed a commit that referenced this pull request Jul 5, 2026
Sequencer defines a set of fallback actions (voting and pruning) which
are meant to be executed if it fails to propose a checkpoint, due to
sync errors.

However, those actions were being triggered as soon as the sequencer
sync check failed, even if in the next sequencer iteration the check
succeeded and the sequencer managed to produce a block.

Now, the sequencer waits until it's past its build deadline (too late
within the build slot to actually build anything), and only then
triggers the fallback actions.

Fixes A-1362
Supersedes #24488
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wip Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant