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
91a80d28
Unverified
Commit
91a80d28
authored
Nov 28, 2022
by
Joshua Gutow
Committed by
GitHub
Nov 28, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4035 from ethereum-optimism/jg/l1_state_uninit_v2
op-node: Audit use of L1 State
parents
0e44785f
f5c6160a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
6 deletions
+18
-6
system_test.go
op-e2e/system_test.go
+1
-1
conf_depth.go
op-node/rollup/driver/conf_depth.go
+4
-2
l1_state.go
op-node/rollup/driver/l1_state.go
+6
-0
state.go
op-node/rollup/driver/state.go
+7
-3
No files found.
op-e2e/system_test.go
View file @
91a80d28
...
...
@@ -566,7 +566,7 @@ func TestSystemMockP2P(t *testing.T) {
require
.
Nil
(
t
,
err
,
"Sending L2 tx to sequencer"
)
// Wait for tx to be mined on the L2 sequencer chain
receiptSeq
,
err
:=
waitForTransaction
(
tx
.
Hash
(),
l2Seq
,
3
*
time
.
Duration
(
sys
.
RollupConfig
.
BlockTime
)
*
time
.
Second
)
receiptSeq
,
err
:=
waitForTransaction
(
tx
.
Hash
(),
l2Seq
,
6
*
time
.
Duration
(
sys
.
RollupConfig
.
BlockTime
)
*
time
.
Second
)
require
.
Nil
(
t
,
err
,
"Waiting for L2 tx on sequencer"
)
// Wait until the block it was first included in shows up in the safe chain on the verifier
...
...
op-node/rollup/driver/conf_depth.go
View file @
91a80d28
...
...
@@ -6,7 +6,6 @@ import (
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
)
// confDepth is an util that wraps the L1 input fetcher used in the pipeline,
...
...
@@ -33,7 +32,10 @@ func (c *confDepth) L1BlockRefByNumber(ctx context.Context, num uint64) (eth.L1B
// Don't apply the conf depth is l1Head is empty (as it is during the startup case before the l1State is initialized).
l1Head
:=
c
.
l1Head
()
if
num
==
0
||
c
.
depth
==
0
||
num
+
c
.
depth
<=
l1Head
.
Number
||
l1Head
.
Hash
==
(
common
.
Hash
{})
{
if
l1Head
==
(
eth
.
L1BlockRef
{})
{
return
c
.
L1Fetcher
.
L1BlockRefByNumber
(
ctx
,
num
)
}
if
num
==
0
||
c
.
depth
==
0
||
num
+
c
.
depth
<=
l1Head
.
Number
{
return
c
.
L1Fetcher
.
L1BlockRefByNumber
(
ctx
,
num
)
}
return
eth
.
L1BlockRef
{},
ethereum
.
NotFound
...
...
op-node/rollup/driver/l1_state.go
View file @
91a80d28
...
...
@@ -63,14 +63,20 @@ func (s *L1State) HandleNewL1FinalizedBlock(finalized eth.L1BlockRef) {
s
.
l1Finalized
=
finalized
}
// L1Head returns either the stored L1 head or an empty block reference
// if the L1 Head has not been initialized yet.
func
(
s
*
L1State
)
L1Head
()
eth
.
L1BlockRef
{
return
s
.
l1Head
}
// L1Safe returns either the stored L1 safe block or an empty block reference
// if the L1 safe block has not been initialized yet.
func
(
s
*
L1State
)
L1Safe
()
eth
.
L1BlockRef
{
return
s
.
l1Safe
}
// L1Finalized returns either the stored L1 finalized block or an empty block reference
// if the L1 finalized block has not been initialized yet.
func
(
s
*
L1State
)
L1Finalized
()
eth
.
L1BlockRef
{
return
s
.
l1Finalized
}
op-node/rollup/driver/state.go
View file @
91a80d28
...
...
@@ -134,8 +134,13 @@ func (s *Driver) createNewL2Block(ctx context.Context) error {
l2Safe
:=
s
.
derivation
.
SafeL2Head
()
l2Finalized
:=
s
.
derivation
.
Finalized
()
l1Head
:=
s
.
l1State
.
L1Head
()
if
l1Head
==
(
eth
.
L1BlockRef
{})
{
return
derive
.
NewTemporaryError
(
errors
.
New
(
"L1 Head in L1 State is not initizalited yet"
))
}
// Figure out which L1 origin block we're going to be building on top of.
l1Origin
,
err
:=
s
.
l1OriginSelector
.
FindL1Origin
(
ctx
,
s
.
l1State
.
L1Head
()
,
l2Head
)
l1Origin
,
err
:=
s
.
l1OriginSelector
.
FindL1Origin
(
ctx
,
l1Head
,
l2Head
)
if
err
!=
nil
{
s
.
log
.
Error
(
"Error finding next L1 Origin"
,
"err"
,
err
)
return
err
...
...
@@ -261,9 +266,8 @@ func (s *Driver) eventLoop() {
case
<-
l2BlockCreationReqCh
:
s
.
snapshot
(
"L2 Block Creation Request"
)
l1Head
:=
s
.
l1State
.
L1Head
()
if
!
s
.
idleDerivation
{
s
.
log
.
Warn
(
"not creating block, node is deriving new l2 data"
,
"head_l1"
,
l1Head
)
s
.
log
.
Warn
(
"not creating block, node is deriving new l2 data"
,
"head_l1"
,
s
.
l1State
.
L1Head
()
)
break
}
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
20
*
time
.
Minute
)
...
...
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