should consider minimum priority fee when calculating `maxPriorityFeePerGas`
- Dominant language
- TypeScript
- Stars
- 413
- Forks
- 308
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 253
Description
In calculating `maxPriorityFeePerGas` as following code:
https://github.com/MetaMask/core/blob/1dadf04f77211e3650d36be86aa0934750ec9a44/packages/gas-fee-controller/src/fetchGasEstimatesViaEthFeeHistory/calculateGasFeeEstimatesForPriorityLevels.ts#L75
```
const medianPriorityFee = medianOf(priorityFees);
const adjustedPriorityFee = medianPriorityFee
.mul(settings.priorityFeePercentageMultiplier)
.divn(100);
```
If minimum priority fee in block history is same to the median value, then the tx having 97% of the median as
`maxPriorityFeePerGas` may not be accepted by txpool.
For example, let's assume the following situation.
priorityFees = [10, 10, 10, 10, 10, 11, 12, 13, 14]
median is 10 (5th element)
and `adjustedPriorityFee` = 9.7 (10 * 97%)
So txpool may reject the tx because of the priorityFee less than min value.
Actually, some chain uses fixed priorityFee to have the all same `effectivePriorityFeePerGas` in block fee history so
metamask fails to send a transaction without manual setting of gas.
Are you willing to improve this?
How about to use median * 97% but at least set it to be greater than min?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in packages/gas-fee-controller/src/fetchGasEstimatesViaEthFeeHistory/calculateGasFeeEstimatesForPriorityLevels.ts at the linked calculation and trace how priorityFees are obtained. Compare the adjusted median with the minimum fee in the block history, then verify the result handles fixed-fee histories without producing a value below the minimum.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- blockchain
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100