Documentation ¶
Index ¶
- func PrePublicationBlocks() uint64
- func Publish(memberIndex group.MemberIndex, dkgGroup *group.Group, ...) error
- func RegisterUnmarshallers(channel net.BroadcastChannel)
- type DKGResultHashSignatureMessage
- type SigningMember
- func (sm *SigningMember) IsSenderAccepted(senderID group.MemberIndex) bool
- func (sm *SigningMember) IsSenderValid(senderID group.MemberIndex, senderPublicKey []byte) bool
- func (sm *SigningMember) SignDKGResult(dkgResult *relayChain.DKGResult, relayChain relayChain.Interface, ...) (*DKGResultHashSignatureMessage, error)
- func (sm *SigningMember) VerifyDKGResultSignatures(messages []*DKGResultHashSignatureMessage, signing chain.Signing) (map[group.MemberIndex][]byte, error)
- type SubmittingMember
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrePublicationBlocks ¶
func PrePublicationBlocks() uint64
PrePublicationBlocks returns the total number of blocks it takes to execute all the required work to get ready for the result publication or to decide to skip the publication because there are not enough supporters of the given result.
func Publish ¶
func Publish( memberIndex group.MemberIndex, dkgGroup *group.Group, membershipValidator group.MembershipValidator, result *gjkr.Result, channel net.BroadcastChannel, relayChain relayChain.Interface, signing chain.Signing, blockCounter chain.BlockCounter, startBlockHeight uint64, ) error
Publish executes Phase 13 and 14 of DKG as a state machine. First, the chosen result is hashed, signed, and sent over a broadcast channel. Then, all other signatures and results are received and accounted for. Those that match our own result and added to the list of votes. Finally, we submit the result along with everyone's votes.
func RegisterUnmarshallers ¶
func RegisterUnmarshallers(channel net.BroadcastChannel)
RegisterUnmarshallers initializes the given broadcast channel to be able to perform DKG result publication protocol interactions by registering all the required protocol message unmarshallers. The channel needs to be fully initialized before Publish is called.
Types ¶
type DKGResultHashSignatureMessage ¶
type DKGResultHashSignatureMessage struct {
// contains filtered or unexported fields
}
DKGResultHashSignatureMessage is a message payload that carries a hash of the DKG result and a signature over this hash for a DKG result.
It is expected to be broadcast within the group.
func (*DKGResultHashSignatureMessage) Marshal ¶
func (d *DKGResultHashSignatureMessage) Marshal() ([]byte, error)
Marshal converts this DKGResultHashSignatureMessage to a byte array suitable for network communication.
func (*DKGResultHashSignatureMessage) SenderID ¶
func (m *DKGResultHashSignatureMessage) SenderID() group.MemberIndex
SenderID returns protocol-level identifier of the message sender.
func (*DKGResultHashSignatureMessage) Type ¶
func (d *DKGResultHashSignatureMessage) Type() string
Type returns a string describing a DKGResultHashSignatureMessage type for marshalling purposes.
func (*DKGResultHashSignatureMessage) Unmarshal ¶
func (d *DKGResultHashSignatureMessage) Unmarshal(bytes []byte) error
Unmarshal converts a byte array produced by Marshal to a DKGResultHashSignatureMessage.
type SigningMember ¶
type SigningMember struct {
// contains filtered or unexported fields
}
SigningMember represents a group member sharing their preferred DKG result hash and signature (over this hash) with other peer members.
func NewSigningMember ¶
func NewSigningMember( memberIndex group.MemberIndex, dkgGroup *group.Group, membershipValidator group.MembershipValidator, ) *SigningMember
NewSigningMember creates a member to execute signing DKG result hash.
func (*SigningMember) IsSenderAccepted ¶
func (sm *SigningMember) IsSenderAccepted(senderID group.MemberIndex) bool
IsSenderAccepted determines if sender of the message is accepted by group (not marked as inactive or disqualified).
func (*SigningMember) IsSenderValid ¶
func (sm *SigningMember) IsSenderValid( senderID group.MemberIndex, senderPublicKey []byte, ) bool
IsSenderValid checks if sender of the provided ProtocolMessage is in the group and uses appropriate group member index.
func (*SigningMember) SignDKGResult ¶
func (sm *SigningMember) SignDKGResult( dkgResult *relayChain.DKGResult, relayChain relayChain.Interface, signing chain.Signing, ) ( *DKGResultHashSignatureMessage, error, )
SignDKGResult calculates hash of DKG result and member's signature over this hash. It packs the hash and signature into a broadcast message.
See Phase 13 of the protocol specification.
func (*SigningMember) VerifyDKGResultSignatures ¶
func (sm *SigningMember) VerifyDKGResultSignatures( messages []*DKGResultHashSignatureMessage, signing chain.Signing, ) (map[group.MemberIndex][]byte, error)
VerifyDKGResultSignatures verifies signatures received in messages from other group members.
It collects signatures supporting only the same DKG result hash as the one preferred by the current member.
Each member is allowed to broadcast only one signature over a preferred DKG result hash.
The function assumes that the public key presented in the message is the correct one. This key needs to be compared against the one used by network client earlier, before this function is called.
See Phase 13 of the protocol specification.
type SubmittingMember ¶
type SubmittingMember struct {
// contains filtered or unexported fields
}
SubmittingMember represents a member submitting a DKG result to the blockchain along with signatures received from other group members supporting the result.
func NewSubmittingMember ¶
func NewSubmittingMember( memberIndex group.MemberIndex, ) *SubmittingMember
NewSubmittingMember creates a member to execute submitting the DKG result hash.
func (*SubmittingMember) SubmitDKGResult ¶
func (sm *SubmittingMember) SubmitDKGResult( result *relayChain.DKGResult, signatures map[group.MemberIndex][]byte, chainRelay relayChain.Interface, blockCounter chain.BlockCounter, startBlockHeight uint64, ) error
SubmitDKGResult sends a result, which contains the group public key and signatures, to the chain.
It checks if the result has already been published to the blockchain by checking if a group with the given public key is already registered. If not, it determines if the current member is eligible to submit a result. If allowed, it submits the result to the chain.
A user's turn to publish is determined based on the user's index and block step.
If a result is submitted by another member and it's accepted by the chain, the current member finishes the phase immediately, without submitting their own result.
It returns the on-chain block height of the moment when the result was successfully submitted on chain by the member. In case of failure or result already submitted by another member it returns `0`.
See Phase 14 of the protocol specification.