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
bbc3786d
Unverified
Commit
bbc3786d
authored
May 11, 2024
by
Adrian Sutton
Committed by
GitHub
May 11, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-challenger: Add resolve-claim subcommand. (#10504)
parent
1a20fd9c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
12 deletions
+96
-12
README.md
op-challenger/README.md
+24
-12
main.go
op-challenger/cmd/main.go
+1
-0
resolve_claim.go
op-challenger/cmd/resolve_claim.go
+71
-0
No files found.
op-challenger/README.md
View file @
bbc3786d
...
@@ -70,7 +70,7 @@ used in production and are intended to provide convenient manual testing.
...
@@ -70,7 +70,7 @@ used in production and are intended to provide convenient manual testing.
--game-address
<GAME_FACTORY_ADDRESS>
\
--game-address
<GAME_FACTORY_ADDRESS>
\
--output-root
<OUTPUT_ROOT>
\
--output-root
<OUTPUT_ROOT>
\
--l2-block-num
<L2_BLOCK_NUM>
\
--l2-block-num
<L2_BLOCK_NUM>
\
...
<SIGNER_ARGS>
<SIGNER_ARGS>
```
```
Starts a new fault dispute game that disputes the latest output proposal
Starts a new fault dispute game that disputes the latest output proposal
...
@@ -80,9 +80,7 @@ in the L2 output oracle.
...
@@ -80,9 +80,7 @@ in the L2 output oracle.
*
`GAME_FACTORY_ADDRESS`
- the address of the dispute game factory contract on L1.
*
`GAME_FACTORY_ADDRESS`
- the address of the dispute game factory contract on L1.
*
`OUTPUT_ROOT`
a hex encoded 32 byte hash that is used as the proposed output root.
*
`OUTPUT_ROOT`
a hex encoded 32 byte hash that is used as the proposed output root.
*
`L2_BLOCK_NUM`
the L2 block number the proposed output root is from.
*
`L2_BLOCK_NUM`
the L2 block number the proposed output root is from.
*
`SIGNER_ARGS`
the remaining args are past as arguments to
`cast`
when sending
*
`SIGNER_ARGS`
arguments to specify the key to sign transactions with (e.g
`--private-key`
)
transactions. These arguments must specify a way for
`cast`
to sign the transactions.
See
`cast send --help`
for supported options.
Optionally, you may specify the game type (aka "trace type") using the
`--trace-type`
Optionally, you may specify the game type (aka "trace type") using the
`--trace-type`
flag, which is set to the cannon trace type by default.
flag, which is set to the cannon trace type by default.
...
@@ -99,7 +97,7 @@ but not both.
...
@@ -99,7 +97,7 @@ but not both.
--attack
\
--attack
\
--parent-index
<PARENT_INDEX>
\
--parent-index
<PARENT_INDEX>
\
--claim
<CLAIM>
\
--claim
<CLAIM>
\
...
<SIGNER_ARGS>
<SIGNER_ARGS>
```
```
Performs a move to either attack or defend the latest claim in the specified game.
Performs a move to either attack or defend the latest claim in the specified game.
...
@@ -114,9 +112,25 @@ Performs a move to either attack or defend the latest claim in the specified gam
...
@@ -114,9 +112,25 @@ Performs a move to either attack or defend the latest claim in the specified gam
*
`PARENT_INDEX`
- the index of the parent claim that will be countered by this new claim.
*
`PARENT_INDEX`
- the index of the parent claim that will be countered by this new claim.
The special value of
`latest`
will counter the latest claim added to the game.
The special value of
`latest`
will counter the latest claim added to the game.
*
`CLAIM`
- the state hash to include in the counter-claim you are posting.
*
`CLAIM`
- the state hash to include in the counter-claim you are posting.
*
`SIGNER_ARGS`
the remaining args are past as arguments to
`cast`
when sending transactions.
*
`SIGNER_ARGS`
arguments to specify the key to sign transactions with (e.g
`--private-key`
)
These arguments must specify a way for
`cast`
to sign the transactions.
See
`cast send --help`
for supported options.
### resolve-claim
```
shell
./bin/op-challenger resolve-claim
\
--l1-eth-rpc
<L1_ETH_RPC>
\
--game-address
<GAME_ADDRESS>
\
--claim
<CLAIM_INDEX>
\
<SIGNER_ARGS>
```
Resolves a claim in a dispute game. Note that this will fail if the claim has already been resolved or if the claim is
not yet resolvable. If the claim is resolved successfully, the result is printed.
*
`L1_ETH_RPC`
- the RPC endpoint of the L1 endpoint to use (e.g.
`http://localhost:8545`
).
*
`GAME_ADDRESS`
- the address of the dispute game to resolve.
*
`CLAIM_INDEX`
- the index of the claim to resolve.
*
`SIGNER_ARGS`
arguments to specify the key to sign transactions with (e.g
`--private-key`
).
### resolve
### resolve
...
@@ -124,7 +138,7 @@ Performs a move to either attack or defend the latest claim in the specified gam
...
@@ -124,7 +138,7 @@ Performs a move to either attack or defend the latest claim in the specified gam
./bin/op-challenger resolve
\
./bin/op-challenger resolve
\
--l1-eth-rpc
<L1_ETH_RPC>
\
--l1-eth-rpc
<L1_ETH_RPC>
\
--game-address
<GAME_ADDRESS>
\
--game-address
<GAME_ADDRESS>
\
...
<SIGNER_ARGS>
<SIGNER_ARGS>
```
```
Resolves a dispute game. Note that this will fail if the dispute game has already
Resolves a dispute game. Note that this will fail if the dispute game has already
...
@@ -133,9 +147,7 @@ If the game is resolved successfully, the result is printed.
...
@@ -133,9 +147,7 @@ If the game is resolved successfully, the result is printed.
*
`L1_ETH_RPC`
- the RPC endpoint of the L1 endpoint to use (e.g.
`http://localhost:8545`
).
*
`L1_ETH_RPC`
- the RPC endpoint of the L1 endpoint to use (e.g.
`http://localhost:8545`
).
*
`GAME_ADDRESS`
- the address of the dispute game to resolve.
*
`GAME_ADDRESS`
- the address of the dispute game to resolve.
*
`SIGNER_ARGS`
the remaining args are past as arguments to
`cast`
when sending transactions.
*
`SIGNER_ARGS`
arguments to specify the key to sign transactions with (e.g
`--private-key`
).
These arguments must specify a way for
`cast`
to sign the transactions.
See
`cast send --help`
for supported options.
### list-games
### list-games
...
...
op-challenger/cmd/main.go
View file @
bbc3786d
...
@@ -51,6 +51,7 @@ func run(ctx context.Context, args []string, action ConfiguredLifecycle) error {
...
@@ -51,6 +51,7 @@ func run(ctx context.Context, args []string, action ConfiguredLifecycle) error {
CreateGameCommand
,
CreateGameCommand
,
MoveCommand
,
MoveCommand
,
ResolveCommand
,
ResolveCommand
,
ResolveClaimCommand
,
}
}
app
.
Action
=
cliapp
.
LifecycleCmd
(
func
(
ctx
*
cli
.
Context
,
close
context
.
CancelCauseFunc
)
(
cliapp
.
Lifecycle
,
error
)
{
app
.
Action
=
cliapp
.
LifecycleCmd
(
func
(
ctx
*
cli
.
Context
,
close
context
.
CancelCauseFunc
)
(
cliapp
.
Lifecycle
,
error
)
{
logger
,
err
:=
setupLogging
(
ctx
)
logger
,
err
:=
setupLogging
(
ctx
)
...
...
op-challenger/cmd/resolve_claim.go
0 → 100644
View file @
bbc3786d
package
main
import
(
"context"
"fmt"
"github.com/ethereum-optimism/optimism/op-challenger/flags"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/contracts"
opservice
"github.com/ethereum-optimism/optimism/op-service"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
"github.com/urfave/cli/v2"
)
var
(
ClaimIdxFlag
=
&
cli
.
Uint64Flag
{
Name
:
"claim"
,
Usage
:
"Index of the claim to resolve."
,
EnvVars
:
opservice
.
PrefixEnvVar
(
flags
.
EnvVarPrefix
,
"CLAIM"
),
}
)
func
ResolveClaim
(
ctx
*
cli
.
Context
)
error
{
if
!
ctx
.
IsSet
(
ClaimIdxFlag
.
Name
)
{
return
fmt
.
Errorf
(
"must specify %v flag"
,
ClaimIdxFlag
.
Name
)
}
idx
:=
ctx
.
Uint64
(
ClaimIdxFlag
.
Name
)
contract
,
txMgr
,
err
:=
NewContractWithTxMgr
[
contracts
.
FaultDisputeGameContract
](
ctx
,
GameAddressFlag
.
Name
,
contracts
.
NewFaultDisputeGameContract
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to create dispute game bindings: %w"
,
err
)
}
err
=
contract
.
CallResolveClaim
(
ctx
.
Context
,
idx
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"claim is not resolvable: %w"
,
err
)
}
tx
,
err
:=
contract
.
ResolveClaimTx
(
idx
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to create resolve claim tx: %w"
,
err
)
}
rct
,
err
:=
txMgr
.
Send
(
context
.
Background
(),
tx
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to send tx: %w"
,
err
)
}
fmt
.
Printf
(
"Sent resolve claim tx with status: %v, hash: %s
\n
"
,
rct
.
Status
,
rct
.
TxHash
.
String
())
return
nil
}
func
resolveClaimFlags
()
[]
cli
.
Flag
{
cliFlags
:=
[]
cli
.
Flag
{
flags
.
L1EthRpcFlag
,
GameAddressFlag
,
ClaimIdxFlag
,
}
cliFlags
=
append
(
cliFlags
,
txmgr
.
CLIFlagsWithDefaults
(
flags
.
EnvVarPrefix
,
txmgr
.
DefaultChallengerFlagValues
)
...
)
cliFlags
=
append
(
cliFlags
,
oplog
.
CLIFlags
(
flags
.
EnvVarPrefix
)
...
)
return
cliFlags
}
var
ResolveClaimCommand
=
&
cli
.
Command
{
Name
:
"resolve-claim"
,
Usage
:
"Resolves the specified claim if possible"
,
Description
:
"Resolves the specified claim if possible"
,
Action
:
ResolveClaim
,
Flags
:
resolveClaimFlags
(),
}
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