Skip to content

Commit

Permalink
Enforce pricelimit in reward values returned from eth_feeHistory
Browse files Browse the repository at this point in the history
  • Loading branch information
sergerad committed Jan 15, 2025
1 parent 8d8944c commit c735323
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions eth/gasprice/feehistory.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"math/big"
"sync/atomic"

"github.com/ethereum/go-ethereum/cmd/geth/immutable/settings"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus/misc/eip1559"
"github.com/ethereum/go-ethereum/core/types"
Expand All @@ -36,6 +37,8 @@ import (
var (
errInvalidPercentile = errors.New("invalid reward percentile")
errRequestBeyondHead = errors.New("request beyond head block")
// CHANGE(immutable): Floor of priority fee is pricelimit
priceLimit = big.NewInt(int64(settings.PriceLimit))
)

const (
Expand Down Expand Up @@ -320,6 +323,14 @@ func (oracle *Oracle) FeeHistory(ctx context.Context, blocks uint64, unresolvedL
}
if len(rewardPercentiles) != 0 {
reward = reward[:firstMissing]
// CHANGE(immutable): Floor of priority fee is pricelimit
for i := range reward {
for j := range reward[i] {
if reward[i][j].Cmp(priceLimit) < 0 {
reward[i][j] = priceLimit
}
}
}
} else {
reward = nil
}
Expand Down

0 comments on commit c735323

Please sign in to comment.