ethereumjs-monorepo

@ethereumjs/statemanager


@ethereumjs/statemanager / StatelessVerkleStateManager

Class: StatelessVerkleStateManager

Defined in: statelessVerkleStateManager.ts:69

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.

Implements

Constructors

Constructor

new StatelessVerkleStateManager(opts): StatelessVerkleStateManager

Defined in: statelessVerkleStateManager.ts:113

Instantiate the StateManager interface.

Parameters

opts

StatelessVerkleStateManagerOpts

Returns

StatelessVerkleStateManager

Properties

_cachedStateRoot?

optional _cachedStateRoot: Uint8Array<ArrayBufferLike>

Defined in: statelessVerkleStateManager.ts:70


common

readonly common: Common

Defined in: statelessVerkleStateManager.ts:80


originalStorageCache

originalStorageCache: OriginalStorageCache

Defined in: statelessVerkleStateManager.ts:72

Implementation of

StateManagerInterface.originalStorageCache


verkleCrypto

verkleCrypto: VerkleCrypto

Defined in: statelessVerkleStateManager.ts:74

Methods

checkChunkWitnessPresent()

checkChunkWitnessPresent(address, codeOffset): Promise<boolean>

Defined in: statelessVerkleStateManager.ts:206

Parameters

address

Address

codeOffset

number

Returns

Promise<boolean>

Implementation of

StateManagerInterface.checkChunkWitnessPresent


checkpoint()

checkpoint(): Promise<void>

Defined in: statelessVerkleStateManager.ts:639

Checkpoints the current state of the StateManager instance. State changes that follow can then be committed by calling commit or reverted by calling rollback.

Returns

Promise<void>

Implementation of

StateManagerInterface.checkpoint


clearCaches()

clearCaches(): void

Defined in: statelessVerkleStateManager.ts:698

Clears all underlying caches

Returns

void

Implementation of

StateManagerInterface.clearCaches


clearStorage()

clearStorage(address): Promise<void>

Defined in: statelessVerkleStateManager.ts:388

Clears all storage entries for the account corresponding to address.

Parameters

address

Address

Address to clear the storage of

Returns

Promise<void>

Implementation of

StateManagerInterface.clearStorage


commit()

commit(): Promise<void>

Defined in: statelessVerkleStateManager.ts:648

Commits the current change-set to the instance since the last call to checkpoint.

Returns

Promise<void>

Implementation of

StateManagerInterface.commit


deleteAccount()

deleteAccount(address): Promise<void>

Defined in: statelessVerkleStateManager.ts:489

Deletes an account from state under the provided address.

Parameters

address

Address

Address of the account which should be deleted

Returns

Promise<void>

Implementation of

StateManagerInterface.deleteAccount


flush()

flush(): Promise<void>

Defined in: statelessVerkleStateManager.ts:671

Writes all cache items to the trie

Returns

Promise<void>


generateCanonicalGenesis()

generateCanonicalGenesis(_initState): Promise<void>

Defined in: statelessVerkleStateManager.ts:706

Parameters

_initState

any

Returns

Promise<void>

Implementation of

StateManagerInterface.generateCanonicalGenesis


getAccount()

getAccount(address): Promise<undefined | Account>

Defined in: statelessVerkleStateManager.ts:396

Parameters

address

Address

Returns

Promise<undefined | Account>

Implementation of

StateManagerInterface.getAccount


getCode()

getCode(address): Promise<Uint8Array<ArrayBufferLike>>

Defined in: statelessVerkleStateManager.ts:257

Gets the code corresponding to the provided address.

Parameters

address

Address

Address to get the code for

Returns

Promise<Uint8Array<ArrayBufferLike>>

Implementation of

StateManagerInterface.getCode


getCodeSize()

getCodeSize(address): Promise<number>

Defined in: statelessVerkleStateManager.ts:312

Parameters

address

Address

Returns

Promise<number>

Implementation of

StateManagerInterface.getCodeSize


getComputedValue()

getComputedValue(accessedState): null | `0x${string}`

Defined in: statelessVerkleStateManager.ts:581

Parameters

accessedState

VerkleAccessedStateWithAddress

Returns

null | `0x${string}`


getStateRoot()

getStateRoot(): Promise<Uint8Array<ArrayBufferLike>>

Defined in: statelessVerkleStateManager.ts:679

Gets the cache state root. This is used to persist the stateRoot between blocks, so that blocks can retrieve the stateRoot of the parent block. This is required to verify and prove verkle execution witnesses.

Returns

Promise<Uint8Array<ArrayBufferLike>>

Implementation of

StateManagerInterface.getStateRoot


getStorage()

getStorage(address, key): Promise<Uint8Array<ArrayBufferLike>>

Defined in: statelessVerkleStateManager.ts:342

Gets the storage value associated with the provided address and key. This method returns the shortest representation of the stored value.

Parameters

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.

Returns

Promise<Uint8Array<ArrayBufferLike>>

Implementation of

StateManagerInterface.getStorage


getTransitionStateRoot()

getTransitionStateRoot(_, __): Promise<Uint8Array<ArrayBufferLike>>

Defined in: statelessVerkleStateManager.ts:138

Parameters

_

MerkleStateManager

__

Uint8Array

Returns

Promise<Uint8Array<ArrayBufferLike>>


hasStateRoot()

hasStateRoot(_): Promise<boolean>

Defined in: statelessVerkleStateManager.ts:654

Parameters

_

Uint8Array

Returns

Promise<boolean>

Implementation of

StateManagerInterface.hasStateRoot


initVerkleExecutionWitness()

initVerkleExecutionWitness(blockNum, executionWitness?): void

Defined in: statelessVerkleStateManager.ts:142

Parameters

blockNum

bigint

executionWitness?
null VerkleExecutionWitness

Returns

void

Implementation of

StateManagerInterface.initVerkleExecutionWitness


modifyAccountFields()

modifyAccountFields(address, accountFields): Promise<void>

Defined in: statelessVerkleStateManager.ts:497

Parameters

address

Address

accountFields

Partial

Returns

Promise<void>

Implementation of

StateManagerInterface.modifyAccountFields


putAccount()

putAccount(address, account): Promise<void>

Defined in: statelessVerkleStateManager.ts:465

Parameters

address

Address

account

Account

Returns

Promise<void>

Implementation of

StateManagerInterface.putAccount


putCode()

putCode(address, value): Promise<void>

Defined in: statelessVerkleStateManager.ts:233

Adds value to the state trie as code, and sets codeHash on the account corresponding to address to reference this.

Parameters

address

Address

Address of the account to add the code for

value

Uint8Array

The value of the code

Returns

Promise<void>

Implementation of

StateManagerInterface.putCode


putStorage()

putStorage(address, key, value): Promise<void>

Defined in: statelessVerkleStateManager.ts:368

Adds value to the state for the account corresponding to address at the provided key.

Parameters

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.

Returns

Promise<void>

Implementation of

StateManagerInterface.putStorage


revert()

revert(): Promise<void>

Defined in: statelessVerkleStateManager.ts:662

Reverts the current change-set to the instance since the last call to checkpoint.

Returns

Promise<void>

Implementation of

StateManagerInterface.revert


setStateRoot()

setStateRoot(stateRoot): Promise<void>

Defined in: statelessVerkleStateManager.ts:691

Sets the cache state root. This is used to persist the stateRoot between blocks, so that blocks can retrieve the stateRoot of the parent block.

Parameters

stateRoot

Uint8Array

The stateRoot to set

Returns

Promise<void>

Implementation of

StateManagerInterface.setStateRoot


shallowCopy()

shallowCopy(downlevelCaches): StatelessVerkleStateManager

Defined in: statelessVerkleStateManager.ts:219

Copies the current instance of the StateManager at the last fully committed point, i.e. as if all current checkpoints were reverted.

Parameters

downlevelCaches

boolean = true

Returns

StatelessVerkleStateManager

Implementation of

StateManagerInterface.shallowCopy


verifyVerklePostState()

verifyVerklePostState(accessWitness): Promise<boolean>

Defined in: statelessVerkleStateManager.ts:503

Parameters

accessWitness

VerkleAccessWitnessInterface

Returns

Promise<boolean>

Implementation of

StateManagerInterface.verifyVerklePostState