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
9d51d103
Unverified
Commit
9d51d103
authored
Jul 21, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-e2e: Expect the challenger to resolve the game
parent
4bad280b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
helper.go
op-e2e/e2eutils/disputegame/helper.go
+13
-4
faultproof_test.go
op-e2e/faultproof_test.go
+3
-4
No files found.
op-e2e/e2eutils/disputegame/helper.go
View file @
9d51d103
...
@@ -2,6 +2,7 @@ package disputegame
...
@@ -2,6 +2,7 @@ package disputegame
import
(
import
(
"context"
"context"
"fmt"
"math"
"math"
"math/big"
"math/big"
"testing"
"testing"
...
@@ -134,10 +135,18 @@ func (g *FaultGameHelper) Resolve(ctx context.Context) {
...
@@ -134,10 +135,18 @@ func (g *FaultGameHelper) Resolve(ctx context.Context) {
g
.
require
.
NoError
(
err
)
g
.
require
.
NoError
(
err
)
}
}
func
(
g
*
FaultGameHelper
)
AssertStatusEqual
s
(
ctx
context
.
Context
,
expected
Status
)
{
func
(
g
*
FaultGameHelper
)
WaitForGameStatu
s
(
ctx
context
.
Context
,
expected
Status
)
{
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
1
*
time
.
Minute
)
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
1
*
time
.
Minute
)
defer
cancel
()
defer
cancel
()
status
,
err
:=
g
.
game
.
Status
(
&
bind
.
CallOpts
{
Context
:
ctx
})
err
:=
utils
.
WaitFor
(
ctx
,
1
*
time
.
Second
,
func
()
(
bool
,
error
)
{
g
.
require
.
NoError
(
err
)
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
30
*
time
.
Second
)
g
.
require
.
Equal
(
expected
,
Status
(
status
))
defer
cancel
()
status
,
err
:=
g
.
game
.
Status
(
&
bind
.
CallOpts
{
Context
:
ctx
})
if
err
!=
nil
{
return
false
,
fmt
.
Errorf
(
"game status unavailable: %w"
,
err
)
}
return
expected
==
Status
(
status
),
nil
})
g
.
require
.
NoError
(
err
,
"wait for game status"
)
}
}
op-e2e/faultproof_test.go
View file @
9d51d103
...
@@ -32,7 +32,7 @@ func TestResolveDisputeGame(t *testing.T) {
...
@@ -32,7 +32,7 @@ func TestResolveDisputeGame(t *testing.T) {
game
:=
disputeGameFactory
.
StartAlphabetGame
(
ctx
,
"zyxwvut"
)
game
:=
disputeGameFactory
.
StartAlphabetGame
(
ctx
,
"zyxwvut"
)
require
.
NotNil
(
t
,
game
)
require
.
NotNil
(
t
,
game
)
game
.
AssertStatusEqual
s
(
ctx
,
disputegame
.
StatusInProgress
)
game
.
WaitForGameStatu
s
(
ctx
,
disputegame
.
StatusInProgress
)
honest
:=
game
.
StartChallenger
(
ctx
,
sys
.
NodeEndpoint
(
"l1"
),
"honestAlice"
,
func
(
c
*
config
.
Config
)
{
honest
:=
game
.
StartChallenger
(
ctx
,
sys
.
NodeEndpoint
(
"l1"
),
"honestAlice"
,
func
(
c
*
config
.
Config
)
{
c
.
AgreeWithProposedOutput
=
true
// Agree with the proposed output, so disagree with the root claim
c
.
AgreeWithProposedOutput
=
true
// Agree with the proposed output, so disagree with the root claim
...
@@ -46,8 +46,7 @@ func TestResolveDisputeGame(t *testing.T) {
...
@@ -46,8 +46,7 @@ func TestResolveDisputeGame(t *testing.T) {
sys
.
TimeTravelClock
.
AdvanceTime
(
gameDuration
)
sys
.
TimeTravelClock
.
AdvanceTime
(
gameDuration
)
require
.
NoError
(
t
,
utils
.
WaitNextBlock
(
ctx
,
l1Client
))
require
.
NoError
(
t
,
utils
.
WaitNextBlock
(
ctx
,
l1Client
))
game
.
Resolve
(
ctx
)
// Challenger should resolve the game now that the clocks have expired.
game
.
WaitForGameStatus
(
ctx
,
disputegame
.
StatusChallengerWins
)
game
.
AssertStatusEquals
(
ctx
,
disputegame
.
StatusChallengerWins
)
require
.
NoError
(
t
,
honest
.
Close
())
require
.
NoError
(
t
,
honest
.
Close
())
}
}
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