flashbots / flashbots/ethers-provider-flashbots-bundle

calculateBundlePricing returns incorrect (negative gas for EIP-1559 tx)

Open
#62 3 comments 4 reactions 0 assignees View on GitHub
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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.