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
8d720b21
Unverified
Commit
8d720b21
authored
Jul 19, 2023
by
OptimismBot
Committed by
GitHub
Jul 19, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6353 from ethereum-optimism/refcell/enforce-step-on-non-agree
fix(op-challenger): Enforce Step Response
parents
a4ae46d3
47902841
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
6 deletions
+21
-6
agent.go
op-challenger/fault/agent.go
+3
-2
solver.go
op-challenger/fault/solver.go
+4
-1
solver_test.go
op-challenger/fault/solver_test.go
+14
-3
No files found.
op-challenger/fault/agent.go
View file @
8d720b21
...
@@ -95,7 +95,8 @@ func (a *Agent) step(claim Claim, game Game) error {
...
@@ -95,7 +95,8 @@ func (a *Agent) step(claim Claim, game Game) error {
return
nil
return
nil
}
}
if
game
.
AgreeWithClaimLevel
(
claim
)
{
agreeWithClaimLevel
:=
game
.
AgreeWithClaimLevel
(
claim
)
if
agreeWithClaimLevel
{
a
.
log
.
Warn
(
"Agree with leaf claim, skipping step"
,
"claim_depth"
,
claim
.
Depth
(),
"maxDepth"
,
a
.
maxDepth
)
a
.
log
.
Warn
(
"Agree with leaf claim, skipping step"
,
"claim_depth"
,
claim
.
Depth
(),
"maxDepth"
,
a
.
maxDepth
)
return
nil
return
nil
}
}
...
@@ -106,7 +107,7 @@ func (a *Agent) step(claim Claim, game Game) error {
...
@@ -106,7 +107,7 @@ func (a *Agent) step(claim Claim, game Game) error {
}
}
a
.
log
.
Info
(
"Attempting step"
,
"claim_depth"
,
claim
.
Depth
(),
"maxDepth"
,
a
.
maxDepth
)
a
.
log
.
Info
(
"Attempting step"
,
"claim_depth"
,
claim
.
Depth
(),
"maxDepth"
,
a
.
maxDepth
)
step
,
err
:=
a
.
solver
.
AttemptStep
(
claim
)
step
,
err
:=
a
.
solver
.
AttemptStep
(
claim
,
agreeWithClaimLevel
)
if
err
!=
nil
{
if
err
!=
nil
{
a
.
log
.
Warn
(
"Failed to get a step"
,
"err"
,
err
)
a
.
log
.
Warn
(
"Failed to get a step"
,
"err"
,
err
)
return
err
return
err
...
...
op-challenger/fault/solver.go
View file @
8d720b21
...
@@ -71,10 +71,13 @@ type StepData struct {
...
@@ -71,10 +71,13 @@ type StepData struct {
// AttemptStep determines what step should occur for a given leaf claim.
// AttemptStep determines what step should occur for a given leaf claim.
// An error will be returned if the claim is not at the max depth.
// An error will be returned if the claim is not at the max depth.
func
(
s
*
Solver
)
AttemptStep
(
claim
Claim
)
(
StepData
,
error
)
{
func
(
s
*
Solver
)
AttemptStep
(
claim
Claim
,
agreeWithClaimLevel
bool
)
(
StepData
,
error
)
{
if
claim
.
Depth
()
!=
s
.
gameDepth
{
if
claim
.
Depth
()
!=
s
.
gameDepth
{
return
StepData
{},
errors
.
New
(
"cannot step on non-leaf claims"
)
return
StepData
{},
errors
.
New
(
"cannot step on non-leaf claims"
)
}
}
if
agreeWithClaimLevel
{
return
StepData
{},
errors
.
New
(
"cannot step on claims we agree with"
)
}
claimCorrect
,
err
:=
s
.
agreeWithClaim
(
claim
.
ClaimData
)
claimCorrect
,
err
:=
s
.
agreeWithClaim
(
claim
.
ClaimData
)
if
err
!=
nil
{
if
err
!=
nil
{
return
StepData
{},
err
return
StepData
{},
err
...
...
op-challenger/fault/solver_test.go
View file @
8d720b21
...
@@ -111,18 +111,29 @@ func TestAttemptStep(t *testing.T) {
...
@@ -111,18 +111,29 @@ func TestAttemptStep(t *testing.T) {
},
},
}
}
step
,
err
:=
solver
.
AttemptStep
(
bottom
)
step
,
err
:=
solver
.
AttemptStep
(
bottom
,
false
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
bottom
,
step
.
LeafClaim
)
require
.
Equal
(
t
,
bottom
,
step
.
LeafClaim
)
require
.
True
(
t
,
step
.
IsAttack
)
require
.
True
(
t
,
step
.
IsAttack
)
require
.
Equal
(
t
,
step
.
PreState
,
BuildAlphabetPreimage
(
3
,
"d"
))
require
.
Equal
(
t
,
step
.
PreState
,
BuildAlphabetPreimage
(
3
,
"d"
))
_
,
err
=
solver
.
AttemptStep
(
middle
)
_
,
err
=
solver
.
AttemptStep
(
middle
,
false
)
require
.
Error
(
t
,
err
)
require
.
Error
(
t
,
err
)
step
,
err
=
solver
.
AttemptStep
(
zero
)
step
,
err
=
solver
.
AttemptStep
(
zero
,
false
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
zero
,
step
.
LeafClaim
)
require
.
Equal
(
t
,
zero
,
step
.
LeafClaim
)
require
.
True
(
t
,
step
.
IsAttack
)
require
.
True
(
t
,
step
.
IsAttack
)
require
.
Equal
(
t
,
canonicalProvider
.
AbsolutePreState
(),
step
.
PreState
)
require
.
Equal
(
t
,
canonicalProvider
.
AbsolutePreState
(),
step
.
PreState
)
}
}
func
TestAttempStep_AgreeWithClaimLevel_Fails
(
t
*
testing
.
T
)
{
maxDepth
:=
3
canonicalProvider
:=
NewAlphabetProvider
(
"abcdefgh"
,
uint64
(
maxDepth
))
solver
:=
NewSolver
(
maxDepth
,
canonicalProvider
)
_
,
_
,
middle
,
_
:=
createTestClaims
()
step
,
err
:=
solver
.
AttemptStep
(
middle
,
true
)
require
.
Error
(
t
,
err
)
require
.
Equal
(
t
,
StepData
{},
step
)
}
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