Documentation ¶
Index ¶
- func ClusteringFromSetupEvent(setupEvent *flow.EpochSetup) (flow.ClusterList, error)
- func NewCommittedEpoch(setupEvent *flow.EpochSetup, commitEvent *flow.EpochCommit) protocol.Epoch
- func NewEpochWithEndBoundary(setupEvent *flow.EpochSetup, commitEvent *flow.EpochCommit, finalHeight uint64) protocol.Epoch
- func NewEpochWithStartAndEndBoundaries(setupEvent *flow.EpochSetup, commitEvent *flow.EpochCommit, ...) protocol.Epoch
- func NewEpochWithStartBoundary(setupEvent *flow.EpochSetup, commitEvent *flow.EpochCommit, firstHeight uint64) protocol.Epoch
- func NewSetupEpoch(setupEvent *flow.EpochSetup) protocol.Epoch
- func ProtocolStateFromEpochServiceEvents(setup *flow.EpochSetup, commit *flow.EpochCommit) *flow.ProtocolStateEntry
- type Cluster
- type DKG
- type DynamicProtocolStateAdapter
- func (s *DynamicProtocolStateAdapter) EpochPhase() flow.EpochPhase
- func (s *DynamicProtocolStateAdapter) GlobalParams() protocol.GlobalParams
- func (s *DynamicProtocolStateAdapter) Identities() flow.IdentityList
- func (s *DynamicProtocolStateAdapter) InvalidEpochTransitionAttempted() bool
- func (s *DynamicProtocolStateAdapter) PreviousEpochExists() bool
- type EncodableCluster
- type EncodableDKG
- type EncodableFullDKG
- type EncodableParams
- type EncodableSnapshot
- type Epochs
- type InitialProtocolStateAdapter
- func (s *InitialProtocolStateAdapter) Clustering() (flow.ClusterList, error)
- func (s *InitialProtocolStateAdapter) DKG() (protocol.DKG, error)
- func (s *InitialProtocolStateAdapter) Entry() *flow.RichProtocolStateEntry
- func (s *InitialProtocolStateAdapter) Epoch() uint64
- func (s *InitialProtocolStateAdapter) EpochCommit() *flow.EpochCommit
- func (s *InitialProtocolStateAdapter) EpochSetup() *flow.EpochSetup
- 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) EpochProtocolState() (protocol.DynamicProtocolState, 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) Phase() (flow.EpochPhase, error)
- 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)
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 NewCommittedEpoch ¶
func NewCommittedEpoch(setupEvent *flow.EpochSetup, 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 NewEpochWithEndBoundary ¶ added in v0.33.30
func NewEpochWithEndBoundary(setupEvent *flow.EpochSetup, 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, 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, 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) 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.
func ProtocolStateFromEpochServiceEvents ¶ added in v0.35.4
func ProtocolStateFromEpochServiceEvents(setup *flow.EpochSetup, commit *flow.EpochCommit) *flow.ProtocolStateEntry
ProtocolStateFromEpochServiceEvents generates a protocol.ProtocolStateEntry 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.
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 FromCluster ¶
FromCluster converts any protocol.Cluster to a memory-backed Cluster. No errors are expected during normal operation.
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 struct {
// contains filtered or unexported fields
}
func DKGFromEncodable ¶
func DKGFromEncodable(enc EncodableDKG) (*DKG, error)
DKGFromEncodable returns a DKG backed by the given encodable representation.
func FromDKG ¶
FromDKG converts any protocol.DKG to a memory-backed DKG.
The given participant list must exactly match the DKG members. All errors indicate inconsistent or invalid inputs. No errors are expected during normal operation.
func NewDKG ¶ added in v0.33.30
func NewDKG(enc EncodableDKG) *DKG
func (DKG) Index ¶
func (d DKG) Index(nodeID flow.Identifier) (uint, error)
Index returns the index for the given node. Error Returns: protocol.IdentityNotFoundError if nodeID is not a valid DKG participant.
type DynamicProtocolStateAdapter ¶ added in v0.35.4
type DynamicProtocolStateAdapter struct { InitialProtocolStateAdapter // contains filtered or unexported fields }
DynamicProtocolStateAdapter implements protocol.DynamicProtocolState by wrapping an InitialProtocolStateAdapter.
func NewDynamicProtocolStateAdapter ¶ added in v0.35.4
func NewDynamicProtocolStateAdapter(entry *flow.RichProtocolStateEntry, params protocol.GlobalParams) *DynamicProtocolStateAdapter
func (*DynamicProtocolStateAdapter) EpochPhase ¶ added in v0.35.4
func (s *DynamicProtocolStateAdapter) EpochPhase() flow.EpochPhase
EpochPhase returns the epoch phase for the current epoch.
func (*DynamicProtocolStateAdapter) GlobalParams ¶ added in v0.35.4
func (s *DynamicProtocolStateAdapter) GlobalParams() protocol.GlobalParams
func (*DynamicProtocolStateAdapter) Identities ¶ added in v0.35.4
func (s *DynamicProtocolStateAdapter) Identities() flow.IdentityList
func (*DynamicProtocolStateAdapter) InvalidEpochTransitionAttempted ¶ added in v0.35.4
func (s *DynamicProtocolStateAdapter) InvalidEpochTransitionAttempted() bool
InvalidEpochTransitionAttempted 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 (*DynamicProtocolStateAdapter) PreviousEpochExists ¶ added in v0.35.4
func (s *DynamicProtocolStateAdapter) PreviousEpochExists() bool
PreviousEpochExists returns true if a previous epoch exists. This is true for all epoch except those immediately following a spork.
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 EncodableDKG ¶
type EncodableDKG struct { GroupKey encodable.RandomBeaconPubKey Participants map[flow.Identifier]flow.DKGParticipant }
EncodableDKG is the encoding format for protocol.DKG
func EncodableDKGFromEvents ¶ added in v0.33.30
func EncodableDKGFromEvents(setup *flow.EpochSetup, commit *flow.EpochCommit) (EncodableDKG, error)
EncodableDKGFromEvents returns an EncodableDKG constructed from epoch setup and commit events. No errors are expected during normal operations.
type EncodableFullDKG ¶ added in v0.22.8
type EncodableFullDKG struct { GroupKey encodable.RandomBeaconPubKey }
type EncodableParams ¶ added in v0.23.2
type EncodableParams struct { ChainID flow.ChainID SporkID flow.Identifier SporkRootBlockHeight uint64 ProtocolVersion uint EpochCommitSafetyThreshold uint64 }
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 Epochs ¶
type Epochs struct {
// contains filtered or unexported fields
}
Epochs provides access to epoch data, backed by a rich protocol state entry.
type InitialProtocolStateAdapter ¶ added in v0.35.4
type InitialProtocolStateAdapter struct {
*flow.RichProtocolStateEntry
}
InitialProtocolStateAdapter implements protocol.InitialProtocolState by wrapping a RichProtocolStateEntry. TODO(yuraolex): for sake of avoiding errors in return values in interface methods this adapter pre-caches some values. This is debatable as clustering for instance is not accessed frequently and could be lazily loaded. The problem with lazy loading is handling error value from `inmem.ClusteringFromSetupEvent`. There are two ways to avoid it: 1. Return error from interface method. 2. Inject irrecoverable.Signaler into the adapter and panic on error since any error in that method has to be a severe implementation bug.
func NewInitialProtocolStateAdapter ¶ added in v0.35.4
func NewInitialProtocolStateAdapter(entry *flow.RichProtocolStateEntry) *InitialProtocolStateAdapter
func (*InitialProtocolStateAdapter) Clustering ¶ added in v0.35.4
func (s *InitialProtocolStateAdapter) Clustering() (flow.ClusterList, error)
func (*InitialProtocolStateAdapter) DKG ¶ added in v0.35.4
func (s *InitialProtocolStateAdapter) DKG() (protocol.DKG, error)
func (*InitialProtocolStateAdapter) Entry ¶ added in v0.35.4
func (s *InitialProtocolStateAdapter) Entry() *flow.RichProtocolStateEntry
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 (*InitialProtocolStateAdapter) Epoch ¶ added in v0.35.4
func (s *InitialProtocolStateAdapter) Epoch() uint64
func (*InitialProtocolStateAdapter) EpochCommit ¶ added in v0.35.4
func (s *InitialProtocolStateAdapter) EpochCommit() *flow.EpochCommit
func (*InitialProtocolStateAdapter) EpochSetup ¶ added in v0.35.4
func (s *InitialProtocolStateAdapter) EpochSetup() *flow.EpochSetup
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) EpochCommitSafetyThreshold ¶ added in v0.29.0
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, epochCommitSafetyThreshold uint64, kvStoreFactory func(epochStateID flow.Identifier) protocol_state.KVStoreAPI, ) (*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) EpochProtocolState ¶ added in v0.33.30
func (s Snapshot) EpochProtocolState() (protocol.DynamicProtocolState, 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)