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

refactor(flag): make flag in help more readable #392

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions cmd/flags/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,45 @@ var (
var (
L1WSEndpoint = &cli.StringFlag{
Name: "l1.ws",
Usage: "Websocket RPC endpoint of a L1 ethereum node",
Usage: "Websocket RPC endpoint `url` of a L1 ethereum node",
Required: true,
Category: commonCategory,
}
L2WSEndpoint = &cli.StringFlag{
Name: "l2.ws",
Usage: "Websocket RPC endpoint of a L2 taiko-geth execution engine",
Usage: "Websocket RPC endpoint `url` of a L2 taiko-geth execution engine",
Required: true,
Category: commonCategory,
}
L1HTTPEndpoint = &cli.StringFlag{
Name: "l1.http",
Usage: "HTTP RPC endpoint of a L1 ethereum node",
Usage: "HTTP RPC endpoint `url` of a L1 ethereum node",
Required: true,
Category: commonCategory,
}
L2HTTPEndpoint = &cli.StringFlag{
Name: "l2.http",
Usage: "HTTP RPC endpoint of a L2 taiko-geth execution engine",
Usage: "HTTP RPC endpoint `url` of a L2 taiko-geth execution engine",
Required: true,
Category: commonCategory,
}
TaikoL1Address = &cli.StringFlag{
Name: "taikoL1",
Usage: "TaikoL1 contract address",
Usage: "TaikoL1 contract `address`",
Required: true,
Category: commonCategory,
}
TaikoL2Address = &cli.StringFlag{
Name: "taikoL2",
Usage: "TaikoL2 contract address",
Usage: "TaikoL2 contract `address`",
Required: true,
Category: commonCategory,
}
// Optional flags used by all client softwares.
// Logging
Verbosity = &cli.IntFlag{
Name: "verbosity",
Usage: "Logging verbosity: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail",
Usage: "Logging verbosity `level`: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail",
Value: 3,
Category: loggingCategory,
}
Expand All @@ -73,13 +73,13 @@ var (
}
MetricsAddr = &cli.StringFlag{
Name: "metrics.addr",
Usage: "Metrics reporting server listening address",
Usage: "Metrics reporting server listening `address`",
Category: metricsCategory,
Value: "0.0.0.0",
}
MetricsPort = &cli.IntFlag{
Name: "metrics.port",
Usage: "Metrics reporting server listening port",
Usage: "Metrics reporting server listening `port`",
Category: metricsCategory,
Value: 6060,
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/flags/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (
var (
L2AuthEndpoint = &cli.StringFlag{
Name: "l2.auth",
Usage: "Authenticated HTTP RPC endpoint of a L2 taiko-geth execution engine",
Usage: "Authenticated HTTP RPC endpoint `url` 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",
Usage: "Path to a JWT secret `file` to use for authenticated RPC endpoints",
Required: true,
Category: driverCategory,
}
Expand All @@ -38,7 +38,7 @@ var (
}
CheckPointSyncUrl = &cli.StringFlag{
Name: "p2p.checkPointSyncUrl",
Usage: "HTTP RPC endpoint of another synced L2 execution engine node",
Usage: "HTTP RPC endpoint `url` of another synced L2 execution engine node",
Category: driverCategory,
}
)
Expand Down
18 changes: 10 additions & 8 deletions cmd/flags/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,31 @@ import (
var (
L1ProposerPrivKey = &cli.StringFlag{
Name: "l1.proposerPrivKey",
Usage: "Private key of the L1 proposer, who will send TaikoL1.proposeBlock transactions",
Usage: "Private `key` of the L1 proposer, who will send TaikoL1.proposeBlock transactions",
Required: true,
Category: proposerCategory,
}
L2SuggestedFeeRecipient = &cli.StringFlag{
Name: "l2.suggestedFeeRecipient",
Usage: "Address of the proposed block's suggested fee recipient",
Usage: "`Address` of the proposed block's suggested fee recipient",
Required: true,
Category: proposerCategory,
}
ProverEndpoints = &cli.StringFlag{
ProverEndpoints = &cli.StringSliceFlag{
Name: "proverEndpoints",
Usage: "Comma-delineated list of prover endpoints proposer should query when attempting to propose a block",
Usage: "Comma-delineated list of prover endpoint `URLs` proposer should query when attempting to propose a block",
Required: true,
Category: proposerCategory,
}
BlockProposalFee = &cli.StringFlag{
Name: "blockProposalFee",
Usage: "Initial block proposal fee (in wei) paid on block proposing",
Required: true,
Category: proposerCategory,
}
TaikoTokenAddress = &cli.StringFlag{
Name: "taikoToken",
Usage: "TaikoToken contract address",
Usage: "TaikoToken contract `address`",
Required: true,
Category: proposerCategory,
}
Expand All @@ -40,12 +42,12 @@ var (
var (
ProposeInterval = &cli.StringFlag{
Name: "proposeInterval",
Usage: "Time interval to propose L2 pending transactions",
Usage: "Time `interval` to propose L2 pending transactions",
Category: proposerCategory,
}
TxPoolLocals = &cli.StringFlag{
TxPoolLocals = &cli.StringSliceFlag{
Name: "txpool.locals",
Usage: "Comma separated accounts to treat as locals (priority inclusion)",
Usage: "Comma separated `accounts` to treat as locals (priority inclusion)",
Category: proposerCategory,
}
TxPoolLocalsOnly = &cli.BoolFlag{
Expand Down
20 changes: 10 additions & 10 deletions cmd/flags/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import (
var (
ZkEvmRpcdEndpoint = &cli.StringFlag{
Name: "zkevmRpcdEndpoint",
Usage: "RPC endpoint of a ZKEVM RPCD service",
Usage: "RPC endpoint `url` of a ZKEVM RPCD service",
Required: true,
Category: proverCategory,
}
ZkEvmRpcdParamsPath = &cli.StringFlag{
Name: "zkevmRpcdParamsPath",
Usage: "Path of ZKEVM parameters file to use",
Usage: "Path of ZKEVM parameters `file` to use",
Required: true,
Category: proverCategory,
}
L1ProverPrivKey = &cli.StringFlag{
Name: "l1.proverPrivKey",
Usage: "Private key of L1 prover, " +
Usage: "Private `key` of L1 prover, " +
"who will send TaikoL1.proveBlock / TaikoL1.proveBlockInvalid transactions",
Required: true,
Category: proverCategory,
Expand All @@ -39,12 +39,12 @@ var (
var (
StartingBlockID = &cli.Uint64Flag{
Name: "startingBlockID",
Usage: "If set, prover will start proving blocks from the block with this ID",
Usage: "If set, prover will start proving blocks from the block with this `ID`",
Category: proverCategory,
}
MaxConcurrentProvingJobs = &cli.UintFlag{
Name: "maxConcurrentProvingJobs",
Usage: "Limits the number of concurrent proving blocks jobs",
Usage: "Limits the `number` of concurrent proving blocks jobs",
Value: 1,
Category: proverCategory,
}
Expand All @@ -57,7 +57,7 @@ var (
}
RandomDummyProofDelay = &cli.StringFlag{
Name: "randomDummyProofDelay",
Usage: "Set the random dummy proof delay between the bounds using the format: " +
Usage: "Set the random dummy proof `delay` between the bounds using the format: " +
"`lowerBound-upperBound` (e.g. `30m-1h`), testing purposes only",
Category: proverCategory,
}
Expand All @@ -68,12 +68,12 @@ var (
}
OracleProverPrivateKey = &cli.StringFlag{
Name: "oracleProverPrivateKey",
Usage: "Private key of oracle prover",
Usage: "Private `key` of oracle prover",
Category: proverCategory,
}
OracleProofSubmissionDelay = &cli.Uint64Flag{
Name: "oracleProofSubmissionDelay",
Usage: "Oracle proof submission delay in seconds",
Usage: "Oracle proof submission `delay` in seconds",
Value: 0,
Category: proverCategory,
}
Expand All @@ -85,7 +85,7 @@ var (
}
Graffiti = &cli.StringFlag{
Name: "graffiti",
Usage: "When string is passed, adds additional graffiti info to proof evidence",
Usage: "When `string` is passed, adds additional graffiti info to proof evidence",
Category: proverCategory,
Value: "",
}
Expand Down Expand Up @@ -119,7 +119,7 @@ var (
}
ProverHTTPServerPort = &cli.Uint64Flag{
Name: "prover.httpServerPort",
Usage: "Port to expose for http server",
Usage: "`Port` to expose for http server",
Category: proverCategory,
Value: 9876,
}
Expand Down
4 changes: 2 additions & 2 deletions proposer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {

localAddresses := []common.Address{}
if c.IsSet(flags.TxPoolLocals.Name) {
for _, account := range strings.Split(c.String(flags.TxPoolLocals.Name), ",") {
for _, account := range c.StringSlice(flags.TxPoolLocals.Name) {
if trimmed := strings.TrimSpace(account); !common.IsHexAddress(trimmed) {
return nil, fmt.Errorf("invalid account in --txpool.locals: %s", trimmed)
} else {
Expand Down Expand Up @@ -110,7 +110,7 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
}

var proverEndpoints []*url.URL
for _, e := range strings.Split(c.String(flags.ProverEndpoints.Name), ",") {
for _, e := range c.StringSlice(flags.ProverEndpoints.Name) {
RogerLamTd marked this conversation as resolved.
Show resolved Hide resolved
endpoint, err := url.Parse(e)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions proposer/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ func (s *ProposerTestSuite) SetupApp() *cli.App {
&cli.StringFlag{Name: flags.L2SuggestedFeeRecipient.Name},
&cli.StringFlag{Name: flags.ProposeEmptyBlocksInterval.Name},
&cli.StringFlag{Name: flags.ProposeInterval.Name},
&cli.StringFlag{Name: flags.TxPoolLocals.Name},
&cli.StringFlag{Name: flags.ProverEndpoints.Name},
&cli.StringSliceFlag{Name: flags.TxPoolLocals.Name},
&cli.StringSliceFlag{Name: flags.ProverEndpoints.Name},
&cli.Uint64Flag{Name: flags.BlockProposalFee.Name},
&cli.Uint64Flag{Name: flags.ProposeBlockTxReplacementMultiplier.Name},
&cli.Uint64Flag{Name: flags.RPCTimeout.Name},
Expand Down