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
31f92e2c
Unverified
Commit
31f92e2c
authored
Aug 23, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-e2e: Assert deletion of game data in fault proof e2e tests
parent
8bb5046e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
9 deletions
+43
-9
helper.go
op-e2e/e2eutils/challenger/helper.go
+32
-6
game_helper.go
op-e2e/e2eutils/disputegame/game_helper.go
+4
-0
faultproof_test.go
op-e2e/faultproof_test.go
+7
-3
No files found.
op-e2e/e2eutils/challenger/helper.go
View file @
31f92e2c
...
@@ -24,6 +24,8 @@ import (
...
@@ -24,6 +24,8 @@ import (
type
Helper
struct
{
type
Helper
struct
{
log
log
.
Logger
log
log
.
Logger
require
*
require
.
Assertions
dir
string
cancel
func
()
cancel
func
()
errors
chan
error
errors
chan
error
}
}
...
@@ -106,6 +108,8 @@ func NewChallenger(t *testing.T, ctx context.Context, l1Endpoint string, name st
...
@@ -106,6 +108,8 @@ func NewChallenger(t *testing.T, ctx context.Context, l1Endpoint string, name st
}()
}()
return
&
Helper
{
return
&
Helper
{
log
:
log
,
log
:
log
,
require
:
require
.
New
(
t
),
dir
:
cfg
.
Datadir
,
cancel
:
cancel
,
cancel
:
cancel
,
errors
:
errCh
,
errors
:
errCh
,
}
}
...
@@ -155,3 +159,25 @@ func (h *Helper) Close() error {
...
@@ -155,3 +159,25 @@ func (h *Helper) Close() error {
return
nil
return
nil
}
}
}
}
type
GameAddr
interface
{
Addr
()
common
.
Address
}
func
(
h
*
Helper
)
VerifyGameDataExists
(
games
...
GameAddr
)
{
for
_
,
game
:=
range
games
{
addr
:=
game
.
Addr
()
h
.
require
.
DirExistsf
(
h
.
gameDataDir
(
addr
),
"should have data for game %v"
,
addr
)
}
}
func
(
h
*
Helper
)
VerifyNoGameDataExists
(
games
...
GameAddr
)
{
for
_
,
game
:=
range
games
{
addr
:=
game
.
Addr
()
h
.
require
.
NoDirExistsf
(
h
.
gameDataDir
(
addr
),
"should have data for game %v"
,
addr
)
}
}
func
(
h
*
Helper
)
gameDataDir
(
addr
common
.
Address
)
string
{
return
filepath
.
Join
(
h
.
dir
,
addr
.
Hex
())
}
op-e2e/e2eutils/disputegame/game_helper.go
View file @
31f92e2c
...
@@ -26,6 +26,10 @@ type FaultGameHelper struct {
...
@@ -26,6 +26,10 @@ type FaultGameHelper struct {
addr
common
.
Address
addr
common
.
Address
}
}
func
(
g
*
FaultGameHelper
)
Addr
()
common
.
Address
{
return
g
.
addr
}
func
(
g
*
FaultGameHelper
)
GameDuration
(
ctx
context
.
Context
)
time
.
Duration
{
func
(
g
*
FaultGameHelper
)
GameDuration
(
ctx
context
.
Context
)
time
.
Duration
{
duration
,
err
:=
g
.
game
.
GAMEDURATION
(
&
bind
.
CallOpts
{
Context
:
ctx
})
duration
,
err
:=
g
.
game
.
GAMEDURATION
(
&
bind
.
CallOpts
{
Context
:
ctx
})
g
.
require
.
NoError
(
err
,
"failed to get game duration"
)
g
.
require
.
NoError
(
err
,
"failed to get game duration"
)
...
...
op-e2e/faultproof_test.go
View file @
31f92e2c
...
@@ -58,7 +58,7 @@ func TestMultipleCannonGames(t *testing.T) {
...
@@ -58,7 +58,7 @@ func TestMultipleCannonGames(t *testing.T) {
gameFactory
:=
disputegame
.
NewFactoryHelper
(
t
,
ctx
,
sys
.
cfg
.
L1Deployments
,
l1Client
)
gameFactory
:=
disputegame
.
NewFactoryHelper
(
t
,
ctx
,
sys
.
cfg
.
L1Deployments
,
l1Client
)
// Start a challenger with the correct alphabet trace
// Start a challenger with the correct alphabet trace
gameFactory
.
StartChallenger
(
ctx
,
sys
.
NodeEndpoint
(
"l1"
),
"TowerDefense"
,
challenger
:=
gameFactory
.
StartChallenger
(
ctx
,
sys
.
NodeEndpoint
(
"l1"
),
"TowerDefense"
,
challenger
.
WithCannon
(
t
,
sys
.
RollupConfig
,
sys
.
L2GenesisCfg
,
sys
.
NodeEndpoint
(
"sequencer"
)),
challenger
.
WithCannon
(
t
,
sys
.
RollupConfig
,
sys
.
L2GenesisCfg
,
sys
.
NodeEndpoint
(
"sequencer"
)),
challenger
.
WithPrivKey
(
sys
.
cfg
.
Secrets
.
Alice
),
challenger
.
WithPrivKey
(
sys
.
cfg
.
Secrets
.
Alice
),
challenger
.
WithAgreeProposedOutput
(
true
),
challenger
.
WithAgreeProposedOutput
(
true
),
...
@@ -74,6 +74,9 @@ func TestMultipleCannonGames(t *testing.T) {
...
@@ -74,6 +74,9 @@ func TestMultipleCannonGames(t *testing.T) {
game2Claim
:=
game2
.
GetClaimValue
(
ctx
,
1
)
game2Claim
:=
game2
.
GetClaimValue
(
ctx
,
1
)
require
.
NotEqual
(
t
,
game1Claim
,
game2Claim
,
"games should have different cannon traces"
)
require
.
NotEqual
(
t
,
game1Claim
,
game2Claim
,
"games should have different cannon traces"
)
// Check that the helper finds the game directories correctly
challenger
.
VerifyGameDataExists
(
game1
,
game2
)
// Push both games down to the step function
// Push both games down to the step function
maxDepth
:=
game1
.
MaxDepth
(
ctx
)
maxDepth
:=
game1
.
MaxDepth
(
ctx
)
for
claimCount
:=
int64
(
1
);
claimCount
<=
maxDepth
;
{
for
claimCount
:=
int64
(
1
);
claimCount
<=
maxDepth
;
{
...
@@ -97,8 +100,9 @@ func TestMultipleCannonGames(t *testing.T) {
...
@@ -97,8 +100,9 @@ func TestMultipleCannonGames(t *testing.T) {
game1
.
WaitForGameStatus
(
ctx
,
disputegame
.
StatusChallengerWins
)
game1
.
WaitForGameStatus
(
ctx
,
disputegame
.
StatusChallengerWins
)
game2
.
WaitForGameStatus
(
ctx
,
disputegame
.
StatusChallengerWins
)
game2
.
WaitForGameStatus
(
ctx
,
disputegame
.
StatusChallengerWins
)
game1
.
LogGameData
(
ctx
)
game2
.
LogGameData
(
ctx
)
// Check that the game directories are removed
challenger
.
VerifyNoGameDataExists
(
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