Skip to content

Commit

Permalink
Add maxPrice cap on getdynamicfee (#14670)
Browse files Browse the repository at this point in the history
* Add maxPrice cap on getdynamicfee

* Add changeset

* Update changeset
  • Loading branch information
dimriou authored Oct 8, 2024
1 parent d3aa5fc commit ad29b19
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/wise-pandas-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

Fix BHE PriceMax bug #bugfix
3 changes: 2 additions & 1 deletion core/chains/evm/gas/block_history_estimator.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,8 @@ func (b *BlockHistoryEstimator) GetDynamicFee(_ context.Context, maxGasPriceWei
"Using Evm.GasEstimator.TipCapDefault as fallback.", "blocks", b.getBlockHistoryNumbers())
tipCap = b.eConfig.TipCapDefault()
}
maxGasPrice := getMaxGasPrice(maxGasPriceWei, b.eConfig.PriceMax())
maxGasPrice := assets.WeiMin(maxGasPriceWei, b.eConfig.PriceMax())
tipCap = assets.WeiMin(tipCap, maxGasPrice)
if b.eConfig.BumpThreshold() == 0 {
// just use the max gas price if gas bumping is disabled
feeCap = maxGasPrice
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/gas/block_history_estimator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2197,7 +2197,7 @@ func TestBlockHistoryEstimator_GetDynamicFee(t *testing.T) {
fee, err := bhe.GetDynamicFee(tests.Context(t), assets.NewWeiI(100))
require.NoError(t, err)

assert.Equal(t, gas.DynamicFee{FeeCap: assets.NewWeiI(100), TipCap: assets.NewWeiI(6000)}, fee)
assert.Equal(t, gas.DynamicFee{FeeCap: assets.NewWeiI(100), TipCap: assets.NewWeiI(100)}, fee)
})

h = testutils.Head(1)
Expand Down

0 comments on commit ad29b19

Please sign in to comment.