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
e1f8f6a0
Commit
e1f8f6a0
authored
Sep 27, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix small issues
parent
9393fc75
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
22 deletions
+14
-22
solver.go
op-challenger/game/fault/solver/solver.go
+1
-1
claim_builder.go
op-challenger/game/fault/test/claim_builder.go
+10
-18
position.go
op-challenger/game/fault/types/position.go
+3
-3
No files found.
op-challenger/game/fault/solver/solver.go
View file @
e1f8f6a0
...
...
@@ -110,7 +110,7 @@ func (s *claimSolver) AttemptStep(ctx context.Context, game types.Game, claim ty
}
else
{
// We agree with the claim so Defend and use this claim as the starting point to
// execute the step after. Thus we need the pre-state of the next step.
preState
,
proofData
,
oracleData
,
err
=
s
.
trace
.
GetStepData
(
ctx
,
claim
.
NextStepPosition
(
s
.
gameDepth
))
preState
,
proofData
,
oracleData
,
err
=
s
.
trace
.
GetStepData
(
ctx
,
claim
.
MoveRight
(
))
if
err
!=
nil
{
return
StepData
{},
err
}
...
...
op-challenger/game/fault/test/claim_builder.go
View file @
e1f8f6a0
...
...
@@ -31,14 +31,6 @@ func (c *ClaimBuilder) CorrectTraceProvider() types.TraceProvider {
return
c
.
correct
}
// CorrectClaim returns the canonical claim at a specified trace index
func
(
c
*
ClaimBuilder
)
CorrectClaim
(
idx
uint64
)
common
.
Hash
{
pos
:=
types
.
NewPosition
(
c
.
maxDepth
,
int
(
idx
))
value
,
err
:=
c
.
correct
.
Get
(
context
.
Background
(),
pos
)
c
.
require
.
NoError
(
err
)
return
value
}
// CorrectClaimAtPosition returns the canonical claim at a specified position
func
(
c
*
ClaimBuilder
)
CorrectClaimAtPosition
(
pos
types
.
Position
)
common
.
Hash
{
value
,
err
:=
c
.
correct
.
Get
(
context
.
Background
(),
pos
)
...
...
@@ -69,20 +61,20 @@ func (c *ClaimBuilder) CorrectOracleData(idx uint64) *types.PreimageOracleData {
return
data
}
func
(
c
*
ClaimBuilder
)
incorrectClaim
(
idx
uint64
)
common
.
Hash
{
return
common
.
BigToHash
(
new
(
big
.
Int
)
.
SetUint64
(
idx
))
func
(
c
*
ClaimBuilder
)
incorrectClaim
(
pos
types
.
Position
)
common
.
Hash
{
return
common
.
BigToHash
(
new
(
big
.
Int
)
.
SetUint64
(
pos
.
TraceIndex
(
c
.
maxDepth
)
))
}
func
(
c
*
ClaimBuilder
)
claim
(
idx
uint64
,
correct
bool
)
common
.
Hash
{
func
(
c
*
ClaimBuilder
)
claim
(
pos
types
.
Position
,
correct
bool
)
common
.
Hash
{
if
correct
{
return
c
.
CorrectClaim
(
idx
)
return
c
.
CorrectClaim
AtPosition
(
pos
)
}
else
{
return
c
.
incorrectClaim
(
idx
)
return
c
.
incorrectClaim
(
pos
)
}
}
func
(
c
*
ClaimBuilder
)
CreateRootClaim
(
correct
bool
)
types
.
Claim
{
value
:=
c
.
claim
(
(
1
<<
c
.
maxDepth
)
-
1
,
correct
)
value
:=
c
.
claim
(
types
.
NewPositionFromGIndex
((
1
<<
c
.
maxDepth
)
-
1
)
,
correct
)
claim
:=
types
.
Claim
{
ClaimData
:
types
.
ClaimData
{
Value
:
value
,
...
...
@@ -97,11 +89,11 @@ func (c *ClaimBuilder) CreateLeafClaim(traceIndex uint64, correct bool) types.Cl
pos
:=
types
.
NewPosition
(
c
.
maxDepth
,
int
(
traceIndex
))
return
types
.
Claim
{
ClaimData
:
types
.
ClaimData
{
Value
:
c
.
claim
(
pos
.
TraceIndex
(
c
.
maxDepth
)
,
correct
),
Value
:
c
.
claim
(
pos
,
correct
),
Position
:
pos
,
},
Parent
:
types
.
ClaimData
{
Value
:
c
.
claim
(
parentPos
.
TraceIndex
(
c
.
maxDepth
)
,
!
correct
),
Value
:
c
.
claim
(
parentPos
,
!
correct
),
Position
:
parentPos
,
},
}
...
...
@@ -111,7 +103,7 @@ func (c *ClaimBuilder) AttackClaim(claim types.Claim, correct bool) types.Claim
pos
:=
claim
.
Position
.
Attack
()
return
types
.
Claim
{
ClaimData
:
types
.
ClaimData
{
Value
:
c
.
claim
(
pos
.
TraceIndex
(
c
.
maxDepth
)
,
correct
),
Value
:
c
.
claim
(
pos
,
correct
),
Position
:
pos
,
},
Parent
:
claim
.
ClaimData
,
...
...
@@ -135,7 +127,7 @@ func (c *ClaimBuilder) DefendClaim(claim types.Claim, correct bool) types.Claim
pos
:=
claim
.
Position
.
Defend
()
return
types
.
Claim
{
ClaimData
:
types
.
ClaimData
{
Value
:
c
.
claim
(
pos
.
TraceIndex
(
c
.
maxDepth
)
,
correct
),
Value
:
c
.
claim
(
pos
,
correct
),
Position
:
pos
,
},
Parent
:
claim
.
ClaimData
,
...
...
op-challenger/game/fault/types/position.go
View file @
e1f8f6a0
...
...
@@ -18,10 +18,10 @@ func NewPositionFromGIndex(x uint64) Position {
return
NewPosition
(
depth
,
int
(
indexAtDepth
))
}
func
(
p
Position
)
NextStepPosition
(
gameDepth
int
)
Position
{
func
(
p
Position
)
MoveRight
(
)
Position
{
return
Position
{
depth
:
gameD
epth
,
indexAtDepth
:
int
(
p
.
TraceIndex
(
gameDepth
)
+
1
),
depth
:
p
.
d
epth
,
indexAtDepth
:
int
(
p
.
indexAtDepth
+
1
),
}
}
...
...
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