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
b7d377f2
Commit
b7d377f2
authored
Mar 16, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix nits
💩
parent
48367f70
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
43 deletions
+4
-43
channel_manager_test.go
op-batcher/batcher/channel_manager_test.go
+4
-43
No files found.
op-batcher/batcher/channel_manager_test.go
View file @
b7d377f2
...
@@ -18,39 +18,6 @@ import (
...
@@ -18,39 +18,6 @@ import (
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
)
)
// TestChannelManagerAddL2Block tests adding an L2 block to the channel manager.
func
TestChannelManagerAddL2Block
(
t
*
testing
.
T
)
{
log
:=
testlog
.
Logger
(
t
,
log
.
LvlCrit
)
m
:=
NewChannelManager
(
log
,
ChannelConfig
{})
// Add one block and assert state changes
a
:=
types
.
NewBlock
(
&
types
.
Header
{
Number
:
big
.
NewInt
(
0
),
},
nil
,
nil
,
nil
,
nil
)
err
:=
m
.
AddL2Block
(
a
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
[]
*
types
.
Block
{
a
},
m
.
blocks
)
require
.
Equal
(
t
,
a
.
Hash
(),
m
.
tip
)
// Add another block and assert state changes
b
:=
types
.
NewBlock
(
&
types
.
Header
{
Number
:
big
.
NewInt
(
1
),
ParentHash
:
a
.
Hash
(),
},
nil
,
nil
,
nil
,
nil
)
err
=
m
.
AddL2Block
(
b
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
[]
*
types
.
Block
{
a
,
b
},
m
.
blocks
)
require
.
Equal
(
t
,
b
.
Hash
(),
m
.
tip
)
// Adding a block with an invalid parent hash should fail
c
:=
types
.
NewBlock
(
&
types
.
Header
{
Number
:
big
.
NewInt
(
2
),
ParentHash
:
common
.
Hash
{},
},
nil
,
nil
,
nil
,
nil
)
err
=
m
.
AddL2Block
(
c
)
require
.
ErrorIs
(
t
,
ErrReorg
,
err
)
}
// TestPendingChannelTimeout tests that the channel manager
// TestPendingChannelTimeout tests that the channel manager
// correctly identifies when a pending channel is timed out.
// correctly identifies when a pending channel is timed out.
func
TestPendingChannelTimeout
(
t
*
testing
.
T
)
{
func
TestPendingChannelTimeout
(
t
*
testing
.
T
)
{
...
@@ -75,16 +42,8 @@ func TestPendingChannelTimeout(t *testing.T) {
...
@@ -75,16 +42,8 @@ func TestPendingChannelTimeout(t *testing.T) {
// Manually set a confirmed transactions
// Manually set a confirmed transactions
// To avoid other methods clearing state
// To avoid other methods clearing state
m
.
confirmedTransactions
[
frameID
{
m
.
confirmedTransactions
[
frameID
{
frameNumber
:
0
}]
=
eth
.
BlockID
{
Number
:
0
}
frameNumber
:
0
,
m
.
confirmedTransactions
[
frameID
{
frameNumber
:
1
}]
=
eth
.
BlockID
{
Number
:
99
}
}]
=
eth
.
BlockID
{
Number
:
0
,
}
m
.
confirmedTransactions
[
frameID
{
frameNumber
:
1
,
}]
=
eth
.
BlockID
{
Number
:
99
,
}
// Since the ChannelTimeout is 100, the
// Since the ChannelTimeout is 100, the
// pending channel should not be timed out
// pending channel should not be timed out
...
@@ -134,6 +93,8 @@ func TestChannelManagerReturnsErrReorg(t *testing.T) {
...
@@ -134,6 +93,8 @@ func TestChannelManagerReturnsErrReorg(t *testing.T) {
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
err
=
m
.
AddL2Block
(
x
)
err
=
m
.
AddL2Block
(
x
)
require
.
ErrorIs
(
t
,
err
,
ErrReorg
)
require
.
ErrorIs
(
t
,
err
,
ErrReorg
)
require
.
Equal
(
t
,
[]
*
types
.
Block
{
a
,
b
,
c
},
m
.
blocks
)
}
}
// TestChannelManagerReturnsErrReorgWhenDrained ensures that the channel manager
// TestChannelManagerReturnsErrReorgWhenDrained ensures that the channel manager
...
...
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