Commit 743c9ee4 authored by Adrian Sutton's avatar Adrian Sutton Committed by GitHub

op-challenger: Fix cli args for subcommands (#9434)

The additional flags from logging and txmgr weren't being picked up.
parent 8ff8134c
...@@ -63,16 +63,16 @@ func CreateGame(ctx *cli.Context) error { ...@@ -63,16 +63,16 @@ func CreateGame(ctx *cli.Context) error {
return nil return nil
} }
var createGameFlags = []cli.Flag{ func createGameFlags() []cli.Flag {
cliFlags := []cli.Flag{
flags.L1EthRpcFlag, flags.L1EthRpcFlag,
flags.FactoryAddressFlag, flags.FactoryAddressFlag,
OutputRootFlag, OutputRootFlag,
L2BlockNumFlag, L2BlockNumFlag,
} }
cliFlags = append(cliFlags, txmgr.CLIFlagsWithDefaults(flags.EnvVarPrefix, txmgr.DefaultChallengerFlagValues)...)
func init() { cliFlags = append(cliFlags, oplog.CLIFlags(flags.EnvVarPrefix)...)
createGameFlags = append(createGameFlags, txmgr.CLIFlagsWithDefaults(flags.EnvVarPrefix, txmgr.DefaultChallengerFlagValues)...) return cliFlags
createGameFlags = append(createGameFlags, oplog.CLIFlags(flags.EnvVarPrefix)...)
} }
var CreateGameCommand = &cli.Command{ var CreateGameCommand = &cli.Command{
...@@ -80,6 +80,6 @@ var CreateGameCommand = &cli.Command{ ...@@ -80,6 +80,6 @@ var CreateGameCommand = &cli.Command{
Usage: "Creates a dispute game via the factory", Usage: "Creates a dispute game via the factory",
Description: "Creates a dispute game via the factory", Description: "Creates a dispute game via the factory",
Action: CreateGame, Action: CreateGame,
Flags: createGameFlags, Flags: createGameFlags(),
Hidden: true, Hidden: true,
} }
...@@ -83,13 +83,13 @@ func listClaims(ctx context.Context, game *contracts.FaultDisputeGameContract) e ...@@ -83,13 +83,13 @@ func listClaims(ctx context.Context, game *contracts.FaultDisputeGameContract) e
return nil return nil
} }
var listClaimsFlags = []cli.Flag{ func listClaimsFlags() []cli.Flag {
cliFlags := []cli.Flag{
flags.L1EthRpcFlag, flags.L1EthRpcFlag,
GameAddressFlag, GameAddressFlag,
} }
cliFlags = append(cliFlags, oplog.CLIFlags("OP_CHALLENGER")...)
func init() { return cliFlags
listClaimsFlags = append(listClaimsFlags, oplog.CLIFlags("OP_CHALLENGER")...)
} }
var ListClaimsCommand = &cli.Command{ var ListClaimsCommand = &cli.Command{
...@@ -97,6 +97,6 @@ var ListClaimsCommand = &cli.Command{ ...@@ -97,6 +97,6 @@ var ListClaimsCommand = &cli.Command{
Usage: "List the claims in a dispute game", Usage: "List the claims in a dispute game",
Description: "Lists the claims in a dispute game", Description: "Lists the claims in a dispute game",
Action: ListClaims, Action: ListClaims,
Flags: listClaimsFlags, Flags: listClaimsFlags(),
Hidden: true, Hidden: true,
} }
...@@ -100,13 +100,13 @@ func listGames(ctx context.Context, caller *batching.MultiCaller, factory *contr ...@@ -100,13 +100,13 @@ func listGames(ctx context.Context, caller *batching.MultiCaller, factory *contr
return nil return nil
} }
var listGamesFlags = []cli.Flag{ func listGamesFlags() []cli.Flag {
cliFlags := []cli.Flag{
flags.L1EthRpcFlag, flags.L1EthRpcFlag,
flags.FactoryAddressFlag, flags.FactoryAddressFlag,
} }
cliFlags = append(cliFlags, oplog.CLIFlags("OP_CHALLENGER")...)
func init() { return cliFlags
listGamesFlags = append(listGamesFlags, oplog.CLIFlags("OP_CHALLENGER")...)
} }
var ListGamesCommand = &cli.Command{ var ListGamesCommand = &cli.Command{
...@@ -114,6 +114,6 @@ var ListGamesCommand = &cli.Command{ ...@@ -114,6 +114,6 @@ var ListGamesCommand = &cli.Command{
Usage: "List the games created by a dispute game factory", Usage: "List the games created by a dispute game factory",
Description: "Lists the games created by a dispute game factory", Description: "Lists the games created by a dispute game factory",
Action: ListGames, Action: ListGames,
Flags: listGamesFlags, Flags: listGamesFlags(),
Hidden: true, Hidden: true,
} }
...@@ -48,6 +48,9 @@ func run(ctx context.Context, args []string, action ConfiguredLifecycle) error { ...@@ -48,6 +48,9 @@ func run(ctx context.Context, args []string, action ConfiguredLifecycle) error {
app.Commands = []*cli.Command{ app.Commands = []*cli.Command{
ListGamesCommand, ListGamesCommand,
ListClaimsCommand, ListClaimsCommand,
CreateGameCommand,
MoveCommand,
ResolveCommand,
} }
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)
......
...@@ -75,18 +75,18 @@ func Move(ctx *cli.Context) error { ...@@ -75,18 +75,18 @@ func Move(ctx *cli.Context) error {
return nil return nil
} }
var moveFlags = []cli.Flag{ func moveFlags() []cli.Flag {
cliFlags := []cli.Flag{
flags.L1EthRpcFlag, flags.L1EthRpcFlag,
GameAddressFlag, GameAddressFlag,
AttackFlag, AttackFlag,
DefendFlag, DefendFlag,
ParentIndexFlag, ParentIndexFlag,
ClaimFlag, ClaimFlag,
} }
cliFlags = append(cliFlags, txmgr.CLIFlagsWithDefaults(flags.EnvVarPrefix, txmgr.DefaultChallengerFlagValues)...)
func init() { cliFlags = append(cliFlags, oplog.CLIFlags(flags.EnvVarPrefix)...)
moveFlags = append(moveFlags, txmgr.CLIFlagsWithDefaults(flags.EnvVarPrefix, txmgr.DefaultChallengerFlagValues)...) return cliFlags
moveFlags = append(moveFlags, oplog.CLIFlags(flags.EnvVarPrefix)...)
} }
var MoveCommand = &cli.Command{ var MoveCommand = &cli.Command{
...@@ -94,6 +94,6 @@ var MoveCommand = &cli.Command{ ...@@ -94,6 +94,6 @@ var MoveCommand = &cli.Command{
Usage: "Creates and sends a move transaction to the dispute game", Usage: "Creates and sends a move transaction to the dispute game",
Description: "Creates and sends a move transaction to the dispute game", Description: "Creates and sends a move transaction to the dispute game",
Action: Move, Action: Move,
Flags: moveFlags, Flags: moveFlags(),
Hidden: true, Hidden: true,
} }
...@@ -32,14 +32,14 @@ func Resolve(ctx *cli.Context) error { ...@@ -32,14 +32,14 @@ func Resolve(ctx *cli.Context) error {
return nil return nil
} }
var resolveFlags = []cli.Flag{ func resolveFlags() []cli.Flag {
cliFlags := []cli.Flag{
flags.L1EthRpcFlag, flags.L1EthRpcFlag,
GameAddressFlag, GameAddressFlag,
} }
cliFlags = append(cliFlags, txmgr.CLIFlagsWithDefaults(flags.EnvVarPrefix, txmgr.DefaultChallengerFlagValues)...)
func init() { cliFlags = append(cliFlags, oplog.CLIFlags(flags.EnvVarPrefix)...)
resolveFlags = append(resolveFlags, txmgr.CLIFlagsWithDefaults(flags.EnvVarPrefix, txmgr.DefaultChallengerFlagValues)...) return cliFlags
resolveFlags = append(resolveFlags, oplog.CLIFlags(flags.EnvVarPrefix)...)
} }
var ResolveCommand = &cli.Command{ var ResolveCommand = &cli.Command{
...@@ -47,6 +47,6 @@ var ResolveCommand = &cli.Command{ ...@@ -47,6 +47,6 @@ var ResolveCommand = &cli.Command{
Usage: "Resolves the specified dispute game if possible", Usage: "Resolves the specified dispute game if possible",
Description: "Resolves the specified dispute game if possible", Description: "Resolves the specified dispute game if possible",
Action: Resolve, Action: Resolve,
Flags: resolveFlags, Flags: resolveFlags(),
Hidden: true, Hidden: true,
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment