I'm having hard time trying to understand how errors in traces apply. Let's consider this tx:
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?