Documentation ¶
Index ¶
- Constants
- Variables
- func BytesToBig(data []byte) *big.Int
- func CompareHRS(h1 uint64, r1 int, s1 RoundStepType, h2 uint64, r2 int, s2 RoundStepType) int
- type Backend
- type BlockPartMessage
- type CommitStepMessage
- type ConsensusMessage
- type ConsensusReactor
- func (conR *ConsensusReactor) AddPeer(peer consensus.Peer)
- func (conR *ConsensusReactor) AfterStart()
- func (conR *ConsensusReactor) OnStart() error
- func (conR *ConsensusReactor) OnStop()
- func (conR *ConsensusReactor) Receive(chID uint64, src consensus.Peer, msgBytes []byte)
- func (conR *ConsensusReactor) RemovePeer(peer consensus.Peer, reason interface{})
- func (conR *ConsensusReactor) SetEventSwitch(evsw types.EventSwitch)
- func (conR *ConsensusReactor) String() string
- type ConsensusState
- func (cs *ConsensusState) AddProposalBlockPart(height uint64, round int, part *types.Part, peerKey string) error
- func (cs *ConsensusState) AddVote(vote *types.Vote, peerKey string) (added bool, err error)
- func (cs *ConsensusState) BLSVerifySignAggr(signAggr *types.SignAggr) (bool, error)
- func (bs *ConsensusState) GetChainReader() consss.ChainReader
- func (cs *ConsensusState) GetProposer() *types.Validator
- func (cs *ConsensusState) GetRoundState() *RoundState
- func (cs *ConsensusState) GetState() *sm.State
- func (cs *ConsensusState) GetValidators() (uint64, []*types.Validator)
- func (cs *ConsensusState) InitState(epoch *ep.Epoch) *sm.State
- func (cs *ConsensusState) Initialize()
- func (cs *ConsensusState) IsProposer() bool
- func (cs *ConsensusState) LoadBlock(height uint64) *types.NCBlock
- func (cs *ConsensusState) LoadCommit(height uint64) *types.Commit
- func (cs *ConsensusState) LoadLastNeatConExtra() (*types.NeatConExtra, uint64)
- func (cs *ConsensusState) LoadNeatConExtra(height uint64) (*types.NeatConExtra, uint64)
- func (cs *ConsensusState) OnStart() error
- func (cs *ConsensusState) OnStop()
- func (cs *ConsensusState) ReconstructLastCommit(state *sm.State)
- func (cs *ConsensusState) SetEventSwitch(evsw types.EventSwitch)
- func (cs *ConsensusState) SetPrivValidator(priv PrivValidator)
- func (cs *ConsensusState) SetProposal(proposal *types.Proposal, peerKey string) error
- func (cs *ConsensusState) SetProposalAndBlock(proposal *types.Proposal, block *types.NCBlock, parts *types.PartSet, ...) error
- func (cs *ConsensusState) SetTimeoutTicker(timeoutTicker TimeoutTicker)
- func (cs *ConsensusState) StartNewHeight()
- func (cs *ConsensusState) String() string
- func (cs *ConsensusState) UpdateToState(state *sm.State)
- func (cs *ConsensusState) ValidateTX4(b *types.NCBlock) error
- func (cs *ConsensusState) Wait()
- type HasVoteMessage
- type HeightVoteSet
- func (hvs *HeightVoteSet) AddVote(vote *types.Vote, peerKey string) (added bool, err error)
- func (hvs *HeightVoteSet) Height() uint64
- func (hvs *HeightVoteSet) POLInfo() (polRound int, polBlockID types.BlockID)
- func (hvs *HeightVoteSet) Precommits(round int) *types.VoteSet
- func (hvs *HeightVoteSet) Prevotes(round int) *types.VoteSet
- func (hvs *HeightVoteSet) Reset(height uint64, valSet *types.ValidatorSet)
- func (hvs *HeightVoteSet) ResetTop2Round(round int)
- func (hvs *HeightVoteSet) Round() int
- func (hvs *HeightVoteSet) SetPeerMaj23(round int, type_ byte, peerID string, blockID types.BlockID)
- func (hvs *HeightVoteSet) SetRound(round int)
- func (hvs *HeightVoteSet) String() string
- func (hvs *HeightVoteSet) StringIndented(indent string) string
- type HeightVoteSignAggr
- func (hvs *HeightVoteSignAggr) AddSignAggr(signAggr *types.SignAggr) (added bool, err error)
- func (hvs *HeightVoteSignAggr) Height() uint64
- func (hvs *HeightVoteSignAggr) POLInfo() (polRound int, polBlockID types.BlockID)
- func (hvs *HeightVoteSignAggr) Precommits(round int) *types.SignAggr
- func (hvs *HeightVoteSignAggr) Prevotes(round int) *types.SignAggr
- func (hvs *HeightVoteSignAggr) Reset(height uint64, valSet *types.ValidatorSet)
- func (hvs *HeightVoteSignAggr) ResetTop2Round(round int)
- func (hvs *HeightVoteSignAggr) Round() int
- func (hvs *HeightVoteSignAggr) SetRound(round int)
- func (hvs *HeightVoteSignAggr) String() string
- func (hvs *HeightVoteSignAggr) StringIndented(indent string) string
- type Maj23SignAggrMessage
- type NewRoundStepMessage
- type PeerRoundState
- type PeerState
- func (ps *PeerState) ApplyCommitStepMessage(msg *CommitStepMessage)
- func (ps *PeerState) ApplyHasVoteMessage(msg *HasVoteMessage)
- func (ps *PeerState) ApplyNewRoundStepMessage(msg *NewRoundStepMessage)
- func (ps *PeerState) ApplyProposalPOLMessage(msg *ProposalPOLMessage)
- func (ps *PeerState) ApplyVoteSetBitsMessage(msg *VoteSetBitsMessage, ourVotes *BitArray)
- func (ps *PeerState) Disconnect()
- func (ps *PeerState) EnsureVoteBitArrays(height uint64, numValidators uint64)
- func (ps *PeerState) GetHeight() uint64
- func (ps *PeerState) GetRoundState() *PeerRoundState
- func (ps *PeerState) PickSendSignAggr(signAggr *types.SignAggr) (ok bool)
- func (ps *PeerState) PickSendVote(votes types.VoteSetReader) (ok bool)
- func (ps *PeerState) PickVoteToSend(votes types.VoteSetReader) (vote *types.Vote, ok bool)
- func (ps *PeerState) SetHasMaj23SignAggr(signAggr *types.SignAggr)
- func (ps *PeerState) SetHasProposal(proposal *types.Proposal)
- func (ps *PeerState) SetHasProposalBlockPart(height uint64, round int, index int)
- func (ps *PeerState) SetHasVote(vote *types.Vote)
- func (ps *PeerState) String() string
- func (ps *PeerState) StringIndented(indent string) string
- type PrivValidator
- type ProposalMessage
- type ProposalPOLMessage
- type RoundState
- type RoundStepType
- type RoundVoteSet
- type RoundVoteSignAggr
- type TimeoutParams
- type TimeoutTicker
- type VRFProposer
- type VoteMessage
- type VoteSetBitsMessage
- type VoteSetMaj23Message
Constants ¶
const ( StateChannel = 0x20 DataChannel = 0x21 VoteChannel = 0x22 VoteSetBitsChannel = 0x23 )
const ( RoundStepNewHeight = RoundStepType(0x01) // Wait til CommitTime + timeoutCommit RoundStepNewRound = RoundStepType(0x02) // Setup new round and go to RoundStepPropose RoundStepWaitForMinerBlock = RoundStepType(0x03) // wait proposal block from miner RoundStepPropose = RoundStepType(0x04) // Did propose, gossip proposal RoundStepPrevote = RoundStepType(0x05) // Did prevote, gossip prevotes RoundStepPrevoteWait = RoundStepType(0x06) // Did receive any +2/3 prevotes, start timeout RoundStepPrecommit = RoundStepType(0x07) // Did precommit, gossip precommits RoundStepPrecommitWait = RoundStepType(0x08) // Did receive any +2/3 precommits, start timeout RoundStepCommit = RoundStepType(0x09) // Entered commit state machine )
const ROUND_NOT_PROPOSED int = 0
const ROUND_PROPOSED int = 1
Variables ¶
var ( ErrPeerStateHeightRegression = errors.New("Error peer state height regression") ErrPeerStateInvalidStartTime = errors.New("Error peer state invalid startTime") )
var ( ErrMinerBlock = errors.New("Miner block is nil") ErrInvalidProposalSignature = errors.New("Error invalid proposal signature") ErrInvalidProposalPOLRound = errors.New("Error invalid proposal POL round") ErrAddingVote = errors.New("Error adding vote") ErrVoteHeightMismatch = errors.New("Error vote height mismatch") ErrInvalidSignatureAggr = errors.New("Invalid signature aggregation") ErrDuplicateSignatureAggr = errors.New("Duplicate signature aggregation") ErrNotMaj23SignatureAggr = errors.New("Signature aggregation has no +2/3 power") )
var Major = "0" //
var Minor = "2" // replay refactor
var NodeID = ""
-----------------------------------------------------------------------------
var Revision = "2" // validation -> commit
var Spec = "1" // async
kind of arbitrary
var Version = Fmt("v%s/%s.%s.%s", Spec, Major, Minor, Revision)
Functions ¶
func BytesToBig ¶
func CompareHRS ¶
func CompareHRS(h1 uint64, r1 int, s1 RoundStepType, h2 uint64, r2 int, s2 RoundStepType) int
Types ¶
type BlockPartMessage ¶
func (*BlockPartMessage) String ¶
func (m *BlockPartMessage) String() string
type CommitStepMessage ¶
type CommitStepMessage struct { Height uint64 BlockPartsHeader types.PartSetHeader BlockParts *BitArray }
func (*CommitStepMessage) String ¶
func (m *CommitStepMessage) String() string
type ConsensusMessage ¶
type ConsensusMessage interface{}
func DecodeMessage ¶
func DecodeMessage(bz []byte) (msgType byte, msg ConsensusMessage, err error)
TODO: check for unnecessary extra bytes at the end.
type ConsensusReactor ¶
type ConsensusReactor struct { BaseService ChainId string //make access easier // contains filtered or unexported fields }
func NewConsensusReactor ¶
func NewConsensusReactor(consensusState *ConsensusState) *ConsensusReactor
func (*ConsensusReactor) AddPeer ¶
func (conR *ConsensusReactor) AddPeer(peer consensus.Peer)
Implements Reactor
func (*ConsensusReactor) AfterStart ¶
func (conR *ConsensusReactor) AfterStart()
func (*ConsensusReactor) OnStart ¶
func (conR *ConsensusReactor) OnStart() error
func (*ConsensusReactor) OnStop ¶
func (conR *ConsensusReactor) OnStop()
func (*ConsensusReactor) Receive ¶
func (conR *ConsensusReactor) Receive(chID uint64, src consensus.Peer, msgBytes []byte)
Implements Reactor NOTE: We process these messages even when we're fast_syncing. Messages affect either a peer state or the consensus state. Peer state updates can happen in parallel, but processing of proposals, block parts, and votes are ordered by the receiveRoutine NOTE: blocks on consensus state for proposals, block parts, and votes
func (*ConsensusReactor) RemovePeer ¶
func (conR *ConsensusReactor) RemovePeer(peer consensus.Peer, reason interface{})
Implements Reactor
func (*ConsensusReactor) SetEventSwitch ¶
func (conR *ConsensusReactor) SetEventSwitch(evsw types.EventSwitch)
implements events.Eventable
func (*ConsensusReactor) String ¶
func (conR *ConsensusReactor) String() string
type ConsensusState ¶
type ConsensusState struct { BaseService RoundState Epoch *ep.Epoch // Current Epoch // contains filtered or unexported fields }
Tracks consensus state across block heights and rounds.
func NewConsensusState ¶
func NewConsensusState(backend Backend, config cfg.Config, chainConfig *params.ChainConfig, cch core.CrossChainHelper, epoch *ep.Epoch) *ConsensusState
func (*ConsensusState) AddProposalBlockPart ¶
func (cs *ConsensusState) AddProposalBlockPart(height uint64, round int, part *types.Part, peerKey string) error
May block on send if queue is full.
func (*ConsensusState) BLSVerifySignAggr ¶
func (cs *ConsensusState) BLSVerifySignAggr(signAggr *types.SignAggr) (bool, error)
func (*ConsensusState) GetChainReader ¶
func (bs *ConsensusState) GetChainReader() consss.ChainReader
The +2/3 and other Precommit-votes for block at `height`. This Commit comes from block.LastCommit for `height+1`.
func (*ConsensusState) GetProposer ¶
func (cs *ConsensusState) GetProposer() *types.Validator
Sets our private validator account for signing votes.
func (*ConsensusState) GetRoundState ¶
func (cs *ConsensusState) GetRoundState() *RoundState
func (*ConsensusState) GetState ¶
func (cs *ConsensusState) GetState() *sm.State
func (*ConsensusState) GetValidators ¶
func (cs *ConsensusState) GetValidators() (uint64, []*types.Validator)
func (*ConsensusState) Initialize ¶
func (cs *ConsensusState) Initialize()
func (*ConsensusState) IsProposer ¶
func (cs *ConsensusState) IsProposer() bool
Returns true if this validator is the proposer.
func (*ConsensusState) LoadBlock ¶
func (cs *ConsensusState) LoadBlock(height uint64) *types.NCBlock
The +2/3 and other Precommit-votes for block at `height`. This Commit comes from block.LastCommit for `height+1`.
func (*ConsensusState) LoadCommit ¶
func (cs *ConsensusState) LoadCommit(height uint64) *types.Commit
func (*ConsensusState) LoadLastNeatConExtra ¶
func (cs *ConsensusState) LoadLastNeatConExtra() (*types.NeatConExtra, uint64)
func (*ConsensusState) LoadNeatConExtra ¶
func (cs *ConsensusState) LoadNeatConExtra(height uint64) (*types.NeatConExtra, uint64)
func (*ConsensusState) OnStart ¶
func (cs *ConsensusState) OnStart() error
func (*ConsensusState) OnStop ¶
func (cs *ConsensusState) OnStop()
func (*ConsensusState) ReconstructLastCommit ¶
func (cs *ConsensusState) ReconstructLastCommit(state *sm.State)
Reconstruct LastCommit from SeenCommit, which we saved along with the block, (which happens even before saving the state)
func (*ConsensusState) SetEventSwitch ¶
func (cs *ConsensusState) SetEventSwitch(evsw types.EventSwitch)
SetEventSwitch implements events.Eventable
func (*ConsensusState) SetPrivValidator ¶
func (cs *ConsensusState) SetPrivValidator(priv PrivValidator)
Sets our private validator account for signing votes.
func (*ConsensusState) SetProposal ¶
func (cs *ConsensusState) SetProposal(proposal *types.Proposal, peerKey string) error
May block on send if queue is full.
func (*ConsensusState) SetProposalAndBlock ¶
func (cs *ConsensusState) SetProposalAndBlock(proposal *types.Proposal, block *types.NCBlock, parts *types.PartSet, peerKey string) error
May block on send if queue is full.
func (*ConsensusState) SetTimeoutTicker ¶
func (cs *ConsensusState) SetTimeoutTicker(timeoutTicker TimeoutTicker)
Set the local timer
func (*ConsensusState) StartNewHeight ¶
func (cs *ConsensusState) StartNewHeight()
this function is called when the system starts or a block has been inserted into the insert could be self/other triggered anyway, we start/restart a new height with the latest block update
func (*ConsensusState) String ¶
func (cs *ConsensusState) String() string
func (*ConsensusState) UpdateToState ¶
func (cs *ConsensusState) UpdateToState(state *sm.State)
Updates ConsensusState and increments height to match thatRewardScheme of state. The round becomes 0 and cs.Step becomes RoundStepNewHeight.
func (*ConsensusState) ValidateTX4 ¶
func (cs *ConsensusState) ValidateTX4(b *types.NCBlock) error
func (*ConsensusState) Wait ¶
func (cs *ConsensusState) Wait()
NOTE: be sure to Stop() the event switch and drain any event channels or this may deadlock
type HasVoteMessage ¶
func (*HasVoteMessage) String ¶
func (m *HasVoteMessage) String() string
type HeightVoteSet ¶
type HeightVoteSet struct {
// contains filtered or unexported fields
}
Keeps track of all VoteSets from round 0 to round 'round'.
Also keeps track of up to one RoundVoteSet greater than 'round' from each peer, to facilitate catchup syncing of commits.
A commit is +2/3 precommits for a block at a round, but which round is not known in advance, so when a peer provides a precommit for a round greater than mtx.round, we create a new entry in roundVoteSets but also remember the peer to prevent abuse. We let each peer provide us with up to 2 unexpected "catchup" rounds. One for their LastCommit round, and another for the official commit round.
func NewHeightVoteSet ¶
func NewHeightVoteSet(chainID string, height uint64, valSet *types.ValidatorSet, logger log.Logger) *HeightVoteSet
func (*HeightVoteSet) AddVote ¶
Duplicate votes return added=false, err=nil. By convention, peerKey is "" if origin is self.
func (*HeightVoteSet) Height ¶
func (hvs *HeightVoteSet) Height() uint64
func (*HeightVoteSet) POLInfo ¶
func (hvs *HeightVoteSet) POLInfo() (polRound int, polBlockID types.BlockID)
Last round and blockID that has +2/3 prevotes for a particular block or nil. Returns -1 if no such round exists.
func (*HeightVoteSet) Precommits ¶
func (hvs *HeightVoteSet) Precommits(round int) *types.VoteSet
func (*HeightVoteSet) Reset ¶
func (hvs *HeightVoteSet) Reset(height uint64, valSet *types.ValidatorSet)
func (*HeightVoteSet) ResetTop2Round ¶
func (hvs *HeightVoteSet) ResetTop2Round(round int)
Create more RoundVoteSets up to round.
func (*HeightVoteSet) Round ¶
func (hvs *HeightVoteSet) Round() int
func (*HeightVoteSet) SetPeerMaj23 ¶
If a peer claims that it has 2/3 majority for given blockKey, call this. NOTE: if there are too many peers, or too much peer churn, this can cause memory issues. TODO: implement ability to remove peers too
func (*HeightVoteSet) SetRound ¶
func (hvs *HeightVoteSet) SetRound(round int)
Create more RoundVoteSets up to round.
func (*HeightVoteSet) String ¶
func (hvs *HeightVoteSet) String() string
func (*HeightVoteSet) StringIndented ¶
func (hvs *HeightVoteSet) StringIndented(indent string) string
type HeightVoteSignAggr ¶
type HeightVoteSignAggr struct {
// contains filtered or unexported fields
}
Keeps track of all signature aggregations from round 0 to round 'round'.
Also keeps track of up to one RoundVoteSignAggr greater than 'round' from each peer, to facilitate catchup syncing of commits.
A commit is +2/3 precommits for a block at a round, but which round is not known in advance, so when a peer provides a precommit for a round greater than mtx.round, we create a new entry in roundVoteSets but also remember the peer to prevent abuse. We let each peer provide us with up to 2 unexpected "catchup" rounds. One for their LastCommit round, and another for the official commit round.
func NewHeightVoteSignAggr ¶
func NewHeightVoteSignAggr(chainID string, height uint64, valSet *types.ValidatorSet, logger log.Logger) *HeightVoteSignAggr
func (*HeightVoteSignAggr) AddSignAggr ¶
func (hvs *HeightVoteSignAggr) AddSignAggr(signAggr *types.SignAggr) (added bool, err error)
Duplicate votes return added=false, err=nil.
func (*HeightVoteSignAggr) Height ¶
func (hvs *HeightVoteSignAggr) Height() uint64
func (*HeightVoteSignAggr) POLInfo ¶
func (hvs *HeightVoteSignAggr) POLInfo() (polRound int, polBlockID types.BlockID)
Last round and blockID that has +2/3 prevotes for a particular block or nil. Returns -1 if no such round exists.
func (*HeightVoteSignAggr) Precommits ¶
func (hvs *HeightVoteSignAggr) Precommits(round int) *types.SignAggr
func (*HeightVoteSignAggr) Prevotes ¶
func (hvs *HeightVoteSignAggr) Prevotes(round int) *types.SignAggr
func (*HeightVoteSignAggr) Reset ¶
func (hvs *HeightVoteSignAggr) Reset(height uint64, valSet *types.ValidatorSet)
func (*HeightVoteSignAggr) ResetTop2Round ¶
func (hvs *HeightVoteSignAggr) ResetTop2Round(round int)
Create more RoundVoteSets up to round.
func (*HeightVoteSignAggr) Round ¶
func (hvs *HeightVoteSignAggr) Round() int
func (*HeightVoteSignAggr) SetRound ¶
func (hvs *HeightVoteSignAggr) SetRound(round int)
Create more RoundVoteSignAggr up to round.
func (*HeightVoteSignAggr) String ¶
func (hvs *HeightVoteSignAggr) String() string
func (*HeightVoteSignAggr) StringIndented ¶
func (hvs *HeightVoteSignAggr) StringIndented(indent string) string
type Maj23SignAggrMessage ¶
func (*Maj23SignAggrMessage) String ¶
func (m *Maj23SignAggrMessage) String() string
type NewRoundStepMessage ¶
type NewRoundStepMessage struct { Height uint64 Round int Step RoundStepType SecondsSinceStartTime int LastCommitRound int }
For every height/round/step transition
func (*NewRoundStepMessage) String ¶
func (m *NewRoundStepMessage) String() string
type PeerRoundState ¶
type PeerRoundState struct { Height uint64 // Height peer is at Round int // Round peer is at, -1 if unknown. Step RoundStepType // Step peer is at StartTime time.Time // Estimated start of round 0 at this height Proposal bool // True if peer has proposal for this round ProposalBlockPartsHeader types.PartSetHeader // ProposalBlockParts *BitArray // ProposalPOLRound int // Proposal's POL round. -1 if none. ProposalPOL *BitArray // nil until ProposalPOLMessage received. Prevotes *BitArray // All votes peer has for this round Precommits *BitArray // All precommits peer has for this round // Fields used for BLS signature aggregation PrevoteMaj23SignAggr bool PrecommitMaj23SignAggr bool }
Read only when returned by PeerState.GetRoundState().
func (PeerRoundState) String ¶
func (prs PeerRoundState) String() string
func (PeerRoundState) StringIndented ¶
func (prs PeerRoundState) StringIndented(indent string) string
type PeerState ¶
type PeerState struct { Peer consensus.Peer PeerRoundState Connected bool // contains filtered or unexported fields }
func (*PeerState) ApplyCommitStepMessage ¶
func (ps *PeerState) ApplyCommitStepMessage(msg *CommitStepMessage)
func (*PeerState) ApplyHasVoteMessage ¶
func (ps *PeerState) ApplyHasVoteMessage(msg *HasVoteMessage)
func (*PeerState) ApplyNewRoundStepMessage ¶
func (ps *PeerState) ApplyNewRoundStepMessage(msg *NewRoundStepMessage)
func (*PeerState) ApplyProposalPOLMessage ¶
func (ps *PeerState) ApplyProposalPOLMessage(msg *ProposalPOLMessage)
func (*PeerState) ApplyVoteSetBitsMessage ¶
func (ps *PeerState) ApplyVoteSetBitsMessage(msg *VoteSetBitsMessage, ourVotes *BitArray)
The peer has responded with a bitarray of votes that it has of the corresponding BlockID. ourVotes: BitArray of votes we have for msg.BlockID NOTE: if ourVotes is nil (e.g. msg.Height < rs.Height), we conservatively overwrite ps's votes w/ msg.Votes.
func (*PeerState) Disconnect ¶
func (ps *PeerState) Disconnect()
func (*PeerState) EnsureVoteBitArrays ¶
NOTE: It's important to make sure that numValidators actually matches what the node sees as the number of validators for height.
func (*PeerState) GetHeight ¶
Returns an atomic snapshot of the PeerRoundState's height used by the mempool to ensure peers are caught up before broadcasting new txs
func (*PeerState) GetRoundState ¶
func (ps *PeerState) GetRoundState() *PeerRoundState
Returns an atomic snapshot of the PeerRoundState. There's no point in mutating it since it won't change PeerState.
func (*PeerState) PickSendSignAggr ¶
PickSendSignAggr sends signature aggregation to peer. Returns true if vote was sent.
func (*PeerState) PickSendVote ¶
func (ps *PeerState) PickSendVote(votes types.VoteSetReader) (ok bool)
PickVoteToSend sends vote to peer. Returns true if vote was sent.
func (*PeerState) PickVoteToSend ¶
votes: Must be the correct Size() for the Height().
func (*PeerState) SetHasMaj23SignAggr ¶
Received msg saying proposer has 2/3+ votes including the signature aggregation
func (*PeerState) SetHasProposal ¶
func (*PeerState) SetHasProposalBlockPart ¶
func (*PeerState) SetHasVote ¶
func (*PeerState) StringIndented ¶
type PrivValidator ¶
type ProposalMessage ¶
func (*ProposalMessage) String ¶
func (m *ProposalMessage) String() string
type ProposalPOLMessage ¶
func (*ProposalPOLMessage) String ¶
func (m *ProposalPOLMessage) String() string
type RoundState ¶
type RoundState struct { Height uint64 // Height we are working on Round int Step RoundStepType StartTime time.Time CommitTime time.Time // Subjective time when +2/3 precommits for Block at Round were found Validators *types.ValidatorSet Proposal *types.Proposal ProposalBlock *types.NCBlock ProposalBlockParts *types.PartSet ProposerPeerKey string // Proposer's peer key LockedRound int LockedBlock *types.NCBlock LockedBlockParts *types.PartSet Votes *HeightVoteSet VoteSignAggr *HeightVoteSignAggr CommitRound int // // Following fields are used for NeatCon/BLS signature aggregation PrevoteMaj23SignAggr *types.SignAggr PrecommitMaj23SignAggr *types.SignAggr // contains filtered or unexported fields }
Immutable when returned from ConsensusState.GetRoundState() TODO: Actually, only the top pointer is copied, so access to field pointers is still racey
func (*RoundState) RoundStateEvent ¶
func (rs *RoundState) RoundStateEvent() types.EventDataRoundState
func (*RoundState) String ¶
func (rs *RoundState) String() string
func (*RoundState) StringIndented ¶
func (rs *RoundState) StringIndented(indent string) string
func (*RoundState) StringShort ¶
func (rs *RoundState) StringShort() string
type RoundStepType ¶
type RoundStepType uint8 // These must be numeric, ordered.
func (RoundStepType) String ¶
func (rs RoundStepType) String() string
type RoundVoteSignAggr ¶
type TimeoutParams ¶
type TimeoutParams struct { WaitForMinerBlock0 int Propose0 int ProposeDelta int Prevote0 int PrevoteDelta int Precommit0 int PrecommitDelta int Commit0 int SkipTimeoutCommit bool }
TimeoutParams holds timeouts and deltas for each round step. All timeouts and deltas in milliseconds.
func InitTimeoutParamsFromConfig ¶
func InitTimeoutParamsFromConfig(config cfg.Config) *TimeoutParams
InitTimeoutParamsFromConfig initializes parameters from config
func (*TimeoutParams) Commit ¶
func (tp *TimeoutParams) Commit(t time.Time) time.Time
After receiving +2/3 precommits for a single block (a commit), wait this long for stragglers in the next height's RoundStepNewHeight
func (*TimeoutParams) Precommit ¶
func (tp *TimeoutParams) Precommit(round int) time.Duration
In NeatCon, wait for this long for Non-Proposer validator to vote precommit
func (*TimeoutParams) Prevote ¶
func (tp *TimeoutParams) Prevote(round int) time.Duration
In NeatCon, wait for this long for Non-Proposer validator to vote prevote the more round, the more time to wait for validator's prevote
func (*TimeoutParams) Propose ¶
func (tp *TimeoutParams) Propose(round int) time.Duration
In NeatCon, wait for this long for Proposer to send proposal the more round, the more time to wait for proposer's proposal
func (*TimeoutParams) WaitForMinerBlock ¶
func (tp *TimeoutParams) WaitForMinerBlock() time.Duration
Wait this long for a proposal
type TimeoutTicker ¶
type TimeoutTicker interface { Start() (bool, error) Stop() bool Chan() <-chan timeoutInfo // on which to receive a timeout ScheduleTimeout(ti timeoutInfo) // reset the timer }
TimeoutTicker is a timer that schedules timeouts conditional on the height/round/step in the timeoutInfo. The timeoutInfo.Duration may be non-positive.
func NewTimeoutTicker ¶
func NewTimeoutTicker(logger log.Logger) TimeoutTicker
type VRFProposer ¶
type VRFProposer struct { Height uint64 Round int Proposer *types.Validator // contains filtered or unexported fields }
-------------------------------------
type VoteMessage ¶
func (*VoteMessage) String ¶
func (m *VoteMessage) String() string