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
d005e41a
Unverified
Commit
d005e41a
authored
Jun 29, 2022
by
protolambda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uncomment snapshot logging, defer json encoding
parent
a704a097
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
16 deletions
+20
-16
node.go
op-node/node/node.go
+1
-2
state.go
op-node/rollup/driver/state.go
+18
-13
service.go
op-node/service.go
+1
-1
No files found.
op-node/node/node.go
View file @
d005e41a
...
...
@@ -144,8 +144,7 @@ func (n *OpNode) initL2(ctx context.Context, cfg *Config, snapshotLog log.Logger
return
err
}
snap
:=
snapshotLog
.
New
()
n
.
l2Engine
=
driver
.
NewDriver
(
&
cfg
.
Driver
,
&
cfg
.
Rollup
,
source
,
n
.
l1Source
,
n
,
n
.
log
,
snap
)
n
.
l2Engine
=
driver
.
NewDriver
(
&
cfg
.
Driver
,
&
cfg
.
Rollup
,
source
,
n
.
l1Source
,
n
,
n
.
log
,
snapshotLog
)
return
nil
}
...
...
op-node/rollup/driver/state.go
View file @
d005e41a
...
...
@@ -2,6 +2,7 @@ package driver
import
(
"context"
"encoding/json"
"fmt"
"io"
gosync
"sync"
...
...
@@ -341,18 +342,22 @@ func (s *state) eventLoop() {
}
}
// deferJSONString helps avoid a JSON-encoding performance hit if the snapshot logger does not run
type
deferJSONString
struct
{
x
any
}
func
(
v
deferJSONString
)
String
()
string
{
out
,
_
:=
json
.
Marshal
(
v
.
x
)
return
string
(
out
)
}
func
(
s
*
state
)
snapshot
(
event
string
)
{
// l1HeadJSON, _ := json.Marshal(s.l1Head)
// l1CurrentJSON, _ := json.Marshal(s.derivation.CurrentL1())
// l2HeadJSON, _ := json.Marshal(s.l2Head)
// l2SafeHeadJSON, _ := json.Marshal(s.l2SafeHead)
// l2FinalizedHeadJSON, _ := json.Marshal(s.l2Finalized)
// s.snapshotLog.Info("Rollup State Snapshot",
// "event", event,
// "l1Head", string(l1HeadJSON),
// "l1Current", string(l1CurrentJSON),
// "l2Head", string(l2HeadJSON),
// "l2SafeHead", string(l2SafeHeadJSON),
// "l2FinalizedHead", string(l2FinalizedHeadJSON))
s
.
snapshotLog
.
Info
(
"Rollup State Snapshot"
,
"event"
,
event
,
"l1Head"
,
deferJSONString
{
s
.
l1Head
},
"l1Current"
,
deferJSONString
{
s
.
derivation
.
Progress
()
.
Origin
},
"l2Head"
,
deferJSONString
{
s
.
l2Head
},
"l2SafeHead"
,
deferJSONString
{
s
.
l2SafeHead
},
"l2FinalizedHead"
,
deferJSONString
{
s
.
l2Finalized
})
}
op-node/service.go
View file @
d005e41a
...
...
@@ -161,8 +161,8 @@ func NewSnapshotLogger(ctx *cli.Context) (log.Logger, error) {
if
err
!=
nil
{
return
nil
,
err
}
handler
=
log
.
SyncHandler
(
handler
)
}
handler
=
log
.
SyncHandler
(
handler
)
logger
:=
log
.
New
()
logger
.
SetHandler
(
handler
)
return
logger
,
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