Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Conversation

@MicaiahReid
Copy link
Contributor

@MicaiahReid MicaiahReid commented Jan 4, 2023

Previously we were returning the wrong gasPrice when a transaction was fetched via eth_getTransactionByHash. This was happening because when we saved the transaction to the chain, we didn't update the transaction's effectiveGasPrice field based off of the baseFeePerGas of the block that the transaction was mined onto in some cases.

However, the effectiveGasPrice returned on a receipt was correct because when the receipt was fetched, we would calculate the effectiveGasPrice on the fly just to correct what we return to the user, rather than directly using what the database returned.

This change removes the on-the-fly calculation of the effectiveGasPrice on the receipt, and presets the transaction's effectiveGasPrice based off of the next block's baseFeePerGas when the transaction is added to the pool. As block's are mined, the miner updates all pending transaction's effectiveGasPrice based off of the next block's baseFeePerGas.

Fixes #4094.

Copy link
Contributor

@davidmurdoch davidmurdoch left a comment

Choose a reason for hiding this comment

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

I wonder if there's a measurable performance improvement when fetching receipts since we don't query the db for the block anymore.

@MicaiahReid MicaiahReid merged commit a3ae75f into develop Jan 9, 2023
@MicaiahReid MicaiahReid deleted the fix-gas-price branch January 9, 2023 14:34
@gitpoap-bot
Copy link

gitpoap-bot bot commented Jan 9, 2023

Congrats, your important contribution to this open-source project has earned you a GitPOAP!

GitPOAP: 2023 Ganache Contributor:

GitPOAP: 2023 Ganache Contributor GitPOAP Badge

Head to gitpoap.io & connect your GitHub account to mint!

Learn more about GitPOAPs here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

transaction gasPrice does not equal baseFeePerGas + maxPriorityFeePerGas

4 participants