Versions in this module Expand all Collapse all v0 v0.4.0 Mar 25, 2024 v0.3.0 Feb 28, 2024 Changes in this version + var ErrDuplicateChangeReq = errors.New("duplicate ir change request") + var ErrVoteIsNil = errors.New("vote is nil") + type ConsensusManager struct + func NewDistributedAbConsensusManager(nodeID peer.ID, rg *genesis.RootGenesis, ...) (*ConsensusManager, error) + func (x *ConsensusManager) CertificationResult() <-chan *types.UnicityCertificate + func (x *ConsensusManager) GetLatestUnicityCertificate(id types.SystemID) (*types.UnicityCertificate, error) + func (x *ConsensusManager) RequestCertification(ctx context.Context, cr consensus.IRChangeRequest) error + func (x *ConsensusManager) Run(ctx context.Context) error + type ConsensusWithSignatures struct + type IRChangeReqVerifier struct + func NewIRChangeReqVerifier(c *consensus.Parameters, pInfo partitions.PartitionConfiguration, ...) (*IRChangeReqVerifier, error) + func (x *IRChangeReqVerifier) VerifyIRChangeReq(round uint64, irChReq *abtypes.IRChangeReq) (*storage.InputData, error) + type IRChangeVerifier interface + VerifyIRChangeReq func(round uint64, irChReq *drctypes.IRChangeReq) (*storage.InputData, error) + type InProgressFn func(id32 types.SystemID) *types.InputRecord + type IrReqBuffer struct + func NewIrReqBuffer(log *slog.Logger) *IrReqBuffer + func (x *IrReqBuffer) Add(round uint64, irChReq *drctypes.IRChangeReq, ver IRChangeVerifier) error + func (x *IrReqBuffer) GeneratePayload(round uint64, timeouts []types.SystemID, inProgress InProgressFn) *drctypes.Payload + func (x *IrReqBuffer) IsChangeInBuffer(id types.SystemID) bool + type Leader interface + GetLeaderForRound func(round uint64) peer.ID + GetNodes func() []peer.ID + Update func(qc *drctypes.QuorumCert, currentRound uint64, b leader.BlockLoader) error + type Observability interface + Logger func() *slog.Logger + Meter func(name string, opts ...metric.MeterOption) metric.Meter + Tracer func(name string, options ...trace.TracerOption) trace.Tracer + type Pacemaker struct + func NewPacemaker(minRoundLen, maxRoundLen time.Duration, observe Observability) (*Pacemaker, error) + func (x *Pacemaker) AdvanceRoundQC(ctx context.Context, qc *types.QuorumCert) bool + func (x *Pacemaker) AdvanceRoundTC(ctx context.Context, tc *types.TimeoutCert) + func (x *Pacemaker) GetCurrentRound() uint64 + func (x *Pacemaker) GetTimeoutVote() *abdrc.TimeoutMsg + func (x *Pacemaker) GetVoted() *abdrc.VoteMsg + func (x *Pacemaker) LastRoundTC() *types.TimeoutCert + func (x *Pacemaker) RegisterTimeoutVote(ctx context.Context, vote *abdrc.TimeoutMsg, quorum QuorumInfo) (*types.TimeoutCert, error) + func (x *Pacemaker) RegisterVote(vote *abdrc.VoteMsg, quorum QuorumInfo) (*types.QuorumCert, bool, error) + func (x *Pacemaker) Reset(ctx context.Context, highQCRound uint64, lastTc *types.TimeoutCert, ...) + func (x *Pacemaker) RoundQC() *types.QuorumCert + func (x *Pacemaker) SetTimeoutVote(vote *abdrc.TimeoutMsg) + func (x *Pacemaker) SetVoted(vote *abdrc.VoteMsg) + func (x *Pacemaker) StatusEvents() <-chan paceMakerStatus + func (x *Pacemaker) Stop() + type PartitionTimeout interface + GetT2Timeouts func(currenRound uint64) ([]types.SystemID, error) + type PartitionTimeoutGenerator struct + func NewLucBasedT2TimeoutGenerator(c *consensus.Parameters, pInfo partitions.PartitionConfiguration, ...) (*PartitionTimeoutGenerator, error) + func (x *PartitionTimeoutGenerator) GetT2Timeouts(currentRound uint64) ([]types.SystemID, error) + type QuorumInfo interface + GetMaxFaultyNodes func() uint32 + GetQuorumThreshold func() uint32 + type RootNet interface + ReceivedChannel func() <-chan any + Send func(ctx context.Context, msg any, receivers ...peer.ID) error + type RootTrustBase struct + func NewRootTrustBase(keyMap map[string]crypto.Verifier, threshold uint32) (*RootTrustBase, error) + func NewRootTrustBaseFromGenesis(genesisRoot *genesis.GenesisRootRecord) (*RootTrustBase, error) + func (r *RootTrustBase) GetMaxFaultyNodes() uint32 + func (r *RootTrustBase) GetQuorumThreshold() uint32 + func (r *RootTrustBase) GetVerifier(nodeID peer.ID) (crypto.Verifier, error) + func (r *RootTrustBase) GetVerifiers() map[string]crypto.Verifier + func (r *RootTrustBase) ValidateQuorum(authors []string) error + func (r *RootTrustBase) VerifyBytes(bytes []byte, sig []byte, author peer.ID) error + func (r *RootTrustBase) VerifyQuorumSignatures(hash []byte, signatures map[string][]byte) error + func (r *RootTrustBase) VerifySignature(hash []byte, sig []byte, author peer.ID) error + type SafetyModule struct + func NewSafetyModule(id string, signer crypto.Signer, db keyvaluedb.KeyValueDB) (*SafetyModule, error) + func (s *SafetyModule) GetHighestQcRound() uint64 + func (s *SafetyModule) GetHighestVotedRound() uint64 + func (s *SafetyModule) MakeVote(block *drctypes.BlockData, execStateID []byte, highQC *drctypes.QuorumCert, ...) (*abdrc.VoteMsg, error) + func (s *SafetyModule) SetHighestQcRound(highestQcRound uint64) + func (s *SafetyModule) SetHighestVotedRound(highestVotedRound uint64) + func (s *SafetyModule) Sign(msg Signer) error + func (s *SafetyModule) SignTimeout(tmoVote *abdrc.TimeoutMsg, lastRoundTC *drctypes.TimeoutCert) error + type Signer interface + Sign func(s crypto.Signer) error + type State interface + GetCertificate func(id types.SystemID) (*types.UnicityCertificate, error) + GetCertificates func() map[types.SystemID]*types.UnicityCertificate + IsChangeInProgress func(id types.SystemID) *types.InputRecord + type VoteRegister struct + func NewVoteRegister() *VoteRegister + func (v *VoteRegister) InsertTimeoutVote(timeout *abdrc.TimeoutMsg, quorumInfo QuorumInfo) (*drctypes.TimeoutCert, uint32, error) + func (v *VoteRegister) InsertVote(vote *abdrc.VoteMsg, quorumInfo QuorumInfo) (*drctypes.QuorumCert, error) + func (v *VoteRegister) Reset()