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
a0d6ec9b
Unverified
Commit
a0d6ec9b
authored
Apr 20, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-e2e: Add actual transactions to the FPP system test
parent
ea6dec5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
16 deletions
+46
-16
system_fpp_test.go
op-e2e/system_fpp_test.go
+46
-16
No files found.
op-e2e/system_fpp_test.go
View file @
a0d6ec9b
...
...
@@ -11,6 +11,7 @@ import (
"github.com/ethereum-optimism/optimism/op-node/testlog"
opp
"github.com/ethereum-optimism/optimism/op-program/host"
oppconf
"github.com/ethereum-optimism/optimism/op-program/host/config"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
...
...
@@ -38,26 +39,51 @@ func TestVerifyL2OutputRoot(t *testing.T) {
require
.
Nil
(
t
,
err
)
rollupClient
:=
sources
.
NewRollupClient
(
client
.
NewBaseRPCClient
(
rollupRPCClient
))
// TODO (CLI-3855): Actually perform some tx to set up a more complex chain.
// Wait for the safe head to reach block 10
require
.
NoError
(
t
,
waitForSafeHead
(
ctx
,
10
,
rollupClient
))
// Use block 5 as the agreed starting block on L2
l2AgreedBlock
,
err
:=
l2Seq
.
BlockByNumber
(
ctx
,
big
.
NewInt
(
5
))
require
.
NoError
(
t
,
err
,
"could not retrieve l2 genesis"
)
l2Head
:=
l2AgreedBlock
.
Hash
()
// Agreed starting L2 block
// Get the expected output at block 10
l2ClaimBlockNumber
:=
uint64
(
10
)
t
.
Log
(
"Sending transactions to setup existing state, prior to challenged period"
)
aliceKey
:=
cfg
.
Secrets
.
Alice
opts
,
err
:=
bind
.
NewKeyedTransactorWithChainID
(
aliceKey
,
cfg
.
L1ChainIDBig
())
require
.
Nil
(
t
,
err
)
SendDepositTx
(
t
,
cfg
,
l1Client
,
l2Seq
,
opts
,
func
(
l2Opts
*
DepositTxOpts
)
{
l2Opts
.
Value
=
big
.
NewInt
(
100
_000_000
)
})
SendL2Tx
(
t
,
cfg
,
l2Seq
,
aliceKey
,
func
(
opts
*
TxOpts
)
{
opts
.
ToAddr
=
&
cfg
.
Secrets
.
Addresses
()
.
Bob
opts
.
Value
=
big
.
NewInt
(
1
_000
)
opts
.
Nonce
=
1
})
SendWithdrawal
(
t
,
cfg
,
l2Seq
,
aliceKey
,
func
(
opts
*
WithdrawalTxOpts
)
{
opts
.
Value
=
big
.
NewInt
(
500
)
opts
.
Nonce
=
2
})
t
.
Log
(
"Capture current L2 head as agreed starting point"
)
l2AgreedBlock
,
err
:=
l2Seq
.
BlockByNumber
(
ctx
,
nil
)
require
.
NoError
(
t
,
err
,
"could not retrieve l2 agreed block"
)
l2Head
:=
l2AgreedBlock
.
Hash
()
t
.
Log
(
"Sending transactions to modify existing state, within challenged period"
)
SendDepositTx
(
t
,
cfg
,
l1Client
,
l2Seq
,
opts
,
func
(
l2Opts
*
DepositTxOpts
)
{
l2Opts
.
Value
=
big
.
NewInt
(
5
_000
)
})
SendL2Tx
(
t
,
cfg
,
l2Seq
,
cfg
.
Secrets
.
Bob
,
func
(
opts
*
TxOpts
)
{
opts
.
ToAddr
=
&
cfg
.
Secrets
.
Addresses
()
.
Alice
opts
.
Value
=
big
.
NewInt
(
100
)
})
SendWithdrawal
(
t
,
cfg
,
l2Seq
,
aliceKey
,
func
(
opts
*
WithdrawalTxOpts
)
{
opts
.
Value
=
big
.
NewInt
(
100
)
opts
.
Nonce
=
4
})
t
.
Log
(
"Determine L2 claim"
)
l2ClaimBlockNumber
,
err
:=
l2Seq
.
BlockNumber
(
ctx
)
require
.
NoError
(
t
,
err
,
"get L2 claim block number"
)
l2Output
,
err
:=
rollupClient
.
OutputAtBlock
(
ctx
,
l2ClaimBlockNumber
)
require
.
NoError
(
t
,
err
,
"could not get expected output"
)
l2Claim
:=
l2Output
.
OutputRoot
// Find the current L1 head
l1BlockNumber
,
err
:=
l1Client
.
BlockNumber
(
ctx
)
require
.
NoError
(
t
,
err
,
"get l1 head block number"
)
l1HeadBlock
,
err
:=
l1Client
.
BlockByNumber
(
ctx
,
new
(
big
.
Int
)
.
SetUint64
(
l1BlockNumber
))
t
.
Log
(
"Determine L1 head that includes all batches required for L2 claim block"
)
require
.
NoError
(
t
,
waitForSafeHead
(
ctx
,
l2ClaimBlockNumber
,
rollupClient
))
l1HeadBlock
,
err
:=
l1Client
.
BlockByNumber
(
ctx
,
nil
)
require
.
NoError
(
t
,
err
,
"get l1 head block"
)
l1Head
:=
l1HeadBlock
.
Hash
()
...
...
@@ -72,7 +98,11 @@ func TestVerifyL2OutputRoot(t *testing.T) {
err
=
opp
.
FaultProofProgram
(
log
,
fppConfig
)
require
.
NoError
(
t
,
err
)
t
.
Log
(
"Shutting down network"
)
// Shutdown the nodes from the actual chain. Should now be able to run using only the pre-fetched data.
sys
.
BatchSubmitter
.
StopIfRunning
(
context
.
Background
())
sys
.
L2OutputSubmitter
.
Stop
()
sys
.
L2OutputSubmitter
=
nil
for
_
,
node
:=
range
sys
.
Nodes
{
require
.
NoError
(
t
,
node
.
Close
())
}
...
...
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