Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
feat: update flags
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Apr 5, 2024
1 parent b3d4653 commit a14e354
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
12 changes: 12 additions & 0 deletions cmd/flags/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ var (
Required: true,
Category: commonCategory,
}
L2AuthEndpoint = &cli.StringFlag{
Name: "l2.auth",
Usage: "Authenticated HTTP RPC endpoint of a L2 taiko-geth execution engine",
Required: true,
Category: commonCategory,
}
JWTSecret = &cli.StringFlag{
Name: "jwtSecret",
Usage: "Path to a JWT secret to use for authenticated RPC endpoints",
Required: true,
Category: commonCategory,
}
TaikoL1Address = &cli.StringFlag{
Name: "taikoL1",
Usage: "TaikoL1 contract `address`",
Expand Down
16 changes: 0 additions & 16 deletions cmd/flags/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,6 @@ import (
"github.com/urfave/cli/v2"
)

// Flags used by driver.
var (
L2AuthEndpoint = &cli.StringFlag{
Name: "l2.auth",
Usage: "Authenticated HTTP RPC endpoint of a L2 taiko-geth execution engine",
Required: true,
Category: driverCategory,
}
JWTSecret = &cli.StringFlag{
Name: "jwtSecret",
Usage: "Path to a JWT secret to use for authenticated RPC endpoints",
Required: true,
Category: driverCategory,
}
)

// Optional flags used by driver.
var (
P2PSyncVerifiedBlocks = &cli.BoolFlag{
Expand Down
2 changes: 2 additions & 0 deletions cmd/flags/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ var (
// ProposerFlags All proposer flags.
var ProposerFlags = MergeFlags(CommonFlags, []cli.Flag{
L2HTTPEndpoint,
L2AuthEndpoint,
JWTSecret,
TaikoTokenAddress,
L1ProposerPrivKey,
L2SuggestedFeeRecipient,
Expand Down
8 changes: 8 additions & 0 deletions proposer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

"github.com/taikoxyz/taiko-client/cmd/flags"
pkgFlags "github.com/taikoxyz/taiko-client/pkg/flags"
"github.com/taikoxyz/taiko-client/pkg/jwt"
"github.com/taikoxyz/taiko-client/pkg/rpc"
)

Expand Down Expand Up @@ -47,6 +48,11 @@ type Config struct {
// NewConfigFromCliContext initializes a Config instance from
// command line flags.
func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
jwtSecret, err := jwt.ParseSecretFromFile(c.String(flags.JWTSecret.Name))
if err != nil {
return nil, fmt.Errorf("invalid JWT secret file: %w", err)
}

l1ProposerPrivKey, err := crypto.ToECDSA(
common.Hex2Bytes(c.String(flags.L1ProposerPrivKey.Name)),
)
Expand Down Expand Up @@ -84,6 +90,8 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
L2Endpoint: c.String(flags.L2HTTPEndpoint.Name),
TaikoL1Address: common.HexToAddress(c.String(flags.TaikoL1Address.Name)),
TaikoL2Address: common.HexToAddress(c.String(flags.TaikoL2Address.Name)),
L2EngineEndpoint: c.String(flags.L2AuthEndpoint.Name),
JwtSecret: string(jwtSecret),
TaikoTokenAddress: common.HexToAddress(c.String(flags.TaikoTokenAddress.Name)),
Timeout: c.Duration(flags.RPCTimeout.Name),
},
Expand Down

0 comments on commit a14e354

Please sign in to comment.