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
1f93dbae
Unverified
Commit
1f93dbae
authored
Jul 25, 2023
by
OptimismBot
Committed by
GitHub
Jul 25, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6439 from ethereum-optimism/refcell/solver-cleanup
fix(op-challenger): Cleanup Solver Internals
parents
49a765a4
95580606
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 @
1f93dbae
...
...
@@ -32,38 +32,14 @@ func (s *Solver) NextMove(claim types.Claim, agreeWithClaimLevel bool) (*types.C
if
agreeWithClaimLevel
{
return
nil
,
nil
}
// Special case of the root claim
if
claim
.
IsRoot
()
{
return
s
.
handleRoot
(
claim
)
if
claim
.
Depth
()
==
s
.
gameDepth
{
return
nil
,
types
.
ErrGameDepthReached
}
return
s
.
handleMiddle
(
claim
)
}
func
(
s
*
Solver
)
handleRoot
(
claim
types
.
Claim
)
(
*
types
.
Claim
,
error
)
{
agree
,
err
:=
s
.
agreeWithClaim
(
claim
.
ClaimData
)
if
err
!=
nil
{
return
nil
,
err
}
// Attack the root claim if we do not agree with it
// 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
{
if
agree
{
return
s
.
defend
(
claim
)
}
else
{
return
s
.
attack
(
claim
)
...
...
@@ -131,6 +107,9 @@ func (s *Solver) attack(claim types.Claim) (*types.Claim, error) {
// defend returns a response that defends the claim.
func
(
s
*
Solver
)
defend
(
claim
types
.
Claim
)
(
*
types
.
Claim
,
error
)
{
if
claim
.
IsRoot
()
{
return
nil
,
nil
}
position
:=
claim
.
Defend
()
value
,
err
:=
s
.
traceAtPosition
(
position
)
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