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 (#729)
Browse files Browse the repository at this point in the history
Co-authored-by: David <[email protected]>
  • Loading branch information
YoGhurt111 and davidtaikocha authored Apr 19, 2024
1 parent a9d637a commit ec7ba9d
Show file tree
Hide file tree
Showing 22 changed files with 293 additions and 96 deletions.
30 changes: 27 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"},
}
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"},
}
L1HTTPEndpoint = &cli.StringFlag{
Name: "l1.http",
Usage: "HTTP RPC endpoint of a L1 ethereum node",
Required: true,
Category: commonCategory,
EnvVars: []string{"L1_HTTP"},
}
L1BeaconEndpoint = &cli.StringFlag{
Name: "l1.beacon",
Usage: "HTTP RPC endpoint of a L1 beacon node",
Category: commonCategory,
EnvVars: []string{"L1_BEACON"},
}
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"},
}
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"},
}
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"},
}
TaikoL2Address = &cli.StringFlag{
Name: "taikoL2",
Usage: "TaikoL2 contract `address`",
Required: true,
Category: commonCategory,
EnvVars: []string{"TAIKO_L2"},
}
TaikoTokenAddress = &cli.StringFlag{
Name: "taikoToken",
Usage: "TaikoToken contract `address`",
Required: true,
Category: commonCategory,
EnvVars: []string{"TAIKO_TOKEN"},
}
// Optional flags used by all client software.
// Logging
Expand All @@ -85,48 +95,62 @@ 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"},
}
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"},
}
AssignmentHookAddress = &cli.StringFlag{
Name: "assignmentHookAddress",
Usage: "Address of the AssignmentHook contract",
Category: commonCategory,
EnvVars: []string{"ASSIGNMENT_HOOK_ADDRESS"},
}
)

Expand All @@ -142,7 +166,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{"P2P_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{"SYNCER_MAX_EXPONENT"},
}
// blob server endpoint
BlobServerEndpoint = &cli.StringFlag{
Name: "blob.server",
Usage: "Blob sidecar storage server",
Category: driverCategory,
EnvVars: []string{"BLOB_SERVER"},
}
)

Expand Down
48 changes: 30 additions & 18 deletions cmd/flags/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,119 +13,131 @@ 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,
}
ProposerAssignmentHookAddress = &cli.StringFlag{
Name: "assignmentHookAddress",
Usage: "Address of the AssignmentHook contract",
Required: true,
Category: proposerCategory,
EnvVars: []string{"L2_SUGGESTED_FEE_RECIPIENT"},
}
)

// Optional flags used by proposer.
var (
// Tier fee related.
OptimisticTierFee = &cli.Uint64Flag{
OptimisticTierFee = &cli.Float64Flag{
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{"TIER_FEE_OPTIMISTIC"},
}
SgxTierFee = &cli.Uint64Flag{
SgxTierFee = &cli.Float64Flag{
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{"TIER_FEE_SGX"},
}
TierFeePriceBump = &cli.Uint64Flag{
Name: "tierFee.pricebump",
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{"TIER_FEE_MAX_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{"EPOCH_INTERVAL"},
}
MinGasUsed = &cli.Uint64Flag{
Name: "epoch.minGasUsed",
Usage: "Minimum gas used for a transactions list to propose",
Category: proposerCategory,
Value: 0,
EnvVars: []string{"EPOCH_MIN_GAS_USED"},
}
MinTxListBytes = &cli.Uint64Flag{
Name: "epoch.minTxListBytes",
Usage: "Minimum bytes for a transactions list to propose",
Category: proposerCategory,
Value: 0,
EnvVars: []string{"EPOCH_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{"EPOCH_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",
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",
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",
Name: "txPool.maxTxListsPerEpoch",
Usage: "Maximum number of transaction lists which will be proposed inside one proposing epoch",
Value: 1,
Category: proposerCategory,
EnvVars: []string{"TX_POOL_MAX_TX_LISTS_PER_EPOCH"},
}
ProposeBlockIncludeParentMetaHash = &cli.BoolFlag{
Name: "includeParentMetaHash",
Usage: "Include parent meta hash when proposing block",
Value: false,
Category: proposerCategory,
EnvVars: []string{"INCLUDE_PARENT_META_HASH"},
}
// 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{"L1_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 All @@ -151,7 +163,7 @@ var ProposerFlags = MergeFlags(CommonFlags, []cli.Flag{
TierFeePriceBump,
MaxTierFeePriceBumps,
ProposeBlockIncludeParentMetaHash,
ProposerAssignmentHookAddress,
AssignmentHookAddress,
BlobAllowed,
L1BlockBuilderTip,
}, TxmgrFlags)
Loading

0 comments on commit ec7ba9d

Please sign in to comment.