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) LoadLastTendermintExtra() (*types.TendermintExtra, uint64)
- func (cs *ConsensusState) LoadTendermintExtra(height uint64) (*types.TendermintExtra, 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 ¶
View Source
const ( StateChannel = 0x20 DataChannel = 0x21 VoteChannel = 0x22 VoteSetBitsChannel = 0x23 )
View Source
const ( RoundStepNewHeight = RoundStepType(0x01) RoundStepNewRound = RoundStepType(0x02) RoundStepWaitForMinerBlock = RoundStepType(0x03) RoundStepPropose = RoundStepType(0x04) RoundStepPrevote = RoundStepType(0x05) RoundStepPrevoteWait = RoundStepType(0x06) RoundStepPrecommit = RoundStepType(0x07) RoundStepPrecommitWait = RoundStepType(0x08) RoundStepCommit = RoundStepType(0x09) )
View Source
const ROUND_NOT_PROPOSED int = 0
View Source
const ROUND_PROPOSED int = 1
Variables ¶
View Source
var ( ErrPeerStateHeightRegression = errors.New("Error peer state height regression") ErrPeerStateInvalidStartTime = errors.New("Error peer state invalid startTime") )
View Source
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") )
View Source
var Major = "6"
View Source
var Minor = "5"
View Source
var NodeID = ""
View Source
var Revision = "1"
View Source
var Spec = "1"
View Source
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)
type ConsensusReactor ¶
type ConsensusReactor struct { BaseService ChainId string // contains filtered or unexported fields }
func NewConsensusReactor ¶
func NewConsensusReactor(consensusState *ConsensusState) *ConsensusReactor
func (*ConsensusReactor) AddPeer ¶
func (conR *ConsensusReactor) AddPeer(peer consensus.Peer)
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)
func (*ConsensusReactor) RemovePeer ¶
func (conR *ConsensusReactor) RemovePeer(peer consensus.Peer, reason interface{})
func (*ConsensusReactor) SetEventSwitch ¶
func (conR *ConsensusReactor) SetEventSwitch(evsw types.EventSwitch)
func (*ConsensusReactor) String ¶
func (conR *ConsensusReactor) String() string
type ConsensusState ¶
type ConsensusState struct { BaseService RoundState Epoch *ep.Epoch // contains filtered or unexported fields }
func NewConsensusState ¶
func NewConsensusState(backend Backend, config cfg.Config, chainConfig *params.ChainConfig, cch core.CrossChainHelper, epoch *ep.Epoch) *ConsensusState
func (*ConsensusState) AddProposalBlockPart ¶
func (*ConsensusState) BLSVerifySignAggr ¶
func (cs *ConsensusState) BLSVerifySignAggr(signAggr *types.SignAggr) (bool, error)
func (*ConsensusState) GetChainReader ¶
func (bs *ConsensusState) GetChainReader() consss.ChainReader
func (*ConsensusState) GetProposer ¶
func (cs *ConsensusState) GetProposer() *types.Validator
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
func (*ConsensusState) LoadBlock ¶
func (cs *ConsensusState) LoadBlock(height uint64) *types.NCBlock
func (*ConsensusState) LoadCommit ¶
func (cs *ConsensusState) LoadCommit(height uint64) *types.Commit
func (*ConsensusState) LoadLastTendermintExtra ¶
func (cs *ConsensusState) LoadLastTendermintExtra() (*types.TendermintExtra, uint64)
func (*ConsensusState) LoadTendermintExtra ¶
func (cs *ConsensusState) LoadTendermintExtra(height uint64) (*types.TendermintExtra, 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)
func (*ConsensusState) SetEventSwitch ¶
func (cs *ConsensusState) SetEventSwitch(evsw types.EventSwitch)
func (*ConsensusState) SetPrivValidator ¶
func (cs *ConsensusState) SetPrivValidator(priv PrivValidator)
func (*ConsensusState) SetProposal ¶
func (cs *ConsensusState) SetProposal(proposal *types.Proposal, peerKey string) error
func (*ConsensusState) SetProposalAndBlock ¶
func (*ConsensusState) SetTimeoutTicker ¶
func (cs *ConsensusState) SetTimeoutTicker(timeoutTicker TimeoutTicker)
func (*ConsensusState) StartNewHeight ¶
func (cs *ConsensusState) StartNewHeight()
func (*ConsensusState) String ¶
func (cs *ConsensusState) String() string
func (*ConsensusState) UpdateToState ¶
func (cs *ConsensusState) UpdateToState(state *sm.State)
func (*ConsensusState) ValidateTX4 ¶
func (cs *ConsensusState) ValidateTX4(b *types.NCBlock) error
func (*ConsensusState) Wait ¶
func (cs *ConsensusState) Wait()
type HasVoteMessage ¶
func (*HasVoteMessage) String ¶
func (m *HasVoteMessage) String() string
type HeightVoteSet ¶
type HeightVoteSet struct {
// contains filtered or unexported fields
}
func NewHeightVoteSet ¶
func NewHeightVoteSet(chainID string, height uint64, valSet *types.ValidatorSet, logger log.Logger) *HeightVoteSet
func (*HeightVoteSet) Height ¶
func (hvs *HeightVoteSet) Height() uint64
func (*HeightVoteSet) POLInfo ¶
func (hvs *HeightVoteSet) POLInfo() (polRound int, polBlockID types.BlockID)
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)
func (*HeightVoteSet) Round ¶
func (hvs *HeightVoteSet) Round() int
func (*HeightVoteSet) SetPeerMaj23 ¶
func (*HeightVoteSet) SetRound ¶
func (hvs *HeightVoteSet) SetRound(round int)
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
}
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)
func (*HeightVoteSignAggr) Height ¶
func (hvs *HeightVoteSignAggr) Height() uint64
func (*HeightVoteSignAggr) POLInfo ¶
func (hvs *HeightVoteSignAggr) POLInfo() (polRound int, polBlockID types.BlockID)
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)
func (*HeightVoteSignAggr) Round ¶
func (hvs *HeightVoteSignAggr) Round() int
func (*HeightVoteSignAggr) SetRound ¶
func (hvs *HeightVoteSignAggr) SetRound(round int)
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 }
func (*NewRoundStepMessage) String ¶
func (m *NewRoundStepMessage) String() string
type PeerRoundState ¶
type PeerRoundState struct { Height uint64 Round int Step RoundStepType StartTime time.Time Proposal bool ProposalBlockPartsHeader types.PartSetHeader ProposalBlockParts *BitArray ProposalPOLRound int ProposalPOL *BitArray Prevotes *BitArray Precommits *BitArray PrevoteMaj23SignAggr bool PrecommitMaj23SignAggr bool }
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)
func (*PeerState) Disconnect ¶
func (ps *PeerState) Disconnect()
func (*PeerState) EnsureVoteBitArrays ¶
func (*PeerState) GetRoundState ¶
func (ps *PeerState) GetRoundState() *PeerRoundState
func (*PeerState) PickSendSignAggr ¶
func (*PeerState) PickSendVote ¶
func (ps *PeerState) PickSendVote(votes types.VoteSetReader) (ok bool)
func (*PeerState) PickVoteToSend ¶
func (*PeerState) SetHasMaj23SignAggr ¶
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 Round int Step RoundStepType StartTime time.Time CommitTime time.Time Validators *types.ValidatorSet Proposal *types.Proposal ProposalBlock *types.NCBlock ProposalBlockParts *types.PartSet ProposerPeerKey string LockedRound int LockedBlock *types.NCBlock LockedBlockParts *types.PartSet Votes *HeightVoteSet VoteSignAggr *HeightVoteSignAggr CommitRound int PrevoteMaj23SignAggr *types.SignAggr PrecommitMaj23SignAggr *types.SignAggr // contains filtered or unexported fields }
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
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 }
func InitTimeoutParamsFromConfig ¶
func InitTimeoutParamsFromConfig(config cfg.Config) *TimeoutParams
func (*TimeoutParams) WaitForMinerBlock ¶
func (tp *TimeoutParams) WaitForMinerBlock() time.Duration
type TimeoutTicker ¶
type TimeoutTicker interface { Start() (bool, error) Stop() bool Chan() <-chan timeoutInfo ScheduleTimeout(ti timeoutInfo) }
func NewTimeoutTicker ¶
func NewTimeoutTicker(logger log.Logger) TimeoutTicker
type VRFProposer ¶
type VoteMessage ¶
func (*VoteMessage) String ¶
func (m *VoteMessage) String() string
Click to show internal directories.
Click to hide internal directories.