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

Commit

Permalink
feat(cmd): default unit for all related flags / logs
Browse files Browse the repository at this point in the history
  • Loading branch information
YoGhurt111 committed Apr 18, 2024
1 parent c71155e commit 7d91891
Show file tree
Hide file tree
Showing 32 changed files with 241 additions and 75 deletions.
2 changes: 1 addition & 1 deletion bindings/encoding/input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestUnpackTxListBytes(t *testing.T) {
)
require.ErrorContains(t, err, "no method with id")

cli, err := ethclient.Dial(os.Getenv("L1_NODE_WS_ENDPOINT"))
cli, err := ethclient.Dial(os.Getenv("L1_WS_ENDPOINT"))
require.Nil(t, err)

chainID, err := cli.ChainID(context.Background())
Expand Down
24 changes: 21 additions & 3 deletions cmd/flags/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,59 +24,69 @@ var (
Usage: "Websocket RPC endpoint of a L1 ethereum node",
Required: true,
Category: commonCategory,
EnvVars: []string{"L1_WS_ENDPOINT"},
}
L2WSEndpoint = &cli.StringFlag{
Name: "l2.ws",
Usage: "Websocket RPC endpoint of a L2 taiko-geth execution engine",
Required: true,
Category: commonCategory,
EnvVars: []string{"L2_WS_ENDPOINT"},
}
L1HTTPEndpoint = &cli.StringFlag{
Name: "l1.http",
Usage: "HTTP RPC endpoint of a L1 ethereum node",
Required: true,
Category: commonCategory,
EnvVars: []string{"L1_HTTP_ENDPOINT"},
}
L1BeaconEndpoint = &cli.StringFlag{
Name: "l1.beacon",
Usage: "HTTP RPC endpoint of a L1 beacon node",
Category: commonCategory,
EnvVars: []string{"L1_BEACON_ENDPOINT"},
}
L2HTTPEndpoint = &cli.StringFlag{
Name: "l2.http",
Usage: "HTTP RPC endpoint of a L2 taiko-geth execution engine",
Required: true,
Category: commonCategory,
EnvVars: []string{"L2_HTTP_ENDPOINT"},
}
L2AuthEndpoint = &cli.StringFlag{
Name: "l2.auth",
Usage: "Authenticated HTTP RPC endpoint of a L2 taiko-geth execution engine",
Required: true,
Category: commonCategory,
EnvVars: []string{"L2_AUTH_ENDPOINT"},
}
JWTSecret = &cli.StringFlag{
Name: "jwtSecret",
Usage: "Path to a JWT secret to use for authenticated RPC endpoints",
Required: true,
Category: commonCategory,
EnvVars: []string{"JWT_SECRET"},
}
TaikoL1Address = &cli.StringFlag{
Name: "taikoL1",
Usage: "TaikoL1 contract `address`",
Required: true,
Category: commonCategory,
EnvVars: []string{"TAIKO_L1_ADDRESS"},
}
TaikoL2Address = &cli.StringFlag{
Name: "taikoL2",
Usage: "TaikoL2 contract `address`",
Required: true,
Category: commonCategory,
EnvVars: []string{"TAIKO_L2_ADDRESS"},
}
TaikoTokenAddress = &cli.StringFlag{
Name: "taikoToken",
Usage: "TaikoToken contract `address`",
Required: true,
Category: commonCategory,
EnvVars: []string{"TAIKO_TOKEN_ADDRESS"},
}
// Optional flags used by all client software.
// Logging
Expand All @@ -85,48 +95,56 @@ var (
Usage: "Logging verbosity: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail",
Value: 3,
Category: loggingCategory,
EnvVars: []string{"VERBOSITY"},
}
LogJSON = &cli.BoolFlag{
Name: "log.json",
Usage: "Format logs with JSON",
Category: loggingCategory,
EnvVars: []string{"LOG_JSON"},
}
// Metrics
MetricsEnabled = &cli.BoolFlag{
Name: "metrics",
Usage: "Enable metrics collection and reporting",
Category: metricsCategory,
Value: false,
EnvVars: []string{"METRICS_ENABLED"},
}
MetricsAddr = &cli.StringFlag{
Name: "metrics.addr",
Usage: "Metrics reporting server listening address",
Category: metricsCategory,
Value: "0.0.0.0",
EnvVars: []string{"METRICS_ADDR"},
}
MetricsPort = &cli.IntFlag{
Name: "metrics.port",
Usage: "Metrics reporting server listening port",
Category: metricsCategory,
Value: 6060,
EnvVars: []string{"METRICS_PORT"},
}
BackOffMaxRetrys = &cli.Uint64Flag{
Name: "backoff.maxRetrys",
BackOffMaxRetries = &cli.Uint64Flag{
Name: "backoff.maxRetries",
Usage: "Max retry times when there is an error",
Category: commonCategory,
Value: 10,
EnvVars: []string{"BACKOFF_MAX_RETRIES"},
}
BackOffRetryInterval = &cli.DurationFlag{
Name: "backoff.retryInterval",
Usage: "Retry interval in seconds when there is an error",
Category: commonCategory,
Value: backoff.DefaultMaxInterval,
EnvVars: []string{"BACKOFF_RETRY_INTERVAL"},
}
RPCTimeout = &cli.DurationFlag{
Name: "rpc.timeout",
Usage: "Timeout in seconds for RPC calls",
Category: commonCategory,
Value: 12 * time.Second,
EnvVars: []string{"RPC_TIMEOUT"},
}
)

Expand All @@ -142,7 +160,7 @@ var CommonFlags = []cli.Flag{
MetricsEnabled,
MetricsAddr,
MetricsPort,
BackOffMaxRetrys,
BackOffMaxRetries,
BackOffRetryInterval,
RPCTimeout,
}
Expand Down
5 changes: 5 additions & 0 deletions cmd/flags/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@ var (
"will be helpful to bring a new node online quickly",
Value: false,
Category: driverCategory,
EnvVars: []string{"P2P_SYNC_VERIFIED_BLOCKS"},
}
P2PSyncTimeout = &cli.DurationFlag{
Name: "p2p.syncTimeout",
Usage: "P2P syncing timeout, if no sync progress is made within this time span, " +
"driver will stop the P2P sync and insert all remaining L2 blocks one by one",
Value: 1 * time.Hour,
Category: driverCategory,
EnvVars: []string{"P2P_SYNC_TIMEOUT"},
}
CheckPointSyncURL = &cli.StringFlag{
Name: "p2p.checkPointSyncUrl",
Usage: "HTTP RPC endpoint of another synced L2 execution engine node",
Category: driverCategory,
EnvVars: []string{"CHECK_POINT_SYNC_URL"},
}
// syncer specific flag
MaxExponent = &cli.Uint64Flag{
Expand All @@ -34,12 +37,14 @@ var (
"0 means that it is reset to the genesis height",
Value: 0,
Category: driverCategory,
EnvVars: []string{"MAX_EXPONENT"},
}
// blob server endpoint
BlobServerEndpoint = &cli.StringFlag{
Name: "blob.server",
Usage: "Blob sidecar storage server",
Category: driverCategory,
EnvVars: []string{"BLOB_SERVER_ENDPOINT"},
}
)

Expand Down
29 changes: 24 additions & 5 deletions cmd/flags/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,28 @@ var (
Usage: "Private key of the L1 proposer, who will send TaikoL1.proposeBlock transactions",
Required: true,
Category: proposerCategory,
EnvVars: []string{"L1_PROPOSER_PRIV_KEY"},
}
ProverEndpoints = &cli.StringFlag{
Name: "proverEndpoints",
Usage: "Comma-delineated list of prover endpoints proposer should query when attempting to propose a block",
Required: true,
Category: proposerCategory,
EnvVars: []string{"PROVER_ENDPOINTS"},
}
L2SuggestedFeeRecipient = &cli.StringFlag{
Name: "l2.suggestedFeeRecipient",
Usage: "Address of the proposed block's suggested L2 fee recipient",
Required: true,
Category: proposerCategory,
EnvVars: []string{"L2_SUGGESTED_FEE_RECIPIENT"},
}
ProposerAssignmentHookAddress = &cli.StringFlag{
Name: "assignmentHookAddress",
Usage: "Address of the AssignmentHook contract",
Required: true,
Category: proposerCategory,
EnvVars: []string{"PROPOSER_ASSIGNMENT_HOOK_ADDRESS"},
}
)

Expand All @@ -39,93 +43,108 @@ var (
// Tier fee related.
OptimisticTierFee = &cli.Uint64Flag{
Name: "tierFee.optimistic",
Usage: "Initial tier fee (in wei) paid to prover to generate an optimistic proofs",
Usage: "Initial tier fee (in GWei) paid to prover to generate an optimistic proofs",
Category: proposerCategory,
EnvVars: []string{"OPTIMISTIC_TIER_FEE"},
}
SgxTierFee = &cli.Uint64Flag{
Name: "tierFee.sgx",
Usage: "Initial tier fee (in wei) paid to prover to generate a SGX proofs",
Usage: "Initial tier fee (in GWei) paid to prover to generate a SGX proofs",
Category: proposerCategory,
EnvVars: []string{"SGX_TIER_FEE"},
}
TierFeePriceBump = &cli.Uint64Flag{
Name: "tierFee.pricebump",
Usage: "Price bump percentage when no prover wants to accept the block at initial fee",
Value: 10,
Category: proposerCategory,
EnvVars: []string{"TIER_FEE_PRICE_BUMP"},
}
MaxTierFeePriceBumps = &cli.Uint64Flag{
Name: "tierFee.maxPriceBumps",
Usage: "If nobody accepts block at initial tier fee, how many iterations to increase tier fee before giving up",
Category: proposerCategory,
Value: 3,
EnvVars: []string{"MAX_TIER_FEE_PRICE_BUMPS"},
}
// Proposing epoch related.
ProposeInterval = &cli.DurationFlag{
Name: "epoch.interval",
Usage: "Time interval to propose L2 pending transactions",
Category: proposerCategory,
Value: 0,
EnvVars: []string{"PROPOSE_INTERVAL"},
}
MinGasUsed = &cli.Uint64Flag{
Name: "epoch.minGasUsed",
Usage: "Minimum gas used for a transactions list to propose",
Category: proposerCategory,
Value: 0,
EnvVars: []string{"MIN_GAS_USED"},
}
MinTxListBytes = &cli.Uint64Flag{
Name: "epoch.minTxListBytes",
Usage: "Minimum bytes for a transactions list to propose",
Category: proposerCategory,
Value: 0,
EnvVars: []string{"MIN_TX_LIST_BYTES"},
}
MinProposingInternal = &cli.DurationFlag{
Name: "epoch.minProposingInterval",
Usage: "Minimum time interval to force proposing a block, even if there are no transaction in mempool",
Category: proposerCategory,
Value: 0,
EnvVars: []string{"MIN_PROPOSING_INTERNAL"},
}
// Proposing metadata related.
ExtraData = &cli.StringFlag{
Name: "extraData",
Usage: "Block extra data set by the proposer (default = client version)",
Value: version.CommitVersion(),
Category: proposerCategory,
EnvVars: []string{"EXTRA_DATA"},
}
// Transactions pool related.
TxPoolLocals = &cli.StringSliceFlag{
Name: "txpool.locals",
Usage: "Comma separated accounts to treat as locals (priority inclusion)",
Category: proposerCategory,
EnvVars: []string{"TX_POOL_LOCALS"},
}
TxPoolLocalsOnly = &cli.BoolFlag{
Name: "txpool.localsOnly",
Usage: "If set to true, proposer will only propose transactions of local accounts",
Value: false,
Category: proposerCategory,
EnvVars: []string{"TX_POOL_LOCALS_ONLY"},
}
MaxProposedTxListsPerEpoch = &cli.Uint64Flag{
Name: "txpool.maxTxListsPerEpoch",
Usage: "Maximum number of transaction lists which will be proposed inside one proposing epoch",
Value: 1,
Category: proposerCategory,
EnvVars: []string{"MAX_PROPOSED_TX_LISTS_PER_EPOCH"},
}
ProposeBlockIncludeParentMetaHash = &cli.BoolFlag{
Name: "includeParentMetaHash",
Usage: "Include parent meta hash when proposing block",
Value: false,
Category: proposerCategory,
EnvVars: []string{"PROPOSE_BLOCK_INCLUDE_PARENT_METAHASH"},
}
// Transaction related.
BlobAllowed = &cli.BoolFlag{
Name: "l1.blobAllowed",
Usage: "Send EIP-4844 blob transactions when proposing blocks",
Value: false,
Name: "l1.blobAllowed",
Usage: "Send EIP-4844 blob transactions when proposing blocks",
Value: false,
EnvVars: []string{"BLOB_ALLOWED"},
}
L1BlockBuilderTip = &cli.Uint64Flag{
Name: "l1.blockBuilderTip",
Usage: "Amount you wish to tip the L1 block builder",
Value: 0,
Category: proposerCategory,
EnvVars: []string{"L1_BLOCK_BUILDER_TIP"},
}
)

Expand Down
Loading

0 comments on commit 7d91891

Please sign in to comment.