hyperledger / besu

An enterprise-grade Java-based, Apache 2.0 licensed Ethereum client https://wiki.hyperledger.org/display/besu
https://www.hyperledger.org/projects/besu
Apache License 2.0
1.44k stars 765 forks source link

Make `eth_gasPrice` aware of the base fee market #7102

Closed fab-10 closed 2 months ago

fab-10 commented 2 months ago

PR description

The eth_gasPrice is not taking in account the base fee market values, when the network supports them, so it is possible that it returns values that are not good for pricing a tx for inclusion in the next block. Specifically the calculation of gas price lower bound only rely on the runtime value of minGasPrice, but on base fee market networks, it could be that baseFee for the next block is higher than the minGasPrice, for example for devnets using the default, the minGasPrice=1kwei and the genesis sets baseFee=1gwei and the result is that senders thinks the can just price the gas at 1kwei to the the tx included, which is not the case.

This PR takes in consideration the baseFee value when calculating the lower bound, along with the fix I did some refactoring to move the gas price calculation into BlockchainQueries and continue to directly use MiningParameters to get the gas market info.

Fixed Issue(s)

Thanks for sending a pull request! Have you done the following?

Locally, you can run these tests to catch failures early: