Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
d091bb33
Unverified
Commit
d091bb33
authored
Jul 12, 2024
by
Brian Bland
Committed by
GitHub
Jul 12, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set a variable timeout on FindL1Origin based on sequencer drift (#11131)
parent
98e1cf26
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
origin_selector.go
op-node/rollup/sequencing/origin_selector.go
+15
-2
No files found.
op-node/rollup/sequencing/origin_selector.go
View file @
d091bb33
...
...
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"time"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/log"
...
...
@@ -48,17 +49,29 @@ func (los *L1OriginSelector) FindL1Origin(ctx context.Context, l2Head eth.L2Bloc
log
:=
los
.
log
.
New
(
"current"
,
currentOrigin
,
"current_time"
,
currentOrigin
.
Time
,
"l2_head"
,
l2Head
,
"l2_head_time"
,
l2Head
.
Time
,
"max_seq_drift"
,
msd
)
seqDrift
:=
l2Head
.
Time
+
los
.
cfg
.
BlockTime
-
currentOrigin
.
Time
// If we are past the sequencer depth, we may want to advance the origin, but need to still
// check the time of the next origin.
pastSeqDrift
:=
l2Head
.
Time
+
los
.
cfg
.
BlockTime
>
currentOrigin
.
Time
+
msd
pastSeqDrift
:=
seqDrift
>
msd
if
pastSeqDrift
{
log
.
Warn
(
"Next L2 block time is past the sequencer drift + current origin time"
)
seqDrift
=
msd
}
// Calculate the maximum time we can spend attempting to fetch the next L1 origin block.
// Time spent fetching this information is time not spent building the next L2 block, so
// we generally prioritize keeping this value small, allowing for a nonzero failure rate.
// As the next L2 block time approaches the max sequencer drift, increase our tolerance for
// slower L1 fetches in order to avoid falling too far behind.
fetchTimeout
:=
time
.
Second
+
(
9
*
time
.
Second
*
time
.
Duration
(
seqDrift
))
/
time
.
Duration
(
msd
)
fetchCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
fetchTimeout
)
defer
cancel
()
// Attempt to find the next L1 origin block, where the next origin is the immediate child of
// the current origin block.
// The L1 source can be shimmed to hide new L1 blocks and enforce a sequencer confirmation distance.
nextOrigin
,
err
:=
los
.
l1
.
L1BlockRefByNumber
(
c
tx
,
currentOrigin
.
Number
+
1
)
nextOrigin
,
err
:=
los
.
l1
.
L1BlockRefByNumber
(
fetchC
tx
,
currentOrigin
.
Number
+
1
)
if
err
!=
nil
{
if
pastSeqDrift
{
return
eth
.
L1BlockRef
{},
fmt
.
Errorf
(
"cannot build next L2 block past current L1 origin %s by more than sequencer time drift, and failed to find next L1 origin: %w"
,
currentOrigin
,
err
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment