pacemaker

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: AGPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivePaceMaker added in v0.29.0

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

ActivePaceMaker implements the hotstuff.PaceMaker Conceptually, we use the Pacemaker algorithm first proposed in [1] (specifically Jolteon) and described in more detail in [2]. [1] https://arxiv.org/abs/2106.10362 [2] https://developers.diem.com/papers/diem-consensus-state-machine-replication-in-the-diem-blockchain/2021-08-17.pdf (aka DiemBFT v4)

To enter a new view `v`, the Pacemaker must observe a valid QC or TC for view `v-1`. The Pacemaker also controls when a node should locally time out for a given view. In contrast to the passive Pacemaker (previous implementation), locally timing a view does not cause a view change. A local timeout for a view `v` causes a node to: * never produce a vote for any proposal with view ≤ `v`, after the timeout * produce and broadcast a timeout object, which can form a part of the TC for the timed out view

Not concurrency safe.

func New

func New(timeoutController *timeout.Controller,
	notifier hotstuff.Consumer,
	persist hotstuff.Persister,
) (*ActivePaceMaker, error)

New creates a new ActivePaceMaker instance

  • startView is the view for the pacemaker to start with.
  • timeoutController controls the timeout trigger.
  • notifier provides callbacks for pacemaker events.

Expected error conditions: * model.ConfigurationError if initial LivenessData is invalid

func (*ActivePaceMaker) BlockRateDelay added in v0.29.0

func (p *ActivePaceMaker) BlockRateDelay() time.Duration

BlockRateDelay returns the delay for broadcasting its own proposals.

func (*ActivePaceMaker) CurView added in v0.29.0

func (p *ActivePaceMaker) CurView() uint64

CurView returns the current view

func (*ActivePaceMaker) LastViewTC added in v0.29.0

func (p *ActivePaceMaker) LastViewTC() *flow.TimeoutCertificate

LastViewTC returns TC for last view, this will be nil only if the current view was entered with a QC.

func (*ActivePaceMaker) NewestQC added in v0.29.0

func (p *ActivePaceMaker) NewestQC() *flow.QuorumCertificate

NewestQC returns QC with the highest view discovered by PaceMaker.

func (*ActivePaceMaker) ProcessQC added in v0.29.0

ProcessQC notifies the pacemaker with a new QC, which might allow pacemaker to fast-forward its view. In contrast to `ProcessTC`, this function does _not_ handle `nil` inputs. No errors are expected, any error should be treated as exception

func (*ActivePaceMaker) ProcessTC added in v0.29.0

ProcessTC notifies the Pacemaker of a new timeout certificate, which may allow Pacemaker to fast-forward its current view. A nil TC is an expected valid input, so that callers may pass in e.g. `Proposal.LastViewTC`, which may or may not have a value. No errors are expected, any error should be treated as exception

func (*ActivePaceMaker) Start added in v0.29.0

func (p *ActivePaceMaker) Start(ctx context.Context)

Start starts the pacemaker by starting the initial timer for the current view. Start should only be called once - subsequent calls are a no-op. CAUTION: ActivePaceMaker is not concurrency safe. The Start method must be executed by the same goroutine that also calls the other business logic methods, or concurrency safety has to be implemented externally.

func (*ActivePaceMaker) TimeoutChannel added in v0.29.0

func (p *ActivePaceMaker) TimeoutChannel() <-chan time.Time

TimeoutChannel returns the timeout channel for current active timeout. Note the returned timeout channel returns only one timeout, which is the current timeout. To get the timeout for the next timeout, you need to call TimeoutChannel() again.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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