Parity-ethereum: VM trace bug(?). Ether disappeared from address.

Created on 31 Jan 2018  路  16Comments  路  Source: openethereum/parity-ethereum

I run Parity/v1.8.6-beta-2d051e4-20180109/x86_64-linux-gnu/rustc1.22.1, but on Etherscan I got the same result.

eth.getBalance('0xb57b9206d75c1bb02cb64f97fb5176eae731a62d',3852625)
21811236187340800
eth.getBalance('0xb57b9206d75c1bb02cb64f97fb5176eae731a62d',3852626)
0

There is one transaction in the block nr 3852626 who calls this contract.
https://etherscan.io/tx/0x92ddeb8df37c1b43debeecb07aa25a0ed96f13f8405aca9dba08ab204a8d2e29
Here is the trace:

trace.transaction('0x92ddeb8df37c1b43debeecb07aa25a0ed96f13f8405aca9dba08ab204a8d2e29')
[
    {
        "blockHash": "0x81d43388efb220c385d5d7bffb3c38e7ff3fdd8d0ad05ae8acc7607563d7a67a",
        "transactionHash": "0x92ddeb8df37c1b43debeecb07aa25a0ed96f13f8405aca9dba08ab204a8d2e29",
        "blockNumber": 3852626,
        "traceAddress": [],
        "subtraces": 3,
        "action": {
            "callType": "call",
            "from": "0x26588a9301b0428d95e6fc3a5024fce8bec12d51",
            "gas": "0x54468",
            "value": "0x0",
            "to": "0xb57b9206d75c1bb02cb64f97fb5176eae731a62d",
            "input": "0x38bbfa503a959d8def976bd51348262afb4586efddb66df187166d76ad34dcd9dfd273c1000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000af1d8d967a0ddd98df1680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c04c50010498c36fc999f7a37ffffe7e4207142d9f708b96f190cfaed75133dba388ac694c2f6db039f926344c918a1d96142a95c332a5403b21e94953a9c75bc27d4290a33044022003bd07a86cb31b9beabbeefa55f9343fdff77afd840da1a43a714948c32e70d1022004f86513ff6689c5553599ccc60da62e063411e484e250545f844a0ba3d1e57ffd94fa71bc0ba10d39d464d0d8f465efeef0a2764e3887fcc9df41ded20f505c19bf4b536960336aac1eff008d2f3efdda1edf9a55a01e6afb22a932a4dd1dd600000000000000000ab266f9f4620f7774ec3dd4554872e9f9cef6174ebb79e034ae98b26720a1c08731440220190305d80a98c143c59582cb0139781c52fadeda89f50c8c29350f8cdf157c9102203406245712f238b2dfd71ff10ce99cb0072e5f1b5845c663d194937e5627f497041a098edd9f3f8a25940bec7a6a28c23e234000c9e6ca961a2fe739aa8b660cc380b2be58a4050eceb5c1d15f7d849a162e3b542076ba9494beec1857a68e77e830440220719c29fe7e009c3fd7cb68f635de422726801f42788bb4cfbc73ef9b0c66ee5902201cfa3f98b4ad9e2996bc57215488405b46d3e15fd297adce289b923d249d016b"
        },
        "transactionPosition": 78,
        "type": "call",
        "result": {
            "output": "0x",
            "gasUsed": "0x384e4"
        }
    },
    {
        "blockHash": "0x81d43388efb220c385d5d7bffb3c38e7ff3fdd8d0ad05ae8acc7607563d7a67a",
        "transactionHash": "0x92ddeb8df37c1b43debeecb07aa25a0ed96f13f8405aca9dba08ab204a8d2e29",
        "blockNumber": 3852626,
        "traceAddress": [
            0
        ],
        "subtraces": 0,
        "action": {
            "callType": "call",
            "from": "0xb57b9206d75c1bb02cb64f97fb5176eae731a62d",
            "gas": "0x3ce30",
            "value": "0x0",
            "to": "0x1d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed",
            "input": "0x38cc4831"
        },
        "transactionPosition": 78,
        "type": "call",
        "result": {
            "output": "0x0000000000000000000000006f28b146804dba2d6f944c03528a8fdbc673df2c",
            "gasUsed": "0x1a2"
        }
    },
    {
        "blockHash": "0x81d43388efb220c385d5d7bffb3c38e7ff3fdd8d0ad05ae8acc7607563d7a67a",
        "transactionHash": "0x92ddeb8df37c1b43debeecb07aa25a0ed96f13f8405aca9dba08ab204a8d2e29",
        "blockNumber": 3852626,
        "traceAddress": [
            1
        ],
        "subtraces": 0,
        "action": {
            "callType": "call",
            "from": "0xb57b9206d75c1bb02cb64f97fb5176eae731a62d",
            "gas": "0x3b1f7",
            "value": "0x0",
            "to": "0x6f28b146804dba2d6f944c03528a8fdbc673df2c",
            "input": "0xc281d19e"
        },
        "transactionPosition": 78,
        "type": "call",
        "result": {
            "output": "0x00000000000000000000000026588a9301b0428d95e6fc3a5024fce8bec12d51",
            "gasUsed": "0x57b"
        }
    },
    {
        "blockHash": "0x81d43388efb220c385d5d7bffb3c38e7ff3fdd8d0ad05ae8acc7607563d7a67a",
        "transactionHash": "0x92ddeb8df37c1b43debeecb07aa25a0ed96f13f8405aca9dba08ab204a8d2e29",
        "blockNumber": 3852626,
        "traceAddress": [
            2
        ],
        "subtraces": 0,
        "action": {
            "callType": "call",
            "from": "0xb57b9206d75c1bb02cb64f97fb5176eae731a62d",
            "gas": "0x8fc",
            "value": "0x18cbe7bb38000",
            "to": "0xfd97b6d9977cb009cdf95fac9dd4878b53233b94",
            "input": "0x"
        },
        "transactionPosition": 78,
        "type": "call",
        "result": {
            "output": "0x",
            "gasUsed": "0x0"
        }
    }
]

In the trace is only one ether transfer with 436224723746816 WEI (0x18cbe7bb38000).

Where is the other 21375011463593984 WEI from the address?

F2-bug 馃悶 M6-rpcapi 馃摚 P5-sometimesoon 馃尣

All 16 comments

I confirm issue.

Also found probably same problem for address: 0x4509008d923eF571FC1D29fD66D3135Fa02f0B64
1ETH is disappeared after https://etherscan.io/tx/0x51c0baead6c3d9e5cb678fe534ef33e61627a321b4b8ee60a21b47acc432fa84

You can check balances here: https://etherscan.io/balancecheck-tool?a=0x4509008d923ef571fc1d29fd66d3135fa02f0b64
Heights for check: 4011777 and 4011778

I confirm the other also:

.eth.getBalance('0x4509008d923ef571fc1d29fd66d3135fa02f0b64', 4011777)
1500514980237701770
Give command:
.eth.getBalance('0x4509008d923ef571fc1d29fd66d3135fa02f0b64', 4011778)
500514980237701770
.trace.transaction('0x51c0baead6c3d9e5cb678fe534ef33e61627a321b4b8ee60a21b47acc432fa84')
[
    {
        "blockHash": "0xdee576ab08a15b10578ab42bdba247bd8113d4e4b0dabeba377fa27d8d7de261",
        "transactionHash": "0x51c0baead6c3d9e5cb678fe534ef33e61627a321b4b8ee60a21b47acc432fa84",
        "blockNumber": 4011778,
        "traceAddress": [],
        "subtraces": 1,
        "action": {
            "callType": "call",
            "from": "0x711a8720b458700cc3512e9950c18d745b41dac9",
            "gas": "0x2b1a8",
            "value": "0x0",
            "to": "0x4509008d923ef571fc1d29fd66d3135fa02f0b64",
            "input": "0x797af627a0c4f00204c40d4ba9d93bf30d29d02f5f5f962de1696e0a2d0b7bd621485e09"
        },
        "transactionPosition": 60,
        "type": "call",
        "result": {
            "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
            "gasUsed": "0xd7b9"
        }
    },
    {
        "blockHash": "0xdee576ab08a15b10578ab42bdba247bd8113d4e4b0dabeba377fa27d8d7de261",
        "transactionHash": "0x51c0baead6c3d9e5cb678fe534ef33e61627a321b4b8ee60a21b47acc432fa84",
        "blockNumber": 4011778,
        "traceAddress": [
            0
        ],
        "subtraces": 0,
        "action": {
            "callType": "delegatecall",
            "from": "0x711a8720b458700cc3512e9950c18d745b41dac9",
            "gas": "0x2a405",
            "value": "0x0",
            "to": "0x4509008d923ef571fc1d29fd66d3135fa02f0b64",
            "input": "0x797af627a0c4f00204c40d4ba9d93bf30d29d02f5f5f962de1696e0a2d0b7bd621485e09"
        },
        "transactionPosition": 60,
        "type": "call",
        "result": {
            "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
            "gasUsed": "0xd4ba"
        }
    }
]

Another address:

.eth.getBalance('0x0000000000000000000000000000000000000003',3852625)
1
.eth.getBalance('0x0000000000000000000000000000000000000003',3852626)
21375011463593985

Whole block trace:
https://pastebin.com/8YZyKG6b

There is no one trace what transfers to this address anything in the block 3852626.

I have upgraded the client to Parity/v1.9.3-unstable/x86_64-linux-gnu/rustc1.24.0 and re synced but the traces are still missing.

I'm having the same issue, it looks like there is a missing transfer from 0xB57b9206d75c1bb02Cb64F97fB5176eAE731a62d to 0x0000000000000000000000000000000000000003 of 21375011463593984 that is reflected on the current balance but is not in the trace history.

I'm also missing ether in 0x4509008d923eF571FC1D29fD66D3135Fa02f0B64, 0x0000000000000000000000000000000000000001, same value in both cases: 1000000000000000000 (1 eth)

@iFA88 @alvarosevilla95 Did you guys re-import the chain while using 1.9.3? It is required to regenerate the trace database.

Yes. Completely re synced.

Looks like whatever is going on is indeed happening in transactions 0x92ddeb8df37c1b43debeecb07aa25a0ed96f13f8405aca9dba08ab204a8d2e29 and 0x51c0baead6c3d9e5cb678fe534ef33e61627a321b4b8ee60a21b47acc432fa84.

The stateDiff for tx 0x92ddeb8df37c1b43debeecb07aa25a0ed96f13f8405aca9dba08ab204a8d2e29 shows:

      "0xb57b9206d75c1bb02cb64f97fb5176eae731a62d": {
        "balance": {
          "*": {
            "from": "0x4d7d34290f0000",
            "to": "0x0"
          }
        },
      "0x0000000000000000000000000000000000000003": {
        "balance": {
          "*": {
            "from": "0x1",
            "to": "0x4bf075ad5b8001"
          }
        },

Neither of these changes can be explained by the trace, and same thing in 0x51c0baead6c3d9e5cb678fe534ef33e61627a321b4b8ee60a21b47acc432fa84:

      "0x0000000000000000000000000000000000000001": {
        "balance": {
          "*": {
            "from": "0x2cd18ebf480c0a",
            "to": "0xe0d884266ac0c0a"
          }
        },
      "0x4509008d923ef571fc1d29fd66d3135fa02f0b64": {
        "balance": {
          "*": {
            "from": "0x14d2e66ca938728a",
            "to": "0x6f22fb901d4728a"
          }
        },

Here are the full traces and stateDiffs for both txs:
0x92ddeb8df37c1b43debeecb07aa25a0ed96f13f8405aca9dba08ab204a8d2e29: https://pastebin.com/QZWgmdT0
0x51c0baead6c3d9e5cb678fe534ef33e61627a321b4b8ee60a21b47acc432fa84: https://pastebin.com/8ryqv8mB

Updated to 1.9.4 and resynced but no changes.

Some more info on transaction 0x92ddeb8df37c1b43debeecb07aa25a0ed96f13f8405aca9dba08ab204a8d2e29.

According to etherscan the transaction calls the function __callback(bytes32 _queryId, string _result, bytes _proof).

    function __callback(bytes32 _queryId, string _result, bytes _proof) oraclize_randomDS_proofVerify(_queryId, _result, _proof)
    {
        // if we reach this point successfully, it means that the attached authenticity proof has passed!
        if(msg.sender != oraclize_cbAddress()) throw;
         // generate a random number between potSize(number of tickets sold) and 1
        random_number = uint(sha3(_result))%potSize + 1;
          // find that winner based on the random number generated
        winnerAddress = findWinner(random_number);
        // winner wins 98% of the remaining balance after oraclize fees
        amountWon = this.balance * 98 / 100 ;
        // announce winner
        winnerAnnounced(winnerAddress, amountWon);
        if(winnerAddress.send(amountWon)) {
            if(owner.send(this.balance)) {
                openPot();
            }
        }
    }

    function findWinner(uint random) constant returns (address winner) {
        for(uint i = 0; i < slots.length; i++) {
           if(random <= slots[i]) {
               return addresses[i];
           }
        }    
    }

    function openPot() internal {
        potSize = 0;
        endTime = now + potTime;
        timeLeft(endTime - now);
        delete slots;
        delete addresses;
        locked = false;
    }

    event winnerAnnounced(
        address winner,
        uint amount
    );
    event timeLeft(uint left);

And the following events were emitted:

winnerAnnnounced
- address: 0000000000000000000000000000000000000000000000000000000000000003
- amount: 000000000000000000000000000000000000000000000000004bf075ad5b8000

timeLeft:
- left: 000000000000000000000000000000000000000000000000000000000000012c

It looks like 0x0000000000000000000000000000000000000003 was drawn as the winner and the amount was succesfully sent as both events were emitted, which matches with the balance changes in the two accounts.

On Parity/v1.9.5-stable-ff821daf1-20180321/x86_64-linux-gnu/rustc1.24.1 with full re-sync the problem is still available.

It seems this issue is still reproduced for this address https://etherscan.io/address/0x4509008d923ef571fc1d29fd66d3135fa02f0b64. You can see it's marked with the tag "Bugs" and points to this issue. The other 4 addresses where this bug is reproduced are in the Limitations section in this article https://medium.com/google-cloud/how-to-query-balances-for-all-ethereum-addresses-in-bigquery-fb594e4034a7. Parity version 2.0.8.

In which block do you have found a balance difference for 0x4509008d923eF571FC1D29fD66D3135Fa02f0B64 address?

@iFA88 I assume it's block 4011777, as I see the difference of 1 Ether. As you detailed in your comment above:

.eth.getBalance('0x4509008d923ef571fc1d29fd66d3135fa02f0b64', 4011777)
1500514980237701770
Give command:
.eth.getBalance('0x4509008d923ef571fc1d29fd66d3135fa02f0b64', 4011778)
500514980237701770

Seems there is a missing trace moving 1 Ether to a precompiled contract at 0x0000000000000000000000000000000000000001 in this transaction 0x51c0baead6c3d9e5cb678fe534ef33e61627a321b4b8ee60a21b47acc432fa84.

Is the issue still reproduced for you?

I have upgraded my parity and resynced. The trace looks now:

.trace_transaction("0x51c0baead6c3d9e5cb678fe534ef33e61627a321b4b8ee60a21b47acc432fa84")
[
    {
        "blockHash": "0xdee576ab08a15b10578ab42bdba247bd8113d4e4b0dabeba377fa27d8d7de261", 
        "transactionHash": "0x51c0baead6c3d9e5cb678fe534ef33e61627a321b4b8ee60a21b47acc432fa84", 
        "blockNumber": 4011778, 
        "traceAddress": [], 
        "subtraces": 1, 
        "action": {
            "callType": "call", 
            "from": "0x711a8720b458700cc3512e9950c18d745b41dac9", 
            "gas": "0x2b1a8", 
            "value": "0x0", 
            "to": "0x4509008d923ef571fc1d29fd66d3135fa02f0b64", 
            "input": "0x797af627a0c4f00204c40d4ba9d93bf30d29d02f5f5f962de1696e0a2d0b7bd621485e09"
        }, 
        "transactionPosition": 60, 
        "type": "call", 
        "result": {
            "output": "0x0000000000000000000000000000000000000000000000000000000000000001", 
            "gasUsed": "0xd7b9"
        }
    }, 
    {
        "blockHash": "0xdee576ab08a15b10578ab42bdba247bd8113d4e4b0dabeba377fa27d8d7de261", 
        "transactionHash": "0x51c0baead6c3d9e5cb678fe534ef33e61627a321b4b8ee60a21b47acc432fa84", 
        "blockNumber": 4011778, 
        "traceAddress": [
            0
        ], 
        "subtraces": 1, 
        "action": {
            "callType": "delegatecall", 
            "from": "0x4509008d923ef571fc1d29fd66d3135fa02f0b64", 
            "gas": "0x2a405", 
            "value": "0x0", 
            "to": "0x6ab9dd83108698b9ca8d03af3c7eb91c0e54c3fc", 
            "input": "0x797af627a0c4f00204c40d4ba9d93bf30d29d02f5f5f962de1696e0a2d0b7bd621485e09"
        }, 
        "transactionPosition": 60, 
        "type": "call", 
        "result": {
            "output": "0x0000000000000000000000000000000000000000000000000000000000000001", 
            "gasUsed": "0xd4ba"
        }
    }, 
    {
        "blockHash": "0xdee576ab08a15b10578ab42bdba247bd8113d4e4b0dabeba377fa27d8d7de261", 
        "transactionHash": "0x51c0baead6c3d9e5cb678fe534ef33e61627a321b4b8ee60a21b47acc432fa84", 
        "blockNumber": 4011778, 
        "traceAddress": [
            0, 
            0
        ], 
        "subtraces": 0, 
        "action": {
            "callType": "call", 
            "from": "0x4509008d923ef571fc1d29fd66d3135fa02f0b64", 
            "gas": "0x1c6a7", 
            "value": "0xde0b6b3a7640000", 
            "to": "0x0000000000000000000000000000000000000001", 
            "input": "0x"
        }, 
        "transactionPosition": 60, 
        "type": "call", 
        "result": {
            "output": "0x", 
            "gasUsed": "0xbb8"
        }
    }
]

For this TX the issue has been solved.

I use now this:
Parity-Ethereum/v2.0.9-stable-09f7757-20181028/x86_64-linux-gnu/rustc1.30.0

That's great! I'll try to resync my node with 2.0.9 and will report back.

Was this page helpful?
0 / 5 - 0 ratings