Use previous block hash to compute tx effectiveGasPrice #1280
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Moonbeam, we were getting some discrepancies between the
effectiveGasPrice
reported byeth_getTransactionReceipt
and the actual fee that was charged on transaction execution (As seen for example as part of thebalances.Withdrawn
event and then verifying the balance change in state). The fee should matchgasUsed
*eth_getTransactionReceipt
but it is sometimes not the case for EIP-1559 transactions. An example case can be found here.The issue was tracked down to
eth_getTransactionReceipt
rpc call doing thegas_price
runtime api call for the same block the transaction happened to get the base fee. Since the state value (NextFeeMultiplier
) on which base fee depends on in our case is updatedon_finalize
, the base_fee when the transaction is executed is different from base fee at the end of the blockThis issue should be present on any chain that updates base fee during
on_finalize
as it is for example the case for the base fee pallet on this repoWe have made the patch on our frontier fork, with a failing test that passes on moonbeam