[][src]Crate finality_grandpa

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

Bitfields and tools for handling equivocations.

round

Logic for a single round of GRANDPA.

vote_graph

Maintains the vote-graph of the blockchain.

voter

A voter in GRANDPA. This transitions between rounds and casts votes.

voter_set

Maintains the VoterSet of the blockchain.

Structs

Commit

A commit message which is an aggregate of precommits.

CommitValidationResult

Struct returned from validate_commit function with information about the validation result.

CompactCommit

A commit message with compact representation of authentication data.

Equivocation

An equivocation (double-vote) in a given round.

Precommit

A precommit for a block and its ancestors.

Prevote

A prevote for a block and its ancestors.

PrimaryPropose

A primary proposed block, this is a broadcast of the last round's estimate.

SignedMessage

A signed message.

SignedPrecommit

A signed precommit message.

Enums

Error
Message

A protocol message or vote.

Traits

BlockNumberOps

Arithmetic necessary for a block number.

Chain

Chain context necessary for implementation of the finality gadget.

Functions

threshold

Get the threshold weight given the total voting weight.

validate_commit

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.

Type Definitions

CommitAuthData

Authentication data for a commit, currently a set of precommit signatures but in the future could be optimized with BLS signature aggregation.