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
bad663e1
Unverified
Commit
bad663e1
authored
Jul 20, 2023
by
OptimismBot
Committed by
GitHub
Jul 20, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6393 from ethereum-optimism/aj/challenger-ctx
op-challenger: Pass context through correctly
parents
21983e0f
ae696da1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
15 deletions
+15
-15
challenger.go
op-challenger/challenger.go
+2
-2
agent.go
op-challenger/fault/agent.go
+6
-6
caller.go
op-challenger/fault/caller.go
+7
-7
No files found.
op-challenger/challenger.go
View file @
bad663e1
...
...
@@ -52,10 +52,10 @@ func Main(ctx context.Context, logger log.Logger, cfg *config.Config) error {
_
=
agent
.
Act
(
ctx
)
status
,
_
:=
caller
.
GetGameStatus
(
ctx
)
if
status
!=
0
{
caller
.
LogGameStatus
()
caller
.
LogGameStatus
(
ctx
)
return
nil
}
else
{
caller
.
LogGameInfo
()
caller
.
LogGameInfo
(
ctx
)
}
select
{
case
<-
time
.
After
(
300
*
time
.
Millisecond
)
:
...
...
op-challenger/fault/agent.go
View file @
bad663e1
...
...
@@ -40,13 +40,13 @@ func (a *Agent) Act(ctx context.Context) error {
}
// Create counter claims
for
_
,
claim
:=
range
game
.
Claims
()
{
if
err
:=
a
.
move
(
claim
,
game
);
err
!=
nil
{
if
err
:=
a
.
move
(
c
tx
,
c
laim
,
game
);
err
!=
nil
{
log
.
Error
(
"Failed to move"
,
"err"
,
err
)
}
}
// Step on all leaf claims
for
_
,
claim
:=
range
game
.
Claims
()
{
if
err
:=
a
.
step
(
claim
,
game
);
err
!=
nil
{
if
err
:=
a
.
step
(
c
tx
,
c
laim
,
game
);
err
!=
nil
{
log
.
Error
(
"Failed to step"
,
"err"
,
err
)
}
}
...
...
@@ -83,7 +83,7 @@ func (a *Agent) newGameFromContracts(ctx context.Context) (Game, error) {
}
// move determines & executes the next move given a claim
func
(
a
*
Agent
)
move
(
claim
Claim
,
game
Game
)
error
{
func
(
a
*
Agent
)
move
(
c
tx
context
.
Context
,
c
laim
Claim
,
game
Game
)
error
{
nextMove
,
err
:=
a
.
solver
.
NextMove
(
claim
,
game
.
AgreeWithClaimLevel
(
claim
))
if
err
!=
nil
{
a
.
log
.
Warn
(
"Failed to execute the next move"
,
"err"
,
err
)
...
...
@@ -102,11 +102,11 @@ func (a *Agent) move(claim Claim, game Game) error {
return
nil
}
log
.
Info
(
"Performing move"
)
return
a
.
responder
.
Respond
(
c
ontext
.
TODO
()
,
move
)
return
a
.
responder
.
Respond
(
c
tx
,
move
)
}
// step determines & executes the next step against a leaf claim through the responder
func
(
a
*
Agent
)
step
(
claim
Claim
,
game
Game
)
error
{
func
(
a
*
Agent
)
step
(
c
tx
context
.
Context
,
c
laim
Claim
,
game
Game
)
error
{
if
claim
.
Depth
()
!=
a
.
maxDepth
{
return
nil
}
...
...
@@ -136,5 +136,5 @@ func (a *Agent) step(claim Claim, game Game) error {
IsAttack
:
step
.
IsAttack
,
StateData
:
step
.
PreState
,
}
return
a
.
responder
.
Step
(
c
ontext
.
TODO
()
,
callData
)
return
a
.
responder
.
Step
(
c
tx
,
callData
)
}
op-challenger/fault/caller.go
View file @
bad663e1
...
...
@@ -44,13 +44,13 @@ func NewFaultCallerFromBindings(fdgAddr common.Address, client *ethclient.Client
}
// LogGameInfo logs the game info.
func
(
fc
*
FaultCaller
)
LogGameInfo
()
{
status
,
err
:=
fc
.
GetGameStatus
(
c
ontext
.
Background
()
)
func
(
fc
*
FaultCaller
)
LogGameInfo
(
ctx
context
.
Context
)
{
status
,
err
:=
fc
.
GetGameStatus
(
c
tx
)
if
err
!=
nil
{
fc
.
log
.
Error
(
"failed to get game status"
,
"err"
,
err
)
return
}
claimLen
,
err
:=
fc
.
GetClaimDataLength
(
c
ontext
.
Background
()
)
claimLen
,
err
:=
fc
.
GetClaimDataLength
(
c
tx
)
if
err
!=
nil
{
fc
.
log
.
Error
(
"failed to get claim count"
,
"err"
,
err
)
return
...
...
@@ -66,8 +66,8 @@ func (fc *FaultCaller) GetGameStatus(ctx context.Context) (uint8, error) {
return
fc
.
Status
(
&
bind
.
CallOpts
{
Context
:
ctx
})
}
func
(
fc
*
FaultCaller
)
LogGameStatus
()
{
status
,
err
:=
fc
.
GetGameStatus
(
c
ontext
.
Background
()
)
func
(
fc
*
FaultCaller
)
LogGameStatus
(
ctx
context
.
Context
)
{
status
,
err
:=
fc
.
GetGameStatus
(
c
tx
)
if
err
!=
nil
{
fc
.
log
.
Error
(
"failed to get game status"
,
"err"
,
err
)
return
...
...
@@ -80,8 +80,8 @@ func (fc *FaultCaller) GetClaimDataLength(ctx context.Context) (*big.Int, error)
return
fc
.
ClaimDataLen
(
&
bind
.
CallOpts
{
Context
:
ctx
})
}
func
(
fc
*
FaultCaller
)
LogClaimDataLength
()
{
claimLen
,
err
:=
fc
.
GetClaimDataLength
(
c
ontext
.
Background
()
)
func
(
fc
*
FaultCaller
)
LogClaimDataLength
(
ctx
context
.
Context
)
{
claimLen
,
err
:=
fc
.
GetClaimDataLength
(
c
tx
)
if
err
!=
nil
{
fc
.
log
.
Error
(
"failed to get claim count"
,
"err"
,
err
)
return
...
...
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