Documentation
¶
Index ¶
- Constants
- Variables
- func BatchSequences(seqs []uint64, numNodes uint64, maxSize uint64) [][]uint64
- func GetLatestVerifiedQuorumRound(round *Round, emptyNotarization *common.EmptyNotarization) *common.VerifiedQuorumRound
- func LeaderForRound(nodes []common.NodeID, r uint64) common.NodeID
- func NewRandomSource() (*rand.Rand, error)
- func NodeIDsFromVotes[VS voteSigner](votes []VS) []common.NodeID
- func RetrieveLastIndexFromStorage(s common.Storage) (*common.VerifiedFinalizedBlock, error)
- func VerifyQC(qc common.QuorumCertificate, isQuorum func(signers []common.NodeID) bool, ...) error
- type EmptyVoteSet
- type Epoch
- func (e *Epoch) AdvanceTime(t time.Time)
- func (e *Epoch) HandleMessage(msg *common.Message, from common.NodeID) error
- func (e *Epoch) Metadata() common.ProtocolMetadata
- func (e *Epoch) Start() error
- func (e *Epoch) Stop()
- func (e *Epoch) VerifyBlockMessageVote(from common.NodeID, md common.BlockHeader, vote common.Vote) error
- type EpochConfig
- type Monitor
- type NotarizationTime
- type OneTimeVerifier
- type ReplicationState
- func (r *ReplicationState) AdvanceTime(now time.Time)
- func (r *ReplicationState) Close()
- func (r *ReplicationState) CreateDependencyTasks(parent *common.Digest, parentSeq uint64, emptyRounds []uint64)
- func (r *ReplicationState) DeleteRound(round uint64)
- func (r *ReplicationState) DeleteSeq(seq uint64)
- func (r *ReplicationState) GetBlockWithSeq(seq uint64) common.Block
- func (r *ReplicationState) GetFinalizedBlockForSequence(seq uint64) (common.Block, *common.Finalization, bool)
- func (r *ReplicationState) GetHighestRound() uint64
- func (r *ReplicationState) GetLowestRound() *common.QuorumRound
- func (r *ReplicationState) MaybeAdvanceState(nextSequenceToCommit uint64, currentRound uint64, lastCommittedRound uint64)
- func (r *ReplicationState) ReceivedFutureFinalization(finalization *common.Finalization, nextSeqToCommit uint64)
- func (r *ReplicationState) ReceivedFutureRound(round, seq, currentRound uint64, signers []common.NodeID)
- func (r *ReplicationState) ResendFinalizationRequest(seq uint64, signers []common.NodeID)
- func (r *ReplicationState) StoreQuorumRound(round *common.QuorumRound)
- type Round
- type Sender
Constants ¶
const ( DefaultMaxRoundWindow = 10 DefaultProcessingBlocks = 500 DefaultMaxProposalWaitTime = 5 * time.Second DefaultReplicationRequestTimeout = 5 * time.Second DefaultEmptyVoteRebroadcastTimeout = 5 * time.Second DefaultFinalizeVoteRebroadcastTimeout = 6 * time.Second EmptyVoteTimeoutID = "rebroadcast_empty_vote" // DefaultMaxReplicationResponseSize is the max size of a replication response. the host node rejects messages larger // than 2 MiB. we cap at 80% (4/5) same as the host node (see utils/constants/networking.go) DefaultMaxReplicationResponseSize = host.MaxContainersLen )
Variables ¶
var (
ErrAlreadyStarted = errors.New("epoch already started")
)
Functions ¶
func BatchSequences ¶
BatchSequences distributes [seqs] as evenly as possible among [numNodes] nodes, returning one batch per node share. Every batch contains at most [maxSize] sequences. a share exceeding [maxSize] is emitted as multiple batches. [seqs] does not need to be sorted or contiguous, it is sorted in place, and the returned batches are sub-slices of it, ordered from lowest to highest sequence.
func GetLatestVerifiedQuorumRound ¶
func GetLatestVerifiedQuorumRound(round *Round, emptyNotarization *common.EmptyNotarization) *common.VerifiedQuorumRound
GetLatestVerifiedQuorumRound returns the latest verified quorum round given a round and empty notarization. If both are nil, it returns nil.
func NewRandomSource ¶
func NodeIDsFromVotes ¶
func RetrieveLastIndexFromStorage ¶
func RetrieveLastIndexFromStorage(s common.Storage) (*common.VerifiedFinalizedBlock, error)
RetrieveLastIndexFromStorage retrieves the latest block and finalization from storage. Returns an error if it cannot be retrieved but the storage has some block. Returns (nil, nil) if the storage is empty.
Types ¶
type EmptyVoteSet ¶
type EmptyVoteSet struct {
// contains filtered or unexported fields
}
type Epoch ¶
type Epoch struct {
EpochConfig
// contains filtered or unexported fields
}
func NewEpoch ¶
func NewEpoch(conf EpochConfig) (*Epoch, error)
func (*Epoch) AdvanceTime ¶
AdvanceTime hints the engine that the given amount of time has passed.
func (*Epoch) HandleMessage ¶
HandleMessage notifies the engine about a reception of a message.
func (*Epoch) Metadata ¶
func (e *Epoch) Metadata() common.ProtocolMetadata
Metadata returns the metadata of the next expected block of the epoch.
func (*Epoch) VerifyBlockMessageVote ¶
func (e *Epoch) VerifyBlockMessageVote(from common.NodeID, md common.BlockHeader, vote common.Vote) error
VerifyBlockMessageVote checks if we have the block in the future messages map. If so, it means we have already verified the vote associated with this proposal. If not, it verifies that the vote corresponds to the block proposed, and that the vote is properly signed.
type EpochConfig ¶
type EpochConfig struct {
MaxProposalWait time.Duration
MaxRoundWindow uint64
MaxReplicationResponseSize int
MaxRebroadcastWait time.Duration
FinalizeRebroadcastTimeout time.Duration
QCDeserializer common.QCDeserializer
Logger common.Logger
ID common.NodeID
Signer common.Signer
Verifier common.SignatureVerifier
BlockDeserializer common.BlockDeserializer
SignatureAggregatorCreator common.SignatureAggregatorCreator
Comm common.Communication
Storage common.Storage
WAL common.WriteAheadLog
BlockBuilder common.BlockBuilder
Epoch uint64
StartTime time.Time
ReplicationEnabled bool
RandomSource *rand.Rand
}
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
func (*Monitor) AdvanceTime ¶
func (*Monitor) CancelFutureTask ¶
func (m *Monitor) CancelFutureTask()
func (*Monitor) CancelTask ¶
func (m *Monitor) CancelTask()
func (*Monitor) FutureTask ¶
type NotarizationTime ¶
type NotarizationTime struct {
// contains filtered or unexported fields
}
func NewNotarizationTime ¶
func (*NotarizationTime) CheckForNotFinalizedNotarizedBlocks ¶
func (nt *NotarizationTime) CheckForNotFinalizedNotarizedBlocks(now time.Time)
type OneTimeVerifier ¶
type OneTimeVerifier struct {
// contains filtered or unexported fields
}
func NewOneTimeVerifier ¶
func NewOneTimeVerifier(logger common.Logger) *OneTimeVerifier
type ReplicationState ¶
type ReplicationState struct {
// contains filtered or unexported fields
}
func NewReplicationState ¶
func (*ReplicationState) AdvanceTime ¶
func (r *ReplicationState) AdvanceTime(now time.Time)
func (*ReplicationState) Close ¶
func (r *ReplicationState) Close()
func (*ReplicationState) CreateDependencyTasks ¶
func (r *ReplicationState) CreateDependencyTasks(parent *common.Digest, parentSeq uint64, emptyRounds []uint64)
CreateDependencyTasks creates tasks to refetch the given parent digest and empty rounds. If there are no dependencies, no tasks are created.
func (*ReplicationState) DeleteRound ¶
func (r *ReplicationState) DeleteRound(round uint64)
func (*ReplicationState) DeleteSeq ¶
func (r *ReplicationState) DeleteSeq(seq uint64)
func (*ReplicationState) GetBlockWithSeq ¶
func (r *ReplicationState) GetBlockWithSeq(seq uint64) common.Block
func (*ReplicationState) GetFinalizedBlockForSequence ¶
func (r *ReplicationState) GetFinalizedBlockForSequence(seq uint64) (common.Block, *common.Finalization, bool)
func (*ReplicationState) GetHighestRound ¶
func (r *ReplicationState) GetHighestRound() uint64
GetHighestRound returns the highest round known to the replicator.
func (*ReplicationState) GetLowestRound ¶
func (r *ReplicationState) GetLowestRound() *common.QuorumRound
func (*ReplicationState) MaybeAdvanceState ¶
func (r *ReplicationState) MaybeAdvanceState(nextSequenceToCommit uint64, currentRound uint64, lastCommittedRound uint64)
MaybeAdvanceState attempts to collect future sequences if there are more to be collected and the round has caught up for us to send the request.
func (*ReplicationState) ReceivedFutureFinalization ¶
func (r *ReplicationState) ReceivedFutureFinalization(finalization *common.Finalization, nextSeqToCommit uint64)
receivedFutureFinalization notifies the replication state a finalization was created in a future round.
func (*ReplicationState) ReceivedFutureRound ¶
func (r *ReplicationState) ReceivedFutureRound(round, seq, currentRound uint64, signers []common.NodeID)
receivedFutureRound notifies the replication state of a future round.
func (*ReplicationState) ResendFinalizationRequest ¶
func (r *ReplicationState) ResendFinalizationRequest(seq uint64, signers []common.NodeID)
ResendFinalizationRequest notifies the replication state that `seq` should be re-requested.
func (*ReplicationState) StoreQuorumRound ¶
func (r *ReplicationState) StoreQuorumRound(round *common.QuorumRound)
StoreQuorumRound stores the quorum round into the replication state.
type Round ¶
type Round struct {
// contains filtered or unexported fields
}
func NewRound ¶
func NewRound(block common.VerifiedBlock) *Round
func SetRound ¶
func SetRound(block common.VerifiedBlock, notarization *common.Notarization, finalization *common.Finalization) *Round
SetRound is a helper function that is used for tests to create a round.