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
163d0720
Unverified
Commit
163d0720
authored
Mar 22, 2023
by
protolambda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-node: fix payloads queue test format and test-duplicates case
parent
7c60017f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
payloads_queue_test.go
op-node/rollup/derive/payloads_queue_test.go
+11
-7
No files found.
op-node/rollup/derive/payloads_queue_test.go
View file @
163d0720
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"container/heap"
"container/heap"
"testing"
"testing"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
...
@@ -74,16 +75,17 @@ func TestPayloadMemSize(t *testing.T) {
...
@@ -74,16 +75,17 @@ func TestPayloadMemSize(t *testing.T) {
}
}
func
TestPayloadsQueue
(
t
*
testing
.
T
)
{
func
TestPayloadsQueue
(
t
*
testing
.
T
)
{
pq
:=
NewPayloadsQueue
(
payloadMemFixedCost
*
3
,
payloadMemSize
)
pq
:=
NewPayloadsQueue
(
payloadMemFixedCost
*
3
,
payloadMemSize
)
require
.
Equal
(
t
,
0
,
pq
.
Len
())
require
.
Equal
(
t
,
0
,
pq
.
Len
())
require
.
Equal
(
t
,
(
*
eth
.
ExecutionPayload
)(
nil
),
pq
.
Peek
())
require
.
Equal
(
t
,
(
*
eth
.
ExecutionPayload
)(
nil
),
pq
.
Peek
())
require
.
Equal
(
t
,
(
*
eth
.
ExecutionPayload
)(
nil
),
pq
.
Pop
())
require
.
Equal
(
t
,
(
*
eth
.
ExecutionPayload
)(
nil
),
pq
.
Pop
())
a
:=
&
eth
.
ExecutionPayload
{
BlockNumber
:
3
}
a
:=
&
eth
.
ExecutionPayload
{
BlockNumber
:
3
,
BlockHash
:
common
.
Hash
{
3
}}
b
:=
&
eth
.
ExecutionPayload
{
BlockNumber
:
4
}
b
:=
&
eth
.
ExecutionPayload
{
BlockNumber
:
4
,
BlockHash
:
common
.
Hash
{
4
}}
c
:=
&
eth
.
ExecutionPayload
{
BlockNumber
:
5
}
c
:=
&
eth
.
ExecutionPayload
{
BlockNumber
:
5
,
BlockHash
:
common
.
Hash
{
5
}}
d
:=
&
eth
.
ExecutionPayload
{
BlockNumber
:
6
}
d
:=
&
eth
.
ExecutionPayload
{
BlockNumber
:
6
,
BlockHash
:
common
.
Hash
{
6
}}
bAlt
:=
&
eth
.
ExecutionPayload
{
BlockNumber
:
4
}
bAlt
:=
&
eth
.
ExecutionPayload
{
BlockNumber
:
4
,
BlockHash
:
common
.
Hash
{
0xff
}}
bDup
:=
&
eth
.
ExecutionPayload
{
BlockNumber
:
4
,
BlockHash
:
common
.
Hash
{
4
}}
require
.
NoError
(
t
,
pq
.
Push
(
b
))
require
.
NoError
(
t
,
pq
.
Push
(
b
))
require
.
Equal
(
t
,
pq
.
Len
(),
1
)
require
.
Equal
(
t
,
pq
.
Len
(),
1
)
require
.
Equal
(
t
,
pq
.
Peek
(),
b
)
require
.
Equal
(
t
,
pq
.
Peek
(),
b
)
...
@@ -126,7 +128,9 @@ func TestPayloadsQueue(t *testing.T) {
...
@@ -126,7 +128,9 @@ func TestPayloadsQueue(t *testing.T) {
require
.
Equal
(
t
,
pq
.
Peek
(),
a
)
require
.
Equal
(
t
,
pq
.
Peek
(),
a
)
// No duplicates allowed
// No duplicates allowed
require
.
Error
(
t
,
pq
.
Push
(
bAlt
))
require
.
Error
(
t
,
pq
.
Push
(
bDup
))
// But reorg data allowed
require
.
NoError
(
t
,
pq
.
Push
(
bAlt
))
require
.
NoError
(
t
,
pq
.
Push
(
d
))
require
.
NoError
(
t
,
pq
.
Push
(
d
))
require
.
Equal
(
t
,
pq
.
Len
(),
3
)
require
.
Equal
(
t
,
pq
.
Len
(),
3
)
...
...
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