Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erroneous stateDiff in API calls for failed transactions #7318

Closed
delehef opened this issue Jul 13, 2024 · 3 comments · Fixed by #7462
Closed

Erroneous stateDiff in API calls for failed transactions #7318

delehef opened this issue Jul 13, 2024 · 3 comments · Fixed by #7462
Assignees
Labels
bug Something isn't working P3 Medium (ex: JSON-RPC request not working with a specific client library due to loose spec assumtion)

Comments

@delehef
Copy link
Contributor

delehef commented Jul 13, 2024

Description

The stateDiff field of the result of a pure transfer tx in trace_replayBlockTransactions call is null if the transaction failed.

Steps to Reproduce (Bug)

On an archive Besu node on the

  1. Have RPC access to an archive Besu node following Holesky
  2. Replay this tx's block and look at the result for the 16th tx with the following curl/jq command:
curl -X POST -H "Content-Type: application/json" --data '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "trace_replayBlockTransactions",
    "params": ["0x1D1921", ["stateDiff"]]
    }' http://localhost:8545 | jq ".result[15]"

Expected behavior:

stateDiff should contain the balance changes for the tx sender and the block validator (here is the correct output as provided by QuickNode:

{
  # This is the sender
  "0x5324ff21932b3ae69a6d46aaf29eca5bbfb86b73": {
    "balance": {
      "*": {
        "from": "0x5bb96a5487a77495",
        "to": "0x5bb9573b1619f045"
      }
    },
    "code": "=",
    "nonce": {
      "*": {
        "from": "0xe3",
        "to": "0xe4"
      }
    },
    "storage": {}
  },
  # This is the miner
  "0x9baa3244565d51d9c7897c0eb6679ed4890e536e": {
    "balance": {
      "*": {
        "from": "0xa39659f932cf1b4668b",
        "to": "0xa39659fa646633eb68b"
      }
    },
    "code": "=",
    "nonce": "=",
    "storage": {}
  }
}

Actual behavior:

stateDiff is null.

Frequency:

100%

Versions (Add all that apply)

  • Software version: freshly compiled from main branch, as well as 24.5.2
  • Java version: 17 & 21
  • OS Name & Version: Debian bookworm
  • Consensus Client & Version if using Proof of Stake: Teku 24.4.0

Additional Information (Add any of the following or anything else that may be relevant)

It seems that this issue is triggered by simple transfer TXs running out of gas. The bug may be coming from this line, where the generation of the state diff is entirely skipped if there are no frames in the tx execution, hence ignoring the balance changes to the sender & miner.

@delehef
Copy link
Contributor Author

delehef commented Jul 13, 2024

@daniellehrner @shemnon

@non-fungible-nelson non-fungible-nelson added the bug Something isn't working label Jul 22, 2024
@siladu siladu added the P3 Medium (ex: JSON-RPC request not working with a specific client library due to loose spec assumtion) label Jul 22, 2024
@siladu
Copy link
Contributor

siladu commented Jul 22, 2024

@non-fungible-nelson to discuss with @daniellehrner

@delehef
Copy link
Contributor Author

delehef commented Aug 14, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P3 Medium (ex: JSON-RPC request not working with a specific client library due to loose spec assumtion)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants