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
192f0a4d
Commit
192f0a4d
authored
Sep 27, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor position construction
parent
8003fe0f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
game_helper.go
op-e2e/e2eutils/disputegame/game_helper.go
+5
-0
honest_helper.go
op-e2e/e2eutils/disputegame/honest_helper.go
+1
-2
No files found.
op-e2e/e2eutils/disputegame/game_helper.go
View file @
192f0a4d
...
@@ -141,6 +141,11 @@ func (g *FaultGameHelper) getClaim(ctx context.Context, claimIdx int64) Contract
...
@@ -141,6 +141,11 @@ func (g *FaultGameHelper) getClaim(ctx context.Context, claimIdx int64) Contract
return
claimData
return
claimData
}
}
// getClaimPosition retrieves the [types.Position] of a claim at a specific index.
func
(
g
*
FaultGameHelper
)
getClaimPosition
(
ctx
context
.
Context
,
claimIdx
int64
)
types
.
Position
{
return
types
.
NewPositionFromGIndex
(
g
.
getClaim
(
ctx
,
claimIdx
)
.
Position
.
Uint64
())
}
func
(
g
*
FaultGameHelper
)
WaitForClaimAtDepth
(
ctx
context
.
Context
,
depth
int
)
{
func
(
g
*
FaultGameHelper
)
WaitForClaimAtDepth
(
ctx
context
.
Context
,
depth
int
)
{
g
.
waitForClaim
(
g
.
waitForClaim
(
ctx
,
ctx
,
...
...
op-e2e/e2eutils/disputegame/honest_helper.go
View file @
192f0a4d
...
@@ -44,8 +44,7 @@ func (h *HonestHelper) Defend(ctx context.Context, claimIdx int64) {
...
@@ -44,8 +44,7 @@ func (h *HonestHelper) Defend(ctx context.Context, claimIdx int64) {
func
(
h
*
HonestHelper
)
StepFails
(
ctx
context
.
Context
,
claimIdx
int64
,
isAttack
bool
)
{
func
(
h
*
HonestHelper
)
StepFails
(
ctx
context
.
Context
,
claimIdx
int64
,
isAttack
bool
)
{
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
2
*
time
.
Minute
)
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
2
*
time
.
Minute
)
defer
cancel
()
defer
cancel
()
claim
:=
h
.
game
.
getClaim
(
ctx
,
claimIdx
)
pos
:=
h
.
game
.
getClaimPosition
(
ctx
,
claimIdx
)
pos
:=
types
.
NewPositionFromGIndex
(
claim
.
Position
.
Uint64
())
if
!
isAttack
{
if
!
isAttack
{
// If we're defending, then the step will be from the trace to the next one
// If we're defending, then the step will be from the trace to the next one
pos
=
pos
.
MoveRight
()
pos
=
pos
.
MoveRight
()
...
...
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