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
4df95053
Commit
4df95053
authored
Mar 11, 2023
by
Sebastian Stammler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-batcher: Test requeuing of transactions
Regression test for #4937
parent
a97c1e7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
3 deletions
+46
-3
channel_manager_test.go
op-batcher/batcher/channel_manager_test.go
+46
-3
No files found.
op-batcher/batcher/channel_manager_test.go
View file @
4df95053
...
...
@@ -3,11 +3,14 @@ package batcher_test
import
(
"io"
"math/big"
"math/rand"
"testing"
"time"
"github.com/ethereum-optimism/optimism/op-batcher/batcher"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
derivetest
"github.com/ethereum-optimism/optimism/op-node/rollup/derive/test"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
...
...
@@ -54,15 +57,15 @@ func TestChannelManagerReturnsErrReorgWhenDrained(t *testing.T) {
log
:=
testlog
.
Logger
(
t
,
log
.
LvlCrit
)
m
:=
batcher
.
NewChannelManager
(
log
,
batcher
.
ChannelConfig
{
TargetFrameSize
:
0
,
MaxFrameSize
:
100
,
MaxFrameSize
:
1
20
_0
00
,
ApproxComprRatio
:
1.0
,
})
lBlock
:=
types
.
NewBlock
(
&
types
.
Header
{
l
1
Block
:=
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
)
l1InfoTx
,
err
:=
derive
.
L1InfoDeposit
(
0
,
l
1
Block
,
eth
.
SystemConfig
{},
false
)
require
.
NoError
(
t
,
err
)
txs
:=
[]
*
types
.
Transaction
{
types
.
NewTx
(
l1InfoTx
)}
...
...
@@ -81,6 +84,46 @@ func TestChannelManagerReturnsErrReorgWhenDrained(t *testing.T) {
require
.
NoError
(
t
,
err
)
_
,
err
=
m
.
TxData
(
eth
.
BlockID
{})
require
.
ErrorIs
(
t
,
err
,
io
.
EOF
)
err
=
m
.
AddL2Block
(
x
)
require
.
ErrorIs
(
t
,
err
,
batcher
.
ErrReorg
)
}
func
TestChannelManager_TxResend
(
t
*
testing
.
T
)
{
require
:=
require
.
New
(
t
)
rng
:=
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
log
:=
testlog
.
Logger
(
t
,
log
.
LvlError
)
m
:=
batcher
.
NewChannelManager
(
log
,
batcher
.
ChannelConfig
{
TargetFrameSize
:
0
,
MaxFrameSize
:
120
_000
,
ApproxComprRatio
:
1.0
,
})
a
,
_
:=
derivetest
.
RandomL2Block
(
rng
,
4
)
err
:=
m
.
AddL2Block
(
a
)
require
.
NoError
(
err
)
txdata0
,
err
:=
m
.
TxData
(
eth
.
BlockID
{})
require
.
NoError
(
err
)
txdata0bytes
:=
txdata0
.
Bytes
()
data0
:=
make
([]
byte
,
len
(
txdata0bytes
))
// make sure we have a clone for later comparison
copy
(
data0
,
txdata0bytes
)
// ensure channel is drained
_
,
err
=
m
.
TxData
(
eth
.
BlockID
{})
require
.
ErrorIs
(
err
,
io
.
EOF
)
// requeue frame
m
.
TxFailed
(
txdata0
.
ID
())
txdata1
,
err
:=
m
.
TxData
(
eth
.
BlockID
{})
require
.
NoError
(
err
)
data1
:=
txdata1
.
Bytes
()
require
.
Equal
(
data1
,
data0
)
fs
,
err
:=
derive
.
ParseFrames
(
data1
)
require
.
NoError
(
err
)
require
.
Len
(
fs
,
1
)
}
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