-
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
Initialize L1 Safe and Finalized head in SyncStatus at OpNode startup #367
Conversation
op-node/node/node.go
Outdated
| 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), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be 6.4 minutes I think. An epoch is 32*12 seconds, which is the default for the L1EpochPollIntervalFlag
|
Do we have understanding what blocks the node from fixing itself, i.e. getting an up-to-date L1 finalized reference when the node ran out of the seq drift window? |
@palango As far as I see the code, there's no way to recover the sequencing except for admin API. FYR, someone raised a similar issue. |
|
I'm wondering if it's better to consolidate the L1 block fetching logic in one place. Specifically, modifying this code block so that we call fetchAndSignal := func() {
reqCtx, reqCancel := context.WithTimeout(eventsCtx, timeout)
ref, err := src.L1BlockRefByLabel(reqCtx, label)
reqCancel()
if err != nil {
log.Warn("failed to poll L1 block", "label", label, "err", err)
} else {
fn(eventsCtx, ref)
}
}
fetchAndSignal()
ticker := time.NewTicker(interval)
defer ticker.Stop()
for {
select {
case <-ticker.C:
fetchAndSignal()
case <-eventsCtx.Done():
return nil
}
} |
@seolaoh Generally speaking, I think it will be better in terms of cleanliness, too. However, the value is set only after func (n *OpNode) OnNewL1Finalized(ctx context.Context, sig eth.L1BlockRef) {
if n.l2Driver == nil {
return
}
// Pass on the event to the L2 Engine
ctx, cancel := context.WithTimeout(ctx, time.Second*10)
defer cancel()
if err := n.l2Driver.OnL1Finalized(ctx, sig); err != nil {
n.log.Warn("failed to notify engine driver of L1 finalized block change", "err", err)
}
} |
Oh I didn't know that, then the original approach seems solid to set the finalized head. |
…sue' into Kourin1996/fix-finalized-flag-issue
piersy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Kourin1996. At present this looks like the best we can do without significant further investigation. But I would say that this does not close the linked issue, since the underlying problem (that the node stalls permanently when maxSequencerDrift is exceeded) remains. So lets merge this but keep the referenced ticket open.
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…ode startup (#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…ode startup (#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…ode startup (#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…ode startup (#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…ode startup (#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…ode startup (#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…ode startup (#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…ode startup (#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
…ode startup (#367) * Set L1 safe and finalized head at startup of op-node * Wrap initialization of L1 safe & finalized head in SyncStatus with if block * Fix comment * Fix commen * Fix comment * Fix codes based on feedback * Fix comment * Swap the order of fetching finalized and safe L1 block references * Move L1 safe and finalized head fetching to the beginning of OpNode::Start * Remove unnecessary empty line * Add log in finalized
Closes https://github.com/celo-org/celo-blockchain-planning/issues/940
This PR adds code to retrieve and initialize L1 Safe and Finalized head in
SyncStatuswhenOpNodestarts, preventing Sequencer from failing to fetch the next L1 finalized block if--sequencer.use-finalizedis enabled.