-
Notifications
You must be signed in to change notification settings - Fork 146
Consensus failure (full-sync, all chains) on contract create/destruct within same block #1478
Comments
In [2]: web3.Web3.toHex(b"X.\x0e,\xc2xA\xed\xb4Y\x15w\x93\xa3\xc1\xe1./\x15\xbf\x11'\x12\xd6\xa8\x85q\xdf\xb2\xd9\x1a0")
Out[2]: '0x582e0e2cc27841edb459157793a3c1e12e2f15bf112712d6a88571dfb2d91a30'
In [3]: web3.Web3.toHex(b'\x05\xb3<\xb4\xb3sr\xb6d\xc0\xa3\xdb|\x1a\xef\xf40Hh\xa9yg7"\xc8Ao\x99\x18UX\x08')
Out[3]: '0x05b33cb4b37372b664c0a3db7c1aeff4304868a979673722c8416f9918555808' Confirming that the |
Neither Etherscan nor Trinity's trace show the contract's code after transaction 0 of the block;
Raw disassembly in this gist. The contract has only 2 4-byte function checks:
According to Etherscan, the 10 transactions in the block do the following:
Without going into too much detail: it seems at a glance that gas usages between |
First ear-mark ("maybe later") is that in the trace (towards the very end), there are three occurrences of
This comes from This might be simply logging noise, but from the link one can see that the following is also hit on each invocation: self._journal_storage.clear()
self._storage_cache.reset_cache() OT: I'm also unsure of the utility of logging Then there's
I'm having a bad memory day; is that what an |
Just checked - am getting a similar error on mainnet block Rolling back versions, That's a long time we haven't tried full-sync, apparently... Or there's something seriously wrong with my machine. |
alpha.25 is unlikely to be the one that has the problem (it's a pretty minor patch). The offending bug is much more likely to be in alpha.24, since the set of changes is huge. |
Here's the diff, release notes. |
Cross-project bisect result, with
The first three are from ethereum/py-evm#1735 (commits), the last one is the branch-to-master merge commit itself. |
This makes sense, since the receipts included the state root back then. It should even help track down which of the 83 transactions is the broken one.
Next up (probably tomorrow) is to generate the proper receipts, to tell which txn is busted. If anyone already did this and knows which txn is broken, let me know! :) |
Ah, forgot to post this last night. I found which transaction it is:
So next step is to diff the VM steps in the good and bad VMs. Interesting that the gas used is the same! |
I'm not amazed it's that transaction: it's a call with I'll try to hack up a way to trace that tx... Do post if you know a trick. Note that the destroyed contract was created in the same block, just one transaction earlier. There are two If I understand correctly, this particular tx did not cause a state root mismatch; if true, then the issue we have is with contracts being created and destroyed within the same block. |
Transaction traces for txs at index 71 and 72: in this gist. As above, this is for trinity
I've edited the timestamps so the files can be diffed. The diff is also in the gist. The VM steps themselves are identical. So, as mentioned previously, this probably has something to do with
lines are printed twice. Hmm, is the diff saying that we're deleting the EDIT: Yup! I've checked with that earlier tx at index 66, and its storage is deleted, and left that way! TL;DR: seems that if a contract is created and deleted within the same block, then we're erroneously re-creating its storage as "empty". Maybe this has something to do with "dirty accounts" and "dirty account stores"... This is a |
Confirming that the issue is no longer present when using Main-net blocks So has Goerli block |
python --version
): CPython 3.7pip freeze
): gist.What is wrong?
Running:
... and adding node as peer from remote
geth
node.Results in state root mismatch at block
#226323
- see run log:Note: Goerli starts from
PetersburgVM
, that's the VM at given block.Extra:
How can it be fixed
This turned out to be a long-time regression in
py-evm
; see #1478 (comment) and ensuing.🔭
The text was updated successfully, but these errors were encountered: