committees

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: 17 Imported by: 8

Documentation

Overview

(c) 2020 Dapper Labs - ALL RIGHTS RESERVED

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WeightThresholdToBuildQC added in v0.29.0

func WeightThresholdToBuildQC(totalWeight uint64) uint64

WeightThresholdToBuildQC returns the weight (sum of unique, valid votes for this view) that is minimally required for a supermajority.

func WeightThresholdToTimeout added in v0.29.0

func WeightThresholdToTimeout(totalWeight uint64) uint64

WeightThresholdToTimeout returns the weight (sum of unique, valid timeout objects for this view) that is minimally required to immediately timeout and build a TO.

Types

type Cluster

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

Cluster represents the committee for a cluster of collection nodes. Cluster committees are epoch-scoped.

Clusters build blocks on a cluster chain but must obtain identity table information from the main chain. Thus, block ID parameters in this DynamicCommittee implementation reference blocks on the cluster chain, which in turn reference blocks on the main chain - this implementation manages that translation.

func NewClusterCommittee

func NewClusterCommittee(
	state protocol.State,
	payloads storage.ClusterPayloads,
	cluster protocol.Cluster,
	epoch protocol.Epoch,
	me flow.Identifier,
) (*Cluster, error)

func (*Cluster) DKG

func (c *Cluster) DKG(_ uint64) (hotstuff.DKG, error)

func (*Cluster) IdentitiesByBlock added in v0.29.0

func (c *Cluster) IdentitiesByBlock(blockID flow.Identifier) (flow.IdentityList, error)

IdentitiesByBlock returns the identities of all cluster members that are authorized to participate at the given block. The order of the identities is the canonical order.

func (*Cluster) IdentitiesByEpoch added in v0.29.0

func (c *Cluster) IdentitiesByEpoch(_ uint64) (flow.IdentityList, error)

IdentitiesByEpoch returns the initial cluster members for this epoch. The view parameter is the view in the cluster consensus. Since clusters only exist for one epoch, we don't need to check the view.

func (*Cluster) IdentityByBlock added in v0.29.0

func (c *Cluster) IdentityByBlock(blockID flow.Identifier, nodeID flow.Identifier) (*flow.Identity, error)

func (*Cluster) IdentityByEpoch added in v0.29.0

func (c *Cluster) IdentityByEpoch(_ uint64, nodeID flow.Identifier) (*flow.Identity, error)

IdentityByEpoch returns the node from the initial cluster members for this epoch. The view parameter is the view in the cluster consensus. Since clusters only exist for one epoch, we don't need to check the view.

Returns:

  • model.InvalidSignerError if nodeID was not listed by the Epoch Setup event as an authorized participant in this cluster

func (*Cluster) LeaderForView

func (c *Cluster) LeaderForView(view uint64) (flow.Identifier, error)

func (*Cluster) QuorumThresholdForView added in v0.29.0

func (c *Cluster) QuorumThresholdForView(_ uint64) (uint64, error)

QuorumThresholdForView returns the weight threshold required to build a QC for the given view. The view parameter is the view in the cluster consensus. Since clusters only exist for one epoch, and the weight threshold is static over the course of an epoch, we don't need to check the view.

No errors are expected during normal operation.

func (*Cluster) Self

func (c *Cluster) Self() flow.Identifier

func (*Cluster) TimeoutThresholdForView added in v0.29.0

func (c *Cluster) TimeoutThresholdForView(_ uint64) (uint64, error)

TimeoutThresholdForView returns the minimum weight of observed timeout objects to safely immediately timeout for the current view. The view parameter is the view in the cluster consensus. Since clusters only exist for one epoch, and the weight threshold is static over the course of an epoch, we don't need to check the view.

No errors are expected during normal operation.

type CommitteeMetricsWrapper

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

CommitteeMetricsWrapper implements the hotstuff.DynamicCommittee interface. It wraps a hotstuff.DynamicCommittee instance and measures the time which the HotStuff's core logic spends in the hotstuff.DynamicCommittee component, i.e. the time determining consensus committee relations. The measured time durations are reported as values for the CommitteeProcessingDuration metric.

func (CommitteeMetricsWrapper) DKG

func (CommitteeMetricsWrapper) IdentitiesByBlock added in v0.29.0

func (w CommitteeMetricsWrapper) IdentitiesByBlock(blockID flow.Identifier) (flow.IdentityList, error)

func (CommitteeMetricsWrapper) IdentitiesByEpoch added in v0.29.0

func (w CommitteeMetricsWrapper) IdentitiesByEpoch(view uint64) (flow.IdentityList, error)

func (CommitteeMetricsWrapper) IdentityByBlock added in v0.29.0

func (w CommitteeMetricsWrapper) IdentityByBlock(blockID flow.Identifier, participantID flow.Identifier) (*flow.Identity, error)

func (CommitteeMetricsWrapper) IdentityByEpoch added in v0.29.0

func (w CommitteeMetricsWrapper) IdentityByEpoch(view uint64, participantID flow.Identifier) (*flow.Identity, error)

func (CommitteeMetricsWrapper) LeaderForView

func (w CommitteeMetricsWrapper) LeaderForView(view uint64) (flow.Identifier, error)

func (CommitteeMetricsWrapper) QuorumThresholdForView added in v0.29.0

func (w CommitteeMetricsWrapper) QuorumThresholdForView(view uint64) (uint64, error)

func (CommitteeMetricsWrapper) Self

func (CommitteeMetricsWrapper) TimeoutThresholdForView added in v0.29.0

func (w CommitteeMetricsWrapper) TimeoutThresholdForView(view uint64) (uint64, error)

type Consensus

type Consensus struct {
	events.Noop // implements protocol.Consumer
	component.Component
	// contains filtered or unexported fields
}

Consensus represents the main committee for consensus nodes. The consensus committee might be active for multiple successive epochs.

func NewConsensusCommittee

func NewConsensusCommittee(state protocol.State, me flow.Identifier) (*Consensus, error)

func (*Consensus) DKG

func (c *Consensus) DKG(view uint64) (hotstuff.DKG, error)

DKG returns the DKG for epoch which includes the given view.

Error returns:

  • model.ErrViewForUnknownEpoch if no committed epoch containing the given view is known. This is an expected error and must be handled.
  • unspecific error in case of unexpected problems and bugs

func (*Consensus) EpochCommittedPhaseStarted added in v0.29.0

func (c *Consensus) EpochCommittedPhaseStarted(_ uint64, first *flow.Header)

EpochCommittedPhaseStarted informs the `committee.Consensus` that the block starting the Epoch Committed Phase has been finalized.

func (*Consensus) EpochEmergencyFallbackTriggered added in v0.29.0

func (c *Consensus) EpochEmergencyFallbackTriggered()

EpochEmergencyFallbackTriggered passes the protocol event to the worker thread.

func (*Consensus) IdentitiesByBlock added in v0.29.0

func (c *Consensus) IdentitiesByBlock(blockID flow.Identifier) (flow.IdentityList, error)

IdentitiesByBlock returns the identities of all authorized consensus participants at the given block. The order of the identities is the canonical order. ERROR conditions:

  • state.ErrUnknownSnapshotReference if the blockID is for an unknown block

func (*Consensus) IdentitiesByEpoch added in v0.29.0

func (c *Consensus) IdentitiesByEpoch(view uint64) (flow.IdentityList, error)

IdentitiesByEpoch returns the committee identities in the epoch which contains the given view. CAUTION: This method considers epochs outside of Previous, Current, Next, w.r.t. the finalized block, to be unknown. https://github.com/onflow/flow-go/issues/4085

Error returns:

  • model.ErrViewForUnknownEpoch if no committed epoch containing the given view is known. This is an expected error and must be handled.
  • unspecific error in case of unexpected problems and bugs

func (*Consensus) IdentityByBlock added in v0.29.0

func (c *Consensus) IdentityByBlock(blockID flow.Identifier, nodeID flow.Identifier) (*flow.Identity, error)

IdentityByBlock returns the identity of the node with the given node ID at the given block. ERROR conditions:

  • model.InvalidSignerError if participantID does NOT correspond to an authorized HotStuff participant at the specified block.
  • state.ErrUnknownSnapshotReference if the blockID is for an unknown block

func (*Consensus) IdentityByEpoch added in v0.29.0

func (c *Consensus) IdentityByEpoch(view uint64, nodeID flow.Identifier) (*flow.Identity, error)

IdentityByEpoch returns the identity for the given node ID, in the epoch which contains the given view. CAUTION: This method considers epochs outside of Previous, Current, Next, w.r.t. the finalized block, to be unknown. https://github.com/onflow/flow-go/issues/4085

Error returns:

  • model.ErrViewForUnknownEpoch if no committed epoch containing the given view is known. This is an expected error and must be handled.
  • model.InvalidSignerError if nodeID was not listed by the Epoch Setup event as an authorized consensus participants.
  • unspecific error in case of unexpected problems and bugs

func (*Consensus) LeaderForView

func (c *Consensus) LeaderForView(view uint64) (flow.Identifier, error)

LeaderForView returns the node ID of the leader for the given view.

Error returns:

  • model.ErrViewForUnknownEpoch if no committed epoch containing the given view is known. This is an expected error and must be handled.
  • unspecific error in case of unexpected problems and bugs

func (*Consensus) QuorumThresholdForView added in v0.29.0

func (c *Consensus) QuorumThresholdForView(view uint64) (uint64, error)

QuorumThresholdForView returns the minimum weight required to build a valid QC in the given view. The weight threshold only changes at epoch boundaries and is computed based on the initial committee weights.

Error returns:

  • model.ErrViewForUnknownEpoch if no committed epoch containing the given view is known. This is an expected error and must be handled.
  • unspecific error in case of unexpected problems and bugs

func (*Consensus) Self

func (c *Consensus) Self() flow.Identifier

func (*Consensus) TimeoutThresholdForView added in v0.29.0

func (c *Consensus) TimeoutThresholdForView(view uint64) (uint64, error)

TimeoutThresholdForView returns the minimum weight of observed timeout objects to safely immediately timeout for the current view. The weight threshold only changes at epoch boundaries and is computed based on the initial committee weights.

type Static

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

Static represents a committee with a static participant set. It is used for bootstrapping purposes.

func NewStaticCommittee

func NewStaticCommittee(participants flow.IdentityList, myID flow.Identifier, dkgParticipants map[flow.Identifier]flow.DKGParticipant, dkgGroupKey crypto.PublicKey) (*Static, error)

NewStaticCommittee returns a new committee with a static participant set.

func NewStaticCommitteeWithDKG added in v0.25.0

func NewStaticCommitteeWithDKG(participants flow.IdentityList, myID flow.Identifier, dkg protocol.DKG) (*Static, error)

NewStaticCommitteeWithDKG returns a new committee with a static participant set.

func (Static) DKG

func (s Static) DKG(_ uint64) (hotstuff.DKG, error)

func (Static) IdentitiesByBlock added in v0.29.0

func (s Static) IdentitiesByBlock(_ flow.Identifier) (flow.IdentityList, error)

func (Static) IdentitiesByEpoch added in v0.29.0

func (s Static) IdentitiesByEpoch(_ uint64) (flow.IdentityList, error)

func (Static) IdentityByBlock added in v0.29.0

func (s Static) IdentityByBlock(_ flow.Identifier, participantID flow.Identifier) (*flow.Identity, error)

func (Static) IdentityByEpoch added in v0.29.0

func (s Static) IdentityByEpoch(_ uint64, participantID flow.Identifier) (*flow.Identity, error)

func (Static) LeaderForView

func (s Static) LeaderForView(_ uint64) (flow.Identifier, error)

func (Static) QuorumThresholdForView added in v0.29.0

func (s Static) QuorumThresholdForView(_ uint64) (uint64, error)

func (Static) Self

func (s Static) Self() flow.Identifier

func (Static) TimeoutThresholdForView added in v0.29.0

func (s Static) TimeoutThresholdForView(_ uint64) (uint64, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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