gasUsed value is incorrect in eth_getTransactionReceipt response #4956
Comments
I'm interested in taking a crack at this as a part of learning more about Ethereum. The bug and recommended fix seem pretty straight-forward, with the exception of calculating the correct On a related note, it looks like the root cause of the issue is that in Presumably I cannot simply add a new constructor |
Hi @halfalicious, thank you for your interest! We shouldn't add new members to |
Thanks gumb0! I've forked the repo and have a change ready which builds clean on Ubuntu, just need to see if I can test it locally before creating the PR. |
Update - ran into some issues trying to sync on Ubuntu (presumably due to running it in a Hyper-V container) so I've rebuilt my changes on Windows and kicked off a sync last night. Assuming I don't hit any other issues and testing goes smoothly I should be able to create the PR this weekend. |
@halfalicious Note - you don't need to sync to the top, you can request any transaction among already downloaded blocks |
Add "gasUsed" data to the LocalisedTransactionReceipt class (fix #4956)
We currently return the same value for
gasUsed
andcumulativeGasUsed
, see https://github.com/ethereum/cpp-ethereum/blob/a17f30a41aa2af506b6b453f052c53bd323a36e0/libweb3jsonrpc/JsonHelper.cpp#L203For both values we return
TransactionReceipt::gasUsed()
, which is in fact cumulative gas.We need to
TransactionReceipt::gasUsed()
tocumulativeGasUsed()
gasUsed()
toLocalizedTransactionReceipt
, calculate it by subtracting the previous transaction receipt's gastoJson()
function linked aboveThe text was updated successfully, but these errors were encountered: