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

Fix maxFeePerGas < maxPriorityFeePerGas transaction issue #1139

Merged
merged 2 commits into from
Feb 12, 2025

Conversation

shawntobin
Copy link
Contributor

resolves #1136

Replaced legacy gas calculation that sometimes caused maxFeePerGas to be less than maxPriorityFeePerGas.

Previous code used web3.eth.getGasPrice() to calculate maxFeePerGas, which isn't suitable anymore for EIP-1559 transactions. Now fetching 'baseFeePerGas' instead.

resolves #1136

Replaced legacy gas calculation which sometimes caused maxFeePerGas to be less than maxPriorityFeePerGas.
@master-malwyl
Copy link
Contributor

One minor suggestion: we might want to add an explicit error case if both 'pending' and 'latest' blocks fail to return baseFeePerGas:

let block = await web3.eth.getBlock('pending');

// in case pending block doesn't return anything
if (!block || !block.baseFeePerGas) {
  block = await web3.eth.getBlock('latest');
  if (!block || !block.baseFeePerGas) {
    throw new Error('Unable to fetch baseFeePerGas from network');
  }
}

This would make debugging easier if we ever hit an edge case where the network isn't returning proper EIP-1559 data.

Otherwise, the changes look good and should fix the issues reported in #1136.

- Cleaner format + error message
@master-malwyl master-malwyl merged commit e7d5629 into master Feb 12, 2025
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.

Can't withdraw star from lockup
2 participants