You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
kona-engine: keep SafeDB history after an outage longer than the sequencing window #24131
After an outage longer than one sequencing window, kona-node's engine reset picks a head above the SafeDB tip, and derivation clears the whole history. op-node keeps the history in the same situation.
Found by the safedb-reviewer pass for #23473 on develop at 7f7abd37fd.
Path
The reset walk-back (rust/kona/crates/node/engine/src/sync/mod.rs:78-101) goes back from the unsafe head and stops at the sequencing window, the finalized head or genesis. It never caps the result at the EL's safe head. op-node does cap it (op-node/rollup/sync/start.go:278).
When the reset head lands above the tip, truncate_safe_db clears the database (rust/kona/crates/node/service/src/actors/derivation/actor/core.rs:432-438).
Examples: a restart with EL sync after more than about 12 hours of downtime on mainnet, or a batcher outage longer than the sequencing window.
Impact
All earlier history becomes unavailable. Queries return not found or l1 at safe head history unavailable, so games over that range can no longer be checked against the SafeDB. Answers are missing, not wrong. Separately, derivation adopts an unsafe head it never derived. That head is not recorded.
Status: the walk-back was checked in code. The scenario is inferred.
Fix
Cap the reset walk-back at the EL's safe head, as op-node does, so the reset head stays at or below the SafeDB tip whenever that tip is still canonical.
The same PR also carries the low-severity findings from the same review (see #23473):
F4: update docs that are out of date. docs/ai/safedb-review.md:30 still describes kona's SafeDB as "crate only; not yet wired", and rust/kona/crates/node/safedb/src/traits.rs:28-31 states a resume rule kona no longer follows.
F5: make RollupNodeBuilder itself refuse a SafeDB together with delegation. Today only the CLI guard (bin/node/src/commands/node/command.rs:333-339) prevents serving a database that nothing writes to.
Acceptance criteria
After an outage longer than the sequencing window, a restart keeps the SafeDB history that is still canonical, matching op-node.
A test covers that scenario and fails without the fix.
The two docs above are updated.
RollupNodeBuilder rejects a SafeDB combined with delegation, with a test.
Activity