forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 9
Initialize L1 Safe and Finalized head in SyncStatus at OpNode startup #367
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
Merged
Kourin1996
merged 13 commits into
celo-rebase-12
from
Kourin1996/fix-finalized-flag-issue
Mar 21, 2025
+32
−4
Merged
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
29049db
Set L1 safe and finalized head at startup of op-node
Kourin1996 9d0a3b5
Wrap initialization of L1 safe & finalized head in SyncStatus with if…
Kourin1996 fd98455
Fix comment
Kourin1996 909fc4d
Fix commen
Kourin1996 a67b446
Fix comment
Kourin1996 69b30ff
Fix codes based on feedback
Kourin1996 8a102a7
Fix comment
Kourin1996 ad0fc8e
Swap the order of fetching finalized and safe L1 block references
Kourin1996 af9ba0b
Merge branch 'celo-rebase-12' into Kourin1996/fix-finalized-flag-issue
Kourin1996 9f73455
Move L1 safe and finalized head fetching to the beginning of OpNode::…
Kourin1996 e639d04
Merge remote-tracking branch 'origin/Kourin1996/fix-finalized-flag-is…
Kourin1996 eae139b
Remove unnecessary empty line
Kourin1996 ce628b7
Add log in finalized
Kourin1996 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -568,6 +568,33 @@ func (n *OpNode) Start(ctx context.Context) error { | |
| return err | ||
| } | ||
| log.Info("Rollup node started") | ||
|
|
||
| // If n.cfg.Driver.SequencerUseFinalized is true, sequencer cannot retrieve non-finalized L1 blocks. | ||
| // OpNode periodically fetches the latest safe and finalized L1 blocks every epoch (13 minutes), | ||
|
||
| // but immediately after startup, these values are not yet available. | ||
| // In some cases, this can cause the sequencer to get stuck because sequencer fails to retrieve next L1 block | ||
| // To prevent this, fetch and initialize the latest safe and finalized L1 block references at startup | ||
| if n.cfg.Driver.SequencerUseFinalized { | ||
| reqCtx, reqCancel := context.WithTimeout(ctx, time.Second*20) | ||
| defer reqCancel() | ||
|
|
||
| safeRef, err := n.l1Source.L1BlockRefByLabel(reqCtx, eth.Safe) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to fetch L1 safe head: %w", err) | ||
seolaoh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| if safeRef != (eth.L1BlockRef{}) { | ||
| n.OnNewL1Safe(reqCtx, safeRef) | ||
| } | ||
|
|
||
| finalizedRef, err := n.l1Source.L1BlockRefByLabel(reqCtx, eth.Finalized) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to fetch L1 finalized head: %w", err) | ||
| } | ||
| if finalizedRef != (eth.L1BlockRef{}) { | ||
| n.OnNewL1Finalized(reqCtx, finalizedRef) | ||
| } | ||
| } | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.