ethereumjs-monorepo

@ethereumjs/vm


@ethereumjs/vm / BlockBuilder

Class: BlockBuilder

Defined in: vm/src/buildBlock.ts:77

Incrementally assembles a block by executing transactions against a VM.

Created via buildBlock; seals the header and transactions trie when finalized.

Constructors

Constructor

new BlockBuilder(vm, opts): BlockBuilder

Defined in: vm/src/buildBlock.ts:118

Parameters

vm

VM

opts

BuildBlockOpts

Returns

BlockBuilder

Properties

blobGasUsed

blobGasUsed: bigint = BIGINT_0

Defined in: vm/src/buildBlock.ts:94

The cumulative blob gas used by the blobs in a block


gasUsed

gasUsed: bigint = BIGINT_0

Defined in: vm/src/buildBlock.ts:82

Cumulative gas used by transactions added to the block (header gasUsed). Under EIP-8037 this is max(regular, state) of the two dimensions.

Accessors

minerValue

Get Signature

get minerValue(): bigint

Defined in: vm/src/buildBlock.ts:114

Returns

bigint


transactionReceipts

Get Signature

get transactionReceipts(): TxReceipt[]

Defined in: vm/src/buildBlock.ts:110

Returns

TxReceipt[]

Methods

addTransaction()

addTransaction(tx, __namedParameters?): Promise<RunTxResult>

Defined in: vm/src/buildBlock.ts:257

Run and add a transaction to the block being built. Please note that this modifies the state of the VM. Throws if the transaction’s gasLimit is greater than the remaining gas in the block (EIP-8037: per-dimension remaining).

Parameters

tx

TypedTransaction

__namedParameters?
allowNoBlobs?

boolean

skipHardForkValidation?

boolean

Returns

Promise<RunTxResult>


build()

build(sealOpts?): Promise<{ block: Block; blockLevelAccessList: BlockLevelAccessList | undefined; requests: CLRequest<CLRequestType>[] | undefined; }>

Defined in: vm/src/buildBlock.ts:396

This method constructs the finalized block, including withdrawals and any CLRequests. It also:

Note: we add CLRequests here because they can be generated at any time during the lifecycle of a pending block so need to be provided only when the block is finalized.

Parameters

sealOpts?

SealBlockOpts

Returns

Promise<{ block: Block; blockLevelAccessList: BlockLevelAccessList | undefined; requests: CLRequest<CLRequestType>[] | undefined; }>


getStatus()

getStatus(): BlockStatus

Defined in: vm/src/buildBlock.ts:179

Returns

BlockStatus


initState()

initState(): Promise<void>

Defined in: vm/src/buildBlock.ts:496

Returns

Promise<void>


logsBloom()

logsBloom(): Uint8Array<ArrayBufferLike>

Defined in: vm/src/buildBlock.ts:196

Calculates and returns the logs bloom for the block.

Returns

Uint8Array<ArrayBufferLike>


receiptTrie()

receiptTrie(): Promise<Uint8Array<ArrayBufferLike>>

Defined in: vm/src/buildBlock.ts:208

Calculates and returns the receiptTrie for the block.

Returns

Promise<Uint8Array<ArrayBufferLike>>


revert()

revert(): Promise<void>

Defined in: vm/src/buildBlock.ts:374

Reverts the checkpoint on the StateManager to reset the state from any transactions that have been run.

Returns

Promise<void>


transactionsTrie()

transactionsTrie(): Promise<Uint8Array<ArrayBufferLike>>

Defined in: vm/src/buildBlock.ts:186

Calculates and returns the transactionsTrie for the block.

Returns

Promise<Uint8Array<ArrayBufferLike>>