Versions in this module Expand all Collapse all v1 v1.10.3 Dec 16, 2024 v1.10.2 Dec 15, 2024 Changes in this version + const CommitSigReceiverTimeout + const CommitSigSenderTimeout + const MaxBlockNumDiff + const MaxViewIDDiff + const RetryIntervalInSec + const ValidPayloadLength + var NIL = []byte + type Consensus struct + AggregateSig bool + BlockPeriod time.Duration + Decider quorum.Decider + IgnoreViewIDCheck *abool.AtomicBool + LeaderPubKey *bls.PublicKeyWrapper + MinPeers int + NextBlockDue time.Time + PRndChannel chan []byte + PostConsensusJob func(*types.Block) error + RndChannel chan [vdfAndSeedSize]byte + ShardID uint32 + SlashChan chan slash.Record + VerifiedNewBlock chan *types.Block + func New(host p2p.Host, shard uint32, multiBLSPriKey multibls.PrivateKeys, ...) (*Consensus, error) + func (consensus *Consensus) AddConsensusLastMile() error + func (consensus *Consensus) AddPubkeyMetrics() + func (consensus *Consensus) Beaconchain() core.BlockChain + func (consensus *Consensus) BlockChannel(newBlock *types.Block) + func (consensus *Consensus) BlockCommitSigs(blockNum uint64) ([]byte, error) + func (consensus *Consensus) BlockNum() uint64 + func (consensus *Consensus) BlockVerifier(newBlock *types.Block) error + func (consensus *Consensus) Blockchain() core.BlockChain + func (consensus *Consensus) BlocksNotSynchronized(reason string) + func (consensus *Consensus) BlocksSynchronized() + func (consensus *Consensus) ChainReader() engine.ChainReader + func (consensus *Consensus) DeleteBlocksLessThan(number uint64) + func (consensus *Consensus) DeleteMessagesLessThan(number uint64) + func (consensus *Consensus) FBFTLog() FBFT + func (consensus *Consensus) FinishFinalityCount() + func (consensus *Consensus) GenerateVdfAndProof(newBlock *types.Block, vrfBlockNumbers []uint64) + func (consensus *Consensus) GenerateVrfAndProof(newHeader *block.Header) error + func (consensus *Consensus) GetCommitSigChannel() chan []byte + func (consensus *Consensus) GetConsensusMode() string + func (consensus *Consensus) GetConsensusPhase() string + func (consensus *Consensus) GetCurBlockViewID() uint64 + func (consensus *Consensus) GetFinality() int64 + func (consensus *Consensus) GetHost() p2p.Host + func (consensus *Consensus) GetLastMileBlockIter(bnStart uint64, cb func(iter *LastMileBlockIter) error) error + func (consensus *Consensus) GetLeaderPubKey() *bls_cosi.PublicKeyWrapper + func (consensus *Consensus) GetLogger() *zerolog.Logger + func (consensus *Consensus) GetNextRnd() ([vdFAndProofSize]byte, [32]byte, error) + func (consensus *Consensus) GetPrivateKeys() multibls.PrivateKeys + func (consensus *Consensus) GetPublicKeys() multibls.PublicKeys + func (consensus *Consensus) GetReadySignal() chan ProposalType + func (consensus *Consensus) GetViewChangingID() uint64 + func (consensus *Consensus) HandleMessageUpdate(ctx context.Context, peer libp2p_peer.ID, msg *msg_pb.Message, ...) error + func (consensus *Consensus) InitConsensusWithValidators() (err error) + func (consensus *Consensus) IsBackup() bool + func (consensus *Consensus) IsLeader() bool + func (consensus *Consensus) IsValidatorInCommittee(pubKey bls.SerializedPublicKey) bool + func (consensus *Consensus) IsViewChangingMode() bool + func (consensus *Consensus) Mode() Mode + func (consensus *Consensus) NumSignaturesIncludedInBlock(block *types.Block) uint32 + func (consensus *Consensus) ParseFBFTMessage(msg *msg_pb.Message) (*FBFTMessage, error) + func (consensus *Consensus) ReadSignatureBitmapPayload(recvPayload []byte, offset int) (*bls_core.Sign, *bls_cosi.Mask, error) + func (consensus *Consensus) ReadySignal(p ProposalType) + func (consensus *Consensus) RegisterPRndChannel(pRndChannel chan []byte) + func (consensus *Consensus) RegisterRndChannel(rndChannel chan [548]byte) + func (consensus *Consensus) Registry() *registry.Registry + func (consensus *Consensus) ResetViewChangeState() + func (consensus *Consensus) SetBlockNum(blockNum uint64) + func (consensus *Consensus) SetCurBlockViewID(viewID uint64) uint64 + func (consensus *Consensus) SetDownloader(d downloader) + func (consensus *Consensus) SetIsBackup(isBackup bool) + func (consensus *Consensus) SetLeaderPubKey(pub *bls_cosi.PublicKeyWrapper) + func (consensus *Consensus) SetMode(m Mode) + func (consensus *Consensus) SetViewChangingID(viewID uint64) + func (consensus *Consensus) SetViewIDs(height uint64) + func (consensus *Consensus) Start(stopChan chan struct{}) + func (consensus *Consensus) StartChannel() + func (consensus *Consensus) StartFinalityCount() + func (consensus *Consensus) Tick() + func (consensus *Consensus) UpdateConsensusInformation() Mode + func (consensus *Consensus) UpdateLeaderMetrics(numCommits float64, blockNum float64) + func (consensus *Consensus) UpdatePreimageGenerationMetrics(preimageStart uint64, preimageEnd uint64, lastPreimageImport uint64, ...) + func (consensus *Consensus) UpdatePublicKeys(pubKeys, allowlist []bls_cosi.PublicKeyWrapper) int64 + func (consensus *Consensus) UpdateValidatorMetrics(numSig float64, blockNum float64) + func (consensus *Consensus) ValidateNewBlock(recvMsg *FBFTMessage) (*types.Block, error) + func (consensus *Consensus) ValidateVdfAndProof(headerObj *block.Header) bool + func (consensus *Consensus) VdfSeedSize() int + func (consensus *Consensus) WaitForNewRandomness() + type DownloadAsync interface + DownloadAsync func() + type FBFT interface + AddBlock func(block *types.Block) + AddVerifiedMessage func(msg *FBFTMessage) + DeleteBlockByNumber func(number uint64) + GetBlockByHash func(hash common.Hash) *types.Block + GetMessagesByTypeSeq func(typ msg_pb.MessageType, blockNum uint64) []*FBFTMessage + GetMessagesByTypeSeqHash func(typ msg_pb.MessageType, blockNum uint64, blockHash common.Hash) []*FBFTMessage + IsBlockVerified func(hash common.Hash) bool + type FBFTLog struct + func NewFBFTLog() *FBFTLog + func (log *FBFTLog) AddBlock(block *types.Block) + func (log *FBFTLog) AddNotVerifiedMessage(msg *FBFTMessage) + func (log *FBFTLog) AddVerifiedMessage(msg *FBFTMessage) + func (log *FBFTLog) DeleteBlockByNumber(number uint64) + func (log *FBFTLog) FindMessageByMaxViewID(msgs []*FBFTMessage) *FBFTMessage + func (log *FBFTLog) GetBlockByHash(hash common.Hash) *types.Block + func (log *FBFTLog) GetBlocksByNumber(number uint64) []*types.Block + func (log *FBFTLog) GetCommittedBlockAndMsgsFromNumber(bn uint64, logger *zerolog.Logger) (*types.Block, *FBFTMessage, error) + func (log *FBFTLog) GetMessagesByTypeSeq(typ msg_pb.MessageType, blockNum uint64) []*FBFTMessage + func (log *FBFTLog) GetMessagesByTypeSeqHash(typ msg_pb.MessageType, blockNum uint64, blockHash common.Hash) []*FBFTMessage + func (log *FBFTLog) GetMessagesByTypeSeqView(typ msg_pb.MessageType, blockNum uint64, viewID uint64) []*FBFTMessage + func (log *FBFTLog) GetMessagesByTypeSeqViewHash(typ msg_pb.MessageType, blockNum uint64, viewID uint64, blockHash common.Hash) []*FBFTMessage + func (log *FBFTLog) GetNotVerifiedCommittedMessages(blockNum uint64, viewID uint64, blockHash common.Hash) []*FBFTMessage + func (log *FBFTLog) HasMatchingAnnounce(blockNum uint64, blockHash common.Hash) bool + func (log *FBFTLog) HasMatchingPrepared(blockNum uint64, blockHash common.Hash) bool + func (log *FBFTLog) HasMatchingViewAnnounce(blockNum uint64, viewID uint64, blockHash common.Hash) bool + func (log *FBFTLog) HasMatchingViewPrepared(blockNum uint64, viewID uint64, blockHash common.Hash) bool + func (log *FBFTLog) IsBlockVerified(hash common.Hash) bool + func (log *FBFTLog) MarkBlockVerified(block *types.Block) + func (log *FBFTLog) PruneCacheBeforeBlock(bn uint64) + type FBFTMessage struct + Block []byte + BlockHash common.Hash + BlockNum uint64 + LeaderPubkey *bls.PublicKeyWrapper + M2AggSig *bls_core.Sign + M2Bitmap *bls_cosi.Mask + M3AggSig *bls_core.Sign + M3Bitmap *bls_cosi.Mask + MessageType msg_pb.MessageType + Payload []byte + SenderPubkeyBitmap []byte + SenderPubkeys []*bls.PublicKeyWrapper + Verified bool + ViewID uint64 + ViewchangeSig *bls_core.Sign + ViewidSig *bls_core.Sign + func ParseNewViewMessage(msg *msg_pb.Message, members multibls.PublicKeys) (*FBFTMessage, error) + func ParseViewChangeMessage(msg *msg_pb.Message) (*FBFTMessage, error) + func (m *FBFTMessage) HasSingleSender() bool + func (m *FBFTMessage) Hash() []byte + func (m *FBFTMessage) String() string + type FBFTPhase byte + const FBFTAnnounce + const FBFTCommit + const FBFTPrepare + func (p FBFTPhase) String() string + type LastMileBlockIter struct + func (iter *LastMileBlockIter) Next() *types.Block + type MessageRetry struct + type MessageSender struct + func NewMessageSender(host p2p.Host) *MessageSender + func (sender *MessageSender) DelayedSendWithRetry(blockNum uint64, msgType msg_pb.MessageType, groups []nodeconfig.GroupID, ...) + func (sender *MessageSender) Reset(blockNum uint64) + func (sender *MessageSender) Retry(msgRetry *MessageRetry) + func (sender *MessageSender) SendWithRetry(blockNum uint64, msgType msg_pb.MessageType, groups []nodeconfig.GroupID, ...) error + func (sender *MessageSender) SendWithoutRetry(groups []nodeconfig.GroupID, p2pMsg []byte) error + func (sender *MessageSender) StopAllRetriesExceptCommitted() + func (sender *MessageSender) StopRetry(msgType msg_pb.MessageType) + type Mode byte + const Listening + const Normal + const NormalBackup + const Syncing + const ViewChanging + func (m Mode) String() string + type NetworkMessage struct + Bytes []byte + FBFTMsg *FBFTMessage + MessageType msg_pb.MessageType + OptionalAggregateSignature *bls_core.Sign + type ProposalType byte + const AsyncProposal + const SyncProposal + type State struct + func (pm *State) GetCurBlockViewID() uint64 + func (pm *State) GetViewChangeDuraion() time.Duration + func (pm *State) GetViewChangingID() uint64 + func (pm *State) Mode() Mode + func (pm *State) SetCurBlockViewID(viewID uint64) uint64 + func (pm *State) SetIsBackup(isBackup bool) + func (pm *State) SetMode(s Mode) + func (pm *State) SetViewChangingID(id uint64) + type TimeoutType int + func (t TimeoutType) String() string