Skip to content

@ethereumjs/blockchain v5.0.0-beta.2

Pre-release
Pre-release
Compare
Choose a tag to compare
@holgerd77 holgerd77 released this 12 Nov 08:47
· 4879 commits to master since this release
d8e7066

ATTENTION: This is a pre-release and only meant to be used for testing purposes.

Do not use in production!

Feedback is extremely welcome, please use the beta Releases feedback issue #923 or our Discord channel.


This is the second beta release towards a final library release, see beta.1 release notes for an overview on the full changes since the last publicly released version.

This release introduces new breaking changes, so please carefully read the additional release note sections!

Safe Static Constructor

The library now has an additional safe static constructor Blockchain.create() which awaits the init method and throws if the init method throws:

const common = new Common({ chain: 'ropsten' })
const blockchain = await Blockchain.create({ common })

This is the new recommended way to instantiate a Blockchain object, see PR #930.

Refactored Genesis Block Handling Mechanism

Genesis handling has been reworked to now be safer and reduce the risk of wiping a blockchain by setting a new genesis, see PR #930.

Breaking: The dedicated setGenesisBlock() methods and the optional isGenesis option on Blockchain.putBlock() have been removed. Instead the genesis block is created on initialization either from the Common library instance passed or a custom genesis block passed along with the genesisBlock option. If a custom genesis block is used, this custom block now always has to be passed along on Blockchain initialization, also when operating on an already existing DB.

Changes and Refactoring

  • Refactored DBManager with the introduction of an abstract DB operation handling mechanism, if you have modified DBManager in your code this will be a potentially breaking change for you, PR #927
  • Renaming of internal variables like Blockchain._headBlock, if you are using these variables in your code this will be a potentially breaking change for you, PR #930
  • Made internal _ methods like _saveHeads() private, if you are using these functions in your code this will be a potentially breaking change for you, PR #930
  • Improved code documentation, PR #930
  • Fixed potential blockchain DB concurrency issues along PR #930

Testing and CI

  • Dedicated blockchain reorg test setup and executable test, PR #926
  • Breaking: validatePow option has been renamed to validateConsensus to prepare for a future integration of non-PoW (PoA) consensus mechanisms, validateConsensus as well as validateBlocks options now throw when set to true for validation on a non-PoW chain (determined by Common, e.g. 'goerli'), see PR #937