consensus

package
v0.33.17 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: AGPL-3.0 Imports: 25 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFollower

func NewFollower(log zerolog.Logger,
	mempoolMetrics module.MempoolMetrics,
	headers storage.Headers,
	updater module.Finalizer,
	notifier hotstuff.FollowerConsumer,
	rootHeader *flow.Header,
	rootQC *flow.QuorumCertificate,
	finalized *flow.Header,
	pending []*flow.Header,
) (*hotstuff.FollowerLoop, error)

NewFollower instantiates the consensus follower and recovers its in-memory state of pending blocks. It receives the list `pending` containing _all_ blocks that

  • have passed the compliance layer and stored in the protocol state
  • descend from the latest finalized block
  • are listed in ancestor-first order (i.e. for any block B ∈ pending, B's parent must be listed before B, unless B's parent is the latest finalized block)

CAUTION: all pending blocks are required to be valid (guaranteed if the block passed the compliance layer)

func NewForks added in v0.23.9

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

NewForks recovers trusted root and creates new forks manager

func NewParticipant

func NewParticipant(
	log zerolog.Logger,
	metrics module.HotstuffMetrics,
	mempoolMetrics module.MempoolMetrics,
	builder module.Builder,
	finalized *flow.Header,
	pending []*flow.Header,
	modules *HotstuffModules,
	options ...Option,
) (*eventloop.EventLoop, error)

NewParticipant initialize the EventLoop instance with needed dependencies

func NewTimeoutAggregator added in v0.29.0

func NewTimeoutAggregator(log zerolog.Logger,
	hotstuffMetrics module.HotstuffMetrics,
	engineMetrics module.EngineMetrics,
	mempoolMetrics module.MempoolMetrics,
	notifier *pubsub.Distributor,
	timeoutProcessorFactory hotstuff.TimeoutProcessorFactory,
	distributor *pubsub.TimeoutAggregationDistributor,
	lowestRetainedView uint64,
) (hotstuff.TimeoutAggregator, error)

NewTimeoutAggregator creates new TimeoutAggregator and connects Hotstuff event source with event handler. No error returns are expected during normal operations.

func NewValidator added in v0.23.9

func NewValidator(metrics module.HotstuffMetrics, committee hotstuff.DynamicCommittee) 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,
	hotstuffMetrics module.HotstuffMetrics,
	engineMetrics module.EngineMetrics,
	mempoolMetrics module.MempoolMetrics,
	lowestRetainedView uint64,
	notifier hotstuff.VoteAggregationConsumer,
	voteProcessorFactory hotstuff.VoteProcessorFactory,
	distributor *pubsub.FollowerDistributor,
) (hotstuff.VoteAggregator, error)

NewVoteAggregator creates new VoteAggregator and subscribes for finalization events. No error returns are expected during normal operations.

Types

type HotstuffModules added in v0.23.9

type HotstuffModules struct {
	Committee                   hotstuff.DynamicCommittee           // consensus committee
	Signer                      hotstuff.Signer                     // signer of proposal & votes
	Persist                     hotstuff.Persister                  // last state of consensus participant
	Notifier                    *pubsub.Distributor                 // observer for hotstuff events
	VoteCollectorDistributor    *pubsub.VoteCollectorDistributor    // observer for vote aggregation events, used by leader
	TimeoutCollectorDistributor *pubsub.TimeoutCollectorDistributor // observer for timeout aggregation events
	Forks                       hotstuff.Forks                      // information about multiple forks
	Validator                   hotstuff.Validator                  // validator of proposals & votes
	VoteAggregator              hotstuff.VoteAggregator             // aggregator of votes, used by leader
	TimeoutAggregator           hotstuff.TimeoutAggregator          // aggregator of `TimeoutObject`s, used by every replica
}

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

type Option

type Option func(*ParticipantConfig)

func WithHappyPathMaxRoundFailures added in v0.29.0

func WithHappyPathMaxRoundFailures(happyPathMaxRoundFailures uint64) Option

func WithMinTimeout

func WithMinTimeout(timeout time.Duration) Option

func WithProposalDurationProvider added in v0.31.0

func WithProposalDurationProvider(provider hotstuff.ProposalDurationProvider) Option

func WithStartupTime added in v0.22.4

func WithStartupTime(time time.Time) Option

func WithStaticProposalDuration added in v0.31.0

func WithStaticProposalDuration(dur time.Duration) Option

func WithTimeoutAdjustmentFactor added in v0.29.0

func WithTimeoutAdjustmentFactor(factor float64) Option

type ParticipantConfig

type ParticipantConfig struct {
	StartupTime                         time.Time                         // the time when consensus participant enters first view
	TimeoutMinimum                      time.Duration                     // the minimum timeout for the pacemaker
	TimeoutMaximum                      time.Duration                     // the maximum timeout for the pacemaker
	TimeoutAdjustmentFactor             float64                           // the factor at which the timeout duration is adjusted
	HappyPathMaxRoundFailures           uint64                            // number of failed rounds before first timeout increase
	MaxTimeoutObjectRebroadcastInterval time.Duration                     // maximum interval for timeout object rebroadcast
	ProposalDurationProvider            hotstuff.ProposalDurationProvider // a delay to broadcast block proposal in order to control the block production rate
}

func DefaultParticipantConfig added in v0.28.13

func DefaultParticipantConfig() ParticipantConfig

Directories

Path Synopsis
committees
(c) 2020 Dapper Labs - ALL RIGHTS RESERVED
(c) 2020 Dapper Labs - ALL RIGHTS RESERVED
cruisectl
Package cruisectl implements a "cruise control" system for Flow by adjusting nodes' latest ProposalTiming in response to changes in the measured view rate and target epoch switchover time.
Package cruisectl implements a "cruise control" system for Flow by adjusting nodes' latest ProposalTiming in response to changes in the measured view rate and target epoch switchover time.

Jump to

Keyboard shortcuts

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