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
fea7e916
Commit
fea7e916
authored
Aug 03, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use time travel clock over sleeping the test thread
parent
9ce2a4c7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
deploy.go
op-e2e/e2eutils/disputegame/deploy.go
+3
-2
helper.go
op-e2e/e2eutils/disputegame/helper.go
+3
-2
faultproof_test.go
op-e2e/faultproof_test.go
+2
-2
No files found.
op-e2e/e2eutils/disputegame/deploy.go
View file @
fea7e916
...
...
@@ -10,6 +10,7 @@ import (
"github.com/ethereum-optimism/optimism/op-e2e/config"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-service/client/utils"
"github.com/ethereum-optimism/optimism/op-service/clock"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/stretchr/testify/require"
...
...
@@ -19,7 +20,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
,
*
big
.
Int
)
{
func
deployDisputeGameContracts
(
require
*
require
.
Assertions
,
ctx
context
.
Context
,
cl
ock
*
clock
.
AdvancingClock
,
cl
ient
*
ethclient
.
Client
,
opts
*
bind
.
TransactOpts
,
gameDuration
uint64
)
(
*
bindings
.
DisputeGameFactory
,
*
big
.
Int
)
{
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
5
*
time
.
Minute
)
defer
cancel
()
// Deploy the proxy
...
...
@@ -108,7 +109,7 @@ func deployDisputeGameContracts(require *require.Assertions, ctx context.Context
// 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
)
clock
.
AdvanceTime
(
13
*
time
.
Second
)
// Store the current block in the oracle
tx
,
err
=
blockHashOracle
.
Checkpoint
(
opts
)
...
...
op-e2e/e2eutils/disputegame/helper.go
View file @
fea7e916
...
...
@@ -15,6 +15,7 @@ import (
"github.com/ethereum-optimism/optimism/op-challenger/fault/types"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/challenger"
"github.com/ethereum-optimism/optimism/op-service/client/utils"
"github.com/ethereum-optimism/optimism/op-service/clock"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
...
...
@@ -47,14 +48,14 @@ type FactoryHelper struct {
l1Head
*
big
.
Int
}
func
NewFactoryHelper
(
t
*
testing
.
T
,
ctx
context
.
Context
,
client
*
ethclient
.
Client
,
gameDuration
uint64
)
*
FactoryHelper
{
func
NewFactoryHelper
(
t
*
testing
.
T
,
ctx
context
.
Context
,
cl
ock
*
clock
.
AdvancingClock
,
cl
ient
*
ethclient
.
Client
,
gameDuration
uint64
)
*
FactoryHelper
{
require
:=
require
.
New
(
t
)
chainID
,
err
:=
client
.
ChainID
(
ctx
)
require
.
NoError
(
err
)
opts
,
err
:=
bind
.
NewKeyedTransactorWithChainID
(
deployer
.
TestKey
,
chainID
)
require
.
NoError
(
err
)
factory
,
l1Head
:=
deployDisputeGameContracts
(
require
,
ctx
,
client
,
opts
,
gameDuration
)
factory
,
l1Head
:=
deployDisputeGameContracts
(
require
,
ctx
,
cl
ock
,
cl
ient
,
opts
,
gameDuration
)
return
&
FactoryHelper
{
t
:
t
,
...
...
op-e2e/faultproof_test.go
View file @
fea7e916
...
...
@@ -21,7 +21,7 @@ func TestResolveDisputeGame(t *testing.T) {
t
.
Cleanup
(
sys
.
Close
)
gameDuration
:=
24
*
time
.
Hour
disputeGameFactory
:=
disputegame
.
NewFactoryHelper
(
t
,
ctx
,
l1Client
,
uint64
(
gameDuration
.
Seconds
()))
disputeGameFactory
:=
disputegame
.
NewFactoryHelper
(
t
,
ctx
,
sys
.
TimeTravelClock
,
l1Client
,
uint64
(
gameDuration
.
Seconds
()))
game
:=
disputeGameFactory
.
StartAlphabetGame
(
ctx
,
"zyxwvut"
)
require
.
NotNil
(
t
,
game
)
...
...
@@ -119,7 +119,7 @@ func TestChallengerCompleteDisputeGame(t *testing.T) {
t
.
Cleanup
(
sys
.
Close
)
gameDuration
:=
24
*
time
.
Hour
disputeGameFactory
:=
disputegame
.
NewFactoryHelper
(
t
,
ctx
,
l1Client
,
uint64
(
gameDuration
.
Seconds
()))
disputeGameFactory
:=
disputegame
.
NewFactoryHelper
(
t
,
ctx
,
sys
.
TimeTravelClock
,
l1Client
,
uint64
(
gameDuration
.
Seconds
()))
game
:=
disputeGameFactory
.
StartAlphabetGame
(
ctx
,
test
.
rootClaimAlphabet
)
require
.
NotNil
(
t
,
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