Documentation ¶
Index ¶
- Variables
- func IsConfigurationError(err error) bool
- func IsDoubleVoteError(err error) bool
- func IsDuplicatedSignerError(err error) bool
- func IsInsufficientSignaturesError(err error) bool
- func IsInvalidBlockError(err error) bool
- func IsInvalidFormatError(err error) bool
- func IsInvalidSignatureIncludedError(err error) bool
- func IsInvalidSignerError(err error) bool
- func IsInvalidVoteError(err error) bool
- func IsMissingBlockError(err error) bool
- func IsNoVoteError(err error) bool
- func NewConfigurationError(err error) error
- func NewConfigurationErrorf(msg string, args ...interface{}) error
- func NewDoubleVoteErrorf(firstVote, conflictingVote *Vote, msg string, args ...interface{}) error
- func NewDuplicatedSignerError(err error) error
- func NewDuplicatedSignerErrorf(msg string, args ...interface{}) error
- func NewInsufficientSignaturesError(err error) error
- func NewInsufficientSignaturesErrorf(msg string, args ...interface{}) error
- func NewInvalidFormatError(err error) error
- func NewInvalidFormatErrorf(msg string, args ...interface{}) error
- func NewInvalidSignatureIncludedError(err error) error
- func NewInvalidSignatureIncludedErrorf(msg string, args ...interface{}) error
- func NewInvalidSignerError(err error) error
- func NewInvalidSignerErrorf(msg string, args ...interface{}) error
- func NewInvalidVoteErrorf(vote *Vote, msg string, args ...interface{}) error
- func ProposalToFlow(proposal *Proposal) *flow.Header
- func UnpackRandomBeaconSig(sigData []byte) (crypto.Signature, error)
- type Block
- type ByzantineThresholdExceededError
- type ConfigurationError
- type DoubleVoteError
- type DuplicatedSignerError
- type InsufficientSignaturesError
- type InvalidBlockError
- type InvalidFormatError
- type InvalidSignatureIncludedError
- type InvalidSignerError
- type InvalidVoteError
- type MissingBlockError
- type NewViewEvent
- type NoVoteError
- type Proposal
- type SigDataPacker
- type SignatureData
- type TimeoutMode
- type TimerInfo
- type Vote
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnverifiableBlock = errors.New("block proposal can't be verified, because its view is above the finalized view, but its QC is below the finalized view") ErrInvalidSignature = errors.New("invalid signature") )
Functions ¶
func IsConfigurationError ¶
IsConfigurationError returns whether err is a ConfigurationError
func IsDoubleVoteError ¶
IsDoubleVoteError returns whether an error is DoubleVoteError
func IsDuplicatedSignerError ¶
IsDuplicatedSignerError returns whether err is an DuplicatedSignerError
func IsInsufficientSignaturesError ¶
IsInsufficientSignaturesError returns whether err is an InsufficientSignaturesError
func IsInvalidBlockError ¶
IsInvalidBlockError returns whether an error is InvalidBlockError
func IsInvalidFormatError ¶
IsInvalidFormatError returns whether err is a InvalidFormatError
func IsInvalidSignatureIncludedError ¶
IsInvalidSignatureIncludedError returns whether err is an InvalidSignatureIncludedError
func IsInvalidSignerError ¶
IsInvalidSignerError returns whether err is an InvalidSignerError
func IsInvalidVoteError ¶
IsInvalidVoteError returns whether an error is InvalidVoteError
func IsMissingBlockError ¶
IsMissingBlockError returns whether an error is MissingBlockError
func IsNoVoteError ¶
IsNoVoteError returns whether an error is NoVoteError
func NewConfigurationError ¶
func NewConfigurationErrorf ¶
func NewDoubleVoteErrorf ¶
func NewInvalidFormatError ¶
func NewInvalidFormatErrorf ¶
func NewInvalidSignerError ¶
func NewInvalidSignerErrorf ¶
func NewInvalidVoteErrorf ¶
func ProposalToFlow ¶
ProposalToFlow turns a block proposal into a flow header.
Types ¶
type Block ¶
type Block struct { View uint64 BlockID flow.Identifier ProposerID flow.Identifier QC *flow.QuorumCertificate PayloadHash flow.Identifier Timestamp time.Time }
Block is the HotStuff algorithm's concept of a block, which - in the bigger picture - corresponds to the block header.
func BlockFromFlow ¶
BlockFromFlow converts a flow header to a hotstuff block.
func GenesisBlockFromFlow ¶
GenesisBlockFromFlow returns a HotStuff block model representing a genesis block based on the given header.
type ByzantineThresholdExceededError ¶
type ByzantineThresholdExceededError struct {
Evidence string
}
ByzantineThresholdExceededError is raised if HotStuff detects malicious conditions which prove a Byzantine threshold of consensus replicas has been exceeded. Per definition, the byzantine threshold is exceeded if there are byzantine consensus replicas with _at least_ 1/3 weight.
func (ByzantineThresholdExceededError) Error ¶
func (e ByzantineThresholdExceededError) Error() string
type ConfigurationError ¶
type ConfigurationError struct {
// contains filtered or unexported fields
}
ConfigurationError indicates that a constructor or component was initialized with invalid or inconsistent parameters.
func (ConfigurationError) Error ¶
func (e ConfigurationError) Error() string
func (ConfigurationError) Unwrap ¶
func (e ConfigurationError) Unwrap() error
type DoubleVoteError ¶
type DoubleVoteError struct { FirstVote *Vote ConflictingVote *Vote // contains filtered or unexported fields }
DoubleVoteError indicates that a consensus replica has voted for two different blocks, or has provided two semantically different votes for the same block.
func AsDoubleVoteError ¶
func AsDoubleVoteError(err error) (*DoubleVoteError, bool)
AsDoubleVoteError determines whether the given error is a DoubleVoteError (potentially wrapped). It follows the same semantics as a checked type cast.
func (DoubleVoteError) Error ¶
func (e DoubleVoteError) Error() string
func (DoubleVoteError) Unwrap ¶
func (e DoubleVoteError) Unwrap() error
type DuplicatedSignerError ¶
type DuplicatedSignerError struct {
// contains filtered or unexported fields
}
DuplicatedSignerError indicates that a signature from the same node ID has already been added
func (DuplicatedSignerError) Error ¶
func (e DuplicatedSignerError) Error() string
func (DuplicatedSignerError) Unwrap ¶
func (e DuplicatedSignerError) Unwrap() error
type InsufficientSignaturesError ¶
type InsufficientSignaturesError struct {
// contains filtered or unexported fields
}
InsufficientSignaturesError indicates that not enough signatures have been stored to complete the operation.
func (InsufficientSignaturesError) Error ¶
func (e InsufficientSignaturesError) Error() string
func (InsufficientSignaturesError) Unwrap ¶
func (e InsufficientSignaturesError) Unwrap() error
type InvalidBlockError ¶
type InvalidBlockError struct { BlockID flow.Identifier View uint64 Err error }
InvalidBlockError indicates that the block with identifier `BlockID` is invalid
func (InvalidBlockError) Error ¶
func (e InvalidBlockError) Error() string
func (InvalidBlockError) Unwrap ¶
func (e InvalidBlockError) Unwrap() error
type InvalidFormatError ¶
type InvalidFormatError struct {
// contains filtered or unexported fields
}
InvalidFormatError indicates that some data has an incompatible format.
func (InvalidFormatError) Error ¶
func (e InvalidFormatError) Error() string
func (InvalidFormatError) Unwrap ¶
func (e InvalidFormatError) Unwrap() error
type InvalidSignatureIncludedError ¶
type InvalidSignatureIncludedError struct {
// contains filtered or unexported fields
}
InvalidSignatureIncludedError indicates that some signatures, included via TrustedAdd, are invalid
func (InvalidSignatureIncludedError) Error ¶
func (e InvalidSignatureIncludedError) Error() string
func (InvalidSignatureIncludedError) Unwrap ¶
func (e InvalidSignatureIncludedError) Unwrap() error
type InvalidSignerError ¶
type InvalidSignerError struct {
// contains filtered or unexported fields
}
InvalidSignerError indicates that the signer is not authorized or unknown
func (InvalidSignerError) Error ¶
func (e InvalidSignerError) Error() string
func (InvalidSignerError) Unwrap ¶
func (e InvalidSignerError) Unwrap() error
type InvalidVoteError ¶
type InvalidVoteError struct { VoteID flow.Identifier View uint64 Err error }
InvalidVoteError indicates that the vote with identifier `VoteID` is invalid
func (InvalidVoteError) Error ¶
func (e InvalidVoteError) Error() string
func (InvalidVoteError) Unwrap ¶
func (e InvalidVoteError) Unwrap() error
type MissingBlockError ¶
type MissingBlockError struct { View uint64 BlockID flow.Identifier }
MissingBlockError indicates that no block with identifier `BlockID` is known
func (MissingBlockError) Error ¶
func (e MissingBlockError) Error() string
type NewViewEvent ¶
type NewViewEvent struct {
View uint64
}
NewViewEvent is the new view event that contains the new view.
type NoVoteError ¶
type NoVoteError struct {
Msg string
}
NoVoteError contains the reason of why the voter didn't vote for a block proposal.
func (NoVoteError) Error ¶
func (e NoVoteError) Error() string
type Proposal ¶
Proposal represent a new proposed block within HotStuff (and thus a a header in the bigger picture), signed by the proposer.
func ProposalFromFlow ¶
ProposalFromFlow turns a flow header into a hotstuff block type.
func (*Proposal) ProposerVote ¶
ProposerVote extracts the proposer vote from the proposal
type SigDataPacker ¶
type SigDataPacker struct {
// contains filtered or unexported fields
}
SigDataPacker implements logic for encoding/decoding SignatureData using RLP encoding.
func (*SigDataPacker) Decode ¶
func (p *SigDataPacker) Decode(data []byte) (*SignatureData, error)
Decode performs decoding of SignatureData
func (*SigDataPacker) Encode ¶
func (p *SigDataPacker) Encode(sigData *SignatureData) ([]byte, error)
Encode performs encoding of SignatureData
type SignatureData ¶
type SignatureData struct { // bit-vector indicating type of signature for each signer. // the order of each sig type matches the order of corresponding signer IDs SigType []byte AggregatedStakingSig []byte AggregatedRandomBeaconSig []byte ReconstructedRandomBeaconSig crypto.Signature }
SignatureData is a compact data type for encoding the block signature data
type TimeoutMode ¶
type TimeoutMode int
TimeoutMode enum type
const ( // ReplicaTimeout represents the time period that the replica is waiting for the block for the current view. ReplicaTimeout TimeoutMode = iota // VoteCollectionTimeout represents the time period that the leader is waiting for votes in order to build // the next block. VoteCollectionTimeout )
func (TimeoutMode) String ¶
func (m TimeoutMode) String() string
type TimerInfo ¶
TimerInfo represents a time period that pacemaker is waiting for a specific event. The end of the time period is the timeout that will trigger pacemaker's view change.
type Vote ¶
type Vote struct { View uint64 BlockID flow.Identifier SignerID flow.Identifier SigData []byte }
Vote is the HotStuff algorithm's concept of a vote for a block proposal.
func VoteFromFlow ¶
func VoteFromFlow(signerID flow.Identifier, blockID flow.Identifier, view uint64, sig crypto.Signature) *Vote
VoteFromFlow turns the vote parameters into a vote struct.