consensus

package
v0.27.6 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: AGPL-3.0 Imports: 26 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFollower

func NewFollower(log zerolog.Logger, committee hotstuff.Committee, headers storage.Headers, updater module.Finalizer,
	verifier hotstuff.Verifier, notifier hotstuff.FinalizationConsumer, rootHeader *flow.Header,
	rootQC *flow.QuorumCertificate, finalized *flow.Header, pending []*flow.Header) (*hotstuff.FollowerLoop, error)

func NewForks added in v0.23.9

func NewForks(final *flow.Header, headers storage.Headers, updater module.Finalizer, notifier hotstuff.Consumer, rootHeader *flow.Header, rootQC *flow.QuorumCertificate) (hotstuff.Forks, error)

NewForks creates new consensus forks manager

func NewParticipant

func NewParticipant(
	log zerolog.Logger,
	metrics module.HotstuffMetrics,
	builder module.Builder,
	communicator hotstuff.Communicator,
	finalized *flow.Header,
	pending []*flow.Header,
	modules *HotstuffModules,
	options ...Option,
) (module.HotStuff, error)

NewParticipant initialize the EventLoop instance with needed dependencies

func NewValidator added in v0.23.9

func NewValidator(metrics module.HotstuffMetrics, committee hotstuff.Committee, forks hotstuff.ForksReader) hotstuff.Validator

NewValidator creates new instance of hotstuff validator needed for votes & proposal validation

func NewVoteAggregator added in v0.23.9

func NewVoteAggregator(
	log zerolog.Logger,
	lowestRetainedView uint64,
	notifier hotstuff.Consumer,
	voteProcessorFactory hotstuff.VoteProcessorFactory,
	distributor *pubsub.FinalizationDistributor,
) (hotstuff.VoteAggregator, error)

NewVoteAggregator creates new VoteAggregator and recover the Forks' state with all pending block

Types

type HotstuffModules added in v0.23.9

type HotstuffModules struct {
	Notifier                hotstuff.Consumer               // observer for hotstuff events
	Committee               hotstuff.Committee              // consensus committee
	Signer                  hotstuff.Signer                 // signer of proposal & votes
	Persist                 hotstuff.Persister              // last state of consensus participant
	FinalizationDistributor *pubsub.FinalizationDistributor // observer for finalization events, used by compliance engine
	QCCreatedDistributor    *pubsub.QCCreatedDistributor    // observer for qc created event, used by leader
	Forks                   hotstuff.Forks                  // information about multiple forks
	Validator               hotstuff.Validator              // validator of proposals & votes
	Aggregator              hotstuff.VoteAggregator         // aggregator of votes, used by leader
}

HotstuffModules is a helper structure to encapsulate dependencies to create a hotStuff participant.

type Option

type Option func(*ParticipantConfig)

func WithBlockRateDelay

func WithBlockRateDelay(delay time.Duration) Option

func WithInitialTimeout

func WithInitialTimeout(timeout time.Duration) Option

func WithMinTimeout

func WithMinTimeout(timeout time.Duration) Option

func WithStartupTime added in v0.22.4

func WithStartupTime(time time.Time) Option

func WithTimeoutDecreaseFactor

func WithTimeoutDecreaseFactor(factor float64) Option

func WithTimeoutIncreaseFactor

func WithTimeoutIncreaseFactor(factor float64) Option

func WithVoteAggregationTimeoutFraction

func WithVoteAggregationTimeoutFraction(fraction float64) Option

type ParticipantConfig

type ParticipantConfig struct {
	StartupTime                time.Time     // the time when consensus participant enters first view
	TimeoutInitial             time.Duration // the initial timeout for the pacemaker
	TimeoutMinimum             time.Duration // the minimum timeout for the pacemaker
	TimeoutAggregationFraction float64       // the percentage part of the timeout period reserved for vote aggregation
	TimeoutIncreaseFactor      float64       // the factor at which the timeout grows when timeouts occur
	TimeoutDecreaseFactor      float64       // the factor at which the timeout grows when timeouts occur
	BlockRateDelay             time.Duration // a delay to broadcast block proposal in order to control the block production rate
}

Jump to

Keyboard shortcuts

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