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
a9792032
Unverified
Commit
a9792032
authored
Aug 24, 2023
by
OptimismBot
Committed by
GitHub
Aug 24, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6999 from ethereum-optimism/aj/game-data-race
op-e2e: Wait for game data to be deleted
parents
589b00ab
9d6a8ccb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
6 deletions
+26
-6
helper.go
op-e2e/e2eutils/challenger/helper.go
+25
-5
faultproof_test.go
op-e2e/faultproof_test.go
+1
-1
No files found.
op-e2e/e2eutils/challenger/helper.go
View file @
a9792032
...
@@ -5,6 +5,7 @@ import (
...
@@ -5,6 +5,7 @@ import (
"crypto/ecdsa"
"crypto/ecdsa"
"encoding/json"
"encoding/json"
"errors"
"errors"
"fmt"
"os"
"os"
"path/filepath"
"path/filepath"
"testing"
"testing"
...
@@ -13,6 +14,7 @@ import (
...
@@ -13,6 +14,7 @@ import (
op_challenger
"github.com/ethereum-optimism/optimism/op-challenger"
op_challenger
"github.com/ethereum-optimism/optimism/op-challenger"
"github.com/ethereum-optimism/optimism/op-challenger/config"
"github.com/ethereum-optimism/optimism/op-challenger/config"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/wait"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
...
@@ -24,6 +26,7 @@ import (
...
@@ -24,6 +26,7 @@ import (
type
Helper
struct
{
type
Helper
struct
{
log
log
.
Logger
log
log
.
Logger
t
*
testing
.
T
require
*
require
.
Assertions
require
*
require
.
Assertions
dir
string
dir
string
cancel
func
()
cancel
func
()
...
@@ -108,6 +111,7 @@ func NewChallenger(t *testing.T, ctx context.Context, l1Endpoint string, name st
...
@@ -108,6 +111,7 @@ func NewChallenger(t *testing.T, ctx context.Context, l1Endpoint string, name st
}()
}()
return
&
Helper
{
return
&
Helper
{
log
:
log
,
log
:
log
,
t
:
t
,
require
:
require
.
New
(
t
),
require
:
require
.
New
(
t
),
dir
:
cfg
.
Datadir
,
dir
:
cfg
.
Datadir
,
cancel
:
cancel
,
cancel
:
cancel
,
...
@@ -171,11 +175,27 @@ func (h *Helper) VerifyGameDataExists(games ...GameAddr) {
...
@@ -171,11 +175,27 @@ func (h *Helper) VerifyGameDataExists(games ...GameAddr) {
}
}
}
}
func
(
h
*
Helper
)
VerifyNoGameDataExists
(
games
...
GameAddr
)
{
func
(
h
*
Helper
)
WaitForGameDataDeletion
(
ctx
context
.
Context
,
games
...
GameAddr
)
{
for
_
,
game
:=
range
games
{
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
30
*
time
.
Second
)
addr
:=
game
.
Addr
()
defer
cancel
()
h
.
require
.
NoDirExistsf
(
h
.
gameDataDir
(
addr
),
"should have data for game %v"
,
addr
)
err
:=
wait
.
For
(
ctx
,
time
.
Second
,
func
()
(
bool
,
error
)
{
}
for
_
,
game
:=
range
games
{
addr
:=
game
.
Addr
()
dir
:=
h
.
gameDataDir
(
addr
)
_
,
err
:=
os
.
Stat
(
dir
)
if
errors
.
Is
(
err
,
os
.
ErrNotExist
)
{
// This game has been successfully deleted
continue
}
if
err
!=
nil
{
return
false
,
fmt
.
Errorf
(
"failed to check dir %v is deleted: %w"
,
dir
,
err
)
}
h
.
t
.
Errorf
(
"Game data directory %v not yet deleted"
,
dir
)
return
false
,
nil
}
return
true
,
nil
})
h
.
require
.
NoErrorf
(
err
,
"should have deleted game data directories"
)
}
}
func
(
h
*
Helper
)
gameDataDir
(
addr
common
.
Address
)
string
{
func
(
h
*
Helper
)
gameDataDir
(
addr
common
.
Address
)
string
{
...
...
op-e2e/faultproof_test.go
View file @
a9792032
...
@@ -102,7 +102,7 @@ func TestMultipleCannonGames(t *testing.T) {
...
@@ -102,7 +102,7 @@ func TestMultipleCannonGames(t *testing.T) {
game2
.
WaitForGameStatus
(
ctx
,
disputegame
.
StatusChallengerWins
)
game2
.
WaitForGameStatus
(
ctx
,
disputegame
.
StatusChallengerWins
)
// Check that the game directories are removed
// Check that the game directories are removed
challenger
.
VerifyNoGameDataExists
(
game1
,
game2
)
challenger
.
WaitForGameDataDeletion
(
ctx
,
game1
,
game2
)
}
}
func
TestResolveDisputeGame
(
t
*
testing
.
T
)
{
func
TestResolveDisputeGame
(
t
*
testing
.
T
)
{
...
...
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