Skip to content

kona-engine: consolidate safe attributes only on top of the local-safe head #24130

Open

Description

@einar-oplabs

Summary

kona-node's engine can apply safe attributes after an engine reset even though they were derived before it. It does this even when they do not build on the current local-safe head. Local-safe then jumps past blocks that derivation never confirmed, the SafeDB never records them, and later answers for that range are wrong.

Found by the safedb-reviewer pass for #23473 on develop at 7f7abd37fd.

Path

  1. EngineActorRequest::ProcessSafeL2Signal queues a ConsolidateTask without any check (rust/kona/crates/node/service/src/actors/engine/actor.rs:328-336).
  2. begin_reset clears the task queue only when no reset is already pending (actor.rs:116-123). Safe signals that arrive while the reset is pending stay queued.
  3. Consolidation compares the attributes with the canonical block at that height (rust/kona/crates/node/engine/src/attributes.rs:299), not with the current local-safe head.
  4. After a reset to R < P, attributes for P+1 (parent P) still consolidate, and local-safe jumps from R to P+1. Derivation is waiting on the attributes for R+1. Its match check fails, so it records nothing (rust/kona/crates/node/service/src/actors/derivation/actor/core.rs:402-409), but it still adopts P+1.

op-node drops attributes whose parent is not the pending-safe head, and resets on a parent conflict (op-node/rollup/attributes/attributes.go:155-182).

Impact

Blocks R+1..P+1 are never recorded:

  • superroot_atTimestamp reports a later required L1 for those blocks, so op-challenger's super trace provider treats the claim as an invalid transition.
  • optimism_safeHeadAtL1Block over that L1 range returns R, which is too low, and the output trace clamps there.

Local-safe also advances over blocks that derivation did not confirm. That is a derivation-level concern beyond the SafeDB.

Status: every step was checked in code. The cross-actor ordering has not been reproduced.

Fix

  • In the kona engine, consolidate attributes only when attributes.parent is the local-safe head, and handle a parent conflict as op-node does.
  • Consider dropping safe signals that arrive while a reset is pending.

Acceptance criteria

  • Attributes derived before a reset cannot advance local-safe past an unconfirmed range.
  • A regression test delivers attributes derived before a reset after it, and asserts SafeDB history below the tip, including l1_at_safe_head inside the affected range. It fails without the fix.
  • A safedb-reviewer re-run on the change reports I2 and I3 holding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions