-
Notifications
You must be signed in to change notification settings - Fork 98
Description
Description
Problem
cumulativeGasUsed in transaction receipts is currently set to the total gas used in the block (block_gas_used) for every receipt in that block. It should instead be the cumulative gas used in the block up to and including that transaction, as defined in the Ethereum Yellow Paper.
Expected behavior (Yellow Paper)
"the cumulative gas used in the block containing the transaction receipt as of immediately after the transaction has happened"
So for a block with 3 transactions using 1000, 2000, and 3000 gas:
- Tx 0: cumulativeGasUsed = 1000
- Tx 1: cumulativeGasUsed = 3000 (1000 + 2000)
- Tx 2: cumulativeGasUsed = 6000 (1000 + 2000 + 3000)
Current behavior
Every receipt in the block gets the same value: the block’s total gas (e.g. 6000 for all three in the example above). This comes from using receiptResponse.block_gas_used (mirror node: “The total gas used in the block”) for cumulativeGasUsed.
Steps to reproduce
- Pick a block with multiple receipts, e.g. 0x56e7e72.
- Call
eth_getBlockReceiptsfor that block. - Observe that every receipt in the response has the same
cumulativeGasUsedvalue, which equals the block’s total gas used, instead of increasing per transaction as defined in the Ethereum Yellow Paper.
Additional context
No response
Hedera network
No response
Version
0.74.1 and main branch
Operating system
None