github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/model/messages/dkg.go (about) 1 package messages 2 3 import ( 4 "github.com/onflow/crypto" 5 6 "github.com/onflow/flow-go/model/flow" 7 ) 8 9 // DKGMessage is the type of message exchanged between DKG nodes. 10 type DKGMessage struct { 11 Data []byte 12 DKGInstanceID string 13 } 14 15 // NewDKGMessage creates a new DKGMessage. 16 func NewDKGMessage(data []byte, dkgInstanceID string) DKGMessage { 17 return DKGMessage{ 18 Data: data, 19 DKGInstanceID: dkgInstanceID, 20 } 21 } 22 23 // PrivDKGMessageIn is a wrapper around a DKGMessage containing the network ID 24 // of the sender. 25 type PrivDKGMessageIn struct { 26 DKGMessage 27 CommitteeMemberIndex uint64 // CommitteeMemberIndex field is set when the message arrives at the Broker 28 OriginID flow.Identifier 29 } 30 31 // PrivDKGMessageOut is a wrapper around a DKGMessage containing the network ID of 32 // the destination. 33 type PrivDKGMessageOut struct { 34 DKGMessage 35 DestID flow.Identifier 36 } 37 38 // BroadcastDKGMessage is a wrapper around a DKGMessage intended for broadcasting. 39 // It contains a signature of the DKGMessage signed with the staking key of the 40 // sender. When the DKG contract receives BroadcastDKGMessage' it will attach the 41 // NodeID of the sender, we then add this field to the BroadcastDKGMessage when reading broadcast messages. 42 type BroadcastDKGMessage struct { 43 DKGMessage 44 CommitteeMemberIndex uint64 `json:"-"` // CommitteeMemberIndex field is set when reading broadcast messages using the NodeID to find the index of the sender in the DKG committee 45 NodeID flow.Identifier `json:"-"` // NodeID field is added when reading broadcast messages from the DKG contract, this field is ignored when sending broadcast messages 46 Signature crypto.Signature 47 }