-
Notifications
You must be signed in to change notification settings - Fork 3.8k
op-node: Light CL: Follow Source #18365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pcw109550
wants to merge
28
commits into
pcw109550/light-cl-unsafe-only
Choose a base branch
from
pcw109550/light-cl-follow-source
base: pcw109550/light-cl-unsafe-only
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
op-node: Light CL: Follow Source #18365
pcw109550
wants to merge
28
commits into
pcw109550/light-cl-unsafe-only
from
pcw109550/light-cl-follow-source
+873
−23
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
10f056f to
59214ce
Compare
54fbe8d to
12835bb
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new upstream sync loop (Driver → Engine Controller) that (1) detects L1 reorgs in unsafe-only mode and resets the node appropriately, and (2) optionally mirrors external L2 safe/finalized state when
--l2.follow.sourceis enabled. It replaces the derivation-pipeline-based reorg logic for unsafe-only nodes and ensures L2 always tracks L1 and external safe/finalized sources correctly.This PR builds on #18290 and implements two features:
Task A – Follow an external L2 source for safe and finalized blocks
Enabled with
--l2.follow.source(requires--l2.unsafe-only).Task B – Trigger an L2 reset when an L1 reorg occurs
Enabled with
--l2.unsafe-only.Note:
--l2.follow.sourcecan only be used when--l2.unsafe-onlyis enabled.A new control-flow path is added:
DriverchangesWe need a periodical ticker that is responsible to perform upper two tasks. Similar to the
altSyncTickerwhich periodically tries to close the unsafe gap, I added theupstreamSyncTickerto do perform tasks. op-node/rollup/driver/driver.go.upstreamSyncTickeris only enabled when--l2.unsafe-onlyis enabled.The ticker calls
followUpstream()method periodically. The method implements Task B and calls Engine Controller to do Task A, by below stepsoptimism/op-node/rollup/derive/pipeline.go
Line 221 in ef97055
CurrentL1view inside the CL. This means we cannot perform the same L1 reorg check.--l2.follow.sourceis enabled thefollowUpstream()fetches external L2 info (esafe,efinalized) and tries to apply to the Engine Controller by callings.SyncDeriver.Engine.FollowSource(eSafe, eFinalized)Engine ControllerChangesFollowSource(eSafe, eFinalized)is implemented at Engine Controller, implementing Task A. Engine Controller has the responsibility to update its internal state based on the injected external state. The Engine Controller performs mirroring by below steps:Tests
Four tests are added for testing the
--l2.follow.source:TestFollowL2_ReorgRecovery: checks follow source seq / ver reorgs when L1 reorgsTestFollowL2_SafeAndFinalized: happy case, external safe and finalized is mirrored when local unsafe head is ahead of external safe and finalizedTestFollowL2_WithoutCLP2P: CLP2P down, so the data source of safe / finalized is only the follow source. Unsafe and safe will advance together.TestSyncTesterFollowL2ReachTips: Using the sync tester, test that the op-node can mirror safe / finalized of op-sepolia.One test was added to test the
--l2.unsafe-only:TestUnsafeOnly_ReorgRecovery: checks unsafe only seq / ver reorgs when L1 reorgsAdditional context
Before this PR, when
--l2.unsafe-onlyis enabled, the node did not L2 reorg when L1 reorg. We now always track the L1 reorg by the newly addedupstreamSyncTickerand do a proper L2 reorg via reset.Metadata