Crate finality_grandpa

source ·
Expand description

Finality gadget for blockchains.

https://github.com/w3f/consensus/blob/master/pdf/grandpa.pdf

Consensus proceeds in rounds. Each round, voters will cast a prevote and precommit message.

Votes on blocks are then applied to the blockchain, being recursively applied to blocks before them. A DAG is superimposed over the blockchain with the vote_graph logic.

Equivocation detection and vote-set management is done in the round module. The work for actually casting votes is done in the voter module.

Modules

Bitfield for handling equivocations.
Logic for a single round of GRANDPA.
Maintains the vote-graph of the blockchain.
A voter in GRANDPA. This transitions between rounds and casts votes.

Structs

A commit message which is an aggregate of precommits.
A commit message with compact representation of authentication data.
An equivocation (double-vote) in a given round.
A precommit for a block and its ancestors.
A prevote for a block and its ancestors.
A signed message.
A signed precommit message.

Enums

A protocol message or vote.

Traits

Arithmetic necessary for a block number.
Chain context necessary for implementation of the finality gadget.

Functions

Validates a GRANDPA commit message and returns the ghost calculated using the precommits in the commit message and using the commit target as a base. If no threshold is given it is calculated using ::threshold and the provided voters.

Type Definitions