model

package
v0.22.8-patch-7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2021 License: AGPL-3.0 Imports: 5 Imported by: 38

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidSignature = errors.New("invalid signature")
View Source
var ErrInvalidSigner = errors.New("invalid signer(s)")
View Source
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")

Functions

func IsInvalidBlockError

func IsInvalidBlockError(err error) bool

IsInvalidBlockError returns whether an error is InvalidBlockError

func IsInvalidVoteError

func IsInvalidVoteError(err error) bool

IsInvalidVoteError returns whether an error is InvalidVoteError

func IsMissingBlockError

func IsMissingBlockError(err error) bool

IsMissingBlockError returns whether an error is MissingBlockError

func IsNoVoteError

func IsNoVoteError(err error) bool

IsNoVoteError returns whether an error is NoVoteError

func ProposalToFlow

func ProposalToFlow(proposal *Proposal) *flow.Header

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

func BlockFromFlow(header *flow.Header, parentView uint64) *Block

BlockFromFlow converts a flow header to a hotstuff block.

func GenesisBlockFromFlow

func GenesisBlockFromFlow(header *flow.Header) *Block

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 is there are byzantine consensus replicas with _at least_ 1/3 stake.

func (ByzantineThresholdExceededError) Error

type ConfigurationError

type ConfigurationError struct {
	Msg string
}

func (ConfigurationError) Error

func (e ConfigurationError) Error() string

type InvalidBlockError

type InvalidBlockError struct {
	BlockID flow.Identifier
	View    uint64
	Err     error
}

func (InvalidBlockError) Error

func (e InvalidBlockError) Error() string

func (InvalidBlockError) Unwrap

func (e InvalidBlockError) Unwrap() error

type InvalidVoteError

type InvalidVoteError struct {
	VoteID flow.Identifier
	View   uint64
	Err    error
}

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
}

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

type Proposal struct {
	Block   *Block
	SigData []byte
}

Proposal represent a new proposed block within HotStuff (and thus a a header in the bigger picture), signed by the proposer.

func ProposalFromFlow

func ProposalFromFlow(header *flow.Header, parentView uint64) *Proposal

ProposalFromFlow turns a flow header into a hotstuff block type.

func (*Proposal) ProposerVote

func (p *Proposal) ProposerVote() *Vote

ProposerVote extracts the proposer vote from the proposal

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

type TimerInfo struct {
	Mode      TimeoutMode
	View      uint64
	StartTime time.Time
	Duration  time.Duration
}

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.

func (*Vote) ID

func (uv *Vote) ID() flow.Identifier

ID returns the identifier for the vote.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL