Skip to content

@ethereumjs/common v2.4.0

Compare
Choose a tag to compare
@holgerd77 holgerd77 released this 08 Jul 09:34
· 2083 commits to master since this release
2ba896e

Finalized London HF Support

This release integrates the london HF blocks for all networks including mainnet and is therefore the first release with finalized London HF support.

Reworked Custom Chain Instantation / Supported Custom Chains (Polygon / Arbitrum / xDaiChain)

This release introduces a new Common.custom() static constructor which replaces the now deprecated Common.forCustomChain() constructor and allows for an easier instantiation of a Common instance with somewhat adopted chain parameters, with the main use case to adopt on instantiating with a deviating chain ID. Instantiating a custom common instance with its own chain ID and inheriting all other parameters from mainnet can now be as easily done as:

const common = Common.custom({ chainId: 1234 })

Along this refactoring work the custom() method now alternatively also takes a string as a first input (instead of a dictionary). This can be used in combination with the new CustomChain enum dict which allows for the selection of predefined supported custom chains for an easier Common setup of these supported chains:

const common = Common.custom(CustomChain.ArbitrumRinkebyTestnet)

Common instances created with this simplified custom() constructor can't be used in all usage contexts (the HF configuration is very likely not matching the actual chain) but can be useful for specific use cases, e.g. for sending a tx with @ethereumjs/tx to an L2 network (see the Tx library README for a complete usage example).

Chain & Hardfork Enums

This Common release comes with two new enums Chain and Hardfork. These contain the currently supported chains and hardforks by the library and can be used for both instantiation and calling various methods where a chain or a hardfork is requested as a parameter, see PR #1322.

import Common, { Chain, Hardfork } from '@ethereumjs/common'
const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.London })

common.hardforkIsActiveOnBlock(Hardfork.Berlin, 5) // false

Included Source Files

Source files from the src folder are now included in the distribution build, see PR #1301. This allows for a better debugging experience in debug tools like Chrome DevTools by having working source map references to the original sources available for inspection.

Other Changes

  • Removed retired dev networks (yolov3, aleut and baikal), PR #1296