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
9d5c144d
Unverified
Commit
9d5c144d
authored
Jun 23, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-node: Persist initial sequencer state
Log info about loaded sequencer state
parent
a370ecf3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
state.go
op-node/rollup/driver/state.go
+13
-0
service.go
op-node/service.go
+11
-4
No files found.
op-node/rollup/driver/state.go
View file @
9d5c144d
...
@@ -92,6 +92,19 @@ func (s *Driver) Start() error {
...
@@ -92,6 +92,19 @@ func (s *Driver) Start() error {
s
.
derivation
.
Reset
()
s
.
derivation
.
Reset
()
log
.
Info
(
"Starting driver"
,
"sequencerEnabled"
,
s
.
driverConfig
.
SequencerEnabled
,
"sequencerStopped"
,
s
.
driverConfig
.
SequencerStopped
)
log
.
Info
(
"Starting driver"
,
"sequencerEnabled"
,
s
.
driverConfig
.
SequencerEnabled
,
"sequencerStopped"
,
s
.
driverConfig
.
SequencerStopped
)
if
s
.
driverConfig
.
SequencerEnabled
{
// Notify the initial sequencer state
// This ensures persistence can write the state correctly and that the state file exists
var
err
error
if
s
.
driverConfig
.
SequencerStopped
{
err
=
s
.
sequencerNotifs
.
SequencerStopped
()
}
else
{
err
=
s
.
sequencerNotifs
.
SequencerStarted
()
}
if
err
!=
nil
{
return
fmt
.
Errorf
(
"persist initial sequencer state: %w"
,
err
)
}
}
s
.
wg
.
Add
(
1
)
s
.
wg
.
Add
(
1
)
go
s
.
eventLoop
()
go
s
.
eventLoop
()
...
...
op-node/service.go
View file @
9d5c144d
...
@@ -37,7 +37,7 @@ func NewConfig(ctx *cli.Context, log log.Logger) (*node.Config, error) {
...
@@ -37,7 +37,7 @@ func NewConfig(ctx *cli.Context, log log.Logger) (*node.Config, error) {
configPersistence
:=
NewConfigPersistence
(
ctx
)
configPersistence
:=
NewConfigPersistence
(
ctx
)
driverConfig
,
err
:=
NewDriverConfig
(
ctx
,
configPersistence
)
driverConfig
,
err
:=
NewDriverConfig
(
ctx
,
log
,
configPersistence
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to load driver config: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"failed to load driver config: %w"
,
err
)
}
}
...
@@ -156,18 +156,25 @@ func NewConfigPersistence(ctx *cli.Context) node.ConfigPersistence {
...
@@ -156,18 +156,25 @@ func NewConfigPersistence(ctx *cli.Context) node.ConfigPersistence {
return
node
.
NewConfigPersistence
(
stateFile
)
return
node
.
NewConfigPersistence
(
stateFile
)
}
}
func
NewDriverConfig
(
ctx
*
cli
.
Context
,
config
node
.
ConfigPersistence
)
(
*
driver
.
Config
,
error
)
{
func
NewDriverConfig
(
ctx
*
cli
.
Context
,
log
log
.
Logger
,
config
node
.
ConfigPersistence
)
(
*
driver
.
Config
,
error
)
{
sequencerEnabled
:=
ctx
.
Bool
(
flags
.
SequencerEnabledFlag
.
Name
)
sequencerStopped
:=
ctx
.
Bool
(
flags
.
SequencerStoppedFlag
.
Name
)
sequencerStopped
:=
ctx
.
Bool
(
flags
.
SequencerStoppedFlag
.
Name
)
if
state
,
err
:=
config
.
SequencerState
();
err
!=
nil
{
if
state
,
err
:=
config
.
SequencerState
();
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
else
if
state
!=
node
.
StateUnset
{
}
else
if
state
!=
node
.
StateUnset
{
sequencerStopped
=
state
==
node
.
StateStopped
stopped
:=
state
==
node
.
StateStopped
if
stopped
!=
sequencerStopped
&&
sequencerEnabled
{
log
.
Warn
(
fmt
.
Sprintf
(
"Overriding %v with persisted state"
,
flags
.
SequencerStoppedFlag
.
Name
),
"stopped"
,
stopped
)
}
sequencerStopped
=
stopped
}
else
{
log
.
Info
(
"No persisted sequencer state loaded"
)
}
}
return
&
driver
.
Config
{
return
&
driver
.
Config
{
VerifierConfDepth
:
ctx
.
Uint64
(
flags
.
VerifierL1Confs
.
Name
),
VerifierConfDepth
:
ctx
.
Uint64
(
flags
.
VerifierL1Confs
.
Name
),
SequencerConfDepth
:
ctx
.
Uint64
(
flags
.
SequencerL1Confs
.
Name
),
SequencerConfDepth
:
ctx
.
Uint64
(
flags
.
SequencerL1Confs
.
Name
),
SequencerEnabled
:
ctx
.
Bool
(
flags
.
SequencerEnabledFlag
.
Name
)
,
SequencerEnabled
:
sequencerEnabled
,
SequencerStopped
:
sequencerStopped
,
SequencerStopped
:
sequencerStopped
,
SequencerMaxSafeLag
:
ctx
.
Uint64
(
flags
.
SequencerMaxSafeLagFlag
.
Name
),
SequencerMaxSafeLag
:
ctx
.
Uint64
(
flags
.
SequencerMaxSafeLagFlag
.
Name
),
},
nil
},
nil
...
...
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