diff --git a/core/chains/evm/config/chain_scoped_gas_estimator.go b/core/chains/evm/config/chain_scoped_gas_estimator.go index dae1b32c1fc..5dcef727f30 100644 --- a/core/chains/evm/config/chain_scoped_gas_estimator.go +++ b/core/chains/evm/config/chain_scoped_gas_estimator.go @@ -190,7 +190,3 @@ type feeHistoryConfig struct { func (u *feeHistoryConfig) CacheTimeout() time.Duration { return u.c.CacheTimeout.Duration() } - -func (u *feeHistoryConfig) HasMempool() bool { - return *u.c.HasMempool -} diff --git a/core/chains/evm/config/config.go b/core/chains/evm/config/config.go index 2aaf48f06f9..555a26024c6 100644 --- a/core/chains/evm/config/config.go +++ b/core/chains/evm/config/config.go @@ -161,7 +161,6 @@ type BlockHistory interface { type FeeHistory interface { CacheTimeout() time.Duration - HasMempool() bool } type Workflow interface { diff --git a/core/chains/evm/config/config_test.go b/core/chains/evm/config/config_test.go index 16a4c19ed5a..ac97d5abe96 100644 --- a/core/chains/evm/config/config_test.go +++ b/core/chains/evm/config/config_test.go @@ -226,7 +226,6 @@ func TestChainScopedConfig_FeeHistory(t *testing.T) { u := cfg.EVM().GasEstimator().FeeHistory() assert.Equal(t, 10*time.Second, u.CacheTimeout()) - assert.Equal(t, true, u.HasMempool()) } func TestChainScopedConfig_GasEstimator(t *testing.T) { diff --git a/core/chains/evm/config/toml/config.go b/core/chains/evm/config/toml/config.go index e3db2393573..c16db689626 100644 --- a/core/chains/evm/config/toml/config.go +++ b/core/chains/evm/config/toml/config.go @@ -728,16 +728,12 @@ func (e *BlockHistoryEstimator) setFrom(f *BlockHistoryEstimator) { type FeeHistoryEstimator struct { CacheTimeout *commonconfig.Duration - HasMempool *bool } func (u *FeeHistoryEstimator) setFrom(f *FeeHistoryEstimator) { if v := f.CacheTimeout; v != nil { u.CacheTimeout = v } - if v := f.HasMempool; v != nil { - u.HasMempool = v - } } type KeySpecificConfig []KeySpecific diff --git a/core/chains/evm/config/toml/defaults/fallback.toml b/core/chains/evm/config/toml/defaults/fallback.toml index 7605cbc0353..899c0e4372c 100644 --- a/core/chains/evm/config/toml/defaults/fallback.toml +++ b/core/chains/evm/config/toml/defaults/fallback.toml @@ -58,7 +58,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 diff --git a/core/chains/evm/gas/fee_history_estimator.go b/core/chains/evm/gas/fee_history_estimator.go index ef447150d55..e33b0588854 100644 --- a/core/chains/evm/gas/fee_history_estimator.go +++ b/core/chains/evm/gas/fee_history_estimator.go @@ -61,11 +61,10 @@ const ( type FeeHistoryEstimatorConfig struct { BumpPercent uint16 CacheTimeout time.Duration - EIP1559 bool + EIP1559 bool BlockHistorySize uint64 RewardPercentile float64 - HasMempool bool } type feeHistoryEstimatorClient interface { @@ -108,50 +107,47 @@ func NewFeeHistoryEstimator(lggr logger.Logger, client feeHistoryEstimatorClient } } -func (u *FeeHistoryEstimator) Start(context.Context) error { - return u.StartOnce("FeeHistoryEstimator", func() error { - if u.config.BumpPercent < MinimumBumpPercentage { +func (f *FeeHistoryEstimator) Start(context.Context) error { + return f.StartOnce("FeeHistoryEstimator", func() error { + if f.config.BumpPercent < MinimumBumpPercentage { return fmt.Errorf("BumpPercent: %s is less than minimum allowed percentage: %s", - strconv.FormatUint(uint64(u.config.BumpPercent), 10), strconv.Itoa(MinimumBumpPercentage)) + strconv.FormatUint(uint64(f.config.BumpPercent), 10), strconv.Itoa(MinimumBumpPercentage)) } - if u.config.EIP1559 && u.config.RewardPercentile > ConnectivityPercentile { + if f.config.EIP1559 && f.config.RewardPercentile > ConnectivityPercentile { return fmt.Errorf("RewardPercentile: %s is greater than maximum allowed percentile: %s", - strconv.FormatUint(uint64(u.config.RewardPercentile), 10), strconv.Itoa(ConnectivityPercentile)) + strconv.FormatUint(uint64(f.config.RewardPercentile), 10), strconv.Itoa(ConnectivityPercentile)) } - if u.config.EIP1559 && u.config.BlockHistorySize == 0 { - return fmt.Errorf("BlockHistorySize is set to 0 and EIP1559 is enabled") - } - u.wg.Add(1) - go u.run() + f.wg.Add(1) + go f.run() return nil }) } -func (u *FeeHistoryEstimator) Close() error { - return u.StopOnce("FeeHistoryEstimator", func() error { - close(u.stopCh) - u.wg.Wait() +func (f *FeeHistoryEstimator) Close() error { + return f.StopOnce("FeeHistoryEstimator", func() error { + close(f.stopCh) + f.wg.Wait() return nil }) } -func (u *FeeHistoryEstimator) run() { - defer u.wg.Done() +func (f *FeeHistoryEstimator) run() { + defer f.wg.Done() - t := services.NewTicker(u.config.CacheTimeout) + t := services.NewTicker(f.config.CacheTimeout) for { select { - case <-u.stopCh: + case <-f.stopCh: return case <-t.C: - if u.config.EIP1559 { - if _, err := u.FetchDynamicPrice(); err != nil { - u.logger.Error(err) + if f.config.EIP1559 { + if err := f.RefreshDynamicPrice(); err != nil { + f.logger.Error(err) } } else { - if _, err := u.FetchGasPrice(); err != nil { - u.logger.Error(err) + if err := f.RefreshGasPrice(); err != nil { + f.logger.Error(err) } } } @@ -159,62 +155,62 @@ func (u *FeeHistoryEstimator) run() { } // GetLegacyGas will fetch the cached gas price value. -func (u *FeeHistoryEstimator) GetLegacyGas(ctx context.Context, _ []byte, gasLimit uint64, maxPrice *assets.Wei, opts ...feetypes.Opt) (gasPrice *assets.Wei, chainSpecificGasLimit uint64, err error) { +func (f *FeeHistoryEstimator) GetLegacyGas(ctx context.Context, _ []byte, gasLimit uint64, maxPrice *assets.Wei, opts ...feetypes.Opt) (gasPrice *assets.Wei, chainSpecificGasLimit uint64, err error) { chainSpecificGasLimit = gasLimit - if gasPrice, err = u.getGasPrice(); err != nil { + if gasPrice, err = f.getGasPrice(); err != nil { return } if gasPrice.Cmp(maxPrice) > 0 { - u.logger.Warnf("estimated gas price: %s is greater than the maximum gas price configured: %s, returning the maximum price instead.", gasPrice, maxPrice) + f.logger.Warnf("estimated gas price: %s is greater than the maximum gas price configured: %s, returning the maximum price instead.", gasPrice, maxPrice) return maxPrice, chainSpecificGasLimit, nil } return } -// FetchGasPrice will use eth_gasPrice to fetch and cache the latest gas price from the RPC. -func (u *FeeHistoryEstimator) FetchGasPrice() (*assets.Wei, error) { - ctx, cancel := u.stopCh.CtxCancel(evmclient.ContextWithDefaultTimeout()) +// RefreshGasPrice will use eth_gasPrice to fetch and cache the latest gas price from the RPC. +func (f *FeeHistoryEstimator) RefreshGasPrice() error { + ctx, cancel := f.stopCh.CtxCancel(evmclient.ContextWithDefaultTimeout()) defer cancel() - gasPrice, err := u.client.SuggestGasPrice(ctx) + gasPrice, err := f.client.SuggestGasPrice(ctx) if err != nil { - return nil, fmt.Errorf("failed to fetch gas price: %s", err) + return fmt.Errorf("failed to fetch gas price: %s", err) } - promFeeHistoryEstimatorGasPrice.WithLabelValues(u.chainID.String()).Set(float64(gasPrice.Int64())) + promFeeHistoryEstimatorGasPrice.WithLabelValues(f.chainID.String()).Set(float64(gasPrice.Int64())) gasPriceWei := assets.NewWei(gasPrice) - u.logger.Debugf("fetched new gas price: %v", gasPriceWei) + f.logger.Debugf("fetched new gas price: %v", gasPriceWei) - u.gasPriceMu.Lock() - defer u.gasPriceMu.Unlock() - u.gasPrice = gasPriceWei - return u.gasPrice, nil + f.gasPriceMu.Lock() + defer f.gasPriceMu.Unlock() + f.gasPrice = gasPriceWei + return nil } -func (u *FeeHistoryEstimator) getGasPrice() (*assets.Wei, error) { - u.gasPriceMu.RLock() - defer u.gasPriceMu.RUnlock() - if u.gasPrice == nil { - return u.gasPrice, fmt.Errorf("gas price not set") +func (f *FeeHistoryEstimator) getGasPrice() (*assets.Wei, error) { + f.gasPriceMu.RLock() + defer f.gasPriceMu.RUnlock() + if f.gasPrice == nil { + return f.gasPrice, fmt.Errorf("gas price not set") } - return u.gasPrice, nil + return f.gasPrice, nil } // GetDynamicFee will fetch the cached dynamic prices. -func (u *FeeHistoryEstimator) GetDynamicFee(ctx context.Context, maxPrice *assets.Wei) (fee DynamicFee, err error) { - if fee, err = u.getDynamicPrice(); err != nil { +func (f *FeeHistoryEstimator) GetDynamicFee(ctx context.Context, maxPrice *assets.Wei) (fee DynamicFee, err error) { + if fee, err = f.getDynamicPrice(); err != nil { return } if fee.FeeCap.Cmp(maxPrice) > 0 { - u.logger.Warnf("estimated maxFeePerGas: %v is greater than the maximum price configured: %v, returning the maximum price instead.", + f.logger.Warnf("estimated maxFeePerGas: %v is greater than the maximum price configured: %v, returning the maximum price instead.", fee.FeeCap, maxPrice) fee.FeeCap = maxPrice if fee.TipCap.Cmp(maxPrice) > 0 { - u.logger.Warnf("estimated maxPriorityFeePerGas: %v is greater than the maximum price configured: %v, returning the maximum price instead.", + f.logger.Warnf("estimated maxPriorityFeePerGas: %v is greater than the maximum price configured: %v, returning the maximum price instead.", fee.TipCap, maxPrice) fee.TipCap = maxPrice } @@ -223,92 +219,109 @@ func (u *FeeHistoryEstimator) GetDynamicFee(ctx context.Context, maxPrice *asset return } -// FetchDynamicPrice uses eth_feeHistory to fetch the baseFee of the next block and the Nth maxPriorityFeePerGas percentiles +// RefreshDynamicPrice uses eth_feeHistory to fetch the baseFee of the next block and the Nth maxPriorityFeePerGas percentiles // of the past X blocks. It also fetches the highest 85th maxPriorityFeePerGas percentile of the past X blocks, which represents // the highest percentile we're willing to pay. A buffer is added on top of the latest baseFee to catch fluctuations in the next // blocks. On Ethereum the increase is baseFee * 1.125 per block, however in some chains that may vary. -func (u *FeeHistoryEstimator) FetchDynamicPrice() (fee DynamicFee, err error) { - ctx, cancel := u.stopCh.CtxCancel(evmclient.ContextWithDefaultTimeout()) +func (f *FeeHistoryEstimator) RefreshDynamicPrice() error { + ctx, cancel := f.stopCh.CtxCancel(evmclient.ContextWithDefaultTimeout()) defer cancel() - if u.config.BlockHistorySize == 0 { - return fee, fmt.Errorf("BlockHistorySize cannot be 0") - } // RewardPercentile will be used for maxPriorityFeePerGas estimations and connectivityPercentile to set the highest threshold for bumping. - feeHistory, err := u.client.FeeHistory(ctx, u.config.BlockHistorySize, []float64{u.config.RewardPercentile, ConnectivityPercentile}) + feeHistory, err := f.client.FeeHistory(ctx, max(f.config.BlockHistorySize, 1), []float64{f.config.RewardPercentile, ConnectivityPercentile}) if err != nil { - return fee, fmt.Errorf("failed to fetch dynamic prices: %s", err) + return fmt.Errorf("failed to fetch dynamic prices: %s", err) } // eth_feeHistory doesn't return the latest baseFee of the range but rather the latest + 1, because it can be derived from the existing // values. Source: https://github.com/ethereum/go-ethereum/blob/b0f66e34ca2a4ea7ae23475224451c8c9a569826/eth/gasprice/feehistory.go#L235 // nextBlock is the latest returned + 1 to be aligned with the base fee value. - baseFee := assets.NewWei(feeHistory.BaseFee[len(feeHistory.BaseFee)-1]) - nextBlock := big.NewInt(0).Add(feeHistory.OldestBlock, big.NewInt(int64(u.config.BlockHistorySize))) - - priorityFee := big.NewInt(0) - priorityFeeThreshold := big.NewInt(0) - for _, fee := range feeHistory.Reward { - priorityFee = priorityFee.Add(priorityFee, fee[0]) - // We don't need an average, we need the max value - priorityFeeThreshold = bigmath.Max(priorityFeeThreshold, fee[1]) - } - priorityFeeThresholdWei := assets.NewWei(priorityFeeThreshold) - - u.priorityFeeThresholdMu.Lock() - u.priorityFeeThreshold = priorityFeeThresholdWei - u.priorityFeeThresholdMu.Unlock() + nextBaseFee := assets.NewWei(feeHistory.BaseFee[len(feeHistory.BaseFee)-1]) + nextBlock := big.NewInt(0).Add(feeHistory.OldestBlock, big.NewInt(int64(f.config.BlockHistorySize))) + + // If BlockHistorySize is 0 it means priority fees will be ignored from the calculations, so we set them to 0. + // If it's not we exclude 0 priced priority fees from the RPC response, even though some networks allow them. For empty blocks, eth_feeHistory + // returns priority fees with 0 values so it's safer to discard them in order to pick values from a more representative sample. + maxPriorityFeePerGas := assets.NewWeiI(0) + priorityFeeThresholdWei := assets.NewWeiI(0) + if f.config.BlockHistorySize > 0 { + var nonZeroRewardsLen int64 = 0 + priorityFee := big.NewInt(0) + priorityFeeThreshold := big.NewInt(0) + for _, reward := range feeHistory.Reward { + // reward needs to have values for two percentiles + if len(reward) < 2 { + return fmt.Errorf("reward size incorrect: %d", len(reward)) + } + // We'll calculate the average of non-zero priority fees + if reward[0].Cmp(big.NewInt(0)) > 0 { + priorityFee = priorityFee.Add(priorityFee, reward[0]) + nonZeroRewardsLen += 1 + } + // We take the max value for the bumping threshold + if reward[1].Cmp(big.NewInt(0)) > 0 { + priorityFeeThreshold = bigmath.Max(priorityFeeThreshold, reward[1]) + } + } - // eth_feeHistory may return less results than BlockHistorySize so we need to divide by the length of the result - maxPriorityFeePerGas := assets.NewWei(priorityFee.Div(priorityFee, big.NewInt(int64(len(feeHistory.Reward))))) - // baseFeeBufferPercentage is used as a safety to catch fluctuations in the next block. - maxFeePerGas := baseFee.AddPercentage(BaseFeeBufferPercentage).Add(maxPriorityFeePerGas) + if nonZeroRewardsLen == 0 || priorityFeeThreshold.Cmp(big.NewInt(0)) == 0 { + return nil + } + priorityFeeThresholdWei = assets.NewWei(priorityFeeThreshold) + maxPriorityFeePerGas = assets.NewWei(priorityFee.Div(priorityFee, big.NewInt(nonZeroRewardsLen))) + } + // baseFeeBufferPercentage is added on top as a safety to catch fluctuations in the next blocks. + maxFeePerGas := nextBaseFee.AddPercentage(BaseFeeBufferPercentage).Add(maxPriorityFeePerGas) - promFeeHistoryEstimatorBaseFee.WithLabelValues(u.chainID.String()).Set(float64(baseFee.Int64())) - promFeeHistoryEstimatorMaxPriorityFeePerGas.WithLabelValues(u.chainID.String()).Set(float64(maxPriorityFeePerGas.Int64())) - promFeeHistoryEstimatorMaxFeePerGas.WithLabelValues(u.chainID.String()).Set(float64(maxFeePerGas.Int64())) + promFeeHistoryEstimatorBaseFee.WithLabelValues(f.chainID.String()).Set(float64(nextBaseFee.Int64())) + promFeeHistoryEstimatorMaxPriorityFeePerGas.WithLabelValues(f.chainID.String()).Set(float64(maxPriorityFeePerGas.Int64())) + promFeeHistoryEstimatorMaxFeePerGas.WithLabelValues(f.chainID.String()).Set(float64(maxFeePerGas.Int64())) - u.logger.Debugf("Fetched new dynamic prices, nextBlock#: %v - oldestBlock#: %v - maxFeePerGas: %v - maxPriorityFeePerGas: %v - maxPriorityFeeThreshold: %v", + f.logger.Debugf("Fetched new dynamic prices, nextBlock#: %v - oldestBlock#: %v - maxFeePerGas: %v - maxPriorityFeePerGas: %v - maxPriorityFeeThreshold: %v", nextBlock, feeHistory.OldestBlock, maxFeePerGas, maxPriorityFeePerGas, priorityFeeThresholdWei) - u.dynamicPriceMu.Lock() - defer u.dynamicPriceMu.Unlock() - u.dynamicPrice.FeeCap = maxFeePerGas - u.dynamicPrice.TipCap = maxPriorityFeePerGas - return u.dynamicPrice, nil + f.priorityFeeThresholdMu.Lock() + f.priorityFeeThreshold = priorityFeeThresholdWei + f.priorityFeeThresholdMu.Unlock() + + f.dynamicPriceMu.Lock() + defer f.dynamicPriceMu.Unlock() + f.dynamicPrice.FeeCap = maxFeePerGas + f.dynamicPrice.TipCap = maxPriorityFeePerGas + return nil } -func (u *FeeHistoryEstimator) getDynamicPrice() (fee DynamicFee, err error) { - u.dynamicPriceMu.RLock() - defer u.dynamicPriceMu.RUnlock() - if u.dynamicPrice.FeeCap == nil || u.dynamicPrice.TipCap == nil { +func (f *FeeHistoryEstimator) getDynamicPrice() (fee DynamicFee, err error) { + f.dynamicPriceMu.RLock() + defer f.dynamicPriceMu.RUnlock() + if f.dynamicPrice.FeeCap == nil || f.dynamicPrice.TipCap == nil { return fee, fmt.Errorf("dynamic price not set") } - return u.dynamicPrice, nil + return f.dynamicPrice, nil } // BumpLegacyGas provides a bumped gas price value by bumping the previous one by BumpPercent. // If the original value is higher than the max price it returns an error as there is no room for bumping. // It aggregates the market, bumped, and max gas price to provide a correct value. -func (u *FeeHistoryEstimator) BumpLegacyGas(ctx context.Context, originalGasPrice *assets.Wei, gasLimit uint64, maxPrice *assets.Wei, _ []EvmPriorAttempt) (*assets.Wei, uint64, error) { +func (f *FeeHistoryEstimator) BumpLegacyGas(ctx context.Context, originalGasPrice *assets.Wei, gasLimit uint64, maxPrice *assets.Wei, _ []EvmPriorAttempt) (*assets.Wei, uint64, error) { // Sanitize original fee input if originalGasPrice == nil || originalGasPrice.Cmp(maxPrice) >= 0 { return nil, 0, fmt.Errorf("%w: error while retrieving original gas price: originalGasPrice: %s. Maximum price configured: %s", commonfee.ErrBump, originalGasPrice, maxPrice) } - currentGasPrice, err := u.getGasPrice() + currentGasPrice, err := f.getGasPrice() if err != nil { return nil, 0, err } - bumpedGasPrice := originalGasPrice.AddPercentage(u.config.BumpPercent) + bumpedGasPrice := originalGasPrice.AddPercentage(f.config.BumpPercent) bumpedGasPrice, err = LimitBumpedFee(originalGasPrice, currentGasPrice, bumpedGasPrice, maxPrice) if err != nil { return nil, 0, fmt.Errorf("gas price error: %s", err.Error()) } - u.logger.Debugw("bumped gas price", "originalGasPrice", originalGasPrice, "bumpedGasPrice", bumpedGasPrice) + f.logger.Debugw("bumped gas price", "originalGasPrice", originalGasPrice, "bumpedGasPrice", bumpedGasPrice) return bumpedGasPrice, gasLimit, nil } @@ -316,10 +329,17 @@ func (u *FeeHistoryEstimator) BumpLegacyGas(ctx context.Context, originalGasPric // BumpDynamicFee provides a bumped dynamic fee by bumping the previous one by BumpPercent. // If the original values are higher than the max price it returns an error as there is no room for bumping. If maxPriorityFeePerGas is bumped // above the priority fee threshold then there is a good chance there is a connectivity issue and we shouldn't bump. -// Both maxFeePerGas as well as maxPriorityFerPergas need to be bumped otherwise the RPC won't accept the transaction and throw an error. +// Both maxFeePerGas as well as maxPriorityFeePerGas need to be bumped otherwise the RPC won't accept the transaction and throw an error. // See: https://github.com/ethereum/go-ethereum/issues/24284 // It aggregates the market, bumped, and max price to provide a correct value, for both maxFeePerGas as well as maxPriorityFerPergas. -func (u *FeeHistoryEstimator) BumpDynamicFee(ctx context.Context, originalFee DynamicFee, maxPrice *assets.Wei, _ []EvmPriorAttempt) (bumped DynamicFee, err error) { +func (f *FeeHistoryEstimator) BumpDynamicFee(ctx context.Context, originalFee DynamicFee, maxPrice *assets.Wei, _ []EvmPriorAttempt) (bumped DynamicFee, err error) { + // For chains that don't have a mempool there is no concept of gas bumping so we force-call FetchDynamicPrice to update the underlying base fee value + if f.config.BlockHistorySize == 0 { + if err = f.RefreshDynamicPrice(); err != nil { + return + } + return f.GetDynamicFee(ctx, maxPrice) + } // Sanitize original fee input // According to geth's spec we need to bump both maxFeePerGas and maxPriorityFeePerGas for the new attempt to be accepted by the RPC if originalFee.FeeCap == nil || @@ -330,37 +350,27 @@ func (u *FeeHistoryEstimator) BumpDynamicFee(ctx context.Context, originalFee Dy commonfee.ErrBump, originalFee.FeeCap, originalFee.TipCap, maxPrice) } - currentDynamicPrice, err := u.getDynamicPrice() + currentDynamicPrice, err := f.getDynamicPrice() if err != nil { return } - bumpedMaxPriorityFeePerGas := originalFee.TipCap.AddPercentage(u.config.BumpPercent) - bumpedMaxFeePerGas := originalFee.FeeCap.AddPercentage(u.config.BumpPercent) + bumpedMaxPriorityFeePerGas := originalFee.TipCap.AddPercentage(f.config.BumpPercent) + bumpedMaxFeePerGas := originalFee.FeeCap.AddPercentage(f.config.BumpPercent) - if u.config.HasMempool { - bumpedMaxPriorityFeePerGas, err = LimitBumpedFee(originalFee.TipCap, currentDynamicPrice.TipCap, bumpedMaxPriorityFeePerGas, maxPrice) - if err != nil { - return bumped, fmt.Errorf("maxPriorityFeePerGas error: %s", err.Error()) - } + bumpedMaxPriorityFeePerGas, err = LimitBumpedFee(originalFee.TipCap, currentDynamicPrice.TipCap, bumpedMaxPriorityFeePerGas, maxPrice) + if err != nil { + return bumped, fmt.Errorf("maxPriorityFeePerGas error: %s", err.Error()) + } - priorityFeeThreshold, e := u.getPriorityFeeThreshold() - if e != nil { - err = e - return - } + priorityFeeThreshold, e := f.getPriorityFeeThreshold() + if e != nil { + return bumped, e + } - // If either of these two values are 0 it could be that the network has extremely low priority fees. We should skip the - // connectivity check because we're only going to be charged for the base fee, which is mandatory. - if (priorityFeeThreshold.Cmp(assets.NewWeiI(0)) > 0) && (bumpedMaxPriorityFeePerGas.Cmp(assets.NewWeiI(0)) > 0) && - bumpedMaxPriorityFeePerGas.Cmp(priorityFeeThreshold) > 0 { - return bumped, fmt.Errorf("bumpedMaxPriorityFeePergas: %s is above market's %sth percentile: %s, bumping is halted", - bumpedMaxPriorityFeePerGas, strconv.Itoa(ConnectivityPercentile), priorityFeeThreshold) - } - } else { - // If the network doesn't have a mempool then transactions are processed in a FCFS manner and maxPriorityFeePerGas value is irrelevant. - // We just need to cap the value at maxPrice in case maxFeePerGas also gets capped. - bumpedMaxPriorityFeePerGas = assets.WeiMin(bumpedMaxPriorityFeePerGas, maxPrice) + if bumpedMaxPriorityFeePerGas.Cmp(priorityFeeThreshold) > 0 { + return bumped, fmt.Errorf("bumpedMaxPriorityFeePergas: %s is above market's %sth percentile: %s, bumping is halted", + bumpedMaxPriorityFeePerGas, strconv.Itoa(ConnectivityPercentile), priorityFeeThreshold) } bumpedMaxFeePerGas, err = LimitBumpedFee(originalFee.FeeCap, currentDynamicPrice.FeeCap, bumpedMaxFeePerGas, maxPrice) @@ -369,7 +379,7 @@ func (u *FeeHistoryEstimator) BumpDynamicFee(ctx context.Context, originalFee Dy } bumpedFee := DynamicFee{FeeCap: bumpedMaxFeePerGas, TipCap: bumpedMaxPriorityFeePerGas} - u.logger.Debugw("bumped dynamic fee", "originalFee", originalFee, "bumpedFee", bumpedFee) + f.logger.Debugw("bumped dynamic fee", "originalFee", originalFee, "bumpedFee", bumpedFee) return bumpedFee, nil } @@ -399,16 +409,16 @@ func LimitBumpedFee(originalFee *assets.Wei, currentFee *assets.Wei, bumpedFee * return bumpedFee, nil } -func (u *FeeHistoryEstimator) getPriorityFeeThreshold() (*assets.Wei, error) { - u.priorityFeeThresholdMu.RLock() - defer u.priorityFeeThresholdMu.RUnlock() - if u.priorityFeeThreshold == nil { - return u.priorityFeeThreshold, fmt.Errorf("priorityFeeThreshold not set") +func (f *FeeHistoryEstimator) getPriorityFeeThreshold() (*assets.Wei, error) { + f.priorityFeeThresholdMu.RLock() + defer f.priorityFeeThresholdMu.RUnlock() + if f.priorityFeeThreshold == nil { + return f.priorityFeeThreshold, fmt.Errorf("priorityFeeThreshold not set") } - return u.priorityFeeThreshold, nil + return f.priorityFeeThreshold, nil } -func (u *FeeHistoryEstimator) Name() string { return u.logger.Name() } -func (u *FeeHistoryEstimator) L1Oracle() rollups.L1Oracle { return u.l1Oracle } -func (u *FeeHistoryEstimator) HealthReport() map[string]error { return map[string]error{u.Name(): nil} } -func (u *FeeHistoryEstimator) OnNewLongestChain(context.Context, *evmtypes.Head) {} +func (f *FeeHistoryEstimator) Name() string { return f.logger.Name() } +func (f *FeeHistoryEstimator) L1Oracle() rollups.L1Oracle { return f.l1Oracle } +func (f *FeeHistoryEstimator) HealthReport() map[string]error { return map[string]error{f.Name(): nil} } +func (f *FeeHistoryEstimator) OnNewLongestChain(context.Context, *evmtypes.Head) {} diff --git a/core/chains/evm/gas/fee_history_estimator_test.go b/core/chains/evm/gas/fee_history_estimator_test.go index 9564e3ac416..91696d06f42 100644 --- a/core/chains/evm/gas/fee_history_estimator_test.go +++ b/core/chains/evm/gas/fee_history_estimator_test.go @@ -53,18 +53,6 @@ func TestFeeHistoryEstimatorLifecycle(t *testing.T) { assert.ErrorContains(t, u.Start(tests.Context(t)), "RewardPercentile") }) - t.Run("fails to start if BlockHistorySize is 0 in EIP-1559", func(t *testing.T) { - cfg := gas.FeeHistoryEstimatorConfig{ - BumpPercent: 20, - RewardPercentile: 10, - BlockHistorySize: 0, - EIP1559: true, - } - - u := gas.NewFeeHistoryEstimator(logger.Test(t), nil, cfg, chainID, nil) - assert.ErrorContains(t, u.Start(tests.Context(t)), "BlockHistorySize") - }) - t.Run("starts if configs are correct", func(t *testing.T) { client := mocks.NewFeeHistoryEstimatorClient(t) client.On("SuggestGasPrice", mock.Anything).Return(big.NewInt(10), nil).Maybe() @@ -97,7 +85,7 @@ func TestFeeHistoryEstimatorGetLegacyGas(t *testing.T) { cfg := gas.FeeHistoryEstimatorConfig{} u := gas.NewFeeHistoryEstimator(logger.Test(t), client, cfg, chainID, nil) - _, err := u.FetchGasPrice() + err := u.RefreshGasPrice() assert.NoError(t, err) gasPrice, _, err := u.GetLegacyGas(tests.Context(t), nil, gasLimit, maxPrice) assert.NoError(t, err) @@ -112,7 +100,7 @@ func TestFeeHistoryEstimatorGetLegacyGas(t *testing.T) { maxPrice := assets.NewWeiI(1) u := gas.NewFeeHistoryEstimator(logger.Test(t), client, cfg, chainID, nil) - _, err := u.FetchGasPrice() + err := u.RefreshGasPrice() assert.NoError(t, err) gas1, _, err := u.GetLegacyGas(tests.Context(t), nil, gasLimit, maxPrice) assert.NoError(t, err) @@ -145,7 +133,7 @@ func TestFeeHistoryEstimatorBumpLegacyGas(t *testing.T) { cfg := gas.FeeHistoryEstimatorConfig{BumpPercent: 50} u := gas.NewFeeHistoryEstimator(logger.Test(t), client, cfg, chainID, nil) - _, err := u.FetchGasPrice() + err := u.RefreshGasPrice() assert.NoError(t, err) gasPrice, _, err := u.BumpLegacyGas(tests.Context(t), originalGasPrice, gasLimit, maxPrice, nil) assert.NoError(t, err) @@ -186,7 +174,7 @@ func TestFeeHistoryEstimatorBumpLegacyGas(t *testing.T) { cfg := gas.FeeHistoryEstimatorConfig{} u := gas.NewFeeHistoryEstimator(logger.Test(t), client, cfg, chainID, nil) - _, err := u.FetchGasPrice() + err := u.RefreshGasPrice() assert.NoError(t, err) gas, _, err := u.BumpLegacyGas(tests.Context(t), originalGasPrice, gasLimit, maxPrice, nil) assert.NoError(t, err) @@ -202,7 +190,7 @@ func TestFeeHistoryEstimatorBumpLegacyGas(t *testing.T) { maxPrice := assets.NewWeiI(14) u := gas.NewFeeHistoryEstimator(logger.Test(t), client, cfg, chainID, nil) - _, err := u.FetchGasPrice() + err := u.RefreshGasPrice() assert.NoError(t, err) gas, _, err := u.BumpLegacyGas(tests.Context(t), originalGasPrice, gasLimit, maxPrice, nil) assert.NoError(t, err) @@ -218,7 +206,7 @@ func TestFeeHistoryEstimatorBumpLegacyGas(t *testing.T) { maxPrice := assets.NewWeiI(14) u := gas.NewFeeHistoryEstimator(logger.Test(t), client, cfg, chainID, nil) - _, err := u.FetchGasPrice() + err := u.RefreshGasPrice() assert.NoError(t, err) gas, _, err := u.BumpLegacyGas(tests.Context(t), originalGasPrice, gasLimit, maxPrice, nil) assert.NoError(t, err) @@ -235,7 +223,7 @@ func TestFeeHistoryEstimatorBumpLegacyGas(t *testing.T) { // Price will be capped by the max price maxPrice := assets.NewWeiI(101) u := gas.NewFeeHistoryEstimator(logger.Test(t), client, cfg, chainID, nil) - _, err := u.FetchGasPrice() + err := u.RefreshGasPrice() assert.NoError(t, err) _, _, err = u.BumpLegacyGas(tests.Context(t), originalGasPrice, gasLimit, maxPrice, nil) assert.Error(t, err) @@ -269,7 +257,7 @@ func TestFeeHistoryEstimatorGetDynamicFee(t *testing.T) { maxFee := (*assets.Wei)(baseFee).AddPercentage(gas.BaseFeeBufferPercentage).Add((*assets.Wei)(avrgPriorityFee)) u := gas.NewFeeHistoryEstimator(logger.Test(t), client, cfg, chainID, nil) - _, err := u.FetchDynamicPrice() + err := u.RefreshDynamicPrice() assert.NoError(t, err) dynamicFee, err := u.GetDynamicFee(tests.Context(t), maxPrice) assert.NoError(t, err) @@ -314,7 +302,7 @@ func TestFeeHistoryEstimatorGetDynamicFee(t *testing.T) { cfg := gas.FeeHistoryEstimatorConfig{BlockHistorySize: 1} u := gas.NewFeeHistoryEstimator(logger.Test(t), client, cfg, chainID, nil) - _, err := u.FetchDynamicPrice() + err := u.RefreshDynamicPrice() assert.NoError(t, err) dynamicFee, err := u.GetDynamicFee(tests.Context(t), maxPrice) assert.NoError(t, err) @@ -348,14 +336,13 @@ func TestFeeHistoryEstimatorBumpDynamicFee(t *testing.T) { cfg := gas.FeeHistoryEstimatorConfig{ BlockHistorySize: 2, BumpPercent: 50, - HasMempool: true, } expectedFeeCap := originalFee.FeeCap.AddPercentage(cfg.BumpPercent) expectedTipCap := originalFee.TipCap.AddPercentage(cfg.BumpPercent) u := gas.NewFeeHistoryEstimator(logger.Test(t), client, cfg, chainID, nil) - _, err := u.FetchDynamicPrice() + err := u.RefreshDynamicPrice() assert.NoError(t, err) dynamicFee, err := u.BumpDynamicFee(tests.Context(t), originalFee, globalMaxPrice, nil) assert.NoError(t, err) @@ -414,11 +401,10 @@ func TestFeeHistoryEstimatorBumpDynamicFee(t *testing.T) { cfg := gas.FeeHistoryEstimatorConfig{ BlockHistorySize: 1, BumpPercent: 50, - HasMempool: true, } u := gas.NewFeeHistoryEstimator(logger.Test(t), client, cfg, chainID, nil) - _, err := u.FetchDynamicPrice() + err := u.RefreshDynamicPrice() assert.NoError(t, err) bumpedFee, err := u.BumpDynamicFee(tests.Context(t), originalFee, globalMaxPrice, nil) assert.NoError(t, err) @@ -447,11 +433,10 @@ func TestFeeHistoryEstimatorBumpDynamicFee(t *testing.T) { cfg := gas.FeeHistoryEstimatorConfig{ BlockHistorySize: 1, BumpPercent: 50, - HasMempool: true, } u := gas.NewFeeHistoryEstimator(logger.Test(t), client, cfg, chainID, nil) - _, err := u.FetchDynamicPrice() + err := u.RefreshDynamicPrice() assert.NoError(t, err) _, err = u.BumpDynamicFee(tests.Context(t), originalFee, globalMaxPrice, nil) assert.Error(t, err) @@ -479,11 +464,10 @@ func TestFeeHistoryEstimatorBumpDynamicFee(t *testing.T) { cfg := gas.FeeHistoryEstimatorConfig{ BlockHistorySize: 1, BumpPercent: 50, - HasMempool: true, } u := gas.NewFeeHistoryEstimator(logger.Test(t), client, cfg, chainID, nil) - _, err := u.FetchDynamicPrice() + err := u.RefreshDynamicPrice() assert.NoError(t, err) bumpedFee, err := u.BumpDynamicFee(tests.Context(t), originalFee, maxPrice, nil) assert.NoError(t, err) @@ -516,13 +500,13 @@ func TestFeeHistoryEstimatorBumpDynamicFee(t *testing.T) { } u := gas.NewFeeHistoryEstimator(logger.Test(t), client, cfg, chainID, nil) - _, err := u.FetchDynamicPrice() + err := u.RefreshDynamicPrice() assert.NoError(t, err) _, err = u.BumpDynamicFee(tests.Context(t), originalFee, maxPrice, nil) assert.Error(t, err) }) - t.Run("ignores maxPriorityFeePerGas if there is no mempool", func(t *testing.T) { + t.Run("ignores maxPriorityFeePerGas if there is no mempool and forces refetch", func(t *testing.T) { client := mocks.NewFeeHistoryEstimatorClient(t) originalFee := gas.DynamicFee{ FeeCap: assets.NewWeiI(40), @@ -541,17 +525,15 @@ func TestFeeHistoryEstimatorBumpDynamicFee(t *testing.T) { client.On("FeeHistory", mock.Anything, mock.Anything, mock.Anything).Return(feeHistoryResult, nil).Once() cfg := gas.FeeHistoryEstimatorConfig{ - BlockHistorySize: 1, + BlockHistorySize: 0, BumpPercent: 20, - HasMempool: false, } + maxFeePerGas := assets.NewWei(baseFee).AddPercentage(gas.BaseFeeBufferPercentage) u := gas.NewFeeHistoryEstimator(logger.Test(t), client, cfg, chainID, nil) - _, err := u.FetchDynamicPrice() - assert.NoError(t, err) bumpedFee, err := u.BumpDynamicFee(tests.Context(t), originalFee, globalMaxPrice, nil) assert.NoError(t, err) assert.Equal(t, assets.NewWeiI(0), (*assets.Wei)(maxPriorityFeePerGas)) - assert.Equal(t, originalFee.FeeCap.AddPercentage(20), bumpedFee.FeeCap) + assert.Equal(t, maxFeePerGas, bumpedFee.FeeCap) }) } diff --git a/core/chains/evm/gas/models.go b/core/chains/evm/gas/models.go index a0cad5cc44e..4b5243ef516 100644 --- a/core/chains/evm/gas/models.go +++ b/core/chains/evm/gas/models.go @@ -119,7 +119,6 @@ func NewEstimator(lggr logger.Logger, ethClient feeEstimatorClient, cfg Config, EIP1559: geCfg.EIP1559DynamicFees(), BlockHistorySize: uint64(geCfg.BlockHistory().BlockHistorySize()), RewardPercentile: float64(geCfg.BlockHistory().TransactionPercentile()), - HasMempool: geCfg.FeeHistory().HasMempool(), } return NewFeeHistoryEstimator(lggr, ethClient, ccfg, ethClient.ConfiguredChainID(), l1Oracle) } @@ -404,7 +403,7 @@ func (e *evmFeeEstimator) estimateFeeLimit(ctx context.Context, feeLimit uint64, e.lggr.Debugw("estimated gas limit with buffer exceeds the provided gas limit with multiplier. falling back to the provided gas limit with multiplier", "estimatedGasLimit", estimatedFeeLimit, "providedGasLimitWithMultiplier", providedGasLimit) estimatedFeeLimit = providedGasLimit } - + return } diff --git a/core/chains/evm/txmgr/test_helpers.go b/core/chains/evm/txmgr/test_helpers.go index 3b847b3999d..e9a093dcbf2 100644 --- a/core/chains/evm/txmgr/test_helpers.go +++ b/core/chains/evm/txmgr/test_helpers.go @@ -133,7 +133,6 @@ type TestFeeHistoryConfig struct { } func (b *TestFeeHistoryConfig) CacheTimeout() time.Duration { return 0 * time.Second } -func (b *TestFeeHistoryConfig) HasMempool() bool { return true } type transactionsConfig struct { evmconfig.Transactions diff --git a/core/config/docs/chains-evm.toml b/core/config/docs/chains-evm.toml index f5d4cd77356..d4f81625f15 100644 --- a/core/config/docs/chains-evm.toml +++ b/core/config/docs/chains-evm.toml @@ -319,9 +319,6 @@ TransactionPercentile = 60 # Default # the timeout. The estimator is already adding a buffer to account for a potential increase in prices within one or two blocks. On the other hand, slower frequency will fail to refresh # the prices and end up in stale values. CacheTimeout = '10s' # Default -# HasMempool should be set to true if the estimator is making RPC calls to a network that supports a transaction mempool. This is only relevant for EIP-1559 estimations and it forces a -# minimum bumping check on maxPriorityFeePerGas and a connectivity check. For chains that don't have a mempool and process transactions in a FCFS manner, the two checks are omitted. -HasMempool = true # Default # The head tracker continually listens for new heads from the chain. # diff --git a/core/services/chainlink/config_test.go b/core/services/chainlink/config_test.go index 0cc7fcb0511..0120397278c 100644 --- a/core/services/chainlink/config_test.go +++ b/core/services/chainlink/config_test.go @@ -546,7 +546,6 @@ func TestConfig_Marshal(t *testing.T) { }, FeeHistory: evmcfg.FeeHistoryEstimator{ CacheTimeout: &second, - HasMempool: ptr(true), }, }, @@ -1057,7 +1056,6 @@ TransactionPercentile = 15 [EVM.GasEstimator.FeeHistory] CacheTimeout = '1s' -HasMempool = true [EVM.HeadTracker] HistoryDepth = 15 diff --git a/core/services/chainlink/testdata/config-full.toml b/core/services/chainlink/testdata/config-full.toml index 78a427f32bf..19e15312755 100644 --- a/core/services/chainlink/testdata/config-full.toml +++ b/core/services/chainlink/testdata/config-full.toml @@ -344,7 +344,6 @@ TransactionPercentile = 15 [EVM.GasEstimator.FeeHistory] CacheTimeout = '1s' -HasMempool = true [EVM.HeadTracker] HistoryDepth = 15 diff --git a/core/services/chainlink/testdata/config-multi-chain-effective.toml b/core/services/chainlink/testdata/config-multi-chain-effective.toml index 4653dfd326a..d6bcd989a05 100644 --- a/core/services/chainlink/testdata/config-multi-chain-effective.toml +++ b/core/services/chainlink/testdata/config-multi-chain-effective.toml @@ -321,7 +321,6 @@ TransactionPercentile = 50 [EVM.GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [EVM.HeadTracker] HistoryDepth = 100 @@ -426,7 +425,6 @@ TransactionPercentile = 50 [EVM.GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [EVM.HeadTracker] HistoryDepth = 100 @@ -525,7 +523,6 @@ TransactionPercentile = 60 [EVM.GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [EVM.HeadTracker] HistoryDepth = 2000 diff --git a/core/web/resolver/testdata/config-full.toml b/core/web/resolver/testdata/config-full.toml index 2ad201a3663..2a4003e45c5 100644 --- a/core/web/resolver/testdata/config-full.toml +++ b/core/web/resolver/testdata/config-full.toml @@ -343,7 +343,6 @@ TransactionPercentile = 15 [EVM.GasEstimator.FeeHistory] CacheTimeout = '1s' -HasMempool = true [EVM.HeadTracker] HistoryDepth = 15 diff --git a/core/web/resolver/testdata/config-multi-chain-effective.toml b/core/web/resolver/testdata/config-multi-chain-effective.toml index f3da4908f84..28e7c1f30e9 100644 --- a/core/web/resolver/testdata/config-multi-chain-effective.toml +++ b/core/web/resolver/testdata/config-multi-chain-effective.toml @@ -321,7 +321,6 @@ TransactionPercentile = 50 [EVM.GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [EVM.HeadTracker] HistoryDepth = 100 @@ -426,7 +425,6 @@ TransactionPercentile = 50 [EVM.GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [EVM.HeadTracker] HistoryDepth = 100 @@ -525,7 +523,6 @@ TransactionPercentile = 60 [EVM.GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [EVM.HeadTracker] HistoryDepth = 2000 diff --git a/docs/CONFIG.md b/docs/CONFIG.md index bbc091856af..771e013430c 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -1836,7 +1836,6 @@ TransactionPercentile = 50 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -1935,7 +1934,6 @@ TransactionPercentile = 50 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -2034,7 +2032,6 @@ TransactionPercentile = 50 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -2133,7 +2130,6 @@ TransactionPercentile = 50 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -2233,7 +2229,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 300 @@ -2332,7 +2327,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -2431,7 +2425,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -2531,7 +2524,6 @@ TransactionPercentile = 50 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -2630,7 +2622,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -2728,7 +2719,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -2826,7 +2816,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -2925,7 +2914,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -3025,7 +3013,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -3124,7 +3111,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -3223,7 +3209,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 2000 @@ -3322,7 +3307,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 2000 @@ -3421,7 +3405,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 2000 @@ -3520,7 +3503,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -3619,7 +3601,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 400 @@ -3718,7 +3699,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 50 @@ -3817,7 +3797,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 50 @@ -3916,7 +3895,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 50 @@ -4016,7 +3994,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 300 @@ -4115,7 +4092,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -4213,7 +4189,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -4312,7 +4287,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -4411,7 +4385,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 2000 @@ -4510,7 +4483,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -4609,7 +4581,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -4707,7 +4678,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 10 @@ -4806,7 +4776,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 2000 @@ -4905,7 +4874,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 400 @@ -5004,7 +4972,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 2000 @@ -5103,7 +5070,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -5201,7 +5167,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -5300,7 +5265,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 300 @@ -5399,7 +5363,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -5499,7 +5462,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -5599,7 +5561,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -5699,7 +5660,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -5798,7 +5758,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 50 @@ -5897,7 +5856,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -5996,7 +5954,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -6095,7 +6052,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 50 @@ -6193,7 +6149,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -6291,7 +6246,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 1000 @@ -6389,7 +6343,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 350 @@ -6488,7 +6441,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -6587,7 +6539,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 2000 @@ -6685,7 +6636,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 2000 @@ -6784,7 +6734,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 300 @@ -6883,7 +6832,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 300 @@ -6983,7 +6931,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -7083,7 +7030,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -7182,7 +7128,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -7281,7 +7226,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 50 @@ -7380,7 +7324,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 50 @@ -7479,7 +7422,6 @@ TransactionPercentile = 50 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -7578,7 +7520,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 300 @@ -7677,7 +7618,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -7776,7 +7716,6 @@ TransactionPercentile = 60 [GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [HeadTracker] HistoryDepth = 100 @@ -8442,7 +8381,6 @@ Setting it lower will tend to set lower gas prices. ```toml [EVM.GasEstimator.FeeHistory] CacheTimeout = '10s' # Default -HasMempool = true # Default ``` @@ -8457,13 +8395,6 @@ and set it to two times the block time i.e. on Optimism you can set it to 4s. Id the timeout. The estimator is already adding a buffer to account for a potential increase in prices within one or two blocks. On the other hand, slower frequency will fail to refresh the prices and end up in stale values. -### HasMempool -```toml -HasMempool = true # Default -``` -HasMempool should be set to true if the estimator is making RPC calls to a network that supports a transaction mempool. This is only relevant for EIP-1559 estimations and it forces a -minimum bumping check on maxPriorityFeePerGas and a connectivity check. For chains that don't have a mempool and process transactions in a FCFS manner, the two checks are omitted. - ## EVM.HeadTracker ```toml [EVM.HeadTracker] diff --git a/testdata/scripts/node/validate/disk-based-logging-disabled.txtar b/testdata/scripts/node/validate/disk-based-logging-disabled.txtar index 662f403a984..b49ada6a2b0 100644 --- a/testdata/scripts/node/validate/disk-based-logging-disabled.txtar +++ b/testdata/scripts/node/validate/disk-based-logging-disabled.txtar @@ -377,7 +377,6 @@ TransactionPercentile = 50 [EVM.GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [EVM.HeadTracker] HistoryDepth = 100 diff --git a/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar b/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar index 21bdd74cc0f..86050de2c20 100644 --- a/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar +++ b/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar @@ -377,7 +377,6 @@ TransactionPercentile = 50 [EVM.GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [EVM.HeadTracker] HistoryDepth = 100 diff --git a/testdata/scripts/node/validate/disk-based-logging.txtar b/testdata/scripts/node/validate/disk-based-logging.txtar index f1907c22f72..b245658bf3b 100644 --- a/testdata/scripts/node/validate/disk-based-logging.txtar +++ b/testdata/scripts/node/validate/disk-based-logging.txtar @@ -377,7 +377,6 @@ TransactionPercentile = 50 [EVM.GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [EVM.HeadTracker] HistoryDepth = 100 diff --git a/testdata/scripts/node/validate/invalid.txtar b/testdata/scripts/node/validate/invalid.txtar index c6cfcb18f10..303e8cdfa8b 100644 --- a/testdata/scripts/node/validate/invalid.txtar +++ b/testdata/scripts/node/validate/invalid.txtar @@ -367,7 +367,6 @@ TransactionPercentile = 50 [EVM.GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [EVM.HeadTracker] HistoryDepth = 100 diff --git a/testdata/scripts/node/validate/valid.txtar b/testdata/scripts/node/validate/valid.txtar index efce5955756..f80216f3a84 100644 --- a/testdata/scripts/node/validate/valid.txtar +++ b/testdata/scripts/node/validate/valid.txtar @@ -374,7 +374,6 @@ TransactionPercentile = 50 [EVM.GasEstimator.FeeHistory] CacheTimeout = '10s' -HasMempool = true [EVM.HeadTracker] HistoryDepth = 100