Skip to content

kona-engine,kona-node-service: keep a stale delegated safe head from moving safe below finality - #24004

Merged
geoknee merged 1 commit into
einar/23912-delegated-parity-verificationfrom
einar/23910-delegated-stale-safe
Nov 19, 2026
Merged

geoknee merged 1 commit into
einar/23912-delegated-parity-verificationfrom
einar/23910-delegated-stale-safe

Conversation

@einar-oplabs

@einar-oplabs einar-oplabs commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Why

A stale delegate snapshot can report a safe head below kona-node's finalized head, and kona-node applies it, moving safe behind its own finality.

What

  • The delegate actor drops a status whose labels are out of order (a zero local-safe head counts as unreported) or that breaks the engine's applied finality; the engine skips a delegated safe head below, or conflicting with, established finality.
  • A delegated safe head below safe is ignored unless an EL that applied the last forkchoice holds a different block at that height, which proves divergence and reorgs above finality; labels left with unsafe below safe are repaired.
  • A rejected delegated forkchoice update still resets the engine as on develop; recovery is kona-engine,kona-node-service: recover when the EL rejects a delegated forkchoice update #24065.

Breakdown

Added Removed Net
Implementation 303 117 186
Tests 529 11 518
Docs 0 0 0

Closes

Part of ethereum-optimism/protocol-team#545. Stack, in merge order: #23900 → #23899 → #23908 → #23947 → #24004 → #24005 → #24007 → #24065.

  1. Closes: kona-node: validate a stale delegated snapshot whose safe head is below local finalized #23910

AI Reviews

  • 2026-11-10T14:13:12Z c1116cd Fable 5.1 xhigh
  • 2026-11-11T13:18:58Z bcbc62d Fable 5.1 xhigh
  • 2026-11-11T14:27:15Z e6966dc Fable 5.1 xhigh
  • 2026-11-11T16:35:47Z 50000d6 Fable 5.1 xhigh

BREAKING CHANGE: ConsolidateTaskError gains BreaksFinality and FailedToFetchDelegatedSafeBlock; FinalizeTaskError::{BehindFinalizedHead, ConflictsWithFinalizedHead} become BreaksFinality(FinalityViolation); FinalityViolation is exported; EngineState gains el_applied_last_forkchoice.

🤖 Generated with Claude Code

@joshklop joshklop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went through this in depth: read the code across the stack, ran the tests and clippy, and mutation-tested the new logic. The finality fix itself holds. I couldn't find a path that moves safe below finalized, and the below/at/conflicting cases are well covered. Most of my concerns are with the code around the fix: the resend memo, the label-order check, the warning dedup and the new forkchoice flag. Dropping some of that would also fix the liveness issues I've noted inline.

Test gaps from mutation testing (all 475 tests in kona-engine and kona-node-service pass on the head):

  • Deleting either assignment of el_applied_last_forkchoice in synchronize still passes (see inline).
  • Making lagging_safe_head_to_remember ignore is_consistent still passes, because every actor test has unsafe ≥ safe. Could you add an unsafe < safe case?
  • Untested: a reset between the send and the task running, FailedToFetchDelegatedSafeBlock, an FCU RPC failure after the EL applied the reorg, and last_rejection warn/debug.

Scope: the FinalizeTaskError variant merge, the L1-lookup dedup in validate_sync_status, and the initial_safe_head test-helper rename aren't needed for the fix. Could they go in a separate PR? Also, engine_l2_safe_head in the delegated actor is written but never read.

…moving safe below finality

A stale delegate snapshot can report a safe head below kona-node's
finalized head, and kona-node applies it, moving safe behind its own
finality.

Kona-node now drops a delegate status whose labels are out of order (a
zero local-safe head counts as unreported) or that breaks the engine's
applied finality, and the engine skips a delegated safe head below, or
conflicting with, established finality. A delegated safe head below safe
is ignored, and forwarded only once per engine view, unless an EL that
applied the last forkchoice holds a different block at that height,
which proves divergence and reorgs the engine above finality. Labels
left with unsafe below safe are repaired by the next delegated head
above finality. Repeated rejection warnings are deduplicated. A rejected
delegated forkchoice update resets the engine as on develop; recovery is
#24065 (#24061). Known window: after a delegate L1 reorg whose fork
point is above its new safe head, safe stays on the old fork until the
delegate passes it.

Closes #23910.

BREAKING CHANGE: `ConsolidateTaskError` gains `BreaksFinality` and
`FailedToFetchDelegatedSafeBlock`;
`FinalizeTaskError::{BehindFinalizedHead, ConflictsWithFinalizedHead}`
become `BreaksFinality(FinalityViolation)`; `FinalityViolation` is
exported; `EngineState` gains `el_applied_last_forkchoice`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joshklop
joshklop force-pushed the einar/23910-delegated-stale-safe branch from 499e320 to 7bdee17 Compare November 19, 2026 00:54

@joshklop joshklop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Claude, for @joshklop: Review of 7bdee17022, which is this PR rebased onto #23947's head; the rebase only changes API calls. The finality fix holds. I found no path that moves safe or finalized below finality or onto a conflicting block, because the engine re-checks the delegated head against finality when the task runs, and synchronize only changes labels after the EL accepts the update. My earlier comments still apply. New points are below, plus two test gaps: nothing exercises FailedToFetchDelegatedSafeBlock, and nothing covers el_applied_last_forkchoice being set or cleared in synchronize/helper.rs.

@joshklop
joshklop self-requested a review November 19, 2026 01:15
@joshklop

Copy link
Copy Markdown
Contributor

@op-centaur re-approve

@otto-op-centaur

Copy link
Copy Markdown

otto-op-centaur[bot] did not re-approve this pull request: there is no dismissed approval from an eligible human reviewer.

@joshklop
joshklop removed this pull request from stack #24203 November 19, 2026 02:00
@joshklop
joshklop added this pull request to stack #24271 November 19, 2026 02:00
@geoknee
geoknee added this pull request to the merge queue Nov 19, 2026
Merged via the queue into develop with commit 551c14c Nov 19, 2026
189 of 192 checks passed
@geoknee
geoknee deleted the einar/23910-delegated-stale-safe branch November 19, 2026 09:27
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.

kona-node: validate a stale delegated snapshot whose safe head is below local finalized

3 participants