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
b5515f2a
Unverified
Commit
b5515f2a
authored
Jul 25, 2023
by
mergify[bot]
Committed by
GitHub
Jul 25, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into feat/l1-deployments
parents
f5f5e275
1f93dbae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
27 deletions
+6
-27
solver.go
op-challenger/fault/solver/solver.go
+6
-27
No files found.
op-challenger/fault/solver/solver.go
View file @
b5515f2a
...
@@ -32,38 +32,14 @@ func (s *Solver) NextMove(claim types.Claim, agreeWithClaimLevel bool) (*types.C
...
@@ -32,38 +32,14 @@ func (s *Solver) NextMove(claim types.Claim, agreeWithClaimLevel bool) (*types.C
if
agreeWithClaimLevel
{
if
agreeWithClaimLevel
{
return
nil
,
nil
return
nil
,
nil
}
}
if
claim
.
Depth
()
==
s
.
gameDepth
{
// Special case of the root claim
return
nil
,
types
.
ErrGameDepthReached
if
claim
.
IsRoot
()
{
return
s
.
handleRoot
(
claim
)
}
}
return
s
.
handleMiddle
(
claim
)
}
func
(
s
*
Solver
)
handleRoot
(
claim
types
.
Claim
)
(
*
types
.
Claim
,
error
)
{
agree
,
err
:=
s
.
agreeWithClaim
(
claim
.
ClaimData
)
agree
,
err
:=
s
.
agreeWithClaim
(
claim
.
ClaimData
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
// Attack the root claim if we do not agree with it
if
agree
{
// Note: We always disagree with the claim level at this point,
// so if we agree with claim maybe we should also attack?
if
!
agree
{
return
s
.
attack
(
claim
)
}
else
{
return
nil
,
nil
}
}
func
(
s
*
Solver
)
handleMiddle
(
claim
types
.
Claim
)
(
*
types
.
Claim
,
error
)
{
claimCorrect
,
err
:=
s
.
agreeWithClaim
(
claim
.
ClaimData
)
if
err
!=
nil
{
return
nil
,
err
}
if
claim
.
Depth
()
==
s
.
gameDepth
{
return
nil
,
types
.
ErrGameDepthReached
}
if
claimCorrect
{
return
s
.
defend
(
claim
)
return
s
.
defend
(
claim
)
}
else
{
}
else
{
return
s
.
attack
(
claim
)
return
s
.
attack
(
claim
)
...
@@ -131,6 +107,9 @@ func (s *Solver) attack(claim types.Claim) (*types.Claim, error) {
...
@@ -131,6 +107,9 @@ func (s *Solver) attack(claim types.Claim) (*types.Claim, error) {
// defend returns a response that defends the claim.
// defend returns a response that defends the claim.
func
(
s
*
Solver
)
defend
(
claim
types
.
Claim
)
(
*
types
.
Claim
,
error
)
{
func
(
s
*
Solver
)
defend
(
claim
types
.
Claim
)
(
*
types
.
Claim
,
error
)
{
if
claim
.
IsRoot
()
{
return
nil
,
nil
}
position
:=
claim
.
Defend
()
position
:=
claim
.
Defend
()
value
,
err
:=
s
.
traceAtPosition
(
position
)
value
,
err
:=
s
.
traceAtPosition
(
position
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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