diff --git a/cmd/flags/common.go b/cmd/flags/common.go index 1aeeda8ee..f5e888761 100644 --- a/cmd/flags/common.go +++ b/cmd/flags/common.go @@ -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 @@ -85,11 +95,13 @@ 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{ @@ -97,36 +109,48 @@ var ( 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"}, } ) @@ -142,7 +166,7 @@ var CommonFlags = []cli.Flag{ MetricsEnabled, MetricsAddr, MetricsPort, - BackOffMaxRetrys, + BackOffMaxRetries, BackOffRetryInterval, RPCTimeout, } diff --git a/cmd/flags/driver.go b/cmd/flags/driver.go index 8693f0366..8c17c510d 100644 --- a/cmd/flags/driver.go +++ b/cmd/flags/driver.go @@ -14,6 +14,7 @@ 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", @@ -21,11 +22,13 @@ var ( "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{ @@ -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"}, } ) diff --git a/cmd/flags/proposer.go b/cmd/flags/proposer.go index 80754460a..f9982686a 100644 --- a/cmd/flags/proposer.go +++ b/cmd/flags/proposer.go @@ -13,51 +13,52 @@ 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{ @@ -65,24 +66,28 @@ var ( 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{ @@ -90,42 +95,49 @@ var ( 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"}, } ) @@ -151,7 +163,7 @@ var ProposerFlags = MergeFlags(CommonFlags, []cli.Flag{ TierFeePriceBump, MaxTierFeePriceBumps, ProposeBlockIncludeParentMetaHash, - ProposerAssignmentHookAddress, + AssignmentHookAddress, BlobAllowed, L1BlockBuilderTip, }, TxmgrFlags) diff --git a/cmd/flags/prover.go b/cmd/flags/prover.go index 715f16538..0e533270f 100644 --- a/cmd/flags/prover.go +++ b/cmd/flags/prover.go @@ -13,53 +13,55 @@ var ( Usage: "Private key of L1 prover, who will send TaikoL1.proveBlock transactions", Required: true, Category: proverCategory, + EnvVars: []string{"L1_PROVER_PRIV_KEY"}, } ProverCapacity = &cli.Uint64Flag{ Name: "prover.capacity", Usage: "Capacity of prover", Required: true, Category: proverCategory, - } - ProverAssignmentHookAddress = &cli.StringFlag{ - Name: "assignmentHook", - Usage: "Address of the AssignmentHook contract", - Required: true, - Category: proverCategory, + EnvVars: []string{"PROVER_CAPACITY"}, } ) // Optional flags used by prover. var ( RaikoHostEndpoint = &cli.StringFlag{ - Name: "raiko.hostEndpoint", + Name: "raiko.host", Usage: "RPC endpoint of a Raiko host service", Category: proverCategory, + EnvVars: []string{"RAIKO_HOST"}, } RaikoL1Endpoint = &cli.StringFlag{ - Name: "raiko.l1Endpoint", + Name: "raiko.l1", Usage: "L1 RPC endpoint which will be sent to the Raiko service", Category: proverCategory, + EnvVars: []string{"RAIKO_L1"}, } RaikoL1BeaconEndpoint = &cli.StringFlag{ - Name: "raiko.l1BeaconEndpoint", + Name: "raiko.l1Beacon", Usage: "L1 beacon RPC endpoint which will be sent to the Raiko service", Category: proverCategory, + EnvVars: []string{"RAIKO_L1_BEACON"}, } RaikoL2Endpoint = &cli.StringFlag{ - Name: "raiko.l2Endpoint", + Name: "raiko.l2", Usage: "L2 RPC endpoint which will be sent to the Raiko service", Category: proverCategory, + EnvVars: []string{"RAIKO_L2"}, } StartingBlockID = &cli.Uint64Flag{ Name: "prover.startingBlockID", Usage: "If set, prover will start proving blocks from the block with this ID", Category: proverCategory, + EnvVars: []string{"PROVER_STARTING_BLOCK_ID"}, } Graffiti = &cli.StringFlag{ Name: "prover.graffiti", Usage: "When string is passed, adds additional graffiti info to proof evidence", Category: proverCategory, Value: "", + EnvVars: []string{"PROVER_GRAFFITI"}, } // Proving strategy. ProveUnassignedBlocks = &cli.BoolFlag{ @@ -67,34 +69,40 @@ var ( Usage: "Whether you want to prove unassigned blocks, or only work on assigned proofs", Category: proverCategory, Value: false, + EnvVars: []string{"PROVER_PROVE_UNASSIGNED_BLOCKS"}, } - MinEthBalance = &cli.Uint64Flag{ + MinEthBalance = &cli.Float64Flag{ Name: "prover.minEthBalance", - Usage: "Minimum ETH balance (in wei) a prover wants to keep", + Usage: "Minimum ETH balance (in Ether) a prover wants to keep", Category: proverCategory, Value: 0, + EnvVars: []string{"PROVER_MIN_ETH_BALANCE"}, } - MinTaikoTokenBalance = &cli.Uint64Flag{ + MinTaikoTokenBalance = &cli.Float64Flag{ Name: "prover.minTaikoTokenBalance", - Usage: "Minimum Taiko token balance a prover wants to keep", + Usage: "Minimum Taiko token balance without decimal a prover wants to keep", Category: proverCategory, Value: 0, + EnvVars: []string{"PROVER_MIN_TAIKO_TOKEN_BALANCE"}, } // Tier fee related. MinOptimisticTierFee = &cli.Uint64Flag{ Name: "minTierFee.optimistic", Usage: "Minimum accepted fee for generating an optimistic proof", Category: proverCategory, + EnvVars: []string{"MIN_TIER_FEE_OPTIMISTIC"}, } MinSgxTierFee = &cli.Uint64Flag{ Name: "minTierFee.sgx", Usage: "Minimum accepted fee for generating a SGX proof", Category: proverCategory, + EnvVars: []string{"MIN_TIER_FEE_SGX"}, } MinSgxAndZkVMTierFee = &cli.Uint64Flag{ Name: "minTierFee.sgxAndZkvm", Usage: "Minimum accepted fee for generating a SGX + zkVM proof", Category: proverCategory, + EnvVars: []string{"MIN_TIER_FEE_SGX_AND_ZKVM"}, } // Running mode ContesterMode = &cli.BoolFlag{ @@ -102,19 +110,22 @@ var ( Usage: "Whether you want to contest wrong transitions with higher tier proofs", Category: proverCategory, Value: false, + EnvVars: []string{"MODE_CONTESTER"}, } // HTTP server related. ProverHTTPServerPort = &cli.Uint64Flag{ - Name: "http.port", + Name: "prover.port", Usage: "Port to expose for http server", Category: proverCategory, Value: 9876, + EnvVars: []string{"PROVER_PORT"}, } MaxExpiry = &cli.DurationFlag{ Name: "http.maxExpiry", Usage: "Maximum accepted expiry in seconds for accepting proving a block", Value: 1 * time.Hour, Category: proverCategory, + EnvVars: []string{"HTTP_MAX_EXPIRY"}, } // Special flags for testing. Dummy = &cli.BoolFlag{ @@ -122,6 +133,7 @@ var ( Usage: "Produce dummy proofs, testing purposes only", Value: false, Category: proverCategory, + EnvVars: []string{"PROVER_DUMMY"}, } // Max slippage allowed MaxAcceptableBlockSlippage = &cli.Uint64Flag{ @@ -129,6 +141,7 @@ var ( Usage: "Maximum accepted slippage difference for blockID for accepting proving a block", Value: 1024, Category: proverCategory, + EnvVars: []string{"PROVER_BLOCK_SLIPPAGE"}, } // Max amount of L1 blocks that can pass before block is invalid MaxProposedIn = &cli.Uint64Flag{ @@ -136,44 +149,52 @@ var ( Usage: "Maximum amount of L1 blocks that can pass before block can not be proposed. 0 means no limit.", Value: 0, Category: proverCategory, + EnvVars: []string{"PROVER_MAX_PROPOSED_IN"}, } - Allowance = &cli.StringFlag{ + Allowance = &cli.Float64Flag{ Name: "prover.allowance", - Usage: "Amount to approve AssignmentHook contract for TaikoToken usage", + Usage: "Amount without decimal to approve AssignmentHook contract for TaikoToken usage", Category: proverCategory, + EnvVars: []string{"PROVER_ALLOWANCE"}, } GuardianProverHealthCheckServerEndpoint = &cli.StringFlag{ Name: "prover.guardianProverHealthCheckServerEndpoint", Usage: "HTTP endpoint for main guardian prover health check server", Category: proverCategory, + EnvVars: []string{"PROVER_GUARDIAN_PROVER_HEALTH_CHECK_SERVER_ENDPOINT"}, } // Guardian prover specific flag GuardianProver = &cli.StringFlag{ Name: "guardianProver", Usage: "GuardianProver contract `address`", Category: proverCategory, + EnvVars: []string{"GUARDIAN_PROVER"}, } GuardianProofSubmissionDelay = &cli.DurationFlag{ Name: "guardian.submissionDelay", Usage: "Guardian proof submission delay", Value: 1 * time.Hour, Category: proverCategory, + EnvVars: []string{"GUARDIAN_SUBMISSION_DELAY"}, } EnableLivenessBondProof = &cli.BoolFlag{ Name: "prover.enableLivenessBondProof", Usage: "Toggles whether the proof is a dummy proof or returns keccak256(RETURN_LIVENESS_BOND) as proof", Value: false, Category: proverCategory, + EnvVars: []string{"PROVER_ENABLE_LIVENESS_BOND_PROOF"}, } L1NodeVersion = &cli.StringFlag{ Name: "prover.l1NodeVersion", Usage: "Version or tag or the L1 Node Version used as an L1 RPC Url by this guardian prover", Category: proverCategory, + EnvVars: []string{"PROVER_L1_NODE_VERSION"}, } L2NodeVersion = &cli.StringFlag{ Name: "prover.l2NodeVersion", Usage: "Version or tag or the L2 Node Version used as an L2 RPC Url by this guardian prover", Category: proverCategory, + EnvVars: []string{"PROVER_L2_NODE_VERSION"}, } // Confirmations specific flag BlockConfirmations = &cli.Uint64Flag{ @@ -181,6 +202,7 @@ var ( Usage: "Confirmations to the latest L1 block before submitting a proof for a L2 block", Value: 6, Category: proverCategory, + EnvVars: []string{"PROVER_BLOCK_CONFIRMATIONS"}, } ) @@ -214,7 +236,7 @@ var ProverFlags = MergeFlags(CommonFlags, []cli.Flag{ MaxProposedIn, TaikoTokenAddress, MaxAcceptableBlockSlippage, - ProverAssignmentHookAddress, + AssignmentHookAddress, Allowance, L1NodeVersion, L2NodeVersion, diff --git a/cmd/flags/txmgr.go b/cmd/flags/txmgr.go index 852b80a8b..640f13a45 100644 --- a/cmd/flags/txmgr.go +++ b/cmd/flags/txmgr.go @@ -12,6 +12,7 @@ var ( Usage: "Number of confirmations which we will wait after sending a transaction", Value: 0, Category: txmgrCategory, + EnvVars: []string{"TX_NUM_CONFIRMATIONS"}, } SafeAbortNonceTooLowCount = &cli.Uint64Flag{ Name: "tx.safeAbortNonceTooLowCount", @@ -19,12 +20,14 @@ var ( "a tx at a particular nonce without receiving confirmation", Value: 3, Category: txmgrCategory, + EnvVars: []string{"TX_SAFE_ABORT_NONCE_TOO_LOW_COUNT"}, } FeeLimitMultiplier = &cli.Uint64Flag{ Name: "tx.feeLimitMultiplier", Usage: "The multiplier applied to fee suggestions to put a hard limit on fee increases", Value: 10, Category: txmgrCategory, + EnvVars: []string{"TX_FEE_LIMIT_MULTIPLIER"}, } FeeLimitThreshold = &cli.Float64Flag{ Name: "tx.feeLimitThreshold", @@ -32,48 +35,56 @@ var ( "Allows arbitrary fee bumps below this threshold.", Value: 100.0, Category: txmgrCategory, + EnvVars: []string{"TX_FEE_LIMIT_THRESHOLD"}, } MinTipCap = &cli.Float64Flag{ Name: "tx.minTipCap", Usage: "Enforces a minimum tip cap (in GWei) to use when determining tx fees. 1 GWei by default.", Value: 1.0, Category: txmgrCategory, + EnvVars: []string{"TX_MIN_TIP_CAP"}, } MinBaseFee = &cli.Float64Flag{ Name: "tx.minBaseFee", Usage: "Enforces a minimum base fee (in GWei) to assume when determining tx fees. 1 GWei by default.", Value: 1.0, Category: txmgrCategory, + EnvVars: []string{"TX_MIN_BASE_FEE"}, } ResubmissionTimeout = &cli.DurationFlag{ Name: "tx.resubmissionTimeout", Usage: "Duration we will wait before resubmitting a transaction to L1", Value: 48 * time.Second, Category: txmgrCategory, + EnvVars: []string{"TX_RESUBMISSION_TIMEOUT"}, } TxSendTimeout = &cli.DurationFlag{ Name: "tx.sendTimeout", Usage: "Timeout for sending transactions. If 0 it is disabled.", Value: 0, Category: txmgrCategory, + EnvVars: []string{"TX_SEND_TIMEOUT"}, } TxNotInMempoolTimeout = &cli.DurationFlag{ Name: "tx.notInMempoolTimeout", Usage: "Timeout for aborting a tx send if the tx does not make it to the mempool.", Value: 2 * time.Minute, Category: txmgrCategory, + EnvVars: []string{"TX_NOT_IN_MEMPOOL_TIMEOUT"}, } ReceiptQueryInterval = &cli.DurationFlag{ Name: "tx.receiptQueryInterval", Usage: "Frequency to poll for receipts", Value: 12 * time.Second, Category: txmgrCategory, + EnvVars: []string{"TX_RECEIPT_QUERY_INTERVAL"}, } TxGasLimit = &cli.Uint64Flag{ Name: "tx.gasLimit", Usage: "Gas limit will be used for transactions (0 means using gas estimation)", Value: 0, Category: txmgrCategory, + EnvVars: []string{"TX_GAS_LIMIT"}, } ) diff --git a/driver/anchor_tx_constructor/anchor_tx_constructor.go b/driver/anchor_tx_constructor/anchor_tx_constructor.go index 7787fe2d5..0c014aa05 100644 --- a/driver/anchor_tx_constructor/anchor_tx_constructor.go +++ b/driver/anchor_tx_constructor/anchor_tx_constructor.go @@ -13,6 +13,7 @@ import ( "github.com/taikoxyz/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-client/driver/signer" + "github.com/taikoxyz/taiko-client/internal/utils" "github.com/taikoxyz/taiko-client/pkg/rpc" ) @@ -69,7 +70,7 @@ func (c *AnchorTxConstructor) AssembleAnchorTx( "l1Height", l1Height, "l1Hash", l1Hash, "stateRoot", l1Header.Root, - "baseFee", baseFee, + "baseFee", utils.WeiToGWei(baseFee), "gasUsed", parentGasUsed, ) diff --git a/driver/chain_syncer/calldata/syncer.go b/driver/chain_syncer/calldata/syncer.go index 85862c596..65dfc971e 100644 --- a/driver/chain_syncer/calldata/syncer.go +++ b/driver/chain_syncer/calldata/syncer.go @@ -296,7 +296,7 @@ func (s *Syncer) onBlockProposed( "height", payloadData.Number, "hash", payloadData.BlockHash, "transactions", len(payloadData.Transactions), - "baseFee", payloadData.BaseFeePerGas, + "baseFee", utils.WeiToGWei(payloadData.BaseFeePerGas), "withdrawals", len(payloadData.Withdrawals), ) @@ -350,7 +350,7 @@ func (s *Syncer) insertNewHead( log.Info( "L2 baseFee", "blockID", event.BlockId, - "baseFee", baseFeeInfo.Basefee, + "baseFee", utils.WeiToGWei(baseFeeInfo.Basefee), "syncedL1Height", event.Meta.L1Height, "parentGasUsed", parent.GasUsed, ) @@ -483,7 +483,7 @@ func (s *Syncer) createExecutionPayloads( "gasLimit", attributes.BlockMetadata.GasLimit, "timestamp", attributes.BlockMetadata.Timestamp, "mixHash", attributes.BlockMetadata.MixHash, - "baseFee", attributes.BaseFeePerGas, + "baseFee", utils.WeiToGWei(attributes.BaseFeePerGas), "extraData", string(attributes.BlockMetadata.ExtraData), "l1OriginHeight", attributes.L1Origin.L1BlockHeight, "l1OriginHash", attributes.L1Origin.L1BlockHash, @@ -510,7 +510,7 @@ func (s *Syncer) createExecutionPayloads( log.Debug( "Payload", "blockID", event.BlockId, - "baseFee", payload.BaseFeePerGas, + "baseFee", utils.WeiToGWei(payload.BaseFeePerGas), "number", payload.Number, "hash", payload.BlockHash, "gasLimit", payload.GasLimit, diff --git a/driver/config.go b/driver/config.go index 852578f3a..21d1382db 100644 --- a/driver/config.go +++ b/driver/config.go @@ -19,7 +19,6 @@ type Config struct { *rpc.ClientConfig P2PSyncVerifiedBlocks bool P2PSyncTimeout time.Duration - RPCTimeout time.Duration RetryInterval time.Duration MaxExponent uint64 BlobServerEndpoint *url.URL @@ -71,7 +70,6 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { RetryInterval: c.Duration(flags.BackOffRetryInterval.Name), P2PSyncVerifiedBlocks: p2pSyncVerifiedBlocks, P2PSyncTimeout: c.Duration(flags.P2PSyncTimeout.Name), - RPCTimeout: timeout, MaxExponent: c.Uint64(flags.MaxExponent.Name), BlobServerEndpoint: blobServerEndpoint, }, nil diff --git a/driver/config_test.go b/driver/config_test.go index 2d528cb72..79bfd9b17 100644 --- a/driver/config_test.go +++ b/driver/config_test.go @@ -18,7 +18,6 @@ var ( l2EngineEndpoint = os.Getenv("L2_EXECUTION_ENGINE_AUTH_ENDPOINT") taikoL1 = os.Getenv("TAIKO_L1_ADDRESS") taikoL2 = os.Getenv("TAIKO_L2_ADDRESS") - rpcTimeout = 5 * time.Second ) func (s *DriverTestSuite) TestNewConfigFromCliContext() { @@ -34,7 +33,6 @@ func (s *DriverTestSuite) TestNewConfigFromCliContext() { s.Equal(taikoL1, c.TaikoL1Address.String()) s.Equal(taikoL2, c.TaikoL2Address.String()) s.Equal(120*time.Second, c.P2PSyncTimeout) - s.Equal(rpcTimeout, c.RPCTimeout) s.NotEmpty(c.JwtSecret) s.True(c.P2PSyncVerifiedBlocks) s.Equal(l2CheckPoint, c.L2CheckPoint) diff --git a/internal/utils/util_test.go b/internal/utils/util_test.go index 1f3a47c8e..730831add 100644 --- a/internal/utils/util_test.go +++ b/internal/utils/util_test.go @@ -1,8 +1,10 @@ package utils_test import ( + "math/big" "testing" + "github.com/ethereum/go-ethereum/params" "github.com/stretchr/testify/require" "github.com/taikoxyz/taiko-client/internal/testutils" "github.com/taikoxyz/taiko-client/internal/utils" @@ -20,3 +22,27 @@ func TestEncodeDecodeBytes(t *testing.T) { require.Equal(t, b, decompressed) } + +func TestGWeiToWei(t *testing.T) { + wei, err := utils.GWeiToWei(1.0) + require.Nil(t, err) + + require.Equal(t, big.NewInt(params.GWei), wei) +} + +func TestEtherToWei(t *testing.T) { + wei, err := utils.EtherToWei(1.0) + require.Nil(t, err) + + require.Equal(t, big.NewInt(params.Ether), wei) +} + +func TestWeiToEther(t *testing.T) { + eth := utils.WeiToEther(big.NewInt(params.Ether)) + require.Equal(t, new(big.Float).SetUint64(1), eth) +} + +func TestWeiToGWei(t *testing.T) { + gwei := utils.WeiToGWei(big.NewInt(params.GWei)) + require.Equal(t, new(big.Float).SetUint64(1), gwei) +} diff --git a/internal/utils/utils.go b/internal/utils/utils.go index 0f3a3805c..1eaea75dd 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -6,13 +6,16 @@ import ( "crypto/rand" "errors" "fmt" + "math" + "io" "math/big" "os" "strings" - "github.com/ethereum/go-ethereum/common/math" + "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/params" "github.com/joho/godotenv" "github.com/modern-go/reflect2" "golang.org/x/exp/constraints" @@ -109,3 +112,51 @@ func Decompress(compressedTxList []byte) ([]byte, error) { return b, nil } + +// GWeiToWei converts gwei value to wei value. +func GWeiToWei(gwei float64) (*big.Int, error) { + if math.IsNaN(gwei) || math.IsInf(gwei, 0) { + return nil, fmt.Errorf("invalid gwei value: %v", gwei) + } + + // convert float GWei value into integer Wei value + wei, _ := new(big.Float).Mul( + big.NewFloat(gwei), + big.NewFloat(params.GWei)). + Int(nil) + + if wei.Cmp(abi.MaxUint256) == 1 { + return nil, errors.New("gwei value larger than max uint256") + } + + return wei, nil +} + +// EtherToWei converts ether value to wei value. +func EtherToWei(ether float64) (*big.Int, error) { + if math.IsNaN(ether) || math.IsInf(ether, 0) { + return nil, fmt.Errorf("invalid ether value: %v", ether) + } + + // convert float GWei value into integer Wei value + wei, _ := new(big.Float).Mul( + big.NewFloat(ether), + big.NewFloat(params.Ether)). + Int(nil) + + if wei.Cmp(abi.MaxUint256) == 1 { + return nil, errors.New("ether value larger than max uint256") + } + + return wei, nil +} + +// WeiToEther converts wei value to ether value. +func WeiToEther(wei *big.Int) *big.Float { + return new(big.Float).Quo(new(big.Float).SetInt(wei), new(big.Float).SetInt(big.NewInt(params.Ether))) +} + +// WeiToGWei converts wei value to gwei value. +func WeiToGWei(wei *big.Int) *big.Float { + return new(big.Float).Quo(new(big.Float).SetInt(wei), new(big.Float).SetInt(big.NewInt(params.GWei))) +} diff --git a/pkg/rpc/methods.go b/pkg/rpc/methods.go index c609d4959..a8f6b8b64 100644 --- a/pkg/rpc/methods.go +++ b/pkg/rpc/methods.go @@ -19,6 +19,7 @@ import ( "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" + "github.com/taikoxyz/taiko-client/internal/utils" ) var ( @@ -277,7 +278,7 @@ func (c *Client) GetPoolContent( return nil, err } - log.Info("Current base fee", "fee", baseFeeInfo.Basefee) + log.Info("Current base fee", "fee", utils.WeiToGWei(baseFeeInfo.Basefee)) var localsArg []string for _, local := range locals { diff --git a/pkg/rpc/utils.go b/pkg/rpc/utils.go index 5771d3d38..cfb64e582 100644 --- a/pkg/rpc/utils.go +++ b/pkg/rpc/utils.go @@ -63,9 +63,9 @@ func CheckProverBalance( log.Info( "Prover allowance for TaikoL1 contract", - "allowance", allowance.String(), + "allowance", utils.WeiToEther(allowance), "address", prover.Hex(), - "bond", bond.String(), + "bond", utils.WeiToEther(bond), ) // Check prover's taiko token balance @@ -76,18 +76,18 @@ func CheckProverBalance( log.Info( "Prover's wallet taiko token balance", - "balance", balance.String(), + "balance", utils.WeiToEther(balance), "address", prover.Hex(), - "bond", bond.String(), + "bond", utils.WeiToEther(bond), ) if bond.Cmp(allowance) > 0 || bond.Cmp(balance) > 0 { log.Info( "Assigned prover does not have required on-chain token balance or allowance", "providedProver", prover.Hex(), - "taikoTokenBalance", balance, - "allowance", allowance.String(), - "bond", bond, + "taikoTokenBalance", utils.WeiToEther(balance), + "allowance", utils.WeiToEther(allowance), + "bond", utils.WeiToEther(bond), ) return false, nil } diff --git a/proposer/config.go b/proposer/config.go index bd5215abb..673289f0e 100644 --- a/proposer/config.go +++ b/proposer/config.go @@ -14,9 +14,11 @@ import ( "github.com/urfave/cli/v2" "github.com/taikoxyz/taiko-client/cmd/flags" - pkgFlags "github.com/taikoxyz/taiko-client/pkg/flags" + "github.com/taikoxyz/taiko-client/internal/utils" "github.com/taikoxyz/taiko-client/pkg/jwt" "github.com/taikoxyz/taiko-client/pkg/rpc" + + pkgFlags "github.com/taikoxyz/taiko-client/pkg/flags" ) // Config contains all configurations to initialize a Taiko proposer. @@ -84,6 +86,16 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { proverEndpoints = append(proverEndpoints, endpoint) } + optimisticTierFee, err := utils.GWeiToWei(c.Float64(flags.OptimisticTierFee.Name)) + if err != nil { + return nil, err + } + + sgxTierFee, err := utils.GWeiToWei(c.Float64(flags.SgxTierFee.Name)) + if err != nil { + return nil, err + } + return &Config{ ClientConfig: &rpc.ClientConfig{ L1Endpoint: c.String(flags.L1WSEndpoint.Name), @@ -95,7 +107,7 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { TaikoTokenAddress: common.HexToAddress(c.String(flags.TaikoTokenAddress.Name)), Timeout: c.Duration(flags.RPCTimeout.Name), }, - AssignmentHookAddress: common.HexToAddress(c.String(flags.ProposerAssignmentHookAddress.Name)), + AssignmentHookAddress: common.HexToAddress(c.String(flags.AssignmentHookAddress.Name)), L1ProposerPrivKey: l1ProposerPrivKey, L2SuggestedFeeRecipient: common.HexToAddress(l2SuggestedFeeRecipient), ExtraData: c.String(flags.ExtraData.Name), @@ -108,8 +120,8 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { MaxProposedTxListsPerEpoch: c.Uint64(flags.MaxProposedTxListsPerEpoch.Name), ProposeBlockTxGasLimit: c.Uint64(flags.TxGasLimit.Name), ProverEndpoints: proverEndpoints, - OptimisticTierFee: new(big.Int).SetUint64(c.Uint64(flags.OptimisticTierFee.Name)), - SgxTierFee: new(big.Int).SetUint64(c.Uint64(flags.SgxTierFee.Name)), + OptimisticTierFee: optimisticTierFee, + SgxTierFee: sgxTierFee, TierFeePriceBump: new(big.Int).SetUint64(c.Uint64(flags.TierFeePriceBump.Name)), MaxTierFeePriceBumps: c.Uint64(flags.MaxTierFeePriceBumps.Name), IncludeParentMetaHash: c.Bool(flags.ProposeBlockIncludeParentMetaHash.Name), diff --git a/proposer/config_test.go b/proposer/config_test.go index 5b3d83eb1..59124c3f2 100644 --- a/proposer/config_test.go +++ b/proposer/config_test.go @@ -13,6 +13,7 @@ import ( "github.com/taikoxyz/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-client/cmd/flags" + "github.com/taikoxyz/taiko-client/internal/utils" ) var ( @@ -22,7 +23,7 @@ var ( taikoL2 = os.Getenv("TAIKO_L2_ADDRESS") taikoToken = os.Getenv("TAIKO_TOKEN_ADDRESS") proverEndpoints = "http://localhost:9876,http://localhost:1234" - tierFee = 102400000000 + tierFee = 100.0 proposeInterval = "10s" rpcTimeout = "5s" ) @@ -47,8 +48,10 @@ func (s *ProposerTestSuite) TestNewConfigFromCliContext() { s.Equal(1, len(c.LocalAddresses)) s.Equal(goldenTouchAddress, c.LocalAddresses[0]) s.Equal(5*time.Second, c.Timeout) - s.Equal(uint64(tierFee), c.OptimisticTierFee.Uint64()) - s.Equal(uint64(tierFee), c.SgxTierFee.Uint64()) + tierFeeGWei, err := utils.GWeiToWei(tierFee) + s.Nil(err) + s.Equal(tierFeeGWei.Uint64(), c.OptimisticTierFee.Uint64()) + s.Equal(tierFeeGWei.Uint64(), c.SgxTierFee.Uint64()) s.Equal(uint64(15), c.TierFeePriceBump.Uint64()) s.Equal(uint64(5), c.MaxTierFeePriceBumps) s.Equal(true, c.IncludeParentMetaHash) @@ -140,7 +143,7 @@ func (s *ProposerTestSuite) SetupApp() *cli.App { &cli.Uint64Flag{Name: flags.TierFeePriceBump.Name}, &cli.Uint64Flag{Name: flags.MaxTierFeePriceBumps.Name}, &cli.BoolFlag{Name: flags.ProposeBlockIncludeParentMetaHash.Name}, - &cli.StringFlag{Name: flags.ProposerAssignmentHookAddress.Name}, + &cli.StringFlag{Name: flags.AssignmentHookAddress.Name}, } app.Flags = append(app.Flags, flags.TxmgrFlags...) app.Action = func(ctx *cli.Context) error { diff --git a/proposer/proposer.go b/proposer/proposer.go index 04da37bd8..6bdb9a0fa 100644 --- a/proposer/proposer.go +++ b/proposer/proposer.go @@ -391,8 +391,8 @@ func (p *Proposer) initTierFees() error { "Protocol tier", "id", tier.ID, "name", string(bytes.TrimRight(tier.VerifierName[:], "\x00")), - "validityBond", tier.ValidityBond, - "contestBond", tier.ContestBond, + "validityBond", utils.WeiToEther(tier.ValidityBond), + "contestBond", utils.WeiToEther(tier.ContestBond), "provingWindow", tier.ProvingWindow, "cooldownWindow", tier.CooldownWindow, ) diff --git a/prover/config.go b/prover/config.go index de366e1d7..c0508e04a 100644 --- a/prover/config.go +++ b/prover/config.go @@ -14,6 +14,8 @@ import ( "github.com/urfave/cli/v2" "github.com/taikoxyz/taiko-client/cmd/flags" + "github.com/taikoxyz/taiko-client/internal/utils" + pkgFlags "github.com/taikoxyz/taiko-client/pkg/flags" ) @@ -34,7 +36,7 @@ type Config struct { GuardianProverAddress common.Address GuardianProofSubmissionDelay time.Duration Graffiti string - BackOffMaxRetrys uint64 + BackOffMaxRetries uint64 BackOffRetryInterval time.Duration ProveUnassignedBlocks bool ContesterMode bool @@ -81,9 +83,9 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { var allowance = common.Big0 if c.IsSet(flags.Allowance.Name) { - amt, ok := new(big.Int).SetString(c.String(flags.Allowance.Name), 10) - if !ok { - return nil, fmt.Errorf("invalid setting allowance config value: %v", c.String(flags.Allowance.Name)) + amt, err := utils.EtherToWei(c.Float64(flags.Allowance.Name)) + if err != nil { + return nil, fmt.Errorf("invalid setting allowance config value: %v", c.Float64(flags.Allowance.Name)) } allowance = amt @@ -136,6 +138,31 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { raikoL2Endpoint = c.String(flags.L2HTTPEndpoint.Name) } + minOptimisticTierFee, err := utils.GWeiToWei(c.Float64(flags.MinOptimisticTierFee.Name)) + if err != nil { + return nil, err + } + + minSgxTierFee, err := utils.GWeiToWei(c.Float64(flags.MinSgxTierFee.Name)) + if err != nil { + return nil, err + } + + minSgxAndZkVMTierFee, err := utils.GWeiToWei(c.Float64(flags.MinSgxAndZkVMTierFee.Name)) + if err != nil { + return nil, err + } + + minEthBalance, err := utils.EtherToWei(c.Float64(flags.MinEthBalance.Name)) + if err != nil { + return nil, err + } + + minTaikoTokenBalance, err := utils.EtherToWei(c.Float64(flags.MinTaikoTokenBalance.Name)) + if err != nil { + return nil, err + } + return &Config{ L1WsEndpoint: c.String(flags.L1WSEndpoint.Name), L1HttpEndpoint: c.String(flags.L1HTTPEndpoint.Name), @@ -145,7 +172,7 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { TaikoL1Address: common.HexToAddress(c.String(flags.TaikoL1Address.Name)), TaikoL2Address: common.HexToAddress(c.String(flags.TaikoL2Address.Name)), TaikoTokenAddress: common.HexToAddress(c.String(flags.TaikoTokenAddress.Name)), - AssignmentHookAddress: common.HexToAddress(c.String(flags.ProverAssignmentHookAddress.Name)), + AssignmentHookAddress: common.HexToAddress(c.String(flags.AssignmentHookAddress.Name)), L1ProverPrivKey: l1ProverPrivKey, RaikoHostEndpoint: c.String(flags.RaikoHostEndpoint.Name), RaikoL1Endpoint: raikoL1Endpoint, @@ -157,7 +184,7 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { GuardianProofSubmissionDelay: c.Duration(flags.GuardianProofSubmissionDelay.Name), GuardianProverHealthCheckServerEndpoint: guardianProverHealthCheckServerEndpoint, Graffiti: c.String(flags.Graffiti.Name), - BackOffMaxRetrys: c.Uint64(flags.BackOffMaxRetrys.Name), + BackOffMaxRetries: c.Uint64(flags.BackOffMaxRetries.Name), BackOffRetryInterval: c.Duration(flags.BackOffRetryInterval.Name), ProveUnassignedBlocks: c.Bool(flags.ProveUnassignedBlocks.Name), ContesterMode: c.Bool(flags.ContesterMode.Name), @@ -166,11 +193,11 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { ProveBlockGasLimit: c.Uint64(flags.TxGasLimit.Name), Capacity: c.Uint64(flags.ProverCapacity.Name), HTTPServerPort: c.Uint64(flags.ProverHTTPServerPort.Name), - MinOptimisticTierFee: new(big.Int).SetUint64(c.Uint64(flags.MinOptimisticTierFee.Name)), - MinSgxTierFee: new(big.Int).SetUint64(c.Uint64(flags.MinSgxTierFee.Name)), - MinSgxAndZkVMTierFee: new(big.Int).SetUint64(c.Uint64(flags.MinSgxAndZkVMTierFee.Name)), - MinEthBalance: new(big.Int).SetUint64(c.Uint64(flags.MinEthBalance.Name)), - MinTaikoTokenBalance: new(big.Int).SetUint64(c.Uint64(flags.MinTaikoTokenBalance.Name)), + MinOptimisticTierFee: minOptimisticTierFee, + MinSgxTierFee: minSgxTierFee, + MinSgxAndZkVMTierFee: minSgxAndZkVMTierFee, + MinEthBalance: minEthBalance, + MinTaikoTokenBalance: minTaikoTokenBalance, MaxExpiry: c.Duration(flags.MaxExpiry.Name), MaxBlockSlippage: c.Uint64(flags.MaxAcceptableBlockSlippage.Name), MaxProposedIn: c.Uint64(flags.MaxProposedIn.Name), diff --git a/prover/config_test.go b/prover/config_test.go index a6214060d..3d8da7f1d 100644 --- a/prover/config_test.go +++ b/prover/config_test.go @@ -10,6 +10,7 @@ import ( "github.com/urfave/cli/v2" "github.com/taikoxyz/taiko-client/cmd/flags" + "github.com/taikoxyz/taiko-client/internal/utils" ) var ( @@ -22,9 +23,9 @@ var ( l2NodeVersion = "0.1.0" taikoL1 = os.Getenv("TAIKO_L1_ADDRESS") taikoL2 = os.Getenv("TAIKO_L2_ADDRESS") - allowance = "10000000000000000000000000000000000000000000000000" + allowance = 10.0 rpcTimeout = 5 * time.Second - minTierFee = 1024 + minTierFee = 1024.0 ) func (s *ProverTestSuite) TestNewConfigFromCliContextGuardianProver() { @@ -49,15 +50,19 @@ func (s *ProverTestSuite) TestNewConfigFromCliContextGuardianProver() { s.True(c.ContesterMode) s.Equal(rpcTimeout, c.RPCTimeout) s.Equal(uint64(8), c.Capacity) - s.Equal(uint64(minTierFee), c.MinOptimisticTierFee.Uint64()) - s.Equal(uint64(minTierFee), c.MinSgxTierFee.Uint64()) + tierFeeGWei, err := utils.GWeiToWei(minTierFee) + s.Nil(err) + s.Equal(tierFeeGWei.Uint64(), c.MinOptimisticTierFee.Uint64()) + s.Equal(tierFeeGWei.Uint64(), c.MinSgxTierFee.Uint64()) s.Equal(c.L1NodeVersion, l1NodeVersion) s.Equal(c.L2NodeVersion, l2NodeVersion) s.Nil(new(Prover).InitFromCli(context.Background(), ctx)) s.True(c.ProveUnassignedBlocks) s.Equal(uint64(100), c.MaxProposedIn) s.Equal(os.Getenv("ASSIGNMENT_HOOK_ADDRESS"), c.AssignmentHookAddress.String()) - s.Equal(allowance, c.Allowance.String()) + allowanceWithDecimal, err := utils.EtherToWei(allowance) + s.Nil(err) + s.Equal(allowanceWithDecimal.Uint64(), c.Allowance.Uint64()) return err } @@ -80,11 +85,11 @@ func (s *ProverTestSuite) TestNewConfigFromCliContextGuardianProver() { "--" + flags.MinSgxTierFee.Name, fmt.Sprint(minTierFee), "--" + flags.ProverCapacity.Name, "8", "--" + flags.GuardianProver.Name, os.Getenv("GUARDIAN_PROVER_CONTRACT_ADDRESS"), - "--" + flags.ProverAssignmentHookAddress.Name, os.Getenv("ASSIGNMENT_HOOK_ADDRESS"), + "--" + flags.AssignmentHookAddress.Name, os.Getenv("ASSIGNMENT_HOOK_ADDRESS"), "--" + flags.Graffiti.Name, "", "--" + flags.ProveUnassignedBlocks.Name, "--" + flags.MaxProposedIn.Name, "100", - "--" + flags.Allowance.Name, allowance, + "--" + flags.Allowance.Name, fmt.Sprint(allowance), "--" + flags.L1NodeVersion.Name, l1NodeVersion, "--" + flags.L2NodeVersion.Name, l2NodeVersion, })) @@ -120,7 +125,7 @@ func (s *ProverTestSuite) SetupApp() *cli.App { &cli.Uint64Flag{Name: flags.MinOptimisticTierFee.Name}, &cli.Uint64Flag{Name: flags.MinSgxTierFee.Name}, &cli.Uint64Flag{Name: flags.MaxProposedIn.Name}, - &cli.StringFlag{Name: flags.ProverAssignmentHookAddress.Name}, + &cli.StringFlag{Name: flags.AssignmentHookAddress.Name}, &cli.StringFlag{Name: flags.Allowance.Name}, &cli.StringFlag{Name: flags.ContesterMode.Name}, &cli.StringFlag{Name: flags.L1NodeVersion.Name}, diff --git a/prover/init.go b/prover/init.go index 0fc7a2a2d..5eb143628 100644 --- a/prover/init.go +++ b/prover/init.go @@ -204,7 +204,7 @@ func (p *Prover) initEventHandlers() { ProofSubmissionCh: p.proofSubmissionCh, ProofContestCh: p.proofContestCh, BackOffRetryInterval: p.cfg.BackOffRetryInterval, - BackOffMaxRetrys: p.cfg.BackOffMaxRetrys, + BackOffMaxRetrys: p.cfg.BackOffMaxRetries, ContesterMode: p.cfg.ContesterMode, ProveUnassignedBlocks: p.cfg.ProveUnassignedBlocks, } diff --git a/prover/prover.go b/prover/prover.go index efc9669d8..57ceed4a5 100644 --- a/prover/prover.go +++ b/prover/prover.go @@ -98,7 +98,7 @@ func InitFromConfig(ctx context.Context, p *Prover, cfg *Config) (err error) { p.backoff = backoff.WithContext( backoff.WithMaxRetries( backoff.NewConstantBackOff(p.cfg.BackOffRetryInterval), - p.cfg.BackOffMaxRetrys, + p.cfg.BackOffMaxRetries, ), p.ctx, ) diff --git a/prover/prover_test.go b/prover/prover_test.go index 8caf93479..210543001 100644 --- a/prover/prover_test.go +++ b/prover/prover_test.go @@ -139,7 +139,7 @@ func (s *ProverTestSuite) TestInitError() { ProveUnassignedBlocks: true, RPCTimeout: 10 * time.Minute, BackOffRetryInterval: 3 * time.Second, - BackOffMaxRetrys: 12, + BackOffMaxRetries: 12, TxmgrConfigs: &txmgr.CLIConfig{ L1RPCURL: os.Getenv("L1_NODE_WS_ENDPOINT"), NumConfirmations: 0, @@ -511,7 +511,7 @@ func (s *ProverTestSuite) initProver( Allowance: new(big.Int).Exp(big.NewInt(1_000_000_100), new(big.Int).SetUint64(uint64(decimal)), nil), RPCTimeout: 3 * time.Second, BackOffRetryInterval: 3 * time.Second, - BackOffMaxRetrys: 12, + BackOffMaxRetries: 12, L1NodeVersion: "1.0.0", L2NodeVersion: "0.1.0", TxmgrConfigs: &txmgr.CLIConfig{ diff --git a/prover/server/api.go b/prover/server/api.go index 2f1b8b4ea..53c7e3cac 100644 --- a/prover/server/api.go +++ b/prover/server/api.go @@ -13,6 +13,7 @@ import ( "github.com/labstack/echo/v4" "github.com/taikoxyz/taiko-client/bindings/encoding" + "github.com/taikoxyz/taiko-client/internal/utils" "github.com/taikoxyz/taiko-client/pkg/rpc" ) @@ -244,7 +245,7 @@ func (s *ProverServer) checkMinEthAndToken(ctx context.Context) (bool, error) { log.Info( "Prover's ETH balance", - "balance", ethBalance, + "balance", utils.WeiToEther(ethBalance), "address", s.proverAddress.Hex(), ) @@ -252,8 +253,8 @@ func (s *ProverServer) checkMinEthAndToken(ctx context.Context) (bool, error) { log.Warn( "Prover does not have required minimum on-chain ETH balance", "providedProver", s.proverAddress.Hex(), - "ethBalance", ethBalance, - "minEthBalance", s.minEthBalance, + "ethBalance", utils.WeiToEther(ethBalance), + "minEthBalance", utils.WeiToEther(s.minEthBalance), ) return false, nil } @@ -266,7 +267,7 @@ func (s *ProverServer) checkMinEthAndToken(ctx context.Context) (bool, error) { log.Info( "Prover's Taiko token balance", - "balance", balance.String(), + "balance", utils.WeiToEther(balance), "address", s.proverAddress.Hex(), ) @@ -274,8 +275,8 @@ func (s *ProverServer) checkMinEthAndToken(ctx context.Context) (bool, error) { log.Warn( "Prover does not have required on-chain Taiko token balance", "providedProver", s.proverAddress.Hex(), - "taikoTokenBalance", balance, - "minTaikoTokenBalance", s.minTaikoTokenBalance, + "taikoTokenBalance", utils.WeiToEther(balance), + "minTaikoTokenBalance", utils.WeiToEther(s.minTaikoTokenBalance), ) return false, nil }