ethereum-optimism / optimism

Optimism is Ethereum, scaled.
https://optimism.io
MIT License
5.56k stars 3.21k forks source link

op-node: improve safe <> derived-from sync status coupling #11014

Open protolambda opened 3 months ago

protolambda commented 3 months ago

Currently the coupling is implied by CurrentL1 (last derived data) and SafeL2 (last L2 safe head). But since the safe-block just reflects the engine, which is not atomically coupled to the derivation, this can be inaccurate data.

Instead, we can add a DerivedSafe and DerivedFrom attribute to the SyncStatus (or to a separately managed attribute, to not make SyncStatus larger than it already is) for the latest derived safe-block. This data is strictly coupled, and emitted whenever the safe-block changes, with engine.SafeDerivedEvent. We can then update the op-challenger to use this more accurate information.