flashbots / flashbots/ethers-provider-flashbots-bundle
calculateBundlePricing returns incorrect (negative gas for EIP-1559 tx)
- Dominant language
- TypeScript
- Stars
- 566
- Forks
- 211
- PR merge metrics
- No merged PRs in 30d
Description
gasPricePaidBySearcher here is the priority fee -- it's already 'above' the base fee so subtracting base gas makes it go negative...
```
private calculateBundlePricing(
bundleTransactions: Array,
baseFee: BigNumber
) {
console.log('DBG__ bundle Transactions = ', bundleTransactions);
const bundleGasPricing = bundleTransactions.reduce(
(acc, transactionDetail) => {
const gasUsed = 'gas_used' in transactionDetail ? transactionDetail.gas_used : transactionDetail.gasUsed
const gasPricePaidBySearcher = BigNumber.from(
'gas_price' in transactionDetail ? transactionDetail.gas_price : transactionDetail.gasPrice
)
const priorityFeeReceivedByMiner = gasPricePaidBySearcher.sub(baseFee) <<<<<<------------------- THIS is incorrect
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Locate calculateBundlePricing in the TypeScript source and trace how gas_price or gasPrice is interpreted for EIP-1559 transactions. Check the bundle pricing behavior around the priority-fee calculation, then verify that EIP-1559 bundle pricing no longer produces a negative gas value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100