@ethereumjs/block v3.1.0
holgerd77
released this
23 Feb 08:38
·
3417 commits
to master
since this release
Clique/PoA Support
This release introduces Clique/PoA support for the Block
library, see the main PR #1032 as well as the follow-up PRs #1074 and PR #1088. The BlockHeader.validate()
function now properly validates the various Clique/PoA-specific properties (extraData
checks and others, see API documentation) and BlockHeader.validateConsensus()
can be used to properly validate that a Clique/PoA block has the correct signature.
For sealing a block on instantiation there is a new cliqueSigner
constructor option:
const cliqueSigner = Buffer.from('PRIVATE_KEY_HEX_STRING', 'hex')
const block = Block.fromHeaderData(headerData, { cliqueSigner })
Additionally there are the following new utility methods for Clique/PoA related functionality in the BlockHeader
class:
BlockHeader.validateCliqueDifficulty(blockchain: Blockchain): boolean
BlockHeader.cliqueSigHash()
BlockHeader.cliqueIsEpochTransition(): boolean
BlockHeader.cliqueExtraVanity(): Buffer
BlockHeader.cliqueExtraSeal(): Buffer
BlockHeader.cliqueEpochTransitionSigners(): Address[]
BlockHeader.cliqueVerifySignature(signerList: Address[]): boolean
BlockHeader.cliqueSigner(): Address
See the API docs for a detailed documentation. Note that these methods will throw if called in a non-Clique/PoA context.
Other Changes
- The
Common
instance passed is now copied to avoid side-effects towards the outer common instance on HF updates, PR #1089 - Fixed a bug where txs have been created with the wrong HF when
hardforkByBlockNumber
is used along with the static constructors, PR #1089 - Fixed a bug where
Common
has not been passed to the returned block in theblockFromRpc()
method, PR #1032