design
design copied to clipboard
EEI: add isAccountEmpty method
This method is required for metering CALL
in runevm/evm2ewasm (#138 and https://github.com/axic/runevm/issues/18 for some context), and can also be used in implementingEXTCODEHASH
(without adding an additional method to EEI).
I believe #112 could alternatively also solve this problem. I'm not sure however what's the consensus on that.
How about accountState
, which returns:
- 0: empty
- 1: external (exists, but has no code)
- 2: contract (exists, but has code)
- 3: evicted (state-rent, this is the state before it is fully pruned?)
@chfast what do you think?
@s1na cannot you emulate this feature by externalBalance() != 0 || extcodeHash() != 0
?
Hm, perhaps we just need to implement #183, because that brings in EXTCODEHASH
which supposed to be able to tell if an account exists: https://eips.ethereum.org/EIPS/eip-1052
- In EVMC it is called
account_exists()
although it works the same as described here. - You will need it to price
CALL
andSELFDESTRUCT
. - In theory you can use that to implement
EXTCODEHASH
by hashing the code in the VM, butEXTCODEHASH
assumes the hash is already known in the state and no hashing is required. - I'm rather for adding simple method as proposed here.
Returning all account information at once was proposed here:
- https://github.com/ewasm/design/issues/112
- https://github.com/ethereum/evmc/issues/124