0

I'm having hard time trying to understand how errors in traces apply. Let's consider this tx:

Etherscan detailed traces

see that only call_0 has status "Reverted" (hover over red exclamation mark to see the error), and then all the rest have "Out of gas". However, when we trace this tx with either Erigon or OpenEthereum , we get (I deleted long input and output fields as they are not relevant):

    [
    {
        "action": {
            "from": "0xf3c0b1ebfd01bc7e56825e6ecbd1379039944129",
            "callType": "call",
            "gas": "0x2aff8",
            "to": "0x958e1e0be167e89eb05eb81e5ac57d260eb9ba03",
            "value": "0x0"
        },
        "blockHash": "0xd0824a89cbab67dfc489c1950f2aebd501aadf4ca48f3a4ebdea0f29ad701a8d",
        "blockNumber": 7497726,
        "result": {
            "gasUsed": "0x2a749",
            "output": "0x"
        },
        "subtraces": 1,
        "traceAddress": [],
        "transactionHash": "0x6d4007f5bf5c71bad9e2331414843c078f9deaf9debb0427855a34b613d11b93",
        "transactionPosition": 65,
        "type": "call"
    },
    {
        "action": {
            "from": "0x958e1e0be167e89eb05eb81e5ac57d260eb9ba03",
            "callType": "call",
            "gas": "0x200db",
            "to": "0x7be8076f4ea4a4ad08075c2508e481d6c946d12b",
            "value": "0x38d7ea4c68000"
        },
        "blockHash": "0xd0824a89cbab67dfc489c1950f2aebd501aadf4ca48f3a4ebdea0f29ad701a8d",
        "blockNumber": 7497726,
        "error": "Reverted",
        "result": null,
        "subtraces": 6,
        "traceAddress": [
            0
        ],
        "transactionHash": "0x6d4007f5bf5c71bad9e2331414843c078f9deaf9debb0427855a34b613d11b93",
        "transactionPosition": 65,
        "type": "call"
    },
    {
        "action": {
            "from": "0x7be8076f4ea4a4ad08075c2508e481d6c946d12b",
            "callType": "call",
            "gas": "0x17729",
            "to": "0xa5409ec958c83c3f309868babaca7c86dcb077c1",
            "value": "0x0"
        },
        "blockHash": "0xd0824a89cbab67dfc489c1950f2aebd501aadf4ca48f3a4ebdea0f29ad701a8d",
        "blockNumber": 7497726,
        "result": {
            "gasUsed": "0x372",
        },
        "subtraces": 0,
        "traceAddress": [
            0,
            0
        ],
        "transactionHash": "0x6d4007f5bf5c71bad9e2331414843c078f9deaf9debb0427855a34b613d11b93",
        "transactionPosition": 65,
        "type": "call"
    },
    {
        "action": {
            "from": "0x7be8076f4ea4a4ad08075c2508e481d6c946d12b",
            "callType": "call",
            "gas": "0x16ba4",
            "input": "0x97204d8e",
            "to": "0xa5409ec958c83c3f309868babaca7c86dcb077c1",
            "value": "0x0"
        },
        "blockHash": "0xd0824a89cbab67dfc489c1950f2aebd501aadf4ca48f3a4ebdea0f29ad701a8d",
        "blockNumber": 7497726,
        "result": {
            "gasUsed": "0x2c9",
        },
        "subtraces": 0,
        "traceAddress": [
            0,
            1
        ],
        "transactionHash": "0x6d4007f5bf5c71bad9e2331414843c078f9deaf9debb0427855a34b613d11b93",
        "transactionPosition": 65,
        "type": "call"
    },
    {
        "action": {
            "from": "0x7be8076f4ea4a4ad08075c2508e481d6c946d12b",
            "callType": "call",
            "gas": "0x16279",
            "input": "0x5c60da1b",
            "to": "0xb45c99cf1af90630b81ded8fbccbf20f96cc4995",
            "value": "0x0"
        },
        "blockHash": "0xd0824a89cbab67dfc489c1950f2aebd501aadf4ca48f3a4ebdea0f29ad701a8d",
        "blockNumber": 7497726,
        "result": {
            "gasUsed": "0x271",
        },
        "subtraces": 0,
        "traceAddress": [
            0,
            2
        ],
        "transactionHash": "0x6d4007f5bf5c71bad9e2331414843c078f9deaf9debb0427855a34b613d11b93",
        "transactionPosition": 65,
        "type": "call"
    },
    {
        "action": {
            "from": "0x7be8076f4ea4a4ad08075c2508e481d6c946d12b",
            "callType": "call",
            "gas": "0x8fc",
            "input": "0x",
            "to": "0x5b3256965e7c3cf26e11fcaf296dfc8807c01073",
            "value": "0x28ed6103d000"
        },
        "blockHash": "0xd0824a89cbab67dfc489c1950f2aebd501aadf4ca48f3a4ebdea0f29ad701a8d",
        "blockNumber": 7497726,
        "result": {
            "gasUsed": "0x0",
            "output": "0x"
        },
        "subtraces": 0,
        "traceAddress": [
            0,
            3
        ],
        "transactionHash": "0x6d4007f5bf5c71bad9e2331414843c078f9deaf9debb0427855a34b613d11b93",
        "transactionPosition": 65,
        "type": "call"
    },
    {
        "action": {
            "from": "0x7be8076f4ea4a4ad08075c2508e481d6c946d12b",
            "callType": "call",
            "gas": "0x8fc",
            "input": "0x",
            "to": "0x425f013fb466b2df721f23ac0ba21049d1c6abd7",
            "value": "0x3649143c2b000"
        },
        "blockHash": "0xd0824a89cbab67dfc489c1950f2aebd501aadf4ca48f3a4ebdea0f29ad701a8d",
        "blockNumber": 7497726,
        "result": {
            "gasUsed": "0x0",
            "output": "0x"
        },
        "subtraces": 0,
        "traceAddress": [
            0,
            4
        ],
        "transactionHash": "0x6d4007f5bf5c71bad9e2331414843c078f9deaf9debb0427855a34b613d11b93",
        "transactionPosition": 65,
        "type": "call"
    },
    {
        "action": {
            "from": "0x7be8076f4ea4a4ad08075c2508e481d6c946d12b",
            "callType": "call",
            "gas": "0xc434",
            "to": "0xb45c99cf1af90630b81ded8fbccbf20f96cc4995",
            "value": "0x0"
        },
        "blockHash": "0xd0824a89cbab67dfc489c1950f2aebd501aadf4ca48f3a4ebdea0f29ad701a8d",
        "blockNumber": 7497726,
        "result": {
            "gasUsed": "0xbf24",
        },
        "subtraces": 1,
        "traceAddress": [
            0,
            5
        ],
        "transactionHash": "0x6d4007f5bf5c71bad9e2331414843c078f9deaf9debb0427855a34b613d11b93",
        "transactionPosition": 65,
        "type": "call"
    },
    {
        "action": {
            "from": "0xb45c99cf1af90630b81ded8fbccbf20f96cc4995",
            "callType": "delegatecall",
            "gas": "0xbbb3",
            "to": "0xf9e266af4bca5890e2781812cc6a6e89495a79f2",
            "value": "0x0"
        },
        "blockHash": "0xd0824a89cbab67dfc489c1950f2aebd501aadf4ca48f3a4ebdea0f29ad701a8d",
        "blockNumber": 7497726,
        "result": {
            "gasUsed": "0xb970",
        },
        "subtraces": 2,
        "traceAddress": [
            0,
            5,
            0
        ],
        "transactionHash": "0x6d4007f5bf5c71bad9e2331414843c078f9deaf9debb0427855a34b613d11b93",
        "transactionPosition": 65,
        "type": "call"
    },
    {
        "action": {
            "from": "0xb45c99cf1af90630b81ded8fbccbf20f96cc4995",
            "callType": "call",
            "gas": "0xadb2",
            "to": "0xa5409ec958c83c3f309868babaca7c86dcb077c1",
            "value": "0x0"
        },
        "blockHash": "0xd0824a89cbab67dfc489c1950f2aebd501aadf4ca48f3a4ebdea0f29ad701a8d",
        "blockNumber": 7497726,
        "result": {
            "gasUsed": "0x28d",
        },
        "subtraces": 0,
        "traceAddress": [
            0,
            5,
            0,
            0
        ],
        "transactionHash": "0x6d4007f5bf5c71bad9e2331414843c078f9deaf9debb0427855a34b613d11b93",
        "transactionPosition": 65,
        "type": "call"
    },
    {
        "action": {
            "from": "0xb45c99cf1af90630b81ded8fbccbf20f96cc4995",
            "callType": "call",
            "gas": "0xa587",
            "to": "0x909899c5dbb5002610dd8543b6f638be56e3b17e",
            "value": "0x0"
        },
        "blockHash": "0xd0824a89cbab67dfc489c1950f2aebd501aadf4ca48f3a4ebdea0f29ad701a8d",
        "blockNumber": 7497726,
        "error": "Out of gas",
        "result": null,
        "subtraces": 0,
        "traceAddress": [
            0,
            5,
            0,
            1
        ],
        "transactionHash": "0x6d4007f5bf5c71bad9e2331414843c078f9deaf9debb0427855a34b613d11b93",
        "transactionPosition": 65,
        "type": "call"
    }
]

Notice that error is only present in traceAddress 0, where it says "Reverted", and 0.5.0.1, where it says "Out of gas".

My question is: how does etherscan know that Out of gas should be propagated up to fill missing errors for all traces except 0 where it is explicitly specified? In general, how do errors propagate among call traces?

1 Answer 1

2

On the Etherscan interface everything is marked as red, as everything was reverted.

Etherscan knows that it needs to mark all as errored as the tracing action where the traceAddress is [0] errored. Therefore all sub traces are also reverted (so every trace where the first entry in the traceAddress is 0).

On EVM level reverts are not automatically propagated up. Solidity adds a check to contracts calls (unless you use the low level call, staticcall or delegatecall) to check if it was successful, otherwise it will bubble up the revert.

For out of gas a propagation might also happen because there is not enough gas left for continuing the execution after the sub call reverted.

You can also see the raw trace that Etherscan use here: https://etherscan.io/vmtrace?txhash=0x6d4007f5bf5c71bad9e2331414843c078f9deaf9debb0427855a34b613d11b93&type=parity

Edit: Click Parity Trace in the options menu to see the traces on Etherscan

enter image description here

4
  • 1
    Thank you! What is the rule of propagating the error then? Let's say I don't need precise error, I just need to know if particular trace succeeded or failed. Does it depend on the error itself? For example, if trace a.b fails, can I assume that all the traces starting with a.b (like a.b.c, a.b.c.d) will fail, and everything not starting with a.b (like e, e.f) succeeds if it does not have its own error?
    – DimaA6_ABC
    Jan 25, 2022 at 13:30
  • Everything that does not have it's own error will still succeed (if the parent succeeded). So in your example it works as you describe.The error message would be in the return data, so if you don't need it just ignore it.
    – Richard
    Jan 25, 2022 at 13:47
  • I added to the original answer how to get to the vmtrace screen
    – Richard
    Jan 25, 2022 at 13:48
  • OK, so the rule is - if trace element does not have explicit error nor does its parent (either direct or indirect), then it succeeds, otherwise it fails. Right? Thanks!
    – DimaA6_ABC
    Jan 25, 2022 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.