@ethereumjs/blockchain v6.0.0-beta.2
Pre-releaseBeta 2 release for the upcoming breaking release round on the EthereumJS monorepo libraries, see the Beta 1 release notes (CHANGELOG) for the main change set description.
Removed Default Exports
The change with the biggest effect on UX since the last Beta 1 releases is for sure that we have removed default exports all accross the monorepo, see PR #2018, we even now added a new linting rule that completely dissalows using.
Default exports were a common source of error and confusion when using our libraries in a CommonJS context, leading to issues like Issue #978.
Now every import is a named import and we think the long term benefits will very much outweigh the one-time hassle of some import adoptions.
Common Library Import Updates
Since our @ethereumjs/common library is used all accross our libraries for chain and HF instantiation this will likely be the one being the most prevalent regarding the need for some import updates.
So Common import and usage is changing from:
import Common, { Chain, Hardfork } from '@ethereumjs/common'
const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Merge })
to:
import { Common, Chain, Hardfork } from '@ethereumjs/common'
const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Merge })
Removed Default Imports in this Library
The main Blockchain
class import has been updated, so import changes from:
import Blockchain from '@ethereumjs/blockchain'
to:
import { Blockchain } from '@ethereumjs/blockchain'
Blockchain Consensus Option
The Blockchain library now has a new optional consensus
constructor options parameter which can be used to pass in a customized or own consensus class respectively implementation, e.g. a modfifed Ethash version or a Clique implementation with adopted parameters or the like, see PR #2002 to get a grasp on the integration.
Other Changes
- Added
ESLint
strict boolean expressions linting rule, PR #2030