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
5eb67805
Unverified
Commit
5eb67805
authored
Feb 27, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-e2e: Update TestCrossLayerUser test to check deposits and tx work with and without regolith
parent
de4279b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
2 deletions
+58
-2
l2_sequencer.go
op-e2e/actions/l2_sequencer.go
+8
-0
user_test.go
op-e2e/actions/user_test.go
+50
-2
No files found.
op-e2e/actions/l2_sequencer.go
View file @
5eb67805
...
@@ -155,3 +155,11 @@ func (s *L2Sequencer) ActBuildToL1HeadExclUnsafe(t Testing) {
...
@@ -155,3 +155,11 @@ func (s *L2Sequencer) ActBuildToL1HeadExclUnsafe(t Testing) {
s
.
ActL2EndBlock
(
t
)
s
.
ActL2EndBlock
(
t
)
}
}
}
}
func
(
s
*
L2Sequencer
)
ActBuildL2ToRegolith
(
t
Testing
)
{
require
.
NotNil
(
t
,
s
.
rollupCfg
.
RegolithTime
,
"cannot activate Regolith when it is not scheduled"
)
for
s
.
L2Unsafe
()
.
Time
<
*
s
.
rollupCfg
.
RegolithTime
{
s
.
ActL2StartBlock
(
t
)
s
.
ActL2EndBlock
(
t
)
}
}
op-e2e/actions/user_test.go
View file @
5eb67805
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"math/rand"
"math/rand"
"testing"
"testing"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
...
@@ -12,7 +13,13 @@ import (
...
@@ -12,7 +13,13 @@ import (
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testlog"
)
)
// TestCrossLayerUser tests that common actions of the CrossLayerUser actor work:
type
regolithScheduledTest
struct
{
name
string
regolithTime
*
hexutil
.
Uint64
activateRegolith
bool
}
// TestCrossLayerUser tests that common actions of the CrossLayerUser actor work in various regolith configurations:
// - transact on L1
// - transact on L1
// - transact on L2
// - transact on L2
// - deposit on L1
// - deposit on L1
...
@@ -20,9 +27,28 @@ import (
...
@@ -20,9 +27,28 @@ import (
// - prove tx on L1
// - prove tx on L1
// - wait 1 week + 1 second
// - wait 1 week + 1 second
// - finalize withdrawal on L1
// - finalize withdrawal on L1
func
TestCrossLayerUser
(
gt
*
testing
.
T
)
{
func
TestCrossLayerUser
(
t
*
testing
.
T
)
{
zeroTime
:=
hexutil
.
Uint64
(
0
)
futureTime
:=
hexutil
.
Uint64
(
20
)
farFutureTime
:=
hexutil
.
Uint64
(
2000
)
tests
:=
[]
regolithScheduledTest
{
{
name
:
"NoRegolith"
,
regolithTime
:
nil
,
activateRegolith
:
false
},
{
name
:
"NotYetRegolith"
,
regolithTime
:
&
farFutureTime
,
activateRegolith
:
false
},
{
name
:
"RegolithAtGenesis"
,
regolithTime
:
&
zeroTime
,
activateRegolith
:
true
},
{
name
:
"RegolithAfterGenesis"
,
regolithTime
:
&
futureTime
,
activateRegolith
:
true
},
}
for
_
,
test
:=
range
tests
{
test
:=
test
// Use a fixed reference as the tests run in parallel
t
.
Run
(
test
.
name
,
func
(
gt
*
testing
.
T
)
{
runCrossLayerUserTest
(
gt
,
test
)
})
}
}
func
runCrossLayerUserTest
(
gt
*
testing
.
T
,
test
regolithScheduledTest
)
{
t
:=
NewDefaultTesting
(
gt
)
t
:=
NewDefaultTesting
(
gt
)
dp
:=
e2eutils
.
MakeDeployParams
(
t
,
defaultRollupTestParams
)
dp
:=
e2eutils
.
MakeDeployParams
(
t
,
defaultRollupTestParams
)
dp
.
DeployConfig
.
L2GenesisRegolithTimeOffset
=
test
.
regolithTime
sd
:=
e2eutils
.
Setup
(
t
,
dp
,
defaultAlloc
)
sd
:=
e2eutils
.
Setup
(
t
,
dp
,
defaultAlloc
)
log
:=
testlog
.
Logger
(
t
,
log
.
LvlDebug
)
log
:=
testlog
.
Logger
(
t
,
log
.
LvlDebug
)
...
@@ -64,6 +90,21 @@ func TestCrossLayerUser(gt *testing.T) {
...
@@ -64,6 +90,21 @@ func TestCrossLayerUser(gt *testing.T) {
alice
.
L1
.
SetUserEnv
(
l1UserEnv
)
alice
.
L1
.
SetUserEnv
(
l1UserEnv
)
alice
.
L2
.
SetUserEnv
(
l2UserEnv
)
alice
.
L2
.
SetUserEnv
(
l2UserEnv
)
// Build at least one l2 block so we have an unsafe head with a deposit info tx (genesis block doesn't)
seq
.
ActL2StartBlock
(
t
)
seq
.
ActL2EndBlock
(
t
)
if
test
.
activateRegolith
{
// advance L2 enough to activate regolith fork
seq
.
ActBuildL2ToRegolith
(
t
)
}
// Check Regolith is active or not by confirming the system info tx is not a system tx
infoTx
,
err
:=
l2Cl
.
TransactionInBlock
(
t
.
Ctx
(),
seq
.
L2Unsafe
()
.
Hash
,
0
)
require
.
NoError
(
t
,
err
)
require
.
True
(
t
,
infoTx
.
IsDepositTx
())
// Should only be a system tx if regolith is not enabled
require
.
Equal
(
t
,
!
test
.
activateRegolith
,
infoTx
.
IsSystemTx
())
// regular L2 tx, in new L2 block
// regular L2 tx, in new L2 block
alice
.
L2
.
ActResetTxOpts
(
t
)
alice
.
L2
.
ActResetTxOpts
(
t
)
alice
.
L2
.
ActSetTxToAddr
(
&
dp
.
Addresses
.
Bob
)(
t
)
alice
.
L2
.
ActSetTxToAddr
(
&
dp
.
Addresses
.
Bob
)(
t
)
...
@@ -158,4 +199,11 @@ func TestCrossLayerUser(gt *testing.T) {
...
@@ -158,4 +199,11 @@ func TestCrossLayerUser(gt *testing.T) {
miner
.
ActL1EndBlock
(
t
)
miner
.
ActL1EndBlock
(
t
)
// check withdrawal succeeded
// check withdrawal succeeded
alice
.
L1
.
ActCheckReceiptStatusOfLastTx
(
true
)(
t
)
alice
.
L1
.
ActCheckReceiptStatusOfLastTx
(
true
)(
t
)
// Check Regolith wasn't activated during the test unintentionally
infoTx
,
err
=
l2Cl
.
TransactionInBlock
(
t
.
Ctx
(),
seq
.
L2Unsafe
()
.
Hash
,
0
)
require
.
NoError
(
t
,
err
)
require
.
True
(
t
,
infoTx
.
IsDepositTx
())
// Should only be a system tx if regolith is not enabled
require
.
Equal
(
t
,
!
test
.
activateRegolith
,
infoTx
.
IsSystemTx
())
}
}
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