You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently in the DefaultStateManager once getContractStorage gets called on a non-existing account, the function throws getContractStorage() called on non-existing account. This is inconsistent with the other state managers (RPC does not throw, and Verkle also does not seem to throw). Also, getAccount does return undefined if it does not exist (and an empty account if the account exists).
There are only some calls to getContractStorage, the first is in DefaultStateManager which gets proof items. This has commented out that it should throw for non-existing accounts:
. Since it is currently not possible to load storage (SLOAD) from other accounts, the account is thus guaranteed to exist. The BLOCKHASH opcode calls into the EIP 2935 history address and would thus throw if this address does not exist, but this is an edge case and no chain which uses this EIP would run into this.
getStorageAt RPC call in client also guards against non-existing accounts by returning the empty storage slot.
In order to make this more consistent, let getContractStorage return empty storage in case the account does not exist. This aligns with reality and also ensures that the caller of this method does not have to do either wrap the call into a try-catch block or checking pre-calling if the account exists.
The text was updated successfully, but these errors were encountered:
Currently in the
DefaultStateManager
oncegetContractStorage
gets called on a non-existing account, the function throwsgetContractStorage() called on non-existing account
. This is inconsistent with the other state managers (RPC does not throw, and Verkle also does not seem to throw). Also,getAccount
does returnundefined
if it does not exist (and an empty account if the account exists).There are only some calls to
getContractStorage
, the first is inDefaultStateManager
which gets proof items. This has commented out that it should throw for non-existing accounts:ethereumjs-monorepo/packages/statemanager/src/stateManager.ts
Lines 721 to 726 in 9dbb55c
ethereumjs-monorepo/packages/evm/src/interpreter.ts
Lines 599 to 605 in 9dbb55c
SLOAD
) from other accounts, the account is thus guaranteed to exist. TheBLOCKHASH
opcode calls into the EIP 2935 history address and would thus throw if this address does not exist, but this is an edge case and no chain which uses this EIP would run into this.getStorageAt
RPC call in client also guards against non-existing accounts by returning the empty storage slot.In order to make this more consistent, let
getContractStorage
return empty storage in case the account does not exist. This aligns with reality and also ensures that the caller of this method does not have to do either wrap the call into a try-catch block or checking pre-calling if the account exists.The text was updated successfully, but these errors were encountered: