Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FHE empty slice fix #14857

Merged
merged 4 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fifty-squids-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

FHE empty reward fix #internal
5 changes: 3 additions & 2 deletions core/chains/evm/gas/fee_history_estimator.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,10 @@ func (f *FeeHistoryEstimator) RefreshDynamicPrice() error {
priorityFee := big.NewInt(0)
priorityFeeThreshold := big.NewInt(0)
for _, reward := range feeHistory.Reward {
// reward needs to have values for two percentiles
// reward needs to have values for two percentiles. Some chains may return an empty slice instead of 0x0 values, so we use
// continue instead of throwing an error.
if len(reward) < 2 {
return fmt.Errorf("reward size incorrect: %d", len(reward))
continue
}
// We'll calculate the average of non-zero priority fees
if reward[0].Cmp(big.NewInt(0)) > 0 {
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/gas/fee_history_estimator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func TestFeeHistoryEstimatorGetDynamicFee(t *testing.T) {

feeHistoryResult := &ethereum.FeeHistory{
OldestBlock: big.NewInt(1),
Reward: [][]*big.Int{{maxPriorityFeePerGas1, big.NewInt(5)}, {maxPriorityFeePerGas2, big.NewInt(5)}}, // first one represents market price and second one connectivity price
Reward: [][]*big.Int{{maxPriorityFeePerGas1, big.NewInt(5)}, {maxPriorityFeePerGas2, big.NewInt(5)}, {}}, // first one represents market price and second one connectivity price
BaseFee: []*big.Int{baseFee, baseFee},
GasUsedRatio: nil,
}
Expand Down
Loading