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
995e3e42
Unverified
Commit
995e3e42
authored
Mar 14, 2023
by
Brian Bland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor test improvements
parent
56c2bff4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
36 deletions
+18
-36
channel_manager_test.go
op-batcher/batcher/channel_manager_test.go
+18
-36
No files found.
op-batcher/batcher/channel_manager_test.go
View file @
995e3e42
...
...
@@ -457,38 +457,25 @@ func TestChannelManagerCloseNoPendingChannel(t *testing.T) {
// can gracefully close with a pending channel, and will not produce any
// new channel frames after this point.
func
TestChannelManagerClosePendingChannel
(
t
*
testing
.
T
)
{
rng
:=
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
log
:=
testlog
.
Logger
(
t
,
log
.
LvlCrit
)
m
:=
NewChannelManager
(
log
,
metrics
.
NoopMetrics
,
ChannelConfig
{
TargetNumFrames
:
100
,
TargetFrameSize
:
1
,
MaxFrameSize
:
1
,
TargetFrameSize
:
25
_000
,
MaxFrameSize
:
40
_000
,
ApproxComprRatio
:
1.0
,
ChannelTimeout
:
1000
,
})
lBlock
:=
types
.
NewBlock
(
&
types
.
Header
{
BaseFee
:
big
.
NewInt
(
10
),
Difficulty
:
common
.
Big0
,
Number
:
big
.
NewInt
(
100
),
},
nil
,
nil
,
nil
,
trie
.
NewStackTrie
(
nil
))
l1InfoTx
,
err
:=
derive
.
L1InfoDeposit
(
0
,
lBlock
,
eth
.
SystemConfig
{},
false
)
require
.
NoError
(
t
,
err
)
txs
:=
[]
*
types
.
Transaction
{
types
.
NewTx
(
l1InfoTx
)}
a
:=
types
.
NewBlock
(
&
types
.
Header
{
Number
:
big
.
NewInt
(
0
),
},
txs
,
nil
,
nil
,
trie
.
NewStackTrie
(
nil
))
l1InfoTx
,
err
=
derive
.
L1InfoDeposit
(
1
,
lBlock
,
eth
.
SystemConfig
{},
false
)
require
.
NoError
(
t
,
err
)
txs
=
[]
*
types
.
Transaction
{
types
.
NewTx
(
l1InfoTx
)}
a
,
_
:=
derivetest
.
RandomL2Block
(
rng
,
128
)
b
:=
types
.
NewBlock
(
&
types
.
Header
{
Number
:
big
.
NewInt
(
1
),
ParentHash
:
a
.
Hash
(),
},
txs
,
nil
,
nil
,
trie
.
NewStackTrie
(
nil
)
)
b
,
_
:=
derivetest
.
RandomL2Block
(
rng
,
8
)
header
:=
b
.
Header
()
header
.
ParentHash
=
a
.
Hash
()
b
=
b
.
WithSeal
(
header
)
err
=
m
.
AddL2Block
(
a
)
err
:
=
m
.
AddL2Block
(
a
)
require
.
NoError
(
t
,
err
)
txdata
,
err
:=
m
.
TxData
(
eth
.
BlockID
{})
...
...
@@ -504,6 +491,9 @@ func TestChannelManagerClosePendingChannel(t *testing.T) {
m
.
TxConfirmed
(
txdata
.
ID
(),
eth
.
BlockID
{})
_
,
err
=
m
.
TxData
(
eth
.
BlockID
{})
require
.
ErrorIs
(
t
,
err
,
io
.
EOF
)
err
=
m
.
AddL2Block
(
b
)
require
.
NoError
(
t
,
err
)
...
...
@@ -515,28 +505,20 @@ func TestChannelManagerClosePendingChannel(t *testing.T) {
// can gracefully close after producing transaction frames if none of these
// have successfully landed on chain.
func
TestChannelManagerCloseAllTxsFailed
(
t
*
testing
.
T
)
{
rng
:=
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
log
:=
testlog
.
Logger
(
t
,
log
.
LvlCrit
)
m
:=
NewChannelManager
(
log
,
metrics
.
NoopMetrics
,
ChannelConfig
{
TargetFrameSize
:
0
,
MaxFrameSize
:
100
,
TargetNumFrames
:
100
,
TargetFrameSize
:
25
_000
,
MaxFrameSize
:
40
_000
,
ApproxComprRatio
:
1.0
,
ChannelTimeout
:
1000
,
})
lBlock
:=
types
.
NewBlock
(
&
types
.
Header
{
BaseFee
:
big
.
NewInt
(
10
),
Difficulty
:
common
.
Big0
,
Number
:
big
.
NewInt
(
100
),
},
nil
,
nil
,
nil
,
trie
.
NewStackTrie
(
nil
))
l1InfoTx
,
err
:=
derive
.
L1InfoDeposit
(
0
,
lBlock
,
eth
.
SystemConfig
{},
false
)
require
.
NoError
(
t
,
err
)
txs
:=
[]
*
types
.
Transaction
{
types
.
NewTx
(
l1InfoTx
)}
a
:=
types
.
NewBlock
(
&
types
.
Header
{
Number
:
big
.
NewInt
(
0
),
},
txs
,
nil
,
nil
,
trie
.
NewStackTrie
(
nil
))
a
,
_
:=
derivetest
.
RandomL2Block
(
rng
,
128
)
err
=
m
.
AddL2Block
(
a
)
err
:
=
m
.
AddL2Block
(
a
)
require
.
NoError
(
t
,
err
)
txdata
,
err
:=
m
.
TxData
(
eth
.
BlockID
{})
...
...
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