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
174ece61
Commit
174ece61
authored
Jul 18, 2023
by
Kelvyne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(op-node): Correctly pop unsafe payload queue when payload is too older
Fixes #6092
parent
a88cd430
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
0 deletions
+90
-0
engine_queue.go
op-node/rollup/derive/engine_queue.go
+5
-0
engine_queue_test.go
op-node/rollup/derive/engine_queue_test.go
+85
-0
No files found.
op-node/rollup/derive/engine_queue.go
View file @
174ece61
...
...
@@ -420,6 +420,11 @@ func (eq *EngineQueue) tryNextUnsafePayload(ctx context.Context) error {
eq
.
unsafePayloads
.
Pop
()
return
nil
}
if
uint64
(
first
.
BlockNumber
)
<=
eq
.
unsafeHead
.
Number
{
eq
.
log
.
Info
(
"skipping unsafe payload, since it is older than unsafe head"
,
"unsafe"
,
eq
.
unsafeHead
.
ID
(),
"unsafe_payload"
,
first
.
ID
())
eq
.
unsafePayloads
.
Pop
()
return
nil
}
// Ensure that the unsafe payload builds upon the current unsafe head
// TODO: once we support snap-sync we can remove this condition, and handle the "SYNCING" status of the execution engine.
...
...
op-node/rollup/derive/engine_queue_test.go
View file @
174ece61
...
...
@@ -1107,3 +1107,88 @@ func TestResetLoop(t *testing.T) {
l1F
.
AssertExpectations
(
t
)
eng
.
AssertExpectations
(
t
)
}
func
TestEngineQueue_StepPopOlderUnsafe
(
t
*
testing
.
T
)
{
logger
:=
testlog
.
Logger
(
t
,
log
.
LvlInfo
)
eng
:=
&
testutils
.
MockEngine
{}
l1F
:=
&
testutils
.
MockL1Source
{}
rng
:=
rand
.
New
(
rand
.
NewSource
(
1234
))
refA
:=
testutils
.
RandomBlockRef
(
rng
)
refA0
:=
eth
.
L2BlockRef
{
Hash
:
testutils
.
RandomHash
(
rng
),
Number
:
0
,
ParentHash
:
common
.
Hash
{},
Time
:
refA
.
Time
,
L1Origin
:
refA
.
ID
(),
SequenceNumber
:
0
,
}
gasLimit
:=
eth
.
Uint64Quantity
(
20
_000_000
)
cfg
:=
&
rollup
.
Config
{
Genesis
:
rollup
.
Genesis
{
L1
:
refA
.
ID
(),
L2
:
refA0
.
ID
(),
L2Time
:
refA0
.
Time
,
SystemConfig
:
eth
.
SystemConfig
{
BatcherAddr
:
common
.
Address
{
42
},
Overhead
:
[
32
]
byte
{
123
},
Scalar
:
[
32
]
byte
{
42
},
GasLimit
:
20
_000_000
,
},
},
BlockTime
:
1
,
SeqWindowSize
:
2
,
}
refA1
:=
eth
.
L2BlockRef
{
Hash
:
testutils
.
RandomHash
(
rng
),
Number
:
refA0
.
Number
+
1
,
ParentHash
:
refA0
.
Hash
,
Time
:
refA0
.
Time
+
cfg
.
BlockTime
,
L1Origin
:
refA
.
ID
(),
SequenceNumber
:
1
,
}
refA2
:=
eth
.
L2BlockRef
{
Hash
:
testutils
.
RandomHash
(
rng
),
Number
:
refA1
.
Number
+
1
,
ParentHash
:
refA1
.
Hash
,
Time
:
refA1
.
Time
+
cfg
.
BlockTime
,
L1Origin
:
refA
.
ID
(),
SequenceNumber
:
2
,
}
payloadA1
:=
&
eth
.
ExecutionPayload
{
ParentHash
:
refA1
.
ParentHash
,
FeeRecipient
:
common
.
Address
{},
StateRoot
:
eth
.
Bytes32
{},
ReceiptsRoot
:
eth
.
Bytes32
{},
LogsBloom
:
eth
.
Bytes256
{},
PrevRandao
:
eth
.
Bytes32
{},
BlockNumber
:
eth
.
Uint64Quantity
(
refA1
.
Number
),
GasLimit
:
gasLimit
,
GasUsed
:
0
,
Timestamp
:
eth
.
Uint64Quantity
(
refA1
.
Time
),
ExtraData
:
nil
,
BaseFeePerGas
:
*
uint256
.
NewInt
(
7
),
BlockHash
:
refA1
.
Hash
,
Transactions
:
[]
eth
.
Data
{},
}
prev
:=
&
fakeAttributesQueue
{
origin
:
refA
}
eq
:=
NewEngineQueue
(
logger
,
cfg
,
eng
,
metrics
.
NoopMetrics
,
prev
,
l1F
)
eq
.
unsafeHead
=
refA2
eq
.
safeHead
=
refA0
eq
.
finalized
=
refA0
eq
.
AddUnsafePayload
(
payloadA1
)
err
:=
eq
.
Step
(
context
.
Background
())
require
.
NoError
(
t
,
err
)
require
.
Nil
(
t
,
eq
.
unsafePayloads
.
Peek
(),
"should pop the unsafe payload because it is too old"
)
fmt
.
Println
(
eq
.
unsafePayloads
.
Peek
())
l1F
.
AssertExpectations
(
t
)
eng
.
AssertExpectations
(
t
)
}
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