@ethereumjs/statemanager / RPCStateManager
Defined in: rpcStateManager.ts:37
State manager backed by an Ethereum JSON-RPC provider.
Reads account and storage data via eth_getProof / related RPC methods at a
fixed block tag. Suitable for simulations against live or archive nodes.
new RPCStateManager(
opts):RPCStateManager
Defined in: rpcStateManager.ts:47
RPCStateManager
readonlycommon:Common
Defined in: rpcStateManager.ts:45
originalStorageCache:
OriginalStorageCache
Defined in: rpcStateManager.ts:41
StateManagerInterface.originalStorageCache
checkpoint():
Promise<void>
Defined in: rpcStateManager.ts:315
Checkpoints the current state of this @ethereumjs/common!StateManagerInterface instance.
State changes that follow can then be committed by calling
commit or reverted by calling rollback.
Promise<void>
StateManagerInterface.checkpoint
clearCaches():
void
Defined in: rpcStateManager.ts:97
Clears the internal cache so all accounts, contract code, and storage slots will initially be retrieved from the provider
void
StateManagerInterface.clearCaches
clearStorage(
address):Promise<void>
Defined in: rpcStateManager.ts:181
Clears all storage entries for the account corresponding to address.
Address to clear the storage of
Promise<void>
StateManagerInterface.clearStorage
commit():
Promise<void>
Defined in: rpcStateManager.ts:325
Commits the current change-set to the instance since the last call to checkpoint.
Partial implementation, called from the subclass.
Promise<void>
StateManagerInterface.commit
consumeBAL(
bal,expectedStateRoot?):Promise<void>
Defined in: rpcStateManager.ts:356
Apply an EIP-7928 BAL onto this state. See consumeBAL.
BALJSONBlockAccessList
Uint8Array<ArrayBufferLike>
Promise<void>
Experimental (Amsterdam): may change on patch releases.
StateManagerInterface.consumeBAL
deleteAccount(
address):Promise<void>
Defined in: rpcStateManager.ts:293
Deletes an account from state under the provided address.
Address of the account which should be deleted
Promise<void>
StateManagerInterface.deleteAccount
dumpStorage(
address):Promise<StorageDump>
Defined in: rpcStateManager.ts:190
Dumps the RLP-encoded storage values for an account specified by address.
Account whose storage should be dumped
Promise<StorageDump>
Hex-keyed map of storage slots (values as 0x-prefixed strings)
StateManagerInterface.dumpStorage
flush():
Promise<void>
Defined in: rpcStateManager.ts:340
Promise<void>
getAccount(
address):Promise<Account|undefined>
Defined in: rpcStateManager.ts:205
Gets the account associated with address or undefined if account does not exist
Address of the account to get
Promise<Account | undefined>
StateManagerInterface.getAccount
getAppliedKey(
address):Uint8Array
Defined in: rpcStateManager.ts:306
Returns the applied key for a given address Used for saving preimages
Uint8Array
Address bytes (typically 20-byte account address)
Uint8Array
Key after trie key hashing (e.g. keccak of the address)
StateManagerInterface.getAppliedKey
getCode(
address):Promise<Uint8Array<ArrayBufferLike>>
Defined in: rpcStateManager.ts:107
Gets the code corresponding to the provided address.
Address to get the code for
Promise<Uint8Array<ArrayBufferLike>>
Contract bytecode, or an empty array when no code is stored
StateManagerInterface.getCode
getCodeSize(
address):Promise<number>
Defined in: rpcStateManager.ts:119
Promise<number>
StateManagerInterface.getCodeSize
getStateRoot():
Promise<Uint8Array<ArrayBuffer>>
Defined in: rpcStateManager.ts:347
Promise<Uint8Array<ArrayBuffer>>
This method is not used by the RPC State Manager and is a stub required by the State Manager interface
StateManagerInterface.getStateRoot
getStorage(
address,key):Promise<Uint8Array<ArrayBufferLike>>
Defined in: rpcStateManager.ts:142
Gets the storage value associated with the provided address and key. This method returns
the shortest representation of the stored value.
Address of the account to get the storage for
Uint8Array
Storage slot (32 bytes)
Promise<Uint8Array<ArrayBufferLike>>
RLP-decoded storage value, or empty bytes when unset
StateManagerInterface.getStorage
hasStateRoot():
never
Defined in: rpcStateManager.ts:368
never
This method is not used by the RPC State Manager and is a stub required by the State Manager interface
StateManagerInterface.hasStateRoot
modifyAccountFields(
address,accountFields):Promise<void>
Defined in: rpcStateManager.ts:272
Gets the account associated with address, modifies the given account
fields, then saves the account into state. Account fields can include
nonce, balance, storageRoot, and codeHash.
Address of the account to modify
AccountFields
Object containing account fields and values to modify
Promise<void>
StateManagerInterface.modifyAccountFields
putAccount(
address,account):Promise<void>
Defined in: rpcStateManager.ts:248
Saves an account into state under the provided address.
Address under which to store account
Account | undefined
The account to store
Promise<void>
StateManagerInterface.putAccount
putCode(
address,value):Promise<void>
Defined in: rpcStateManager.ts:130
Adds value to the state trie as code, and sets codeHash on the account
corresponding to address to reference this.
Address of the account to add the code for
Uint8Array
The value of the code
Promise<void>
StateManagerInterface.putCode
putStorage(
address,key,value):Promise<void>
Defined in: rpcStateManager.ts:173
Adds value to the cache for the account
corresponding to address at the provided key.
Address to set a storage value for
Uint8Array
Key to set the value at. Must be 32 bytes long.
Uint8Array
Value to set at key for account corresponding to address.
Cannot be more than 32 bytes. Leading zeros are stripped.
If it is empty or filled with zeros, deletes the value.
Promise<void>
StateManagerInterface.putStorage
revert():
Promise<void>
Defined in: rpcStateManager.ts:336
Reverts the current change-set to the instance since the last call to checkpoint.
Partial implementation , called from the subclass.
Promise<void>
StateManagerInterface.revert
setBlockTag(
blockTag):void
Defined in: rpcStateManager.ts:87
Sets the new block tag used when querying the provider and clears the internal cache.
bigint | "earliest"
the new block tag to use when querying the provider
void
setStateRoot(
_root):Promise<void>
Defined in: rpcStateManager.ts:363
Uint8Array
Promise<void>
This method is not used by the RPC State Manager and is a stub required by the State Manager interface
StateManagerInterface.setStateRoot
shallowCopy():
RPCStateManager
Defined in: rpcStateManager.ts:72
Note that the returned statemanager will share the same JSONRPCProvider as the original
RPCStateManager
RPCStateManager
StateManagerInterface.shallowCopy