Skip to content

@ethereumjs/vm v5.3.0

Compare
Choose a tag to compare
@holgerd77 holgerd77 released this 01 Apr 18:54
· 2234 commits to master since this release
8733939

EIP-2930 Tx Access List Generation

This release adds the ability to generate access lists from tx runs with VM.runTx(), see PR #1170. There is a new option reportAccessList which can be used on all tx types to generate an access list as defined by EIP-2930 which is then returned along the VM.runTx() result adhering to the @ethereumjs/tx AccessList TypeScript type definition.

Note that this functionality needs the new StateManager.generateAccessList() function which is not yet part of the StateManager interface for compatibility reasons. If you implement an own StateManager make sure that this function is present (e.g. by inheriting your StateManager from the DefaultStateManager implementation).

Another note: there is an edge case on accessList generation where an internal call might revert without an accessList but pass if the accessList is used for a tx run (so the subsequent behavior might change). This edge case is not covered by this implementation.

New Block Builder

There is a new Block Builder API for creating new blocks on top of the current state by adding transactions one at a time, see PR #1158.

It can be used like the following:

const blockBuilder = await vm.buildBlock({ parentBlock, blockData, blockOpts })
const txResult = await blockBuilder.addTransaction(tx)
// reset the state with `blockBuilder.revert()`
const block = await blockBuilder.build()

When the block is built it becomes fully executed in the vm and its blockchain.

Other Changes

  • Fixed VM.runBlock() with generate: true by setting the header fields for gasUsed, logsBloom, receiptTrie, and transactionsTrie, PR #1158
  • Fixed a bug in VM.runTx() with reportAccessList=truereturning addresses without a 0x prefix, PR #1183
  • Do not include the tx sender address in the access list in VM.runTx() with reportAccessList=true, only include the to address if storage slots have been touched, PR #1183