Documentation ¶
Index ¶
- Variables
- func Adapt(f flow.IdentityFilter[flow.IdentitySkeleton]) flow.IdentityFilter[flow.Identity]
- func And[T flow.GenericIdentity](filters ...flow.IdentityFilter[T]) flow.IdentityFilter[T]
- func Any(*flow.Identity) bool
- func HasInitialWeight[T flow.GenericIdentity](hasWeight bool) flow.IdentityFilter[T]
- func HasNetworkingKey(keys ...crypto.PublicKey) flow.IdentityFilter[flow.Identity]
- func HasNodeID[T flow.GenericIdentity](nodeIDs ...flow.Identifier) flow.IdentityFilter[T]
- func HasParticipationStatus(status flow.EpochParticipationStatus) flow.IdentityFilter[flow.Identity]
- func HasRole[T flow.GenericIdentity](roles ...flow.Role) flow.IdentityFilter[T]
- func HasWeightGreaterThanZero[T flow.GenericIdentity](identity *T) bool
- func In[T flow.GenericIdentity](list flow.GenericIdentityList[T]) flow.IdentityFilter[T]
- func Not[T flow.GenericIdentity](filter flow.IdentityFilter[T]) flow.IdentityFilter[T]
- func Or[T flow.GenericIdentity](filters ...flow.IdentityFilter[T]) flow.IdentityFilter[T]
Constants ¶
This section is empty.
Variables ¶
var IsConsensusCommitteeMember = And( HasRole[flow.IdentitySkeleton](flow.RoleConsensus), HasInitialWeight[flow.IdentitySkeleton](true), )
IsConsensusCommitteeMember is an identity filter for all members of the consensus committee. Formally, a Node X is a Consensus Committee Member if and only if X is a consensus node with positive initial weight. This is specified by the EpochSetup Event and remains static throughout the epoch.
var IsValidCurrentEpochParticipant = HasParticipationStatus(flow.EpochParticipationStatusActive)
IsValidCurrentEpochParticipant is an identity filter for members of the current epoch in good standing. Effective it means that node is an active identity in current epoch and has not been ejected.
var IsValidCurrentEpochParticipantOrJoining = Or(IsValidCurrentEpochParticipant, HasParticipationStatus(flow.EpochParticipationStatusJoining))
IsValidCurrentEpochParticipantOrJoining is an identity filter for members of the current epoch or that are going to join in next epoch.
var IsValidDKGParticipant = IsConsensusCommitteeMember
IsValidDKGParticipant is an identity filter for all DKG participants. It is equivalent to the filter for consensus committee members, as these are the same group for now.
var IsValidProtocolParticipant = And[flow.Identity]( NotEjectedFilter, HasWeightGreaterThanZero[flow.Identity], )
IsValidProtocolParticipant is an identity filter for all valid protocol participants. A protocol participant is considered valid if and only if the following are both true. 1. The node is not ejected. 2. The node has a weight greater than 0.
var IsVotingConsensusCommitteeMember = And[flow.Identity]( IsValidCurrentEpochParticipant, Adapt(IsConsensusCommitteeMember), )
IsVotingConsensusCommitteeMember is an identity filter for all members of the consensus committee allowed to vote. Formally, a Node X has authority to vote in the consensus process, if and only if
- Node X is an active member of the current epoch AND
- X is a consensus node with positive initial weight in the current Epoch. This is specified by the EpochSetup Event for the current epoch and remains static throughout the epoch.
var NotEjectedFilter = Not(HasParticipationStatus(flow.EpochParticipationStatusEjected))
NotEjectedFilter is an identity filter for peers that are not ejected.
Functions ¶
func Adapt ¶ added in v0.33.30
func Adapt(f flow.IdentityFilter[flow.IdentitySkeleton]) flow.IdentityFilter[flow.Identity]
Adapt takes an IdentityFilter on the domain of IdentitySkeletons and adapts the filter to the domain of full Identities. In other words, it converts flow.IdentityFilter[flow.IdentitySkeleton] to flow.IdentityFilter[flow.Identity].
func And ¶
func And[T flow.GenericIdentity](filters ...flow.IdentityFilter[T]) flow.IdentityFilter[T]
And combines two or more filters that all need to be true.
func HasInitialWeight ¶ added in v0.33.30
func HasInitialWeight[T flow.GenericIdentity](hasWeight bool) flow.IdentityFilter[T]
HasInitialWeight returns a filter for nodes with non-zero initial weight.
func HasNetworkingKey ¶ added in v0.21.1
HasNetworkingKey returns a filter that returns true for any identity with a networking public key matching any of the inputs.
func HasNodeID ¶
func HasNodeID[T flow.GenericIdentity](nodeIDs ...flow.Identifier) flow.IdentityFilter[T]
HasNodeID returns a filter that returns true for any identity with an ID matching any of the inputs.
func HasParticipationStatus ¶ added in v0.33.30
func HasParticipationStatus(status flow.EpochParticipationStatus) flow.IdentityFilter[flow.Identity]
HasParticipationStatus is a filter that returns true if the node epoch participation status matches the input.
func HasRole ¶
func HasRole[T flow.GenericIdentity](roles ...flow.Role) flow.IdentityFilter[T]
HasRole returns a filter for nodes with one of the input roles.
func HasWeightGreaterThanZero ¶ added in v0.33.30
func HasWeightGreaterThanZero[T flow.GenericIdentity](identity *T) bool
HasWeightGreaterThanZero returns a filter for nodes with a weight greater than zero.
func In ¶
func In[T flow.GenericIdentity](list flow.GenericIdentityList[T]) flow.IdentityFilter[T]
In returns a filter for identities within the input list. For an input identity i, the filter returns true if and only if i ∈ list. Caution: The filter solely operates on NodeIDs. Other identity fields are not compared. This function is just a compact representation of `HasNodeID[T](list.NodeIDs()...)` which behaves algorithmically the same way.
func Not ¶
func Not[T flow.GenericIdentity](filter flow.IdentityFilter[T]) flow.IdentityFilter[T]
Not returns a filter equivalent to the inverse of the input filter.
func Or ¶
func Or[T flow.GenericIdentity](filters ...flow.IdentityFilter[T]) flow.IdentityFilter[T]
Or combines two or more filters and only needs one of them to be true.
Types ¶
This section is empty.