@ethereumjs/blockchain / CliqueConsensus
Defined in: consensus/clique.ts:68
This class encapsulates Clique-related consensus functionality when used with the Blockchain class. Note: reorgs which happen between epoch transitions, which change the internal voting state over the reorg will result in failure and is currently not supported. The hotfix for this could be: re-load the latest epoch block (this has the clique state in the extraData of the header) Now replay all blocks on top of it. This should validate the chain up to the new/reorged tip which previously threw.
new CliqueConsensus():
CliqueConsensus
Defined in: consensus/clique.ts:120
CliqueConsensus
_cliqueLatestBlockSigners:
CliqueLatestBlockSigners
=[]
Defined in: consensus/clique.ts:117
List of signers for the last consecutive Blockchain.cliqueSignerLimit blocks. Kept as a snapshot for quickly checking for “recently signed” error. Format: [ [BLOCK_NUMBER, SIGNER_ADDRESS], …]
On reorgs elements from the array are removed until BLOCK_NUMBER > REORG_BLOCK.
_cliqueLatestSignerStates:
CliqueLatestSignerStates
=[]
Defined in: consensus/clique.ts:92
List with the latest signer states checkpointed on blocks where a change (added new or removed a signer) occurred.
Format: [ [BLOCK_NUMBER_1, [SIGNER1, SIGNER 2,]], [BLOCK_NUMBER2, [SIGNER1, SIGNER3]], …]
The top element from the array represents the list of current signers. On reorgs elements from the array are removed until BLOCK_NUMBER > REORG_BLOCK.
Always keep at least one item on the stack.
_cliqueLatestVotes:
CliqueLatestVotes
=[]
Defined in: consensus/clique.ts:108
List with the latest signer votes.
Format: [ [BLOCK_NUMBER_1, [SIGNER, BENEFICIARY, AUTH]], [BLOCK_NUMBER_1, [SIGNER, BENEFICIARY, AUTH]] ] where AUTH = CLIQUE_NONCE_AUTH | CLIQUE_NONCE_DROP
For votes all elements here must be taken into account with a block number >= LAST_EPOCH_BLOCK (nevertheless keep entries with blocks before EPOCH_BLOCK in case a reorg happens during an epoch change)
On reorgs elements from the array are removed until BLOCK_NUMBER > REORG_BLOCK.
algorithm:
ConsensusAlgorithm
Defined in: consensus/clique.ts:70
blockchain:
undefined
|Blockchain
Defined in: consensus/clique.ts:69
DEBUG:
boolean
Defined in: consensus/clique.ts:119
cliqueActiveSigners(
blockNum
):Address
[]
Defined in: consensus/clique.ts:447
Returns a list with the current block signers
bigint
Address
[]
cliqueSignerInTurn(
signer
,blockNum
):Promise
<boolean
>
Defined in: consensus/clique.ts:622
Helper to determine if a signer is in or out of turn for the next block.
Address
The signer address
bigint
Promise
<boolean
>
genesisInit(
genesisBlock
):Promise
<void
>
Defined in: consensus/clique.ts:143
Initialize genesis for consensus mechanism
Block
genesis block
Promise
<void
>
newBlock(
block
,commonAncestor
):Promise
<void
>
Defined in: consensus/clique.ts:207
Update consensus on new block
Block
new block
common ancestor block header (optional)
undefined |
BlockHeader |
Promise
<void
>
setup(
param
):Promise
<void
>
Defined in: consensus/clique.ts:135
dictionary containing a Blockchain object
Note: this method must be called before consensus checks are used or type errors will occur
Promise
<void
>
validateConsensus(
block
):Promise
<void
>
Defined in: consensus/clique.ts:147
Validate block consensus parameters
Block
block to be validated
Promise
<void
>
validateDifficulty(
header
):Promise
<void
>
Defined in: consensus/clique.ts:178
BlockHeader
Promise
<void
>