consensus

package
v0.29.16-access-remove... Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: AGPL-3.0 Imports: 27 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.DynamicCommittee, 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.FinalizationConsumer, 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,
	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.TimeoutCollectorDistributor,
	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.Consumer,
	voteProcessorFactory hotstuff.VoteProcessorFactory,
	distributor *pubsub.FinalizationDistributor,
) (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
	FinalizationDistributor     *pubsub.FinalizationDistributor // observer for finalization events, used by compliance engine
	QCCreatedDistributor        *pubsub.QCCreatedDistributor    // observer for qc created event, used by leader
	TimeoutCollectorDistributor *pubsub.TimeoutCollectorDistributor
	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 WithBlockRateDelay

func WithBlockRateDelay(delay time.Duration) Option

func WithConfigRegistrar added in v0.28.13

func WithConfigRegistrar(reg updatable_configs.Registrar) Option

func WithHappyPathMaxRoundFailures added in v0.29.0

func WithHappyPathMaxRoundFailures(happyPathMaxRoundFailures uint64) Option

func WithMinTimeout

func WithMinTimeout(timeout time.Duration) Option

func WithStartupTime added in v0.22.4

func WithStartupTime(time time.Time) 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
	BlockRateDelay                      time.Duration               // a delay to broadcast block proposal in order to control the block production rate
	MaxTimeoutObjectRebroadcastInterval time.Duration               // maximum interval for timeout object rebroadcast
	Registrar                           updatable_configs.Registrar // optional: for registering HotStuff configs as dynamically configurable
}

func DefaultParticipantConfig added in v0.28.13

func DefaultParticipantConfig() ParticipantConfig

Jump to

Keyboard shortcuts

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