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
e0c0f867
Commit
e0c0f867
authored
Aug 02, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E dispute test fix
parent
ae7c2740
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
10 deletions
+47
-10
deploy.go
op-e2e/e2eutils/disputegame/deploy.go
+39
-7
helper.go
op-e2e/e2eutils/disputegame/helper.go
+8
-3
No files found.
op-e2e/e2eutils/disputegame/deploy.go
View file @
e0c0f867
...
...
@@ -9,7 +9,6 @@ import (
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer"
"github.com/ethereum-optimism/optimism/op-service/client/utils"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/stretchr/testify/require"
)
...
...
@@ -18,7 +17,7 @@ import (
// It configures the alphabet fault game as game type 0 (faultGameType)
// If/when the dispute game factory becomes a predeployed contract this can be removed and just use the
// predeployed version
func
deployDisputeGameContracts
(
require
*
require
.
Assertions
,
ctx
context
.
Context
,
client
*
ethclient
.
Client
,
opts
*
bind
.
TransactOpts
,
gameDuration
uint64
)
*
bindings
.
DisputeGameFactory
{
func
deployDisputeGameContracts
(
require
*
require
.
Assertions
,
ctx
context
.
Context
,
client
*
ethclient
.
Client
,
opts
*
bind
.
TransactOpts
,
gameDuration
uint64
)
(
*
bindings
.
DisputeGameFactory
,
uint64
)
{
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
5
*
time
.
Minute
)
defer
cancel
()
// Deploy the proxy
...
...
@@ -60,17 +59,50 @@ func deployDisputeGameContracts(require *require.Assertions, ctx context.Context
blockHashOracle
,
err
:=
bindings
.
NewBlockOracle
(
blockHashOracleAddr
,
client
)
require
.
NoError
(
err
)
// Deploy the L2 output oracle
_
,
tx
,
_
,
err
=
bindings
.
DeployL2OutputOracle
(
opts
,
client
,
big
.
NewInt
(
1800
),
big
.
NewInt
(
2
),
big
.
NewInt
(
0
),
big
.
NewInt
(
0
),
opts
.
From
,
opts
.
From
,
big
.
NewInt
(
3600
),
)
require
.
NoError
(
err
)
l2OutputOracleAddr
,
err
:=
bind
.
WaitDeployed
(
ctx
,
client
,
tx
)
require
.
NoError
(
err
)
l2OutputOracle
,
err
:=
bindings
.
NewL2OutputOracle
(
l2OutputOracleAddr
,
client
)
require
.
NoError
(
err
)
// Deploy the fault dispute game implementation
_
,
tx
,
_
,
err
=
bindings
.
DeployFaultDisputeGame
(
opts
,
client
,
alphabetVMAbsolutePrestateClaim
,
big
.
NewInt
(
alphabetGameDepth
),
gameDuration
,
alphaVMAddr
,
common
.
Address
{
0xBE
,
0xEF
}
,
blockHashOracleAddr
)
_
,
tx
,
_
,
err
=
bindings
.
DeployFaultDisputeGame
(
opts
,
client
,
alphabetVMAbsolutePrestateClaim
,
big
.
NewInt
(
alphabetGameDepth
),
gameDuration
,
alphaVMAddr
,
l2OutputOracleAddr
,
blockHashOracleAddr
)
require
.
NoError
(
err
)
faultDisputeGameAddr
,
err
:=
bind
.
WaitDeployed
(
ctx
,
client
,
tx
)
require
.
NoError
(
err
)
// Store the genesis block hash in the oracle
tx
,
err
=
blockHashOracle
.
Store
(
opts
,
big
.
NewInt
(
0
))
// Propose 2 outputs
for
i
:=
uint8
(
0
);
i
<
2
;
i
++
{
nextBlockNumber
,
err
:=
l2OutputOracle
.
NextBlockNumber
(
nil
)
require
.
NoError
(
err
)
block
,
err
:=
client
.
BlockByNumber
(
ctx
,
big
.
NewInt
(
int64
(
i
)))
require
.
NoError
(
err
)
tx
,
err
=
l2OutputOracle
.
ProposeL2Output
(
opts
,
[
32
]
byte
{
i
+
1
},
nextBlockNumber
,
block
.
Hash
(),
block
.
Number
())
require
.
NoError
(
err
)
_
,
err
=
utils
.
WaitReceiptOK
(
ctx
,
client
,
tx
.
Hash
())
require
.
NoError
(
err
)
}
// Store the current block in the oracle
blockNo
,
err
:=
client
.
BlockNumber
(
ctx
)
require
.
NoError
(
err
)
tx
,
err
=
blockHashOracle
.
Store
(
opts
,
big
.
NewInt
(
int64
(
blockNo
)))
require
.
NoError
(
err
)
_
,
err
=
utils
.
WaitReceiptOK
(
ctx
,
client
,
tx
.
Hash
())
require
.
NoError
(
err
,
"failed to store
genesis block hash in
oracle"
)
require
.
NoError
(
err
,
"failed to store
block in block
oracle"
)
// Set the fault game type implementation
tx
,
err
=
factory
.
SetImplementation
(
opts
,
faultGameType
,
faultDisputeGameAddr
)
...
...
@@ -78,5 +110,5 @@ func deployDisputeGameContracts(require *require.Assertions, ctx context.Context
_
,
err
=
utils
.
WaitReceiptOK
(
ctx
,
client
,
tx
.
Hash
())
require
.
NoError
(
err
,
"wait for final transaction to be included and OK"
)
return
factory
return
factory
,
blockNo
}
op-e2e/e2eutils/disputegame/helper.go
View file @
e0c0f867
...
...
@@ -2,6 +2,7 @@ package disputegame
import
(
"context"
"encoding/binary"
"fmt"
"math/big"
"testing"
...
...
@@ -33,7 +34,6 @@ const (
StatusDefenderWins
)
var
alphaExtraData
=
common
.
Hex2Bytes
(
"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000"
)
var
alphabetVMAbsolutePrestate
=
common
.
Hex2Bytes
(
"0000000000000000000000000000000000000000000000000000000000000060"
)
var
alphabetVMAbsolutePrestateClaim
=
crypto
.
Keccak256Hash
(
alphabetVMAbsolutePrestate
)
var
CorrectAlphabet
=
"abcdefghijklmnop"
...
...
@@ -44,6 +44,7 @@ type FactoryHelper struct {
client
*
ethclient
.
Client
opts
*
bind
.
TransactOpts
factory
*
bindings
.
DisputeGameFactory
l1Head
uint64
}
func
NewFactoryHelper
(
t
*
testing
.
T
,
ctx
context
.
Context
,
client
*
ethclient
.
Client
,
gameDuration
uint64
)
*
FactoryHelper
{
...
...
@@ -53,7 +54,7 @@ func NewFactoryHelper(t *testing.T, ctx context.Context, client *ethclient.Clien
opts
,
err
:=
bind
.
NewKeyedTransactorWithChainID
(
deployer
.
TestKey
,
chainID
)
require
.
NoError
(
err
)
factory
:=
deployDisputeGameContracts
(
require
,
ctx
,
client
,
opts
,
gameDuration
)
factory
,
l1Head
:=
deployDisputeGameContracts
(
require
,
ctx
,
client
,
opts
,
gameDuration
)
return
&
FactoryHelper
{
t
:
t
,
...
...
@@ -61,6 +62,7 @@ func NewFactoryHelper(t *testing.T, ctx context.Context, client *ethclient.Clien
client
:
client
,
opts
:
opts
,
factory
:
factory
,
l1Head
:
l1Head
,
}
}
...
...
@@ -70,7 +72,10 @@ func (h *FactoryHelper) StartAlphabetGame(ctx context.Context, claimedAlphabet s
trace
:=
alphabet
.
NewTraceProvider
(
claimedAlphabet
,
4
)
rootClaim
,
err
:=
trace
.
Get
(
ctx
,
lastAlphabetTraceIndex
)
h
.
require
.
NoError
(
err
,
"get root claim"
)
tx
,
err
:=
h
.
factory
.
Create
(
h
.
opts
,
faultGameType
,
rootClaim
,
alphaExtraData
)
extraData
:=
make
([]
byte
,
64
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
24
:
],
uint64
(
3600
))
binary
.
BigEndian
.
PutUint64
(
extraData
[
56
:
],
h
.
l1Head
)
tx
,
err
:=
h
.
factory
.
Create
(
h
.
opts
,
faultGameType
,
rootClaim
,
extraData
)
h
.
require
.
NoError
(
err
,
"create fault dispute game"
)
rcpt
,
err
:=
utils
.
WaitReceiptOK
(
ctx
,
h
.
client
,
tx
.
Hash
())
h
.
require
.
NoError
(
err
,
"wait for create fault dispute game receipt to be OK"
)
...
...
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