Documentation ¶
Overview ¶
Package config provides a configuration struct and getters for the submitter.
Config contains configuration for the submitter. It can be loaded from a YAML file. Chain-specific configuration items can be provided via the `Chains` map, which overrides the global config for each chain. If a chain-specific item is not provided, the global config is used.
Index ¶
- Constants
- Variables
- type ChainConfig
- type Config
- func (c *Config) GetBatch(chainID int) bool
- func (c *Config) GetBumpInterval(chainID int) time.Duration
- func (c *Config) GetDynamicGasEstimate(chainID int) bool
- func (c *Config) GetGasBumpPercentage(chainID int) (gasBumpPercentage int)
- func (c *Config) GetGasEstimate(chainID int) (gasEstimate uint64)
- func (c *Config) GetMaxBatchSize(chainID int) int
- func (c *Config) GetMaxGasPrice(chainID int) (maxPrice *big.Int)
- func (c *Config) GetMaxRecordAge() time.Duration
- func (c *Config) GetMinGasPrice(chainID int) (minPrice *big.Int)
- func (c *Config) GetReaperInterval() time.Duration
- func (c *Config) SetGlobalEIP1559Support(supportsEIP1559 bool)
- func (c *Config) SetGlobalMaxGasPrice(maxPrice *big.Int)
- func (c *Config) SetMinGasPrice(basePrice *big.Int)
- func (c *Config) SupportsEIP1559(chainID int) bool
- type IConfig
Constants ¶
const ( // DefaultMaxBatchSize is the default maximum number of transactions to send in a batch. DefaultMaxBatchSize = 10 // DefaultBumpIntervalSeconds is the default number of seconds to wait before bumping a transaction. DefaultBumpIntervalSeconds = 30 // DefaultGasBumpPercentage is the default percentage to bump the gas price by. // See: https://github.com/ethereum/go-ethereum/blob/8c5576b1ac89473c7ec15c9b03d1ca02e9499dcc/core/txpool/legacypool/legacypool.go#L146 DefaultGasBumpPercentage = 10 // DefaultGasEstimate is the default gas estimate to use for transactions. DefaultGasEstimate = uint64(1200000) )
Variables ¶
var DefaultMaxPrice = big.NewInt(500 * params.GWei)
DefaultMaxPrice is the default max price of a tx.
var DefaultMaxRecordAge = time.Hour * 24 * 7
DefaultMaxRecordAge is the default maximum age of a record before it is flushed.
var DefaultMinGasPrice = big.NewInt(0.01 * params.GWei)
DefaultMinGasPrice is the default min price of a tx.
var DefaultReaperInterval = time.Minute * 5
DefaultReaperInterval is the default interval at which to scan for transactions to flush.
Functions ¶
This section is empty.
Types ¶
type ChainConfig ¶
type ChainConfig struct { // MaxBatchSize is the maximum number of transactions to send in a batch // if this is zero, the default will be used. This field is ignored if batching is disabled. MaxBatchSize int `yaml:"max_batch_size"` // Batch is whether or not to batch transactions at the rpc level DoNotBatch bool `yaml:"skip_batching"` // MaxGasPrice is the maximum gas price to use for transactions MaxGasPrice *big.Int `yaml:"max_gas_price"` // MinGasPrice is the gas price that will be used if 0 is returned from the gas price oracle MinGasPrice *big.Int `yaml:"min_gas_price"` // BumpIntervalSeconds is the number of seconds to wait before bumping a transaction BumpIntervalSeconds int `yaml:"bump_interval_seconds"` // GasBumpPercentages is the percentage to bump the gas price by // this is applied to the greatrer of the chainprice or the last price GasBumpPercentage int `yaml:"gas_bump_percentage"` // GasEstimate is the gas estimate to use for transactions // if dynamic gas estimation is enabled, this is only used as a default if the estimate fails GasEstimate uint64 `yaml:"gas_estimate"` // DynamicGasEstimate is whether or not to use dynamic gas estimation DynamicGasEstimate bool `yaml:"dynamic_gas_estimate"` // SupportsEIP1559 is whether or not this chain supports EIP1559 SupportsEIP1559 bool `yaml:"supports_eip_1559"` }
ChainConfig contains configuration for a specific chain.
type Config ¶
type Config struct { // GlobalConfig stores the default configuration ChainConfig `yaml:",inline"` // Chains overrides the global config for each chain Chains map[int]ChainConfig `yaml:"chains"` // ReaperInterval is the interval at which scan for transactions to flush ReaperInterval time.Duration `yaml:"reaper_interval"` // MaxRecordAge is the maximum age of a record before it is flushed MaxRecordAge time.Duration `yaml:"max_record_age"` }
Config contains configuration for the submitter.
func (*Config) GetBumpInterval ¶
GetBumpInterval returns the number of seconds to wait before bumping a transaction TODO: test this method.
func (*Config) GetDynamicGasEstimate ¶
GetDynamicGasEstimate returns whether or not to use dynamic gas estimation TODO: test this method.
func (*Config) GetGasBumpPercentage ¶
GetGasBumpPercentage returns the percentage to bump the gas price by TODO: test this method.
func (*Config) GetGasEstimate ¶
GetGasEstimate returns the gas estimate to use for transactions TODO: test this method.
func (*Config) GetMaxBatchSize ¶
GetMaxBatchSize returns the maximum number of transactions to send in a batch.
func (*Config) GetMaxGasPrice ¶
GetMaxGasPrice returns the maximum gas price to use for transactions.
func (*Config) GetMaxRecordAge ¶ added in v0.14.9
GetMaxRecordAge returns the maximum record age.
func (*Config) GetMinGasPrice ¶ added in v0.6.0
GetMinGasPrice returns the minimum gas price to use for transactions.
func (*Config) GetReaperInterval ¶ added in v0.14.9
GetReaperInterval returns the reaper interval.
func (*Config) SetGlobalEIP1559Support ¶
SetGlobalEIP1559Support is a helper function that sets the global EIP1559 support.
func (*Config) SetGlobalMaxGasPrice ¶
SetGlobalMaxGasPrice is a helper function that sets the global gas price.
func (*Config) SetMinGasPrice ¶ added in v0.6.0
SetMinGasPrice is a helper function that sets the base gas price.
func (*Config) SupportsEIP1559 ¶
SupportsEIP1559 returns whether or not this chain supports EIP1559.
type IConfig ¶
type IConfig interface { // GetReaperInterval returns the reaper interval. GetReaperInterval() time.Duration // GetMaxRecordAge returns the maximum record age. GetMaxRecordAge() time.Duration // GetMaxBatchSize returns the maximum number of transactions to send in a batch. GetMaxBatchSize(chainID int) int // GetBatch returns whether or not to batch transactions at the rpc level. GetBatch(chainID int) bool // GetMaxGasPrice returns the maximum gas price to use for transactions. GetMaxGasPrice(chainID int) (maxPrice *big.Int) // GetMinGasPrice returns the minimum gas price to use for transactions. GetMinGasPrice(chainID int) (minPrice *big.Int) // GetBumpInterval returns the number of seconds to wait before bumping a transaction // TODO: test this method. GetBumpInterval(chainID int) time.Duration // GetGasBumpPercentage returns the percentage to bump the gas price by // TODO: test this method. GetGasBumpPercentage(chainID int) (gasBumpPercentage int) // GetGasEstimate returns the gas estimate to use for transactions // TODO: test this method. GetGasEstimate(chainID int) (gasEstimate uint64) // GetDynamicGasEstimate returns whether or not to use dynamic gas estimation // TODO: test this method. GetDynamicGasEstimate(chainID int) bool // SupportsEIP1559 returns whether or not this chain supports EIP1559. SupportsEIP1559(chainID int) bool // SetGlobalMaxGasPrice is a helper function that sets the global gas price. SetGlobalMaxGasPrice(maxPrice *big.Int) // SetMinGasPrice is a helper function that sets the base gas price. SetMinGasPrice(basePrice *big.Int) // SetGlobalEIP1559Support is a helper function that sets the global EIP1559 support. SetGlobalEIP1559Support(supportsEIP1559 bool) }
IConfig ...