Skip to content

Conversation

@MilanKomsa
Copy link
Contributor

@MilanKomsa MilanKomsa commented Dec 17, 2025

Note

Use a configurable priority fee percentile (default 80) for fee history and apply gas buffer to base fee only, with config plumbed via InputService.

  • Blockchain service (services/blockchain-service/blockchain-service-base.js):
    • Fee history: Use configurable blockchain.priorityFeePercentile (default 80) in eth_getFeeHistory instead of fixed 50.
    • Gas price buffering:
      • Change applyGasPriceBuffer(maxBaseFee, maxPriorityFee, gasPriceBufferPercent) to apply buffer only to base fee and then add priority fee.
      • Update estimateGasPriceFromFeeHistory to use new signature and handle fallbacks by separating base and priority components.
  • Input service (services/input-service.js):
    • Add and propagate priorityFeePercentile in getBlockchain config.

Written by Cursor Bugbot for commit 0e6a648. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on January 7

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.


Bug: Incomplete signature update breaks fallback gas price paths

The applyGasPriceBuffer function signature was changed from 2 parameters to 3 parameters (maxBaseFee, maxPriorityFee, gasPriceBufferPercent), but two fallback call sites weren't updated. These calls still pass only 2 arguments, causing gasPriceBufferPercent to become the maxPriorityFee parameter (a number), and the actual third parameter becomes undefined. When the function executes maxBaseFee + maxPriorityFee, it attempts to add a BigInt with a number, which throws a TypeError.

services/blockchain-service/blockchain-service-base.js#L1461-L1465

if (baseFees.length === 0 || priorityFees.length === 0) {
return this.applyGasPriceBuffer(
BigInt(await this.getNetworkGasPrice(blockchain)),
gasPriceBufferPercent,
);

Fix in Cursor Fix in Web


Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Mismatched function call arguments cause runtime error

The applyGasPriceBuffer function signature was changed from 2 to 3 parameters, but two fallback call sites were not updated. These calls still pass (gasPrice, gasPriceBufferPercent) instead of (maxBaseFee, maxPriorityFee, gasPriceBufferPercent). This causes maxPriorityFee to receive the buffer percent number while gasPriceBufferPercent becomes undefined. When the function attempts to add maxBaseFee (BigInt) to maxPriorityFee (now a number), JavaScript will throw a TypeError because BigInt and Number types cannot be mixed.

services/blockchain-service/blockchain-service-base.js#L1462-L1466

if (baseFees.length === 0 || priorityFees.length === 0) {
return this.applyGasPriceBuffer(
BigInt(await this.getNetworkGasPrice(blockchain)),
gasPriceBufferPercent,
);

Fix in Cursor Fix in Web


Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Fallback calls use wrong argument count for updated function

The applyGasPriceBuffer function signature changed from 2 to 3 parameters (maxBaseFee, maxPriorityFee, gasPriceBufferPercent), but the fallback call sites at lines 1453-1456 and 1463-1466 still pass only 2 arguments. This causes gasPriceBufferPercent to be passed as maxPriorityFee, leaving the third argument undefined. When the function executes maxBaseFee + maxPriorityFee (since gasPriceBufferPercent is falsy), it will try to add a BigInt with a Number, throwing a TypeError.

services/blockchain-service/blockchain-service-base.js#L1452-L1456

if (!feeHistory.supported) {
return this.applyGasPriceBuffer(
BigInt(await this.getNetworkGasPrice(blockchain)),
gasPriceBufferPercent,
);

services/blockchain-service/blockchain-service-base.js#L1462-L1466

if (baseFees.length === 0 || priorityFees.length === 0) {
return this.applyGasPriceBuffer(
BigInt(await this.getNetworkGasPrice(blockchain)),
gasPriceBufferPercent,
);

Fix in Cursor Fix in Web


0n,
BigInt(await this.getNetworkGasPrice(blockchain)),
gasPriceBufferPercent,
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Buffer not applied to fallback network gas price

In the fallback cases, the network gas price is passed as maxPriorityFee (second argument) while maxBaseFee is 0n. Since applyGasPriceBuffer only applies the buffer percentage to maxBaseFee, the calculation becomes ((0n * buffer) / 100n) + networkGasPrice = networkGasPrice. The buffer is never applied to the fallback gas price. The arguments appear to be in the wrong order—the network gas price should be passed as maxBaseFee and 0n as maxPriorityFee.

Additional Locations (1)

Fix in Cursor Fix in Web

@MilanKomsa MilanKomsa merged commit 53d7f99 into v8/develop Dec 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants