ethereum-optimism / optimism

Optimism is Ethereum, scaled.
https://optimism.io
MIT License
5.54k stars 3.2k forks source link

callTracer returns TypeError exception for certarin txs #2306

Closed qk-santi closed 1 year ago

qk-santi commented 2 years ago

Describe the bug

Some transactions raise an exception when using debug_traceTransaction with the callTracer tracer.

These transactions all have the same error in the Status at Etherscan: Fail with error 'deployer address not whitelisted: 0xc6dbd69d69F22842832E93aE1Ede9995c583bFC1'

List of transactions detected:

To Reproduce

Send debug_traceTransaction to an archive node:

curl https://your-node \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"debug_traceTransaction","params":["0xc033250c5a45f9d104fc28640071a776d146d48403cf5e95ed0015c712e26cb6", {"tracer": "callTracer"}],"id":1,"jsonrpc":"2.0"}'

{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"TypeError: cannot read property 'toString' of undefined    in server-side tracer function 'result'"}}

Expected behavior Get a response without an exception which is similar to other callTracer responses.

System Specs:

Additional context Add any other context about the problem here.

Inphi commented 2 years ago

yeah, the default call tracer doesn't handle null values correctly. Until this is fixed, for the time being, might I suggest using this tracer. The script does the same thing as the default call_tracer. You can supply a custom tracer to debug_traceTransaction by setting the "tracer" parameter to the script content.

qk-santi commented 2 years ago

@Inphi, thanks for the quick response!

How would be the way to send the code inside params/tracer? I've tried a few ways, but getting always: {"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"failed to parse request"}}

Inphi commented 2 years ago

It's tricky to do this directly on the cmd line as the tracer script has to be escaped. If you don't mind using python, you can use this convenient script that does it for you:

ETH_RPC_URL=https://your-node python3 trace_tx.py <txhash> <path_to_tracer.js>
qk-santi commented 2 years ago

@Inphi Great! It works like a charm :smile: Leaving this gist with a test request and the code escaped in case it is useful for anyone: https://gist.github.com/qk-santi/c73f01788c2bf75d09cc330efe4d730d

MRabenda commented 7 months ago

I would like to reopen that issue as @Inphi solution was really temporary Until this is fixed, for the time being, might I suggest today we are trying to build a professional indexer which is compatible with 10s of EVMs chain and our indexer is stuck at block

{  
    "method": "debug_traceBlockByNumber",                                   
    "params": [
        "0x15679",
        {
            "tracer": "callTracer"
        }
    ],
    "id": 0,
    "jsonrpc": "2.0"
  }

Getting incorrect response

  {
    "jsonrpc": "2.0",
    "id": 0,
    "result": [
        {
            "result": {
                "type": "",
                "from": "",
                "gas": "",
                "gasUsed": "",
                "input": ""
            }
        }
    ]
}

This is how Etherscan see this https://optimistic.etherscan.io/tx/0xcf6e46a1f41e1678fba10590f9d092690c5e8fd2e85a3614715fb21caa74655d - we should have also some error information line deployer address not whitelisted: 0x6C3F14DA26556585706c02af737a44E67Dc6954D