op-node: Recovery reset seeds the cross-safe cache with the unsafe head
Claude: filed by Claude (AI assistant) from a review of ethereum-optimism/optimism#22982, on behalf of @ajsutton.
Summary
EngineController.forceReset seeds the cross-safe cache with whatever sync.FindL2Heads returns as Safe, without any check against the SuperAuthority. On two recovery paths FindL2Heads returns the unsafe head as Safe. On an interop chain the cache then holds a block that cross-chain verification never covered, and crossSafeFallback can publish it as the safe label.
This is not the ethereum-optimism/optimism#22845 path. On an ordinary L1 reorg, FindL2Heads walks strictly below the previous safe label, so the seeded value is a previously verified ancestor and ethereum-optimism/optimism#22982 is a complete fix there. Only the two recovery branches produce an unverified value.
Trace
Line numbers are on develop at ad1c8e12f43c7e9158bb5da127b0153c3e28d4ad.
- The two recovery branches return
Safe = Unsafe, becauseOffsetELSafeis forced to 0 outside EL sync (op-node/service.go#L363-L366):- EL finished syncing but left safe and finalized at genesis —
start.go#L171-L177 - EL was rewound behind its own forkchoice —
start.go#L181-L185 - both call
L2HeadsForELSyncWithOffset, which returns{Unsafe: tip, Safe: derived, Finalized: derived}withderived == tipwhen the offset is 0.
- EL finished syncing but left safe and finalized at genesis —
onResetEngineRequestpasses that value as bothlocalSafeandcrossSafe:engine_controller.go#L1432.forceResetstores it in the cross-safe cache with no authority check:engine_controller.go#L1265.crossSafeCache.Getvalidates only<= localSafeHeadand EL canonicality (cross_safe_cache.go#L33-L57), both of which the seeded value satisfies, because the reset also setlocalSafeHeadto it.crossSafeFallbacktherefore returns it whenever the verified head is ahead of local-safe (engine_controller.go#L296-L304), andSafeL2Head()reaches the EL asfc.SafeBlockHash, where op-geth appliesSetSafe.
The reset path is reachable with a SuperAuthority registered: SyncDeriver.onResetEvent emits ResetEngineRequestEvent unconditionally (sync_deriver.go#L225-L230) and SyncDeriver is registered regardless of superAuthority (driver.go#L90-L105). The comment "This event is not used in interop" at engine_controller.go#L40-L44 is not enforced by code.
Spec rule
The initiating messages for all dependent executing messages MUST be resolved as safe before an L2 block can transition from being unsafe to safe.
interop/verifier.html#safety, specs 344a78a2812f0775027492250dee35358fd76dfa.
Impact
Low likelihood, safety consequence. Both triggers need a damaged or unusual execution client state (sync completed without finality, or an EL rewound behind its forkchoice). Not a regression: before ethereum-optimism/optimism#22982 the same branch returned localSafeHead, which is the same block.
Suggested fix
Gate the cache seed in forceReset on the SuperAuthority: when one is registered, seed only a block at or below FullyVerifiedL2Head, otherwise leave the cache empty so the fallback floors at finalized. A narrower alternative is to reject the recovery branches for interop chains instead of returning the unsafe head as safe.
Source: ethereum-optimism/optimism