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
c9264c54
Commit
c9264c54
authored
Aug 03, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E test fix; Need to parameterize block time in `BlockOracle` constructor
parent
b36be32b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
42 deletions
+36
-42
deploy.go
op-e2e/e2eutils/disputegame/deploy.go
+35
-41
helper.go
op-e2e/e2eutils/disputegame/helper.go
+1
-1
No files found.
op-e2e/e2eutils/disputegame/deploy.go
View file @
c9264c54
...
@@ -6,7 +6,9 @@ import (
...
@@ -6,7 +6,9 @@ import (
"time"
"time"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-service/client/utils"
"github.com/ethereum-optimism/optimism/op-service/client/utils"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/ethclient"
...
@@ -51,22 +53,7 @@ func deployDisputeGameContracts(require *require.Assertions, ctx context.Context
...
@@ -51,22 +53,7 @@ func deployDisputeGameContracts(require *require.Assertions, ctx context.Context
alphaVMAddr
,
err
:=
bind
.
WaitDeployed
(
ctx
,
client
,
tx
)
alphaVMAddr
,
err
:=
bind
.
WaitDeployed
(
ctx
,
client
,
tx
)
require
.
NoError
(
err
)
require
.
NoError
(
err
)
// Deploy the L2 output oracle
l2OutputOracle
,
err
:=
bindings
.
NewL2OutputOracle
(
predeploys
.
DevL2OutputOracleAddr
,
client
)
_
,
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
)
require
.
NoError
(
err
)
// Deploy the block hash oracle
// Deploy the block hash oracle
...
@@ -77,30 +64,6 @@ func deployDisputeGameContracts(require *require.Assertions, ctx context.Context
...
@@ -77,30 +64,6 @@ func deployDisputeGameContracts(require *require.Assertions, ctx context.Context
blockHashOracle
,
err
:=
bindings
.
NewBlockOracle
(
blockHashOracleAddr
,
client
)
blockHashOracle
,
err
:=
bindings
.
NewBlockOracle
(
blockHashOracleAddr
,
client
)
require
.
NoError
(
err
)
require
.
NoError
(
err
)
// Propose 2 outputs
for
i
:=
uint8
(
0
);
i
<
2
;
i
++
{
nextBlockNumber
,
err
:=
l2OutputOracle
.
NextBlockNumber
(
&
bind
.
CallOpts
{
Pending
:
true
,
Context
:
ctx
})
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
tx
,
err
=
blockHashOracle
.
Checkpoint
(
opts
)
require
.
NoError
(
err
)
r
,
err
:=
utils
.
WaitReceiptOK
(
ctx
,
client
,
tx
.
Hash
())
require
.
NoError
(
err
,
"failed to store block in blockoracle"
)
_
,
tx
,
_
,
err
=
bindings
.
DeployMIPS
(
opts
,
client
)
require
.
NoError
(
err
)
_
,
err
=
bind
.
WaitDeployed
(
ctx
,
client
,
tx
)
require
.
NoError
(
err
)
// Deploy the fault dispute game implementation
// Deploy the fault dispute game implementation
_
,
tx
,
_
,
err
=
bindings
.
DeployFaultDisputeGame
(
_
,
tx
,
_
,
err
=
bindings
.
DeployFaultDisputeGame
(
opts
,
opts
,
...
@@ -109,18 +72,49 @@ func deployDisputeGameContracts(require *require.Assertions, ctx context.Context
...
@@ -109,18 +72,49 @@ func deployDisputeGameContracts(require *require.Assertions, ctx context.Context
big
.
NewInt
(
alphabetGameDepth
),
big
.
NewInt
(
alphabetGameDepth
),
gameDuration
,
gameDuration
,
alphaVMAddr
,
alphaVMAddr
,
l
2OutputOracleAddr
,
predeploys
.
DevL
2OutputOracleAddr
,
blockHashOracleAddr
,
blockHashOracleAddr
,
)
)
require
.
NoError
(
err
)
require
.
NoError
(
err
)
faultDisputeGameAddr
,
err
:=
bind
.
WaitDeployed
(
ctx
,
client
,
tx
)
faultDisputeGameAddr
,
err
:=
bind
.
WaitDeployed
(
ctx
,
client
,
tx
)
require
.
NoError
(
err
)
require
.
NoError
(
err
)
// Create a proposer transactor
secrets
,
err
:=
e2eutils
.
DefaultMnemonicConfig
.
Secrets
()
require
.
NoError
(
err
)
chainId
,
err
:=
client
.
ChainID
(
ctx
)
require
.
NoError
(
err
)
proposerOpts
,
err
:=
bind
.
NewKeyedTransactorWithChainID
(
secrets
.
Proposer
,
chainId
)
require
.
NoError
(
err
)
// Propose 2 outputs
for
i
:=
uint8
(
0
);
i
<
2
;
i
++
{
nextBlockNumber
,
err
:=
l2OutputOracle
.
NextBlockNumber
(
&
bind
.
CallOpts
{
Pending
:
true
,
Context
:
ctx
})
require
.
NoError
(
err
)
block
,
err
:=
client
.
BlockByNumber
(
ctx
,
big
.
NewInt
(
int64
(
i
)))
require
.
NoError
(
err
)
tx
,
err
=
l2OutputOracle
.
ProposeL2Output
(
proposerOpts
,
[
32
]
byte
{
i
+
1
},
nextBlockNumber
,
block
.
Hash
(),
block
.
Number
())
require
.
NoError
(
err
)
_
,
err
=
utils
.
WaitReceiptOK
(
ctx
,
client
,
tx
.
Hash
())
require
.
NoError
(
err
)
}
// Set the fault game type implementation
// Set the fault game type implementation
tx
,
err
=
factory
.
SetImplementation
(
opts
,
faultGameType
,
faultDisputeGameAddr
)
tx
,
err
=
factory
.
SetImplementation
(
opts
,
faultGameType
,
faultDisputeGameAddr
)
require
.
NoError
(
err
)
require
.
NoError
(
err
)
_
,
err
=
utils
.
WaitReceiptOK
(
ctx
,
client
,
tx
.
Hash
())
_
,
err
=
utils
.
WaitReceiptOK
(
ctx
,
client
,
tx
.
Hash
())
require
.
NoError
(
err
,
"wait for final transaction to be included and OK"
)
require
.
NoError
(
err
,
"wait for final transaction to be included and OK"
)
// Wait for the block hash oracle to be ready to receive the checkpoint.
// The block time is hard coded at 13 seconds, should parameterize.
time
.
Sleep
(
15
*
time
.
Second
)
// Store the current block in the oracle
tx
,
err
=
blockHashOracle
.
Checkpoint
(
opts
)
require
.
NoError
(
err
)
r
,
err
:=
utils
.
WaitReceiptOK
(
ctx
,
client
,
tx
.
Hash
())
require
.
NoError
(
err
,
"failed to store block in blockoracle"
)
return
factory
,
new
(
big
.
Int
)
.
Sub
(
r
.
BlockNumber
,
big
.
NewInt
(
1
))
return
factory
,
new
(
big
.
Int
)
.
Sub
(
r
.
BlockNumber
,
big
.
NewInt
(
1
))
}
}
op-e2e/e2eutils/disputegame/helper.go
View file @
c9264c54
...
@@ -73,7 +73,7 @@ func (h *FactoryHelper) StartAlphabetGame(ctx context.Context, claimedAlphabet s
...
@@ -73,7 +73,7 @@ func (h *FactoryHelper) StartAlphabetGame(ctx context.Context, claimedAlphabet s
rootClaim
,
err
:=
trace
.
Get
(
ctx
,
lastAlphabetTraceIndex
)
rootClaim
,
err
:=
trace
.
Get
(
ctx
,
lastAlphabetTraceIndex
)
h
.
require
.
NoError
(
err
,
"get root claim"
)
h
.
require
.
NoError
(
err
,
"get root claim"
)
extraData
:=
make
([]
byte
,
64
)
extraData
:=
make
([]
byte
,
64
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
24
:
],
uint64
(
3600
))
binary
.
BigEndian
.
PutUint64
(
extraData
[
24
:
],
uint64
(
8
))
binary
.
BigEndian
.
PutUint64
(
extraData
[
56
:
],
h
.
l1Head
.
Uint64
())
binary
.
BigEndian
.
PutUint64
(
extraData
[
56
:
],
h
.
l1Head
.
Uint64
())
tx
,
err
:=
h
.
factory
.
Create
(
h
.
opts
,
faultGameType
,
rootClaim
,
extraData
)
tx
,
err
:=
h
.
factory
.
Create
(
h
.
opts
,
faultGameType
,
rootClaim
,
extraData
)
h
.
require
.
NoError
(
err
,
"create fault dispute game"
)
h
.
require
.
NoError
(
err
,
"create fault dispute game"
)
...
...
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