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

[BUG] FlatCallTracer: Block Hash Mismatch on Failed Transactions (EVM) #2116

Open
achmand opened this issue Mar 29, 2025 · 0 comments
Open
Labels
bug Something isn't working linear Created by Linear-GitHub Sync

Comments

@achmand
Copy link

achmand commented Mar 29, 2025

Web3 Client Version: Geth/linux-amd64/go1.21.13 via QuickNode

Chain ID: 1329

Describe the bug
We noticed an inconsistency when calling debug_traceBlockByNumber with the tracer set to flatCallTracer. This inconsistency occurs when there are traces for failed transactions within the block. The response returns an incorrect blockHash within the output of this tracer.

To Reproduce
We observed this issue occurring on multiple blocks.
To illustrate the problem, we will highlight two specific examples: blocks 79123882 and 79124420.

When you request the block details using the eth_getBlockByNumber endpoint for each of the examples, you will get the following responses:

Block Details Example 79123882

// Request
{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params": ["0x4B755AA", false],"id":0}

// Response
[
    {
        "jsonrpc": "2.0",
        "id": 0,
        "result": {
            "baseFeePerGas": "0x3b9aca00",
            "difficulty": "0x0",
            "extraData": "0x",
            "gasLimit": "0x989680",
            "gasUsed": "0x700e2c",
            "hash": "0xf35379eeb07f128a728e2800da1b866fff83f88654702e18de12e8e023693381",
            "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
            "miner": "0xc3c53b82d3333ce3c9902d4513736bd70f6ea950",
            "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "nonce": "0x0000000000000000",
            "number": "0x4b755aa",
            "parentHash": "0xe43c3e52a4f74dc7bb35f55cc813ed2ce97e46aafb3fcf8884056b0a757f5b75",
            "receiptsRoot": "0x259717de50a69e7a0f978ae9168b67ff45d95a81653365640ab4e1fe7a7f6242",
            "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
            "size": "0x11b3",
            "stateRoot": "0x21c5ac3c137211167e56b35043bebdc46de36cdd48a85522703f4e50536b55e2",
            "timestamp": "0x6654877e",
            "transactions": [
                "0x6acd4adb60084b0281ed40b5cce4fcf560cdcb42a883d0130001db70bb4c2420"
            ],
            "transactionsRoot": "0x8827589a099198aaabfbc66143cd23e7e99b7a93fb15e75d8f67325de1c92412",
            "uncles": []
        }
    }
]

Block Details Example 79124420

// Request
{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params": ["0x4B757C4", false],"id":0}

// Response
[
    {
        "jsonrpc": "2.0",
        "id": 0,
        "result": {
            "baseFeePerGas": "0x3b9aca00",
            "difficulty": "0x0",
            "extraData": "0x",
            "gasLimit": "0x989680",
            "gasUsed": "0x6acfc0",
            "hash": "0x613665431b87da5cec698a7e4bf170bf9a179ae310265f3872cf15f33711be54",
            "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
            "miner": "0x399548ff09159af3711df1ef08cc243c505130b6",
            "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "nonce": "0x0000000000000000",
            "number": "0x4b757c4",
            "parentHash": "0x711d14efe66cb456d9e5c3f9581e4513ec8561eec87dd71a7afa50a3bca259a5",
            "receiptsRoot": "0xb50a5e9f2fafcad82ab1c78e16615ad5ac24390db07a0aaed15631f589870ef2",
            "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
            "size": "0x4446",
            "stateRoot": "0x62a6be81b0b3b94987bcc8967a0037698aa681a599b800430b7a069a20af46e9",
            "timestamp": "0x665488fb",
            "transactions": [
                "0xf59b273e232c919d0b3dec144322e8024d71cbd881bbcf707dba3332c987a6c0"
            ],
            "transactionsRoot": "0xcd29a74cf972f694fd4ce3f79a983101558410af95d7c907b2330d4c570c2de9",
            "uncles": []
        }
    }
]

These responses are all correct, and if you take note of each block hash, you'll have:

  • Block 79123882 -> 0xf35379eeb07f128a728e2800da1b866fff83f88654702e18de12e8e023693381
  • Block 79124420 -> 0x613665431b87da5cec698a7e4bf170bf9a179ae310265f3872cf15f33711be54

This is also highlighted in SEITrace explorer for blocks 79123882 and 79124420.

For each of these blocks, there was 1 EVM transaction, both of which failed.

Now the problem lies here, when we call the debug_traceBlockByNumber with the tracer set to flatCallTracer as shown below:

Tracing Block Example 79123882

// Request
[
  {
    "id": 0,
    "method": "debug_traceBlockByNumber",
    "params": [
      "0x4b755aa",
      {
        "timeout": "60s",
        "tracer": "flatCallTracer",
        "tracerConfig": {
          "convertParityErrors": true
        }
      }
    ],
    "jsonrpc": "2.0"
  }
]

// Response
[
  {
    "jsonrpc": "2.0",
    "id": 0,
    "result": [
      {
        "txHash": "0x6acd4adb60084b0281ed40b5cce4fcf560cdcb42a883d0130001db70bb4c2420",
        "result": [
          {
            "action": {
              "callType": "call",
              "from": "0xe606a74343b6813115ba0714c1d233ef8db6e5d5",
              "gas": "0x6acfc0",
              "input": "0xc31d960f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003e73656931793330657a363374386a78647233676e68367576376a7337746c3377396167386375666e6d6779377872336836366b726475367367306c337a610000",
              "to": "0x000000000000000000000000000000000000100b",
              "value": "0x0"
            },
            "blockHash": "0xe03a22247e778c76d23ab1063882fefa52e21f9193e7c1e6b5982664af7f98d3",
            "blockNumber": 79123882,
            "error": "Reverted",
            "result": {
              "gasUsed": "0x6acfc0",
              "output": "0x64656e6f6d2073656931793330657a363374386a78647233676e68367576376a7337746c3377396167386375666e6d6779377872336836366b726475367367306c337a6120646f6573206e6f742068617665206d657461646174612073746f72656420616e6420746875732063616e206f6e6c7920686176652069747320706f696e74657220736574207468726f75676820676f762070726f706f73616c"
            },
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0x6acd4adb60084b0281ed40b5cce4fcf560cdcb42a883d0130001db70bb4c2420",
            "transactionPosition": 0,
            "type": "call"
          }
        ]
      }
    ]
  }
]

Tracing Block Example 79124420

// Request:
[
  {
    "id": 0,
    "method": "debug_traceBlockByNumber",
    "params": [
      "0x4b757c4",
      {
        "timeout": "60s",
        "tracer": "flatCallTracer",
        "tracerConfig": {
          "convertParityErrors": true
        }
      }
    ],
    "jsonrpc": "2.0"
  }
]

// Response:
[
  {
    "jsonrpc": "2.0",
    "id": 0,
    "result": [
      {
        "txHash": "0xf59b273e232c919d0b3dec144322e8024d71cbd881bbcf707dba3332c987a6c0",
        "result": [
          {
            "action": {
              "callType": "call",
              "from": "0xe606a74343b6813115ba0714c1d233ef8db6e5d5",
              "gas": "0x6acfc0",
              "input": "0xc31d960f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003e73656931793330657a363374386a78647233676e68367576376a7337746c3377396167386375666e6d6779377872336836366b726475367367306c337a610000",
              "to": "0x000000000000000000000000000000000000100b",
              "value": "0x0"
            },
            "blockHash": "0xe0ff31bf20f8fc9f8765313c16e8b4cda883ea99de2f2535c31a738f9c336893",
            "blockNumber": 79124420,
            "error": "Reverted",
            "result": {
              "gasUsed": "0x6acfc0",
              "output": "0x64656e6f6d2073656931793330657a363374386a78647233676e68367576376a7337746c3377396167386375666e6d6779377872336836366b726475367367306c337a6120646f6573206e6f742068617665206d657461646174612073746f72656420616e6420746875732063616e206f6e6c7920686176652069747320706f696e74657220736574207468726f75676820676f762070726f706f73616c"
            },
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0xf59b273e232c919d0b3dec144322e8024d71cbd881bbcf707dba3332c987a6c0",
            "transactionPosition": 0,
            "type": "call"
          }
        ]
      }
    ]
  }
]

Notice the incorrect blockHash returned in the example responses when tracing the block.

  • For transaction 0x6acd4adb60084b0281ed40b5cce4fcf560cdcb42a883d0130001db70bb4c2420 (79123882) we got the blockHash 0xe03a22247e778c76d23ab1063882fefa52e21f9193e7c1e6b5982664af7f98d3
  • For transaction 0xf59b273e232c919d0b3dec144322e8024d71cbd881bbcf707dba3332c987a6c0 (79124420) we got the blockHash 0xe0ff31bf20f8fc9f8765313c16e8b4cda883ea99de2f2535c31a738f9c336893

Both of which is returning incorrect blockHash fields.

Expected behavior
The tracer result in the examples shown above should be returning the correct blockHash for these failed transactions. That is:

When tracing block 79123882;

  • the blockHash should be 0xf35379eeb07f128a728e2800da1b866fff83f88654702e18de12e8e023693381
  • and NOT 0xe03a22247e778c76d23ab1063882fefa52e21f9193e7c1e6b5982664af7f98d3
  • for transaction 0x6acd4adb60084b0281ed40b5cce4fcf560cdcb42a883d0130001db70bb4c2420

When tracing block 79124420;

  • the blockHash should be 0x613665431b87da5cec698a7e4bf170bf9a179ae310265f3872cf15f33711be54
  • and NOT 0xe0ff31bf20f8fc9f8765313c16e8b4cda883ea99de2f2535c31a738f9c336893
  • for transaction 0xf59b273e232c919d0b3dec144322e8024d71cbd881bbcf707dba3332c987a6c0

Additional context
Some additional context which might be affecting this:

I noticed on the master branch the version of Geth is: github.com/ethereum/go-ethereum v1.13.2
I know there have been some changes which may require bumping go-ethereum to get this fixed.

For example:

I am speculating here and I am unsure if it is helpful, but maybe it's a good start to hone into the problem.

@achmand achmand added bug Something isn't working linear Created by Linear-GitHub Sync labels Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linear Created by Linear-GitHub Sync
Projects
None yet
Development

No branches or pull requests

2 participants
@achmand and others