Skip to content

Geth trace parser providing invalid traces #21438

@juliankoh

Description

@juliankoh

Hi! I'm getting invalid traces when using the call_tracer geth tracing paser. Specifically, it is outputting a trace that should change balance, even though there is no actual balance change on-chain.

System information

Geth version: geth version v1.9.18
OS & Version: OSX
Commit hash : -

Expected behaviour

Using the aforementioned tracer on this transaction, I get the following output:

{
  "type": "CALL",
  "from": "0x66fdfd05e46126a07465ad24e40cc0597bc1ef31",
  "to": "0x6c06b16512b332e6cd8293a2974872674716ce18",
  "value": "0x0",
  "gas": "0x1a466",
  "gasUsed": "0x1dc6",
  "input": "0x2e1a7d4d00000000000000000000000000000000000000000000000014d1120d7b160000",
  "output": "0x",
  "time": "1.278236ms",
  "calls": [
    {
      "type": "CALL",
      "from": "0x6c06b16512b332e6cd8293a2974872674716ce18",
      "to": "0x66fdfd05e46126a07465ad24e40cc0597bc1ef31",
      "value": "0x14d1120d7b160000",
      "input": "0x"
    }
  ]
}

This implies that there should be a transfer of value 0x14d1120d7b160000, but Etherscan shows that this balance change does not happen.

Furthermore, tracing that same transaction using Parity's node shows that the subcall does not actually happen. Here are Parity's traces:

{
  "jsonrpc": "2.0",
  "result": [
    {
      "action": {
        "callType": "call",
        "from": "0x66fdfd05e46126a07465ad24e40cc0597bc1ef31",
        "gas": "0x1a466",
        "input": "0x2e1a7d4d00000000000000000000000000000000000000000000000014d1120d7b160000",
        "to": "0x6c06b16512b332e6cd8293a2974872674716ce18",
        "value": "0x0"
      },
      "blockHash": "0xc91e2c6efc40c303a969cace595c31a5ea810986dbbc134c6825fa8b6b226113",
      "blockNumber": 24974,
      "result": {
        "gasUsed": "0x1dc6",
        "output": "0x"
      },
      "subtraces": 0,
      "traceAddress": [],
      "transactionHash": "0x73ccf1fbebdaa2bc4d33e769373fd9cf65365666245736a11bc773b32ab9f92a",
      "transactionPosition": 1,
      "type": "call"
    }
  ],
  "id": 1
}

Initially, I thought that I could consider this call invalid because it did not have gasUsed populated. However, I found an example of another transaction where the traces look identical to the one I posted above, but actually does apply a balance change as you can see on Etherscan.

Here are the traces for that transaction:

{
  "type": "CALL",
  "from": "0xb5f5999a52904d4f3482fa31baa52f7be1984906",
  "to": "0x536e7faca074d21f0830c936e141a7271d09b0c9",
  "value": "0x0",
  "gas": "0x2b168",
  "gasUsed": "0x88f9",
  "input": "0xb5c5f6720000000000000000000000008f480474b014ea63d4fe5e52478e833fb9e8f93800000000000000000000000000000000000000000000000006f05b59d3b200000000000000000000000000000000000000000000000000000000000000030d40",
  "output": "0x",
  "time": "2.063668ms",
  "calls": [
    {
      "type": "CALL",
      "from": "0x536e7faca074d21f0830c936e141a7271d09b0c9",
      "to": "0x8f480474b014ea63d4fe5e52478e833fb9e8f938",
      "value": "0x6f05b59d3b20000",
      "input": "0x"
    }
  ]
}

Actual behaviour

Showing trace in a transaction although it never happened on-chain.

Steps to reproduce the behaviour

To reproduce, use this call_tracer in the debug_traceTransaction endpoint, with this transaction on Ropsten

Backtrace

[backtrace]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions