Missing `account_exists` implementation prevents execution of sharding transactions
See original GitHub issueWhat is wrong?
Executing sharding transactions currently does not work with the FlatTrieBackend as it doesn’t implement account_exists.
Note that it is not related to account creation transactions per se (as I assumed earlier), normal transactions are affected in the same way.
How can it be fixed
Either implement account_exists or don’t use it. It is called in some SELFDESTUCT (e.g. https://github.com/ethereum/py-evm/blob/362266c323c83a851f7dff0a2a59796abaa3f318/evm/logic/system.py#L64) and some CALL (e.g. https://github.com/ethereum/py-evm/blob/362266c323c83a851f7dff0a2a59796abaa3f318/evm/logic/call.py#L287) opcodes. It changes from fork to fork though and I’m not sure if this is still needed, especially as at least one one motivation seems to have been the dust clean up in Spurious Dragon. Also, it seems to be used for gas calculation only which will be different with stateless clients anyway.
It is also called indirectly via touch_account for every message, but this can unproblematically be replaced by setting nonce/balance/code to zero unless they are non-zero.
Implementing account_exists is probably the easier solution (with check_if_branch_exist in py-trie), but I don’t like this as much. But that’s mainly due to me not seeing why such a function would be necessary.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (7 by maintainers)

Top Related StackOverflow Question
I don’t think the account methods need to be removed, rather changed slightly:
account_is_emptyshould not check the nonceaccount_existsshould be kept as is (raising aNotImplementedError)touch_accountshould not rely onaccount_exists, but have the same effect (just set nonce/balance/code to zero unless they are set already)I was under the impression that contract nonces would be removed altogether. ~In its current implementation CREATE2 uses the contract nonce though~, so I’m not sure about this. But I don’t think it matters a lot, the only thing that would be affected is the definition of an “empty account” (
code/balance/nonce = 0tocode/balance = 0).