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
685c40f4
Commit
685c40f4
authored
Mar 21, 2023
by
keroro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-node: delay creating blocks when safe lag exceeds limit
parent
568f0805
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
6 deletions
+33
-6
flags.go
op-node/flags/flags.go
+8
-0
config.go
op-node/rollup/driver/config.go
+4
-0
state.go
op-node/rollup/driver/state.go
+16
-2
service.go
op-node/service.go
+5
-4
No files found.
op-node/flags/flags.go
View file @
685c40f4
...
...
@@ -100,6 +100,13 @@ var (
Usage
:
"Initialize the sequencer in a stopped state. The sequencer can be started using the admin_startSequencer RPC"
,
EnvVar
:
prefixEnvVar
(
"SEQUENCER_STOPPED"
),
}
SequencerMaxSafeLagFlag
=
cli
.
Uint64Flag
{
Name
:
"sequencer.max-safe-lag"
,
Usage
:
"Maximum number of L2 blocks for restricting the distance between L2 safe and unsafe. Disabled if 0."
,
EnvVar
:
prefixEnvVar
(
"SEQUENCER_MAX_SAFE_LAG"
),
Required
:
false
,
Value
:
0
,
}
SequencerL1Confs
=
cli
.
Uint64Flag
{
Name
:
"sequencer.l1-confs"
,
Usage
:
"Number of L1 blocks to keep distance from the L1 head as a sequencer for picking an L1 origin."
,
...
...
@@ -193,6 +200,7 @@ var optionalFlags = []cli.Flag{
VerifierL1Confs
,
SequencerEnabledFlag
,
SequencerStoppedFlag
,
SequencerMaxSafeLagFlag
,
SequencerL1Confs
,
L1EpochPollIntervalFlag
,
RPCEnableAdmin
,
...
...
op-node/rollup/driver/config.go
View file @
685c40f4
...
...
@@ -16,4 +16,8 @@ type Config struct {
// SequencerStopped is false when the driver should sequence new blocks.
SequencerStopped
bool
`json:"sequencer_stopped"`
// SequencerMaxSafeLag is the maximum number of L2 blocks for restricting the distance between L2 safe and unsafe.
// Disabled if 0.
SequencerMaxSafeLag
uint64
`json:"sequencer_max_safe_lag"`
}
op-node/rollup/driver/state.go
View file @
685c40f4
...
...
@@ -212,8 +212,22 @@ func (s *Driver) eventLoop() {
// And avoid sequencing if the derivation pipeline indicates the engine is not ready.
if
s
.
driverConfig
.
SequencerEnabled
&&
!
s
.
driverConfig
.
SequencerStopped
&&
s
.
l1State
.
L1Head
()
!=
(
eth
.
L1BlockRef
{})
&&
s
.
derivation
.
EngineReady
()
{
// update sequencer time if the head changed
if
s
.
sequencer
.
BuildingOnto
()
.
ID
()
!=
s
.
derivation
.
UnsafeL2Head
()
.
ID
()
{
if
s
.
driverConfig
.
SequencerMaxSafeLag
>
0
&&
s
.
derivation
.
SafeL2Head
()
.
Number
+
s
.
driverConfig
.
SequencerMaxSafeLag
<=
s
.
derivation
.
UnsafeL2Head
()
.
Number
{
// If the safe head has fallen behind by a significant number of blocks, delay creating new blocks
// until the safe lag is below SequencerMaxSafeLag.
if
sequencerCh
!=
nil
{
s
.
log
.
Warn
(
"Delay creating new block since safe lag exceeds limit"
,
"safe_l2"
,
s
.
derivation
.
SafeL2Head
(),
"unsafe_l2"
,
s
.
derivation
.
UnsafeL2Head
(),
)
sequencerCh
=
nil
}
}
else
if
s
.
sequencer
.
BuildingOnto
()
.
ID
()
!=
s
.
derivation
.
UnsafeL2Head
()
.
ID
()
{
// If we are sequencing, and the L1 state is ready, update the trigger for the next sequencer action.
// This may adjust at any time based on fork-choice changes or previous errors.
//
// update sequencer time if the head changed
planSequencerAction
()
}
}
else
{
...
...
op-node/service.go
View file @
685c40f4
...
...
@@ -141,10 +141,11 @@ func NewL2SyncEndpointConfig(ctx *cli.Context) *node.L2SyncEndpointConfig {
func
NewDriverConfig
(
ctx
*
cli
.
Context
)
*
driver
.
Config
{
return
&
driver
.
Config
{
VerifierConfDepth
:
ctx
.
GlobalUint64
(
flags
.
VerifierL1Confs
.
Name
),
SequencerConfDepth
:
ctx
.
GlobalUint64
(
flags
.
SequencerL1Confs
.
Name
),
SequencerEnabled
:
ctx
.
GlobalBool
(
flags
.
SequencerEnabledFlag
.
Name
),
SequencerStopped
:
ctx
.
GlobalBool
(
flags
.
SequencerStoppedFlag
.
Name
),
VerifierConfDepth
:
ctx
.
GlobalUint64
(
flags
.
VerifierL1Confs
.
Name
),
SequencerConfDepth
:
ctx
.
GlobalUint64
(
flags
.
SequencerL1Confs
.
Name
),
SequencerEnabled
:
ctx
.
GlobalBool
(
flags
.
SequencerEnabledFlag
.
Name
),
SequencerStopped
:
ctx
.
GlobalBool
(
flags
.
SequencerStoppedFlag
.
Name
),
SequencerMaxSafeLag
:
ctx
.
GlobalUint64
(
flags
.
SequencerMaxSafeLagFlag
.
Name
),
}
}
...
...
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