Namespace Libplanet.Net.Consensus
Classes
ConsensusContext
A class that maintains the states of a Context for block indices now in consensus.
ConsensusReactor
A manager class for starting network and joining into consensus. Libplanet.Net.Consensus.ConsensusReactor.ConsensusContext
Context
A state machine class of PBFT consensus algorithm. The state machine is responsible for proposing, validating, voting a block and committing the voted block to the blockchain. There are five states:
- Default which is the initial state when the Start(BlockCommit) is not called (i.e., round has not been started).
- Propose, which is the state when the round has been started and waiting for the block proposal. If a validator is a proposer of the round, it will propose a block to the other validators and to itself.
- PreVote, which is the state when a block proposal for a round has been received. While translating to this step, state machine votes for the block whether block is valid or not, and waiting for any +2/3 votes from other validators.
- PreCommit, which is the state received any +2/3 votes in PreVote. While translating to this step, state machine votes for whether the block should be committed or not, and waiting for any +2/3 committing votes from other validators. If PreCommit receives +2/3 commit votes with NIL, starts new round Libplanet.Net.Consensus.Context.StartRound(System.Int32) and moves step to Propose.
- EndCommit, which is the state represents committing vote has been received from other validators. Block will be committed to the blockchain and consensus for this height is stopped. (responsibility of next height handling is at ConsensusContext).
- In the above states, Propose, If receiving proposal fails in Libplanet.Net.Consensus.Context.TimeoutPropose(System.Int64), then step is moved to PreVote and vote NIL.
- Similar to Propose, PreVote and PreCommit also wait for Libplanet.Net.Consensus.Context.TimeoutPreVote(System.Int64) or Libplanet.Net.Consensus.Context.TimeoutPreCommit(System.Int64) respectively, if +2/3 vote received but neither NIL nor Block is not +2/3. If still +2/3 vote is not received neither NIL nor Block after timeout runs out, then move to next step and vote NIL.
ContextTimeoutOption
A options class to configure Context timeout for each ConsensusStep.
Gossip
A class gossips messages into network. Peers will be stored and managed by Kademlia DHT.
GossipConsensusMessageCommunicator
An IConsensusMessageCommunicator implementation using Libplanet.Net.Consensus.GossipConsensusMessageCommunicator.Gossip.
HeightVoteSet
InvalidConsensusMessageException
An exception thrown when a received ConsensusMsg is invalid. In particular, this is thrown pre-emptively before a ConsensusMsg is processed, i.e. does not change the state of a Context in a meaningful way.
InvalidHeightIncreasingException
An exception thrown when a NewHeight(Int64) has called with height is not the index of Tip + 1.
InvalidMaj23Exception
An exception thrown when a received Maj23 is invalid. In particular, this is thrown pre-emptively before a Maj23 is processed, i.e. does not change the state of a Context in a meaningful way.
InvalidProposalException
An exception thrown when a received Proposal is invalid. In particular, this is thrown pre-emptively before a Proposal is processed, i.e. does not change the state of a Context in a meaningful way.
InvalidVoteException
An exception thrown when a received Vote is invalid. In particular, this is thrown pre-emptively before a Vote is processed, i.e. does not change the state of a Context in a meaningful way.
MessageCache
Cache object that stores recently seen Messages.
VoteSet
Structs
ConsensusReactorOption
A option struct for initializing ConsensusReactor.
Interfaces
IConsensusMessageCommunicator
Interface for communicating ConsensusMsgs with peers.
IReactor
A interface of consensus reactors.