timeout

package
v0.15.0-patch.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: AGPL-3.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = NewDefaultConfig()

Functions

func StandardTimeoutDecreaseFactor

func StandardTimeoutDecreaseFactor(maxFractionOfflineReplicas, timeoutIncreaseFactor float64) float64

StandardTimeoutDecreaseFactor calculates a standard value for TimeoutDecreaseFactor for an assumed max fraction of offline (byzantine) HotStuff committee members

func StandardVoteAggregationTimeoutFraction

func StandardVoteAggregationTimeoutFraction(minReplicaTimeout time.Duration, blockRateDelay time.Duration) float64

StandardVoteAggregationTimeoutFraction calculates a standard value for the VoteAggregationTimeoutFraction in case a block delay is used. The motivation for the standard value is as follows:

  • the next primary receives the block it ideally would extend at some time t
  • the best guess the primary has, when other nodes would receive the block is at time t as well
  • the primary needs to get its block to the other replicas, before they time out: the primary uses its own timeout as estimator for the other replicas' timeout

Types

type Config

type Config struct {
	// ReplicaTimeout is the duration of a view before we time out [MILLISECONDS]
	// ReplicaTimeout is the only variable quantity
	ReplicaTimeout float64
	// MinReplicaTimeout is the minimum the timeout can decrease to [MILLISECONDS]
	MinReplicaTimeout float64
	// VoteAggregationTimeoutFraction is the FRACTION of ReplicaTimeout which the Primary
	// will maximally wait to collect enough votes before building a block (with an old qc)
	VoteAggregationTimeoutFraction float64
	// TimeoutDecrease: MULTIPLICATIVE factor for increasing timeout on timeout
	TimeoutIncrease float64
	// TimeoutDecrease: MULTIPLICATIVE factor for decreasing timeout on progress
	TimeoutDecrease float64
	// BlockRateDelayMS is a delay to broadcast the proposal in order to control block production rate [MILLISECONDS]
	BlockRateDelayMS float64
}

Config contains the configuration parameters for ExponentialIncrease-LinearDecrease timeout.Controller

  • on timeout: increase timeout by multiplicative factor `timeoutIncrease` (user-specified) this results in exponential growing timeout duration on multiple subsequent timeouts
  • on progress: MULTIPLICATIVE timeout decrease

func NewConfig

func NewConfig(
	startReplicaTimeout time.Duration,
	minReplicaTimeout time.Duration,
	voteAggregationTimeoutFraction float64,
	timeoutIncrease float64,
	timeoutDecrease float64,
	blockRateDelay time.Duration,
) (Config, error)

NewConfig creates a new TimoutConfig. startReplicaTimeout: starting timeout value for replica round [Milliseconds]; minReplicaTimeout: minimal timeout value for replica round [Milliseconds]; voteAggregationTimeoutFraction: fraction of replicaTimeout which is reserved for aggregating votes; timeoutIncrease: multiplicative factor for increasing timeout; timeoutDecrease: linear subtrahend for timeout decrease [Milliseconds] blockRateDelay: a delay to delay the proposal broadcasting

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig returns a default timeout configuration. We explicitly provide a method here, which demonstrates in-code how to compute standard values from some basic quantities.

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller implements a timout with:

  • on timeout: increase timeout by multiplicative factor `timeoutIncrease` (user-specified) this results in exponential growing timeout duration on multiple subsequent timeouts
  • on progress: decrease timeout by subtrahend `timeoutDecrease`

func DefaultController

func DefaultController() *Controller

func NewController

func NewController(timeoutConfig Config) *Controller

NewController creates a new Controller.

func (*Controller) BlockRateDelay

func (t *Controller) BlockRateDelay() time.Duration

BlockRateDelay is a delay to broadcast the proposal in order to control block production rate

func (*Controller) Channel

func (t *Controller) Channel() <-chan time.Time

Channel returns a channel that will receive the specific timeout. New channel is created for each timer. in the event the timeout is reached (specified as TimerInfo). returns closed channel if no timer has been started.

func (*Controller) OnProgressBeforeTimeout

func (t *Controller) OnProgressBeforeTimeout()

OnProgressBeforeTimeout indicates to the Controller that progress was made _before_ the timeout was reached

func (*Controller) OnTimeout

func (t *Controller) OnTimeout()

OnTimeout indicates to the Controller that the timeout was reached

func (*Controller) ReplicaTimeout

func (t *Controller) ReplicaTimeout() time.Duration

ReplicaTimeout returns the duration of the current view before we time out

func (*Controller) StartTimeout

func (t *Controller) StartTimeout(mode model.TimeoutMode, view uint64) *model.TimerInfo

StartTimeout starts the timeout of the specified type and returns the

func (*Controller) TimerInfo

func (t *Controller) TimerInfo() *model.TimerInfo

TimerInfo returns TimerInfo for the current timer. New struct is created for each timer. Is nil if no timer has been started.

func (*Controller) VoteCollectionTimeout

func (t *Controller) VoteCollectionTimeout() time.Duration

VoteCollectionTimeout returns the duration of Vote aggregation _after_ receiving a block during which the primary tries to aggregate votes for the view where it is leader

Jump to

Keyboard shortcuts

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