@ethereumjs/statemanager / StatelessVerkleStateManager
Stateless Verkle StateManager implementation for the VM.
Experimental.
This State Manager enables stateless block execution by building a temporary (1-block) state from the verkle block witness. The Stateless Verkle State Manager then uses that populated state to fetch data requested by the the VM.
EVMStateManagerInterface
- checkChunkWitnessPresent
- checkpoint
- chunkifyCode
- clearCaches
- clearContractStorage
- commit
- deleteAccount
- dumpStorage
- dumpStorageRange
- flush
- generateCanonicalGenesis
- getAccount
- getAppliedKey
- getComputedValue
- getContractCode
- getContractStorage
- getProof
- getStateRoot
- getTransitionStateRoot
- getTreeKeyForBalance
- getTreeKeyForCodeChunk
- getTreeKeyForCodeHash
- getTreeKeyForCodeSize
- getTreeKeyForNonce
- getTreeKeyForStorageSlot
- getTreeKeyForVersion
- hasStateRoot
- initVerkleExecutionWitness
- modifyAccountFields
- putAccount
- putContractCode
- putContractStorage
- revert
- setStateRoot
- shallowCopy
- verifyPostState
- verifyProof
• new StatelessVerkleStateManager(opts?
)
Instantiate the StateManager interface.
Name | Type |
---|---|
opts |
StatelessVerkleStateManagerOpts |
statelessVerkleStateManager.ts:178
• Optional
_accountCache: AccountCache
statelessVerkleStateManager.ts:138
• Optional
_codeCache: CodeCache
statelessVerkleStateManager.ts:140
• Optional
_storageCache: StorageCache
statelessVerkleStateManager.ts:139
• Optional
accessWitness: AccessWitness
statelessVerkleStateManager.ts:171
• originalStorageCache: OriginalStorageCache
EVMStateManagerInterface.originalStorageCache
statelessVerkleStateManager.ts:142
▸ checkChunkWitnessPresent(address
, codeOffset
): boolean
Name | Type |
---|---|
address |
Address |
codeOffset |
number |
boolean
statelessVerkleStateManager.ts:344
▸ checkpoint(): Promise
<void
>
Checkpoints the current state of the StateManager instance.
State changes that follow can then be committed by calling
commit
or reverted
by calling rollback.
Promise
<void
>
EVMStateManagerInterface.checkpoint
statelessVerkleStateManager.ts:806
▸ chunkifyCode(code
): void
Name | Type |
---|---|
code |
Uint8Array |
void
statelessVerkleStateManager.ts:328
▸ clearCaches(): void
Clears all underlying caches
void
statelessVerkleStateManager.ts:881
▸ clearContractStorage(address
): Promise
<void
>
Clears all storage entries for the account corresponding to address
.
Name | Type | Description |
---|---|---|
address |
Address |
Address to clear the storage of |
Promise
<void
>
EVMStateManagerInterface.clearContractStorage
statelessVerkleStateManager.ts:495
▸ commit(): Promise
<void
>
Commits the current change-set to the instance since the last call to checkpoint.
Promise
<void
>
EVMStateManagerInterface.commit
statelessVerkleStateManager.ts:817
▸ deleteAccount(address
): Promise
<void
>
Deletes an account from state under the provided address
.
Name | Type | Description |
---|---|---|
address |
Address |
Address of the account which should be deleted |
Promise
<void
>
EVMStateManagerInterface.deleteAccount
statelessVerkleStateManager.ts:595
▸ dumpStorage(_
): Promise
<StorageDump
>
Dumps the RLP-encoded storage values for an account
specified by address
.
Name | Type |
---|---|
_ |
Address |
Promise
<StorageDump
>
- The state of the account as an
Object
map. Keys are are the storage keys, values are the storage values as strings. Both are represented as hex strings without the0x
prefix.
EVMStateManagerInterface.dumpStorage
statelessVerkleStateManager.ts:870
▸ dumpStorageRange(_
, __
, ___
): Promise
<StorageRange
>
Name | Type |
---|---|
_ |
Address |
__ |
bigint |
___ |
number |
Promise
<StorageRange
>
EVMStateManagerInterface.dumpStorageRange
statelessVerkleStateManager.ts:874
▸ flush(): Promise
<void
>
Writes all cache items to the trie
Promise
<void
>
statelessVerkleStateManager.ts:844
▸ generateCanonicalGenesis(_initState
): Promise
<void
>
Name | Type |
---|---|
_initState |
any |
Promise
<void
>
EVMStateManagerInterface.generateCanonicalGenesis
statelessVerkleStateManager.ts:887
▸ getAccount(address
): Promise
<undefined
| Account
>
Name | Type |
---|---|
address |
Address |
Promise
<undefined
| Account
>
EVMStateManagerInterface.getAccount
statelessVerkleStateManager.ts:505
▸ getAppliedKey(_
): Uint8Array
Name | Type |
---|---|
_ |
Uint8Array |
Uint8Array
EVMStateManagerInterface.getAppliedKey
statelessVerkleStateManager.ts:891
▸ getComputedValue(accessedState
): null
| string
Name | Type |
---|---|
accessedState |
AccessedStateWithAddress |
null
| string
statelessVerkleStateManager.ts:717
▸ getContractCode(address
): Promise
<Uint8Array
>
Gets the code corresponding to the provided address
.
Name | Type | Description |
---|---|---|
address |
Address |
Address to get the code for |
Promise
<Uint8Array
>
- Resolves with the code corresponding to the provided address.
Returns an empty
Uint8Array
if the account has no associated code.
EVMStateManagerInterface.getContractCode
statelessVerkleStateManager.ts:391
▸ getContractStorage(address
, key
): Promise
<Uint8Array
>
Gets the storage value associated with the provided address
and key
. This method returns
the shortest representation of the stored value.
Name | Type | Description |
---|---|---|
address |
Address |
Address of the account to get the storage for |
key |
Uint8Array |
Key in the account's storage to get the value for. Must be 32 bytes long. |
Promise
<Uint8Array
>
- The storage value for the account
corresponding to the provided address at the provided key.
If this does not exist an empty
Uint8Array
is returned.
EVMStateManagerInterface.getContractStorage
statelessVerkleStateManager.ts:455
▸ getProof(_
, __?
): Promise
<Proof
>
Name | Type | Default value |
---|---|---|
_ |
Address |
undefined |
__ |
Uint8Array [] |
[] |
Promise
<Proof
>
EVMStateManagerInterface.getProof
statelessVerkleStateManager.ts:621
▸ getStateRoot(): Promise
<Uint8Array
>
Gets the verkle root. NOTE: this needs some examination in the code where this is needed and if we have the verkle root present
Promise
<Uint8Array
>
- Returns the verkle root of the
StateManager
EVMStateManagerInterface.getStateRoot
statelessVerkleStateManager.ts:852
▸ getTransitionStateRoot(_
, __
): Promise
<Uint8Array
>
Name | Type |
---|---|
_ |
DefaultStateManager |
__ |
Uint8Array |
Promise
<Uint8Array
>
statelessVerkleStateManager.ts:242
▸ getTreeKeyForBalance(stem
): Uint8Array
Name | Type |
---|---|
stem |
Uint8Array |
Uint8Array
statelessVerkleStateManager.ts:307
▸ getTreeKeyForCodeChunk(address
, chunkId
): Uint8Array
Name | Type |
---|---|
address |
Address |
chunkId |
number |
Uint8Array
statelessVerkleStateManager.ts:323
▸ getTreeKeyForCodeHash(stem
): Uint8Array
Name | Type |
---|---|
stem |
Uint8Array |
Uint8Array
statelessVerkleStateManager.ts:315
▸ getTreeKeyForCodeSize(stem
): Uint8Array
Name | Type |
---|---|
stem |
Uint8Array |
Uint8Array
statelessVerkleStateManager.ts:319
▸ getTreeKeyForNonce(stem
): Uint8Array
Name | Type |
---|---|
stem |
Uint8Array |
Uint8Array
statelessVerkleStateManager.ts:311
▸ getTreeKeyForStorageSlot(address
, storageKey
): Uint8Array
Name | Type |
---|---|
address |
Address |
storageKey |
bigint |
Uint8Array
statelessVerkleStateManager.ts:338
▸ getTreeKeyForVersion(stem
): Uint8Array
Name | Type |
---|---|
stem |
Uint8Array |
Uint8Array
statelessVerkleStateManager.ts:303
▸ hasStateRoot(_
): Promise
<boolean
>
Name | Type |
---|---|
_ |
Uint8Array |
Promise
<boolean
>
EVMStateManagerInterface.hasStateRoot
statelessVerkleStateManager.ts:825
▸ initVerkleExecutionWitness(executionWitness?
, accessWitness?
): void
Name | Type |
---|---|
executionWitness? |
null | VerkleExecutionWitness |
accessWitness? |
AccessWitness |
void
statelessVerkleStateManager.ts:246
▸ modifyAccountFields(address
, accountFields
): Promise
<void
>
Name | Type |
---|---|
address |
Address |
accountFields |
Partial <Pick <Account , "nonce" | "balance" | "storageRoot" | "codeHash" >> |
Promise
<void
>
EVMStateManagerInterface.modifyAccountFields
statelessVerkleStateManager.ts:608
▸ putAccount(address
, account
): Promise
<void
>
Name | Type |
---|---|
address |
Address |
account |
Account |
Promise
<void
>
EVMStateManagerInterface.putAccount
statelessVerkleStateManager.ts:561
▸ putContractCode(address
, value
): Promise
<void
>
Adds value
to the state trie as code, and sets codeHash
on the account
corresponding to address
to reference this.
Name | Type | Description |
---|---|---|
address |
Address |
Address of the account to add the code for |
value |
Uint8Array |
The value of the code |
Promise
<void
>
EVMStateManagerInterface.putContractCode
statelessVerkleStateManager.ts:367
▸ putContractStorage(address
, key
, value
): Promise
<void
>
Adds value to the state for the account
corresponding to address
at the provided key
.
Name | Type | Description |
---|---|---|
address |
Address |
Address to set a storage value for |
key |
Uint8Array |
Key to set the value at. Must be 32 bytes long. |
value |
Uint8Array |
Value to set at key for account corresponding to address . Cannot be more than 32 bytes. Leading zeros are stripped. If it is a empty or filled with zeros, deletes the value. |
Promise
<void
>
EVMStateManagerInterface.putContractStorage
statelessVerkleStateManager.ts:480
▸ revert(): Promise
<void
>
Reverts the current change-set to the instance since the last call to checkpoint.
Promise
<void
>
EVMStateManagerInterface.revert
statelessVerkleStateManager.ts:833
▸ setStateRoot(_
): Promise
<void
>
TODO: needed? Maybe in this context: reset to original pre state suffice
Name | Type |
---|---|
_ |
Uint8Array |
Promise
<void
>
EVMStateManagerInterface.setStateRoot
statelessVerkleStateManager.ts:861
▸ shallowCopy(): EVMStateManagerInterface
Copies the current instance of the StateManager
at the last fully committed point, i.e. as if all current
checkpoints were reverted.
EVMStateManagerInterface
EVMStateManagerInterface.shallowCopy
statelessVerkleStateManager.ts:355
▸ verifyPostState(): boolean
boolean
statelessVerkleStateManager.ts:648
▸ verifyProof(parentVerkleRoot
): Promise
<boolean
>
Name | Type |
---|---|
parentVerkleRoot |
Uint8Array |
Promise
<boolean
>