testinprod-io / op-erigon

Optimism implementation on the efficiency frontier
https://op-erigon.testinprod.io
GNU Lesser General Public License v3.0
85 stars 14 forks source link

txHash is missing in response for some blocks in debug calls #167

Open AlbertMakhortov opened 2 months ago

AlbertMakhortov commented 2 months ago

System information

Erigon version: 2.57.3-0.5.2-amd64

Expected behaviour

After making a debug_traceBlockByHash call txHash should be present in the response

Actual behaviour

At least for this blocks it is not present

0x8326c86e5528116e14e70238c16e39fb6b3eeb2255e41a8f2b71515a778b7719

0xeab0b969536d35ff771d76e9c3543078f37437b78b568d1c913c83a6c76a0699

0xe1ba72adf6dc8fac1381fc2e8c475064a2226ee6409fdda559a3eb883d08ec92

curl example:

curl --location 'our-endpoint' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "method": "debug_traceBlockByHash",
    "params": [
        "0xe1ba72adf6dc8fac1381fc2e8c475064a2226ee6409fdda559a3eb883d08ec92",
        {
            "tracer": "callTracer",
            "tracerConfig": {
                "onlyTopCall": false,
                "withLog": true
            },
            "disableStorage": true,
            "disableStack": true
        }
    ],
    "id": 1
}' 

part of the response, so we can observe that txHash is not there:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "result": {
        "calls": [
          {
            "from": "0x4d8d3667a3296e99274c121aae10663ef54544a1",
            "gas": "0x64d4fe",
            "gasUsed": "0x919",
            "input": "0x519b4bd3",
            "output": "0x00000000000000000000000000000000000000000000000000000008fac303dd",
            "to": "0x420000000000000000000000000000000000000f",
            "type": "STATICCALL"
          },
          {
            "calls": [
              {
                "from": "0x13e3ee699d1909e989722e753853ae30b17e08c5",
                "gas": "0x6310c3",
                "gasUsed": "0x1be5",
                "input": "0x50d25bcd",
                "output": "0x000000000000000000000000000000000000000000000000000000186d2ed1c0",
                "to": "0x02f5e9e9dcc66ba6392f6904d5fcf8625d9b19c9",
                "type": "STATICCALL"
              }
            ],

On most of the blocks it works as expected, with txHash in the response

mininny commented 2 months ago

Hi, thanks for posting the issue! :)

I've taken a look at this, and it seems like the transactions you mentioned are all from pre-bedrock. When using traceBlock on pre-bedrock blocks, we fallback to historical rpc, which is essentially legacy geth.

This addition of txHash to the result of debug_traceBlock was added around this time last year and doesn't seem like it was added to legacy geth. So, unfortunately, all responses of debug_traceBlock on pre-bedrock blocks will not have the txHash.

Is the txHash essential to your service's logic? I think it would be best to handle this edge case where txHash doesn't exist with something like 0x0 for now. Are there any instances of this happening on post-bedrock blocks as well by any chance?

mininny commented 4 days ago

@AlbertMakhortov Do you need any more help with this? Would it be okay to close this issue for now? :)