Documentation
¶
Index ¶
- func ClusteringFromSetupEvent(setupEvent *flow.EpochSetup) (flow.ClusterList, error)
- func EpochProtocolStateFromServiceEvents(setup *flow.EpochSetup, commit *flow.EpochCommit) *flow.MinEpochStateEntry
- func NewCommittedEpoch(setupEvent *flow.EpochSetup, extensions []flow.EpochExtension, ...) protocol.Epoch
- func NewDKG(setup *flow.EpochSetup, commit *flow.EpochCommit) protocol.DKG
- func NewEpochWithEndBoundary(setupEvent *flow.EpochSetup, extensions []flow.EpochExtension, ...) protocol.Epoch
- func NewEpochWithStartAndEndBoundaries(setupEvent *flow.EpochSetup, extensions []flow.EpochExtension, ...) protocol.Epoch
- func NewEpochWithStartBoundary(setupEvent *flow.EpochSetup, extensions []flow.EpochExtension, ...) protocol.Epoch
- func NewSetupEpoch(setupEvent *flow.EpochSetup, extensions []flow.EpochExtension) protocol.Epoch
- type Cluster
- type DKG
- func (d *DKG) GroupKey() crypto.PublicKey
- func (d *DKG) Index(nodeID flow.Identifier) (uint, error)
- func (d *DKG) KeyShare(nodeID flow.Identifier) (crypto.PublicKey, error)
- func (d *DKG) KeyShares() []crypto.PublicKey
- func (d *DKG) NodeID(index uint) (flow.Identifier, error)
- func (d *DKG) Size() uint
- type DKGv0
- func (d DKGv0) GroupKey() crypto.PublicKey
- func (d DKGv0) Index(nodeID flow.Identifier) (uint, error)
- func (d DKGv0) KeyShare(nodeID flow.Identifier) (crypto.PublicKey, error)
- func (d DKGv0) KeyShares() []crypto.PublicKey
- func (d DKGv0) NodeID(index uint) (flow.Identifier, error)
- func (d DKGv0) Size() uint
- type EncodableCluster
- type EncodableParams
- type EncodableSnapshot
- type EpochProtocolStateAdapter
- func (s *EpochProtocolStateAdapter) Clustering() (flow.ClusterList, error)
- func (s *EpochProtocolStateAdapter) DKG() (protocol.DKG, error)
- func (s *EpochProtocolStateAdapter) Entry() *flow.RichEpochStateEntry
- func (s *EpochProtocolStateAdapter) Epoch() uint64
- func (s *EpochProtocolStateAdapter) EpochCommit() *flow.EpochCommit
- func (s *EpochProtocolStateAdapter) EpochExtensions() []flow.EpochExtension
- func (s *EpochProtocolStateAdapter) EpochFallbackTriggered() bool
- func (s *EpochProtocolStateAdapter) EpochPhase() flow.EpochPhase
- func (s *EpochProtocolStateAdapter) EpochSetup() *flow.EpochSetup
- func (s *EpochProtocolStateAdapter) GlobalParams() protocol.GlobalParams
- func (s *EpochProtocolStateAdapter) Identities() flow.IdentityList
- func (s *EpochProtocolStateAdapter) PreviousEpochExists() bool
- type Epochs
- type Params
- type Snapshot
- func FromSnapshot(from protocol.Snapshot) (*Snapshot, error)
- func SnapshotFromBootstrapState(root *flow.Block, result *flow.ExecutionResult, seal *flow.Seal, ...) (*Snapshot, error)
- func SnapshotFromBootstrapStateWithParams(root *flow.Block, result *flow.ExecutionResult, seal *flow.Seal, ...) (*Snapshot, error)
- func SnapshotFromEncodable(enc EncodableSnapshot) *Snapshot
- func (s Snapshot) Commit() (flow.StateCommitment, error)
- func (s Snapshot) Descendants() ([]flow.Identifier, error)
- func (s Snapshot) Encodable() EncodableSnapshot
- func (s Snapshot) EpochPhase() (flow.EpochPhase, error)
- func (s Snapshot) EpochProtocolState() (protocol.EpochProtocolState, error)
- func (s Snapshot) Epochs() protocol.EpochQuery
- func (s Snapshot) Head() (*flow.Header, error)
- func (s Snapshot) Identities(selector flow.IdentityFilter[flow.Identity]) (flow.IdentityList, error)
- func (s Snapshot) Identity(nodeID flow.Identifier) (*flow.Identity, error)
- func (s Snapshot) Params() protocol.GlobalParams
- func (s Snapshot) ProtocolState() (protocol.KVStoreReader, error)
- func (s Snapshot) QuorumCertificate() (*flow.QuorumCertificate, error)
- func (s Snapshot) RandomSource() ([]byte, error)
- func (s Snapshot) SealedResult() (*flow.ExecutionResult, *flow.Seal, error)
- func (s Snapshot) SealingSegment() (*flow.SealingSegment, error)
- func (s Snapshot) VersionBeacon() (*flow.SealedVersionBeacon, error)
- type ThresholdKeySet
- type ThresholdParticipant
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClusteringFromSetupEvent ¶ added in v0.26.1
func ClusteringFromSetupEvent(setupEvent *flow.EpochSetup) (flow.ClusterList, error)
func EpochProtocolStateFromServiceEvents ¶ added in v0.33.30
func EpochProtocolStateFromServiceEvents(setup *flow.EpochSetup, commit *flow.EpochCommit) *flow.MinEpochStateEntry
EpochProtocolStateFromServiceEvents generates a protocol.MinEpochStateEntry for a root protocol state which is used for bootstrapping.
CONTEXT: The EpochSetup event contains the IdentitySkeletons for each participant, thereby specifying active epoch members. While ejection status is not part of the EpochSetup event, we can supplement this information as follows:
- Per convention, service events are delivered (asynchronously) in an *order-preserving* manner. Furthermore, node ejection is also mediated by system smart contracts and delivered via service events.
- Therefore, the EpochSetup event contains the up-to-date snapshot of the epoch participants. Any node ejection that happened before should be reflected in the EpochSetup event. Specifically, ejected nodes should be no longer listed in the EpochSetup event. Hence, when the EpochSetup event is emitted / processed, the ejected flag is false for all epoch participants.
func NewCommittedEpoch ¶
func NewCommittedEpoch(setupEvent *flow.EpochSetup, extensions []flow.EpochExtension, commitEvent *flow.EpochCommit) protocol.Epoch
NewCommittedEpoch returns a memory-backed epoch implementation based on an EpochSetup and EpochCommit events. No errors are expected during normal operations.
func NewDKG ¶ added in v0.33.30
func NewDKG(setup *flow.EpochSetup, commit *flow.EpochCommit) protocol.DKG
NewDKG creates a new DKG instance from the given setup and commit events. TODO(EFM, #6794): Remove branch `commit.DKGIndexMap == nil` once we complete the network upgrade.
func NewEpochWithEndBoundary ¶ added in v0.33.30
func NewEpochWithEndBoundary(setupEvent *flow.EpochSetup, extensions []flow.EpochExtension, commitEvent *flow.EpochCommit, finalHeight uint64) protocol.Epoch
NewEpochWithEndBoundary returns a memory-backed epoch implementation based on an EpochSetup and EpochCommit events, and the epoch's final block height (end boundary). No errors are expected during normal operations.
func NewEpochWithStartAndEndBoundaries ¶ added in v0.33.30
func NewEpochWithStartAndEndBoundaries(setupEvent *flow.EpochSetup, extensions []flow.EpochExtension, commitEvent *flow.EpochCommit, firstHeight, finalHeight uint64) protocol.Epoch
NewEpochWithStartAndEndBoundaries returns a memory-backed epoch implementation based on an EpochSetup and EpochCommit events, and the epoch's first and final block heights (start+end boundaries). No errors are expected during normal operations.
func NewEpochWithStartBoundary ¶ added in v0.33.30
func NewEpochWithStartBoundary(setupEvent *flow.EpochSetup, extensions []flow.EpochExtension, commitEvent *flow.EpochCommit, firstHeight uint64) protocol.Epoch
NewEpochWithStartBoundary returns a memory-backed epoch implementation based on an EpochSetup and EpochCommit events, and the epoch's first block height (start boundary). No errors are expected during normal operations.
func NewSetupEpoch ¶
func NewSetupEpoch(setupEvent *flow.EpochSetup, extensions []flow.EpochExtension) protocol.Epoch
NewSetupEpoch returns a memory-backed epoch implementation based on an EpochSetup event. Epoch information available after the setup phase will not be accessible in the resulting epoch instance. No errors are expected during normal operations.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func ClusterFromEncodable ¶
func ClusterFromEncodable(enc EncodableCluster) (*Cluster, error)
ClusterFromEncodable returns a Cluster backed by the given encodable representation.
func (Cluster) EpochCounter ¶
func (Cluster) Members ¶
func (c Cluster) Members() flow.IdentitySkeletonList
func (Cluster) RootBlock ¶
func (c Cluster) RootBlock() *clustermodel.Block
func (Cluster) RootQC ¶
func (c Cluster) RootQC() *flow.QuorumCertificate
type DKG ¶
type DKG flow.EpochCommit
DKG defines a new type using flow.EpochCommit as underlying type and implements the protocol.DKG interface.
func (*DKG) Index ¶
func (d *DKG) Index(nodeID flow.Identifier) (uint, error)
Index returns the DKG index for the given node. Expected error during normal operations:
- protocol.IdentityNotFoundError if nodeID is not a known DKG participant
func (*DKG) KeyShare ¶
KeyShare returns the public key share for the given node. Expected error during normal operations:
- protocol.IdentityNotFoundError if nodeID is not a known DKG participant
func (*DKG) KeyShares ¶ added in v0.39.0
KeyShares returns the public portions of all threshold key shares. Note that there might not exist a private key corresponding to each entry (e.g. if the respective node failed the DKG).
func (*DKG) NodeID ¶ added in v0.39.0
func (d *DKG) NodeID(index uint) (flow.Identifier, error)
NodeID returns the node identifier for the given index. An exception is returned if the index is ≥ Size(). Intended for use outside the hotpath, with runtime scaling linearly in the number of DKG participants (ie. Size())
type DKGv0 ¶ added in v0.39.0
type DKGv0 struct { Participants flow.IdentitySkeletonList Commit *flow.EpochCommit }
DKGv0 implements the protocol.DKG interface for the EpochCommit model used before Protocol State Version 2. This model is used for flow.EpochCommit events without the DKGIndexMap field. TODO(EFM, #6794): Remove this once we complete the network upgrade
func NewDKGv0 ¶ added in v0.39.0
func NewDKGv0(setup *flow.EpochSetup, commit *flow.EpochCommit) *DKGv0
func (DKGv0) Index ¶ added in v0.39.0
func (d DKGv0) Index(nodeID flow.Identifier) (uint, error)
Index returns the DKG index for the given node. Expected error during normal operations:
- protocol.IdentityNotFoundError if nodeID is not a known DKG participant
func (DKGv0) KeyShare ¶ added in v0.39.0
KeyShare returns the public key share for the given node. Expected error during normal operations:
- protocol.IdentityNotFoundError if nodeID is not a known DKG participant
func (DKGv0) NodeID ¶ added in v0.39.0
func (d DKGv0) NodeID(index uint) (flow.Identifier, error)
NodeID returns the node identifier for the given index. An exception is returned if the index is ≥ Size(). Intended for use outside the hotpath, with runtime scaling linearly in the number of DKG participants (ie. Size())
type EncodableCluster ¶
type EncodableCluster struct { Index uint Counter uint64 Members flow.IdentitySkeletonList RootBlock *cluster.Block RootQC *flow.QuorumCertificate }
EncodableCluster is the encoding format for protocol.Cluster
type EncodableParams ¶ added in v0.23.2
type EncodableParams struct { ChainID flow.ChainID SporkID flow.Identifier SporkRootBlockHeight uint64 ProtocolVersion uint }
EncodableParams is the encoding format for protocol.GlobalParams
type EncodableSnapshot ¶
type EncodableSnapshot struct { SealingSegment *flow.SealingSegment QuorumCertificate *flow.QuorumCertificate Params EncodableParams SealedVersionBeacon *flow.SealedVersionBeacon }
EncodableSnapshot is the encoding format for protocol.Snapshot
func (EncodableSnapshot) Head ¶
func (snap EncodableSnapshot) Head() *flow.Header
Head returns the latest finalized header of the Snapshot, which is the block in the sealing segment with the greatest Height. The EncodableSnapshot receiver must be correctly formed.
func (EncodableSnapshot) LatestSeal ¶
func (snap EncodableSnapshot) LatestSeal() (*flow.Seal, error)
LatestSeal returns the latest seal of the Snapshot. This is the seal for the block with the greatest height, of all seals in the Snapshot. The EncodableSnapshot receiver must be correctly formed. No errors are expected during normal operation.
func (EncodableSnapshot) LatestSealedResult ¶ added in v0.33.30
func (snap EncodableSnapshot) LatestSealedResult() (*flow.ExecutionResult, error)
LatestSealedResult returns the latest sealed result of the Snapshot. This is the result which is sealed by LatestSeal. The EncodableSnapshot receiver must be correctly formed. No errors are expected during normal operation.
type EpochProtocolStateAdapter ¶ added in v0.33.30
type EpochProtocolStateAdapter struct { *flow.RichEpochStateEntry // contains filtered or unexported fields }
EpochProtocolStateAdapter implements protocol.EpochProtocolState by wrapping a flow.RichEpochStateEntry.
func NewEpochProtocolStateAdapter ¶ added in v0.33.30
func NewEpochProtocolStateAdapter(entry *flow.RichEpochStateEntry, params protocol.GlobalParams) *EpochProtocolStateAdapter
func (*EpochProtocolStateAdapter) Clustering ¶ added in v0.33.30
func (s *EpochProtocolStateAdapter) Clustering() (flow.ClusterList, error)
Clustering returns the cluster assignment for the current epoch. No errors are expected during normal operations.
func (*EpochProtocolStateAdapter) DKG ¶ added in v0.33.30
func (s *EpochProtocolStateAdapter) DKG() (protocol.DKG, error)
DKG returns the DKG information for the current epoch. No errors are expected during normal operations.
func (*EpochProtocolStateAdapter) Entry ¶ added in v0.33.30
func (s *EpochProtocolStateAdapter) Entry() *flow.RichEpochStateEntry
Entry Returns low-level protocol state entry that was used to initialize this object. It shouldn't be used by high-level logic, it is useful for some cases such as bootstrapping. Prefer using other methods to access protocol state.
func (*EpochProtocolStateAdapter) Epoch ¶ added in v0.33.30
func (s *EpochProtocolStateAdapter) Epoch() uint64
Epoch returns the current epoch counter.
func (*EpochProtocolStateAdapter) EpochCommit ¶ added in v0.33.30
func (s *EpochProtocolStateAdapter) EpochCommit() *flow.EpochCommit
EpochCommit returns the flow.EpochCommit service event which partly defines the initial epoch state for the current epoch.
func (*EpochProtocolStateAdapter) EpochExtensions ¶ added in v0.37.1
func (s *EpochProtocolStateAdapter) EpochExtensions() []flow.EpochExtension
EpochExtensions returns the epoch extensions associated with the current epoch, if any.
func (*EpochProtocolStateAdapter) EpochFallbackTriggered ¶ added in v0.37.1
func (s *EpochProtocolStateAdapter) EpochFallbackTriggered() bool
EpochFallbackTriggered denotes whether an invalid epoch state transition was attempted on the fork ending this block. Once the first block where this flag is true is finalized, epoch fallback mode is triggered. TODO for 'leaving Epoch Fallback via special service event': at the moment, this is a one-way transition and requires a spork to recover - need to revisit for sporkless EFM recovery
func (*EpochProtocolStateAdapter) EpochPhase ¶ added in v0.33.30
func (s *EpochProtocolStateAdapter) EpochPhase() flow.EpochPhase
EpochPhase returns the epoch phase for the current epoch. The receiver must be properly constructed. See flow.EpochPhase for detailed documentation.
func (*EpochProtocolStateAdapter) EpochSetup ¶ added in v0.33.30
func (s *EpochProtocolStateAdapter) EpochSetup() *flow.EpochSetup
EpochSetup returns the flow.EpochSetup service event which partly defines the initial epoch state for the current epoch.
func (*EpochProtocolStateAdapter) GlobalParams ¶ added in v0.33.30
func (s *EpochProtocolStateAdapter) GlobalParams() protocol.GlobalParams
GlobalParams returns spork-scoped global network parameters.
func (*EpochProtocolStateAdapter) Identities ¶ added in v0.33.30
func (s *EpochProtocolStateAdapter) Identities() flow.IdentityList
Identities returns the identity table as of the current block.
func (*EpochProtocolStateAdapter) PreviousEpochExists ¶ added in v0.33.30
func (s *EpochProtocolStateAdapter) PreviousEpochExists() bool
PreviousEpochExists returns true if a previous epoch exists. This is true for all epoch except those immediately following a spork.
type Epochs ¶
type Epochs struct {
// contains filtered or unexported fields
}
Epochs provides access to epoch data, backed by a rich epoch protocol state entry.
type Params ¶ added in v0.23.2
type Params struct {
// contains filtered or unexported fields
}
func FromParams ¶ added in v0.23.2
func FromParams(from protocol.GlobalParams) (*Params, error)
FromParams converts any protocol.GlobalParams to a memory-backed Params. TODO error docs
func NewParams ¶ added in v0.33.30
func NewParams(enc EncodableParams) *Params
func (Params) ProtocolVersion ¶ added in v0.23.2
func (Params) SporkID ¶ added in v0.23.2
func (p Params) SporkID() flow.Identifier
func (Params) SporkRootBlockHeight ¶ added in v0.29.6
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot is a memory-backed implementation of protocol.Snapshot. The snapshot data is stored in the embedded encodable snapshot model, which defines the canonical structure of an encoded snapshot for the purposes of serialization.
func FromSnapshot ¶
FromSnapshot generates a memory-backed snapshot from the input snapshot. Typically, this would be used to convert a database-backed snapshot to one that can easily be serialized to disk or to network. TODO error docs
func SnapshotFromBootstrapState ¶
func SnapshotFromBootstrapState(root *flow.Block, result *flow.ExecutionResult, seal *flow.Seal, qc *flow.QuorumCertificate) (*Snapshot, error)
SnapshotFromBootstrapState generates a protocol.Snapshot representing a root bootstrap state. This is used to bootstrap the protocol state for genesis or post-spork states.
func SnapshotFromBootstrapStateWithParams ¶ added in v0.29.0
func SnapshotFromBootstrapStateWithParams( root *flow.Block, result *flow.ExecutionResult, seal *flow.Seal, qc *flow.QuorumCertificate, protocolVersion uint, kvStoreFactory func(epochStateID flow.Identifier) (protocol_state.KVStoreAPI, error), ) (*Snapshot, error)
SnapshotFromBootstrapStateWithParams is SnapshotFromBootstrapState with a caller-specified protocol version.
func SnapshotFromEncodable ¶
func SnapshotFromEncodable(enc EncodableSnapshot) *Snapshot
func (Snapshot) Descendants ¶ added in v0.17.6
func (s Snapshot) Descendants() ([]flow.Identifier, error)
func (Snapshot) Encodable ¶
func (s Snapshot) Encodable() EncodableSnapshot
func (Snapshot) EpochPhase ¶ added in v0.37.1
func (s Snapshot) EpochPhase() (flow.EpochPhase, error)
func (Snapshot) EpochProtocolState ¶ added in v0.33.30
func (s Snapshot) EpochProtocolState() (protocol.EpochProtocolState, error)
func (Snapshot) Epochs ¶
func (s Snapshot) Epochs() protocol.EpochQuery
func (Snapshot) Identities ¶
func (s Snapshot) Identities(selector flow.IdentityFilter[flow.Identity]) (flow.IdentityList, error)
func (Snapshot) Params ¶ added in v0.23.2
func (s Snapshot) Params() protocol.GlobalParams
func (Snapshot) ProtocolState ¶ added in v0.33.30
func (s Snapshot) ProtocolState() (protocol.KVStoreReader, error)
func (Snapshot) QuorumCertificate ¶
func (s Snapshot) QuorumCertificate() (*flow.QuorumCertificate, error)
func (Snapshot) RandomSource ¶ added in v0.25.0
func (Snapshot) SealedResult ¶
func (Snapshot) SealingSegment ¶
func (s Snapshot) SealingSegment() (*flow.SealingSegment, error)
func (Snapshot) VersionBeacon ¶ added in v0.31.0
func (s Snapshot) VersionBeacon() (*flow.SealedVersionBeacon, error)
type ThresholdKeySet ¶ added in v0.39.0
type ThresholdKeySet struct { GroupKey encodable.RandomBeaconPubKey Participants []ThresholdParticipant }
ThresholdKeySet contains the key set for a threshold signature scheme. Typically, the ThresholdKeySet is used to encode the output of a trusted setup. In general, signature scheme is configured with a threshold parameter t, which is the number of malicious colluding nodes the signature scheme is safe against. To balance liveness and safety, the Flow protocol fixes threshold to t = floor((n-1)/2), for n the number of parties in the threshold cryptography scheme, specifically n = len(Participants). Without loss of generality, our threshold cryptography protocol with n parties identifies the individual participants by the indices {0, 1, …, n-1}. The slice Participants is ordered accordingly.
type ThresholdParticipant ¶ added in v0.39.0
type ThresholdParticipant struct { NodeID flow.Identifier }
ThresholdParticipant encodes the threshold key data for single participant.