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
e63de25f
Unverified
Commit
e63de25f
authored
Feb 28, 2023
by
Michael de Hoog
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add E2E test
parent
b779e62f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
0 deletions
+95
-0
system_test.go
op-e2e/system_test.go
+95
-0
No files found.
op-e2e/system_test.go
View file @
e63de25f
...
...
@@ -1173,6 +1173,101 @@ func TestStopStartSequencer(t *testing.T) {
require
.
Greater
(
t
,
blockAfter
,
blockBefore
,
"Chain did not advance after starting sequencer"
)
}
func
TestStopStartBatcher
(
t
*
testing
.
T
)
{
parallel
(
t
)
if
!
verboseGethNodes
{
log
.
Root
()
.
SetHandler
(
log
.
DiscardHandler
())
}
cfg
:=
DefaultSystemConfig
(
t
)
sys
,
err
:=
cfg
.
Start
()
require
.
Nil
(
t
,
err
,
"Error starting up system"
)
defer
sys
.
Close
()
rollupRPCClient
,
err
:=
rpc
.
DialContext
(
context
.
Background
(),
sys
.
RollupNodes
[
"sequencer"
]
.
HTTPEndpoint
())
require
.
Nil
(
t
,
err
)
rollupClient
:=
sources
.
NewRollupClient
(
client
.
NewBaseRPCClient
(
rollupRPCClient
))
l2Seq
:=
sys
.
Clients
[
"sequencer"
]
l2Verif
:=
sys
.
Clients
[
"verifier"
]
// retrieve the initial sync status
seqStatus
,
err
:=
rollupClient
.
SyncStatus
(
context
.
Background
())
require
.
Nil
(
t
,
err
)
nonce
:=
uint64
(
0
)
sendTx
:=
func
()
*
types
.
Receipt
{
// Submit TX to L2 sequencer node
tx
:=
types
.
MustSignNewTx
(
cfg
.
Secrets
.
Alice
,
types
.
LatestSignerForChainID
(
cfg
.
L2ChainIDBig
()),
&
types
.
DynamicFeeTx
{
ChainID
:
cfg
.
L2ChainIDBig
(),
Nonce
:
nonce
,
To
:
&
common
.
Address
{
0xff
,
0xff
},
Value
:
big
.
NewInt
(
1
_000_000_000
),
GasTipCap
:
big
.
NewInt
(
10
),
GasFeeCap
:
big
.
NewInt
(
200
),
Gas
:
21000
,
})
nonce
++
err
=
l2Seq
.
SendTransaction
(
context
.
Background
(),
tx
)
require
.
Nil
(
t
,
err
,
"Sending L2 tx to sequencer"
)
// Let it show up on the unsafe chain
receipt
,
err
:=
waitForTransaction
(
tx
.
Hash
(),
l2Seq
,
3
*
time
.
Duration
(
cfg
.
DeployConfig
.
L1BlockTime
)
*
time
.
Second
)
require
.
Nil
(
t
,
err
,
"Waiting for L2 tx on sequencer"
)
return
receipt
}
// send a transaction
receipt
:=
sendTx
()
// wait until the block the tx was first included in shows up in the safe chain on the verifier
safeBlockInclusionDuration
:=
time
.
Duration
(
3
*
cfg
.
DeployConfig
.
L1BlockTime
)
*
time
.
Second
_
,
err
=
waitForBlock
(
receipt
.
BlockNumber
,
l2Verif
,
safeBlockInclusionDuration
)
require
.
Nil
(
t
,
err
,
"Waiting for block on verifier"
)
// ensure the safe chain advances
newSeqStatus
,
err
:=
rollupClient
.
SyncStatus
(
context
.
Background
())
require
.
Nil
(
t
,
err
)
require
.
Greater
(
t
,
newSeqStatus
.
SafeL2
.
Number
,
seqStatus
.
SafeL2
.
Number
,
"Safe chain did not advance"
)
// stop the batch submission
err
=
sys
.
BatchSubmitter
.
Stop
()
require
.
Nil
(
t
,
err
)
// wait for any old safe blocks being submitted / derived
time
.
Sleep
(
safeBlockInclusionDuration
)
// get the initial sync status
seqStatus
,
err
=
rollupClient
.
SyncStatus
(
context
.
Background
())
require
.
Nil
(
t
,
err
)
// send another tx
sendTx
()
time
.
Sleep
(
safeBlockInclusionDuration
)
// ensure that the safe chain does not advance while the batcher is stopped
newSeqStatus
,
err
=
rollupClient
.
SyncStatus
(
context
.
Background
())
require
.
Nil
(
t
,
err
)
require
.
Equal
(
t
,
newSeqStatus
.
SafeL2
.
Number
,
seqStatus
.
SafeL2
.
Number
,
"Safe chain advanced while batcher was stopped"
)
// start the batch submission
err
=
sys
.
BatchSubmitter
.
Start
()
require
.
Nil
(
t
,
err
)
time
.
Sleep
(
safeBlockInclusionDuration
)
// send a third tx
receipt
=
sendTx
()
// wait until the block the tx was first included in shows up in the safe chain on the verifier
_
,
err
=
waitForBlock
(
receipt
.
BlockNumber
,
l2Verif
,
safeBlockInclusionDuration
)
require
.
Nil
(
t
,
err
,
"Waiting for block on verifier"
)
// ensure that the safe chain advances after restarting the batcher
newSeqStatus
,
err
=
rollupClient
.
SyncStatus
(
context
.
Background
())
require
.
Nil
(
t
,
err
)
require
.
Greater
(
t
,
newSeqStatus
.
SafeL2
.
Number
,
seqStatus
.
SafeL2
.
Number
,
"Safe chain did not advance after batcher was restarted"
)
}
func
safeAddBig
(
a
*
big
.
Int
,
b
*
big
.
Int
)
*
big
.
Int
{
return
new
(
big
.
Int
)
.
Add
(
a
,
b
)
}
...
...
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