Documentation ¶
Index ¶
- func IsMessageFromSelf(memberIndex MemberIndex, message ProtocolMessage) bool
- func IsSenderAccepted(filter MessageFiltering, message ProtocolMessage) bool
- func IsSenderValid(filter MessageFiltering, message ProtocolMessage, senderPublicKey []byte) bool
- type Group
- func (g *Group) DishonestThreshold() int
- func (g *Group) DisqualifiedMemberIDs() []MemberIndex
- func (g *Group) GroupSize() int
- func (g *Group) InactiveMemberIDs() []MemberIndex
- func (g *Group) IsOperating(memberID MemberIndex) bool
- func (g *Group) MarkMemberAsDisqualified(memberID MemberIndex)
- func (g *Group) MarkMemberAsInactive(memberID MemberIndex)
- func (g *Group) MemberIDs() []MemberIndex
- func (g *Group) OperatingMemberIDs() []MemberIndex
- type InactiveMemberFilter
- type MemberIndex
- type MembershipValidator
- type MessageFiltering
- type ProtocolMessage
- type StakersMembershipValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsMessageFromSelf ¶
func IsMessageFromSelf(memberIndex MemberIndex, message ProtocolMessage) bool
IsMessageFromSelf is an auxiliary function determining whether the given ProtocolMessage is from the current member itself.
func IsSenderAccepted ¶
func IsSenderAccepted(filter MessageFiltering, message ProtocolMessage) bool
IsSenderAccepted determines if sender of the given ProtocoLMessage is accepted by group (not marked as inactive or disqualified).
func IsSenderValid ¶
func IsSenderValid( filter MessageFiltering, message ProtocolMessage, senderPublicKey []byte, ) bool
IsSenderValid checks if sender of the provided ProtocolMessage is in the group and uses appropriate group member index.
Types ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group is protocol's members group.
func NewDkgGroup ¶
NewDkgGroup creates a new Group with the provided dishonest threshold, member identifiers, and empty IA and DQ members list.
func (*Group) DishonestThreshold ¶
DishonestThreshold returns value of the dishonest members threshold as set for the group.
func (*Group) DisqualifiedMemberIDs ¶
func (g *Group) DisqualifiedMemberIDs() []MemberIndex
DisqualifiedMemberIDs returns indexes of all group members that have been disqualified during DKG protocol execution.
func (*Group) GroupSize ¶
GroupSize returns the full size of the group, including IA and DQ members.
func (*Group) InactiveMemberIDs ¶
func (g *Group) InactiveMemberIDs() []MemberIndex
InactiveMemberIDs returns indexes of all group members that have been marked as inactive during DKG protocol execution.
func (*Group) IsOperating ¶
func (g *Group) IsOperating(memberID MemberIndex) bool
IsOperating returns true if member with the given index has not been marked as IA or DQ in the group.
func (*Group) MarkMemberAsDisqualified ¶
func (g *Group) MarkMemberAsDisqualified(memberID MemberIndex)
MarkMemberAsDisqualified adds the member with the given ID to the list of disqualified members. If the member is not a part of the group, is already disqualified or marked as inactive, method does nothing.
func (*Group) MarkMemberAsInactive ¶
func (g *Group) MarkMemberAsInactive(memberID MemberIndex)
MarkMemberAsInactive adds the member with the given ID to the list of inactive members. If the member is not a part of the group, is already disqualified or marked as inactive, method does nothing.
func (*Group) MemberIDs ¶
func (g *Group) MemberIDs() []MemberIndex
MemberIDs returns IDs of all group members, as initially selected to the group. Returned list contains IDs of all members, including those marked as inactive or disqualified.
func (*Group) OperatingMemberIDs ¶
func (g *Group) OperatingMemberIDs() []MemberIndex
OperatingMemberIDs returns IDs of all group members that are active and have not been disqualified. All those members are properly operating in the group at the moment of calling this method.
type InactiveMemberFilter ¶
type InactiveMemberFilter struct {
// contains filtered or unexported fields
}
InactiveMemberFilter is a proxy facilitates filtering out inactive members in the given phase and registering their final list in DKG Group.
func NewInactiveMemberFilter ¶
func NewInactiveMemberFilter( selfMemberIndex MemberIndex, group *Group, ) *InactiveMemberFilter
NewInactiveMemberFilter creates a new instance of InactiveMemberFilter. It accepts member index of the current member (the one which will be filtering out other group members for inactivity) and the reference to Group to which all those members belong.
func (*InactiveMemberFilter) FlushInactiveMembers ¶
func (mf *InactiveMemberFilter) FlushInactiveMembers()
FlushInactiveMembers takes all members who were not previously marked as active and flushes them to DKG group as inactive members.
func (*InactiveMemberFilter) MarkMemberAsActive ¶
func (mf *InactiveMemberFilter) MarkMemberAsActive(memberID MemberIndex)
MarkMemberAsActive marks member with the given index as active in the given phase.
type MemberIndex ¶
type MemberIndex = uint8
MemberIndex is an index of a member in a group. The maximum member index value is 255.
type MembershipValidator ¶
type MembershipValidator interface { IsInGroup(publicKey *ecdsa.PublicKey) bool IsValidMembership(memberID MemberIndex, publicKey []byte) bool }
MembershipValidator lets to validate one's membership based on the provided public key.
type MessageFiltering ¶
type MessageFiltering interface { // IsSenderAccepted returns true if the message from the given sender should be // accepted for further processing. Otherwise, function returns false. // Message from the given sender is allowed only if that member is a properly // operating group member - it was not DQ or IA so far. IsSenderAccepted(senderID MemberIndex) bool // IsSenderValid returns true if the message from the given sender should be // accepted for further processing. Otherwise, function returns false. // IsSenderValid checks if sender of the provided ProtocolMessage is in the // group and uses appropriate group member index. IsSenderValid(senderID MemberIndex, senderPublicKey []byte) bool }
MessageFiltering interface defines method allowing to filter out messages from members that are not part of the group or were marked as IA or DQ.
type ProtocolMessage ¶
type ProtocolMessage interface { // SenderID returns protocol-level identifier of the message sender. SenderID() MemberIndex }
ProtocolMessage is a common interface for all messages of GJKR DKG protocol.
type StakersMembershipValidator ¶
type StakersMembershipValidator struct {
// contains filtered or unexported fields
}
StakersMembershipValidator operates on a group selection result and lets to validate one's membership based on the provided public key.
Validator is used to filter out messages from parties not selected to the group. It is also used to confirm the position in the group of a party that was selected. This is used to validate messages sent by that party to all other group members.
func NewStakersMembershipValidator ¶
func NewStakersMembershipValidator( stakersAddresses []relaychain.StakerAddress, signing chain.Signing, ) *StakersMembershipValidator
NewStakersMembershipValidator creates a validator for the provided group selection result.
func (*StakersMembershipValidator) IsInGroup ¶
func (smv *StakersMembershipValidator) IsInGroup( publicKey *ecdsa.PublicKey, ) bool
IsInGroup returns true if party with the given public key has been selected to the group. Otherwise, function returns false.
func (*StakersMembershipValidator) IsValidMembership ¶
func (smv *StakersMembershipValidator) IsValidMembership( memberID MemberIndex, publicKey []byte, ) bool
IsValidMembership returns true if party with the given public key has been selected to the group at the given position. If the position does not match function returns false. The same happens when the party was not selected to the group.