committees

package
v0.37.0-crescendo-RC3-... Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: AGPL-3.0 Imports: 15 Imported by: 8

Documentation

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.IdentitySkeletonList, error)

IdentitiesByEpoch returns the IdentitySkeletons of the cluster members in canonical order. This represents the cluster composition at the time the cluster was specified by the epoch smart contract (hence, we return IdentitySkeletons as opposed to full identities). 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(view uint64, participantID flow.Identifier) (*flow.IdentitySkeleton, 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.IdentitySkeletonList, 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.IdentitySkeleton, 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 `committees.Consensus` that the first block in flow.EpochPhaseCommitted has been finalized. This event consumer function enqueues an event handler function for the single event handler thread to execute.

func (*Consensus) EpochExtended added in v0.37.1

func (c *Consensus) EpochExtended(epochCounter uint64, _ *flow.Header, extension flow.EpochExtension)

EpochExtended informs `committees.Consensus` that a block including a new epoch extension has been finalized. This event consumer function enqueues an event handler function for the single event handler thread to execute.

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.IdentitySkeletonList, 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, participantID flow.Identifier) (*flow.IdentitySkeleton, 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 {
	StaticReplicas
	// 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) IdentitiesByBlock added in v0.29.0

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

func (Static) IdentityByBlock added in v0.29.0

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

type StaticReplicas added in v0.33.30

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

func NewStaticReplicas added in v0.33.30

func NewStaticReplicas(participants flow.IdentitySkeletonList, myID flow.Identifier, dkgParticipants map[flow.Identifier]flow.DKGParticipant, dkgGroupKey crypto.PublicKey) (*StaticReplicas, error)

func NewStaticReplicasWithDKG added in v0.33.30

func NewStaticReplicasWithDKG(participants flow.IdentitySkeletonList, myID flow.Identifier, dkg protocol.DKG) (*StaticReplicas, error)

func (StaticReplicas) DKG added in v0.33.30

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

func (StaticReplicas) IdentitiesByEpoch added in v0.33.30

func (s StaticReplicas) IdentitiesByEpoch(view uint64) (flow.IdentitySkeletonList, error)

func (StaticReplicas) IdentityByEpoch added in v0.33.30

func (s StaticReplicas) IdentityByEpoch(view uint64, participantID flow.Identifier) (*flow.IdentitySkeleton, error)

func (StaticReplicas) LeaderForView added in v0.33.30

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

func (StaticReplicas) QuorumThresholdForView added in v0.33.30

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

func (StaticReplicas) Self added in v0.33.30

func (s StaticReplicas) Self() flow.Identifier

func (StaticReplicas) TimeoutThresholdForView added in v0.33.30

func (s StaticReplicas) 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