diff --git a/common/fireblocks_config.go b/common/fireblocks_config.go index 9d013c74e4..018d924f79 100644 --- a/common/fireblocks_config.go +++ b/common/fireblocks_config.go @@ -1,6 +1,8 @@ package common import ( + "time" + "github.com/urfave/cli" ) @@ -12,6 +14,7 @@ const ( FireblocksWalletAddressFlagName = "fireblocks-wallet-address" FireblocksSecretManagerRegion = "fireblocks-secret-manager-region" FireblocksDisable = "fireblocks-disable" + FireblocksAPITimeoutFlagName = "fireblocks-api-timeout" ) type FireblocksConfig struct { @@ -22,6 +25,7 @@ type FireblocksConfig struct { WalletAddress string Region string Disable bool + APITimeout time.Duration } func FireblocksCLIFlags(envPrefix string, flagPrefix string) []cli.Flag { @@ -68,6 +72,13 @@ func FireblocksCLIFlags(envPrefix string, flagPrefix string) []cli.Flag { Required: false, EnvVar: PrefixEnvVar(envPrefix, "FIREBLOCKS_DISABLE"), }, + cli.DurationFlag{ + Name: PrefixFlag(flagPrefix, FireblocksAPITimeoutFlagName), + Usage: "Timeout for Fireblocks API requests", + Required: false, + Value: 2 * time.Minute, + EnvVar: PrefixEnvVar(envPrefix, "FIREBLOCKS_API_TIMEOUT"), + }, } } @@ -80,5 +91,6 @@ func ReadFireblocksCLIConfig(ctx *cli.Context, flagPrefix string) FireblocksConf WalletAddress: ctx.GlobalString(PrefixFlag(flagPrefix, FireblocksWalletAddressFlagName)), Region: ctx.GlobalString(PrefixFlag(flagPrefix, FireblocksSecretManagerRegion)), Disable: ctx.GlobalBool(PrefixFlag(flagPrefix, FireblocksDisable)), + APITimeout: ctx.GlobalDuration(PrefixFlag(flagPrefix, FireblocksAPITimeoutFlagName)), } } diff --git a/disperser/batcher/batcher.go b/disperser/batcher/batcher.go index 7f3999b4e3..56cf352f53 100644 --- a/disperser/batcher/batcher.go +++ b/disperser/batcher/batcher.go @@ -40,13 +40,12 @@ type QuorumInfo struct { } type TimeoutConfig struct { - EncodingTimeout time.Duration - AttestationTimeout time.Duration - ChainReadTimeout time.Duration - ChainWriteTimeout time.Duration - ChainStateTimeout time.Duration - FireblocksAPITimeout time.Duration - TxnBroadcastTimeout time.Duration + EncodingTimeout time.Duration + AttestationTimeout time.Duration + ChainReadTimeout time.Duration + ChainWriteTimeout time.Duration + ChainStateTimeout time.Duration + TxnBroadcastTimeout time.Duration } type Config struct { diff --git a/disperser/cmd/batcher/config.go b/disperser/cmd/batcher/config.go index 251b7432f4..4e9832c4a3 100644 --- a/disperser/cmd/batcher/config.go +++ b/disperser/cmd/batcher/config.go @@ -67,13 +67,12 @@ func NewConfig(ctx *cli.Context) (Config, error) { FinalizationBlockDelay: ctx.GlobalUint(flags.FinalizationBlockDelayFlag.Name), }, TimeoutConfig: batcher.TimeoutConfig{ - EncodingTimeout: ctx.GlobalDuration(flags.EncodingTimeoutFlag.Name), - AttestationTimeout: ctx.GlobalDuration(flags.AttestationTimeoutFlag.Name), - ChainReadTimeout: ctx.GlobalDuration(flags.ChainReadTimeoutFlag.Name), - ChainWriteTimeout: ctx.GlobalDuration(flags.ChainWriteTimeoutFlag.Name), - ChainStateTimeout: ctx.GlobalDuration(flags.ChainStateTimeoutFlag.Name), - FireblocksAPITimeout: ctx.GlobalDuration(flags.FireblocksAPITimeoutFlag.Name), - TxnBroadcastTimeout: ctx.GlobalDuration(flags.TransactionBroadcastTimeoutFlag.Name), + EncodingTimeout: ctx.GlobalDuration(flags.EncodingTimeoutFlag.Name), + AttestationTimeout: ctx.GlobalDuration(flags.AttestationTimeoutFlag.Name), + ChainReadTimeout: ctx.GlobalDuration(flags.ChainReadTimeoutFlag.Name), + ChainWriteTimeout: ctx.GlobalDuration(flags.ChainWriteTimeoutFlag.Name), + ChainStateTimeout: ctx.GlobalDuration(flags.ChainStateTimeoutFlag.Name), + TxnBroadcastTimeout: ctx.GlobalDuration(flags.TransactionBroadcastTimeoutFlag.Name), }, MetricsConfig: batcher.MetricsConfig{ HTTPPort: ctx.GlobalString(flags.MetricsHTTPPort.Name), diff --git a/disperser/cmd/batcher/flags/flags.go b/disperser/cmd/batcher/flags/flags.go index 7d126815c5..6118eafedb 100644 --- a/disperser/cmd/batcher/flags/flags.go +++ b/disperser/cmd/batcher/flags/flags.go @@ -121,13 +121,6 @@ var ( Value: 15 * time.Second, EnvVar: common.PrefixEnvVar(envVarPrefix, "CHAIN_STATE_TIMEOUT"), } - FireblocksAPITimeoutFlag = cli.DurationFlag{ - Name: "fireblocks-write-timeout", - Usage: "connection timeout to get API response from Fireblocks", - Required: false, - Value: 10 * time.Second, - EnvVar: common.PrefixEnvVar(envVarPrefix, "FIREBLOCKS_API_TIMEOUT"), - } TransactionBroadcastTimeoutFlag = cli.DurationFlag{ Name: "transaction-broadcast-timeout", Usage: "timeout to broadcast transaction", @@ -223,7 +216,6 @@ var optionalFlags = []cli.Flag{ ChainReadTimeoutFlag, ChainWriteTimeoutFlag, ChainStateTimeoutFlag, - FireblocksAPITimeoutFlag, TransactionBroadcastTimeoutFlag, NumConnectionsFlag, FinalizerIntervalFlag, diff --git a/disperser/cmd/batcher/main.go b/disperser/cmd/batcher/main.go index 34e5cae373..cc0fe400f9 100644 --- a/disperser/cmd/batcher/main.go +++ b/disperser/cmd/batcher/main.go @@ -191,7 +191,7 @@ func RunBatcher(ctx *cli.Context) error { apiKey, []byte(secretKey), config.FireblocksConfig.BaseURL, - config.TimeoutConfig.FireblocksAPITimeout, + config.FireblocksConfig.APITimeout, logger.With("component", "FireblocksClient"), ) if err != nil { diff --git a/disperser/cmd/dataapi/config.go b/disperser/cmd/dataapi/config.go index 93d0e08eab..b8c074620e 100644 --- a/disperser/cmd/dataapi/config.go +++ b/disperser/cmd/dataapi/config.go @@ -38,8 +38,7 @@ type Config struct { ChurnerHostname string BatcherHealthEndpt string - FireblockAPITimeout time.Duration - TxnTimeout time.Duration + TxnTimeout time.Duration } func NewConfig(ctx *cli.Context) (Config, error) { @@ -87,8 +86,7 @@ func NewConfig(ctx *cli.Context) (Config, error) { ChurnerHostname: ctx.GlobalString(flags.ChurnerHostnameFlag.Name), BatcherHealthEndpt: ctx.GlobalString(flags.BatcherHealthEndptFlag.Name), - FireblockAPITimeout: ctx.GlobalDuration(flags.FireblockAPITimeoutFlag.Name), - TxnTimeout: ctx.GlobalDuration(flags.TxnTimeoutFlag.Name), + TxnTimeout: ctx.GlobalDuration(flags.TxnTimeoutFlag.Name), } return config, nil } diff --git a/disperser/cmd/dataapi/main.go b/disperser/cmd/dataapi/main.go index 6464bd2c35..f2cbaf9b22 100644 --- a/disperser/cmd/dataapi/main.go +++ b/disperser/cmd/dataapi/main.go @@ -185,7 +185,7 @@ func getWallet(config Config, ethClient common.EthClient, logger logging.Logger) apiKey, []byte(secretKey), config.FireblocksConfig.BaseURL, - config.FireblockAPITimeout, + config.FireblocksConfig.APITimeout, logger.With("component", "FireblocksClient"), ) if err != nil {