Repository navigation
Description
Part of ethereum-optimism/protocol-team#442 (long-term Kona improvements). Follow-up to merged #23583 and closed #23474; reference behavior: #21111.
Timing
Do not pursue this work before the EoY milestone is complete. This is a long-term improvement, not a requirement for the EoY SafeDB delivery.
Problem
After EL-sync completion, Kona currently clears SafeDB history when the engine resumes above the persisted database tip. This prevents a silent gap, but discards valid historical records instead of resuming derivation from a canonical recorded head. #23590 explicitly leaves this recovery behavior out of scope.
Scope
- At EL-sync completion, validate the recorded SafeDB tip against the synced canonical chain. Preserve history and resume derivation from that tip when it is canonical, including when it is older than the EL safe head.
- If the tip is no longer canonical, recover from a canonical recorded head and truncate inconsistent later history where possible; clear history only when no trustworthy recovery point exists. Use fix(op-node): preserve safedb across EL-sync restarts #21111 as the reference for recovery semantics.
- Keep safe/finalized head selection consistent with the recovery point. Do not advance finalization beyond genuinely finalized or successfully persisted history.
- Preserve the no-database and empty-database fallback, and propagate persistence/read errors explicitly under the existing fail-fast policy.
Acceptance criteria
- A canonical persisted tip older than the EL safe head is preserved and becomes the derivation resume point; subsequent writes leave no history gap.
- Reorged history is truncated to a trustworthy canonical recorded head, or cleared if no such head exists.
- Recovery below the previous finalized head does not incorrectly advance finality or expose inconsistent forkchoice labels.
- Disabled/empty SafeDB behavior remains supported, and database failures are handled explicitly.
- The EL-resync scenario in kona-node,safedb,op-acceptance-tests: verify parity with op-node #23585 passes and its deferred coverage is enabled once the devstack can wipe an EL data directory between stop/start. Track any missing harness primitive explicitly rather than treating a restart as an EL resync.
Testing plan
Use unit tests at the EL-sync recovery boundary with injected SafeDb and canonical-chain lookup dependencies. Table-test canonical tip, tip older than finalized, reorged tip with a recoverable recorded head, unrecoverable history, disabled/empty database, and database/lookup failures. Assert the selected resume head, preserved/truncated/cleared records, finality bounds, and explicit error propagation. Add the real EL-resync acceptance case through #23585 to verify contiguous history after recovery.
Related work
#23659 records explicit L2 intervals and permits multiple rows per L1 block so missing coverage can be detected and represented safely. This issue prevents or repairs gaps by resuming derivation from recorded canonical history; interval recording does not reconstruct missing records. Related current integration: #23473.
Status — 2026-10-29
The current integration passed its 24-hour persistence soak and #23479 is closed. Final evidence. The soak retained the EL and PVC; it did not wipe EL data or validate canonical-tip recovery after true EL resync. This issue remains open as deferred long-term work under ethereum-optimism/protocol-team#442; none of its implementation checkboxes are completed by the soak.
Activity
[-]fix(kona-node): resume derivation from the canonical SafeDB tip after EL sync[/-][+]kona-safedb,gap-detection: resume derivation from the canonical SafeDB tip after EL sync[/+][-]kona-safedb,gap-detection: resume derivation from the canonical SafeDB tip after EL sync[/-][+]kona-node,safedb,gap-detection: resume derivation from the canonical SafeDB tip after EL sync[/+]sebastianst commentedon Nov 13, 2026
🤖 Fable 5.2 says: The harness primitive that the last acceptance criterion waits for exists since #23827:
L2ELNode.Wipe()deletes a stopped EL's chain data, so the next start is a real EL resync and not a restart. For op-reth it removes the datadir (OpReth.Wipe).TestTruncateDatabaseOnELResyncalready uses it and runs in the op-reth acceptance jobs, so the EL-resync case for this issue can be written against it. Nothing in the harness blocks that part any more.kona-engine,kona-node!: place safe and finalized behind the tip after…
kona-engine,kona-node!: place safe and finalized behind the tip after…