Skip to content

eth/tracers: add txHash to pre-bedrock historical trace results #576

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

Open
wants to merge 1 commit into
base: optimism
Choose a base branch
from

Conversation

bbaktaeho
Copy link

@bbaktaeho bbaktaeho commented Apr 9, 2025

Description

When querying debug_traceBlockXXX RPC methods on pre-Bedrock blocks, the txHash field is missing in the results.
Below is an example from block number 4, using debug_traceBlockByNumber with the callTracer:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "txHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "result": {
        "from": "0x7107142636c85c549690b1aca12bdb8052d26ae6",
        "gas": "0x2130",
        "gasUsed": "0x2130",
        "input": "0xbede39b500000000000000000000000000000000000000000000000000000029a05f69e1",
        "output": "0x",
        "time": "1.804646ms",
        "to": "0x420000000000000000000000000000000000000f",
        "type": "CALL",
        "value": "0x0"
      }
    }
  ]
}

As you can see, txHash is set to a zero hash.
This PR initializes the txHash field using the corresponding transaction from the block that was traced.

real result:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "txHash": "0xc1d20abbdd2a63df8dcd8eba2bdcf850d067109dd626964a9987747a154b8fdb",
      "result": {
        "from": "0x7107142636c85c549690b1aca12bdb8052d26ae6",
        "gas": "0x2130",
        "gasUsed": "0x2130",
        "input": "0xbede39b500000000000000000000000000000000000000000000000000000029a05f69e1",
        "output": "0x",
        "time": "34.258333ms",
        "to": "0x420000000000000000000000000000000000000f",
        "type": "CALL",
        "value": "0x0"
      }
    }
  ]
}

Tests

Additional context

Metadata

@bbaktaeho bbaktaeho requested a review from a team as a code owner April 9, 2025 08:54
@bbaktaeho bbaktaeho requested a review from teddyknox April 9, 2025 08:54
@teddyknox
Copy link

/ci authorize 0d73c8f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants