diff --git a/core/chains/evm/gas/block_history_estimator.go b/core/chains/evm/gas/block_history_estimator.go index fcd0d627063..051544af520 100644 --- a/core/chains/evm/gas/block_history_estimator.go +++ b/core/chains/evm/gas/block_history_estimator.go @@ -264,7 +264,7 @@ func (b *BlockHistoryEstimator) GetLegacyGas(_ context.Context, _ []byte, gasLim gasPrice = b.eConfig.PriceDefault() } gasPrice = capGasPrice(gasPrice, maxGasPriceWei, b.eConfig.PriceMax()) - chainSpecificGasLimit, err = commonfee.ApplyMultiplier(gasLimit, b.eConfig.LimitMultiplier()) + chainSpecificGasLimit = gasLimit return } @@ -396,7 +396,7 @@ func (b *BlockHistoryEstimator) GetDynamicFee(_ context.Context, gasLimit uint64 var feeCap *assets.Wei var tipCap *assets.Wei ok := b.IfStarted(func() { - chainSpecificGasLimit, err = commonfee.ApplyMultiplier(gasLimit, b.eConfig.LimitMultiplier()) + chainSpecificGasLimit = gasLimit if err != nil { return } diff --git a/core/chains/evm/gas/fixed_price_estimator.go b/core/chains/evm/gas/fixed_price_estimator.go index 53b7e93a871..01796707020 100644 --- a/core/chains/evm/gas/fixed_price_estimator.go +++ b/core/chains/evm/gas/fixed_price_estimator.go @@ -60,10 +60,7 @@ func (f *fixedPriceEstimator) Start(context.Context) error { func (f *fixedPriceEstimator) GetLegacyGas(_ context.Context, _ []byte, gasLimit uint64, maxGasPriceWei *assets.Wei, _ ...feetypes.Opt) (*assets.Wei, uint64, error) { gasPrice := commonfee.CalculateFee(f.config.PriceDefault().ToInt(), maxGasPriceWei.ToInt(), f.config.PriceMax().ToInt()) - chainSpecificGasLimit, err := commonfee.ApplyMultiplier(gasLimit, f.config.LimitMultiplier()) - if err != nil { - return nil, 0, err - } + chainSpecificGasLimit := gasLimit return assets.NewWei(gasPrice), chainSpecificGasLimit, nil } @@ -88,10 +85,7 @@ func (f *fixedPriceEstimator) BumpLegacyGas( return nil, 0, err } - chainSpecificGasLimit, err := commonfee.ApplyMultiplier(originalGasLimit, f.config.LimitMultiplier()) - if err != nil { - return nil, 0, err - } + chainSpecificGasLimit := originalGasLimit return assets.NewWei(gasPrice), chainSpecificGasLimit, err } @@ -101,10 +95,7 @@ func (f *fixedPriceEstimator) GetDynamicFee(_ context.Context, originalGasLimit if gasTipCap == nil { return d, 0, pkgerrors.New("cannot calculate dynamic fee: EthGasTipCapDefault was not set") } - chainSpecificGasLimit, err = commonfee.ApplyMultiplier(originalGasLimit, f.config.LimitMultiplier()) - if err != nil { - return d, 0, err - } + chainSpecificGasLimit = originalGasLimit var feeCap *assets.Wei if f.config.BumpThreshold() == 0 { diff --git a/core/chains/evm/gas/fixed_price_estimator_test.go b/core/chains/evm/gas/fixed_price_estimator_test.go index 968275ace48..3eea0018557 100644 --- a/core/chains/evm/gas/fixed_price_estimator_test.go +++ b/core/chains/evm/gas/fixed_price_estimator_test.go @@ -24,50 +24,47 @@ func Test_FixedPriceEstimator(t *testing.T) { t.Parallel() maxGasPrice := assets.NewWeiI(1000000) - t.Run("GetLegacyGas returns EvmGasPriceDefault from config, with multiplier applied", func(t *testing.T) { + t.Run("GetLegacyGas returns EvmGasPriceDefault from config", func(t *testing.T) { config := &gas.MockGasEstimatorConfig{} f := gas.NewFixedPriceEstimator(config, &blockHistoryConfig{}, logger.Test(t)) config.PriceDefaultF = assets.NewWeiI(42) - config.LimitMultiplierF = float32(1.1) config.PriceMaxF = maxGasPrice gasPrice, gasLimit, err := f.GetLegacyGas(testutils.Context(t), nil, 100000, maxGasPrice) require.NoError(t, err) - assert.Equal(t, 110000, int(gasLimit)) + assert.Equal(t, 100000, int(gasLimit)) assert.Equal(t, assets.NewWeiI(42), gasPrice) }) t.Run("GetLegacyGas returns user specified maximum gas price", func(t *testing.T) { config := &gas.MockGasEstimatorConfig{} config.PriceDefaultF = assets.NewWeiI(42) - config.LimitMultiplierF = float32(1.1) config.PriceMaxF = assets.NewWeiI(35) f := gas.NewFixedPriceEstimator(config, &blockHistoryConfig{}, logger.Test(t)) gasPrice, gasLimit, err := f.GetLegacyGas(testutils.Context(t), nil, 100000, assets.NewWeiI(30)) require.NoError(t, err) - assert.Equal(t, 110000, int(gasLimit)) + assert.Equal(t, 100000, int(gasLimit)) assert.Equal(t, assets.NewWeiI(30), gasPrice) }) t.Run("GetLegacyGas returns global maximum gas price", func(t *testing.T) { config := &gas.MockGasEstimatorConfig{} config.PriceDefaultF = assets.NewWeiI(42) - config.LimitMultiplierF = float32(1.1) config.PriceMaxF = assets.NewWeiI(20) f := gas.NewFixedPriceEstimator(config, &blockHistoryConfig{}, logger.Test(t)) gasPrice, gasLimit, err := f.GetLegacyGas(testutils.Context(t), nil, 100000, assets.NewWeiI(30)) require.NoError(t, err) - assert.Equal(t, 110000, int(gasLimit)) + assert.Equal(t, 100000, int(gasLimit)) assert.Equal(t, assets.NewWeiI(20), gasPrice) }) t.Run("BumpLegacyGas calls BumpLegacyGasPriceOnly", func(t *testing.T) { config := &gas.MockGasEstimatorConfig{} config.PriceDefaultF = assets.NewWeiI(42) - config.LimitMultiplierF = float32(1.1) + config.LimitMultiplierF = float32(1.0) config.PriceMaxF = maxGasPrice config.BumpPercentF = uint16(10) config.BumpMinF = assets.NewWeiI(150) @@ -85,9 +82,8 @@ func Test_FixedPriceEstimator(t *testing.T) { assert.Equal(t, expectedGasPrice, gasPrice) }) - t.Run("GetDynamicFee returns defaults from config, with multiplier applied", func(t *testing.T) { + t.Run("GetDynamicFee returns defaults from config", func(t *testing.T) { config := &gas.MockGasEstimatorConfig{} - config.LimitMultiplierF = float32(1.1) config.PriceMaxF = maxGasPrice config.TipCapDefaultF = assets.NewWeiI(52) config.FeeCapDefaultF = assets.NewWeiI(100) @@ -98,7 +94,7 @@ func Test_FixedPriceEstimator(t *testing.T) { fee, gasLimit, err := f.GetDynamicFee(testutils.Context(t), 100000, maxGasPrice) require.NoError(t, err) - assert.Equal(t, 110000, int(gasLimit)) + assert.Equal(t, 100000, int(gasLimit)) assert.Equal(t, assets.NewWeiI(52), fee.TipCap) assert.Equal(t, assets.NewWeiI(100), fee.FeeCap) @@ -108,7 +104,7 @@ func Test_FixedPriceEstimator(t *testing.T) { fee, gasLimit, err = f.GetDynamicFee(testutils.Context(t), 100000, maxGasPrice) require.NoError(t, err) - assert.Equal(t, 110000, int(gasLimit)) + assert.Equal(t, 100000, int(gasLimit)) assert.Equal(t, assets.NewWeiI(52), fee.TipCap) assert.Equal(t, maxGasPrice, fee.FeeCap) @@ -116,7 +112,7 @@ func Test_FixedPriceEstimator(t *testing.T) { // override max gas price fee, gasLimit, err = f.GetDynamicFee(testutils.Context(t), 100000, assets.NewWeiI(10)) require.NoError(t, err) - assert.Equal(t, 110000, int(gasLimit)) + assert.Equal(t, 100000, int(gasLimit)) assert.Equal(t, assets.NewWeiI(52), fee.TipCap) assert.Equal(t, assets.NewWeiI(10), fee.FeeCap) @@ -124,7 +120,6 @@ func Test_FixedPriceEstimator(t *testing.T) { t.Run("BumpDynamicFee calls BumpDynamicFeeOnly", func(t *testing.T) { config := &gas.MockGasEstimatorConfig{} - config.LimitMultiplierF = float32(1.1) config.PriceMaxF = maxGasPrice config.TipCapDefaultF = assets.NewWeiI(52) config.BumpMinF = assets.NewWeiI(150)