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
16982bb6
Unverified
Commit
16982bb6
authored
Oct 17, 2022
by
Matthew Slipper
Committed by
GitHub
Oct 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-node: Log sync start (#3716)
parent
a2fa8c0f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
engine_queue.go
op-node/rollup/derive/engine_queue.go
+1
-1
start.go
op-node/rollup/sync/start.go
+4
-1
start_test.go
op-node/rollup/sync/start_test.go
+3
-1
No files found.
op-node/rollup/derive/engine_queue.go
View file @
16982bb6
...
@@ -405,7 +405,7 @@ func (eq *EngineQueue) forceNextSafeAttributes(ctx context.Context) error {
...
@@ -405,7 +405,7 @@ func (eq *EngineQueue) forceNextSafeAttributes(ctx context.Context) error {
// ResetStep Walks the L2 chain backwards until it finds an L2 block whose L1 origin is canonical.
// ResetStep Walks the L2 chain backwards until it finds an L2 block whose L1 origin is canonical.
// The unsafe head is set to the head of the L2 chain, unless the existing safe head is not canonical.
// The unsafe head is set to the head of the L2 chain, unless the existing safe head is not canonical.
func
(
eq
*
EngineQueue
)
Reset
(
ctx
context
.
Context
,
_
eth
.
L1BlockRef
)
error
{
func
(
eq
*
EngineQueue
)
Reset
(
ctx
context
.
Context
,
_
eth
.
L1BlockRef
)
error
{
result
,
err
:=
sync
.
FindL2Heads
(
ctx
,
eq
.
cfg
,
eq
.
l1Fetcher
,
eq
.
engine
)
result
,
err
:=
sync
.
FindL2Heads
(
ctx
,
eq
.
cfg
,
eq
.
l1Fetcher
,
eq
.
engine
,
eq
.
log
)
if
err
!=
nil
{
if
err
!=
nil
{
return
NewTemporaryError
(
fmt
.
Errorf
(
"failed to find the L2 Heads to start from: %w"
,
err
))
return
NewTemporaryError
(
fmt
.
Errorf
(
"failed to find the L2 Heads to start from: %w"
,
err
))
}
}
...
...
op-node/rollup/sync/start.go
View file @
16982bb6
...
@@ -32,6 +32,7 @@ import (
...
@@ -32,6 +32,7 @@ import (
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
)
)
type
L1Chain
interface
{
type
L1Chain
interface
{
...
@@ -101,7 +102,7 @@ func currentHeads(ctx context.Context, cfg *rollup.Config, l2 L2Chain) (*FindHea
...
@@ -101,7 +102,7 @@ func currentHeads(ctx context.Context, cfg *rollup.Config, l2 L2Chain) (*FindHea
// Plausible: meaning that the blockhash of the L2 block's L1 origin
// Plausible: meaning that the blockhash of the L2 block's L1 origin
// (as reported in the L1 Attributes deposit within the L2 block) is not canonical at another height in the L1 chain,
// (as reported in the L1 Attributes deposit within the L2 block) is not canonical at another height in the L1 chain,
// and the same holds for all its ancestors.
// and the same holds for all its ancestors.
func
FindL2Heads
(
ctx
context
.
Context
,
cfg
*
rollup
.
Config
,
l1
L1Chain
,
l2
L2Chain
)
(
result
*
FindHeadsResult
,
err
error
)
{
func
FindL2Heads
(
ctx
context
.
Context
,
cfg
*
rollup
.
Config
,
l1
L1Chain
,
l2
L2Chain
,
lgr
log
.
Logger
)
(
result
*
FindHeadsResult
,
err
error
)
{
// Fetch current L2 forkchoice state
// Fetch current L2 forkchoice state
result
,
err
=
currentHeads
(
ctx
,
cfg
,
l2
)
result
,
err
=
currentHeads
(
ctx
,
cfg
,
l2
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -137,6 +138,8 @@ func FindL2Heads(ctx context.Context, cfg *rollup.Config, l1 L1Chain, l2 L2Chain
...
@@ -137,6 +138,8 @@ func FindL2Heads(ctx context.Context, cfg *rollup.Config, l1 L1Chain, l2 L2Chain
ahead
=
notFound
ahead
=
notFound
}
}
lgr
.
Trace
(
"walking sync start"
,
"number"
,
n
.
Number
)
// Don't walk past genesis. If we were at the L2 genesis, but could not find its L1 origin,
// Don't walk past genesis. If we were at the L2 genesis, but could not find its L1 origin,
// the L2 chain is building on the wrong L1 branch.
// the L2 chain is building on the wrong L1 branch.
if
n
.
Number
==
cfg
.
Genesis
.
L2
.
Number
{
if
n
.
Number
==
cfg
.
Genesis
.
L2
.
Number
{
...
...
op-node/rollup/sync/start_test.go
View file @
16982bb6
...
@@ -73,7 +73,9 @@ func (c *syncStartTestCase) Run(t *testing.T) {
...
@@ -73,7 +73,9 @@ func (c *syncStartTestCase) Run(t *testing.T) {
Genesis
:
genesis
,
Genesis
:
genesis
,
SeqWindowSize
:
c
.
SeqWindowSize
,
SeqWindowSize
:
c
.
SeqWindowSize
,
}
}
result
,
err
:=
FindL2Heads
(
context
.
Background
(),
cfg
,
chain
,
chain
)
lgr
:=
log
.
New
()
lgr
.
SetHandler
(
log
.
DiscardHandler
())
result
,
err
:=
FindL2Heads
(
context
.
Background
(),
cfg
,
chain
,
chain
,
lgr
)
if
c
.
ExpectedErr
!=
nil
{
if
c
.
ExpectedErr
!=
nil
{
require
.
ErrorIs
(
t
,
err
,
c
.
ExpectedErr
,
"expected error"
)
require
.
ErrorIs
(
t
,
err
,
c
.
ExpectedErr
,
"expected error"
)
return
return
...
...
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