Documentation ¶
Index ¶
- Constants
- Variables
- func CreateReceivedEchoMap() map[NodeDetailsID]receivedEchoState
- func CreateReceivedReadyMap() map[NodeDetailsID]receivedReadyState
- func GetPointArrayFromMap(m map[NodeDetailsID]common.Point) (res []common.Point)
- func SignedTextToProposeProof(c00 common.Point, st map[NodeDetailsID]SignedText) (pp map[NodeDetailsID]ProposeProof)
- type C
- type CID
- type DKG
- type DKGID
- type KeyStorage
- type Keygen
- type KeygenID
- type KeygenIDDetails
- type KeygenMessage
- type KeygenMsgComplete
- type KeygenMsgDecide
- type KeygenMsgEcho
- type KeygenMsgNIZKP
- type KeygenMsgPropose
- type KeygenMsgPubKey
- type KeygenMsgReady
- type KeygenMsgSend
- type KeygenMsgShare
- type KeygenNode
- type KeygenState
- type KeygenTransport
- type NIZKP
- type NodeDetails
- type NodeDetailsID
- type NodeNetwork
- type ProposeProof
- type Sharing
- type SignedText
- type SignedTextDetails
Constants ¶
const NullKeygenID = KeygenID("")
Variables ¶
var KCounters = keygenCounters{
ProcessedMessages: "keygen_processed_messages",
ShareMessage: "keygen_share_message",
SendMessage: "keygen_send_message",
EchoMessage: "keygen_echo_message",
ReadyMessage: "keygen_ready_message",
CompleteMessage: "keygen_complete_message",
NizkpMessage: "keygen_nizkp_message",
DecideMessage: "keygen_decide_message",
IgnoredMessage: "keygen_ignored_message",
AlreadyReceivedReady: "keygen_already_received_ready",
InvalidEcho: "keygen_invalid_echo",
InvalidReady: "keygen_invalid_ready",
ReadySigInvalid: "keygen_ready_sig_invalid",
ReadyBeforeEcho: "keygen_ready_before_echo",
SendingEcho: "keygen_sending_echo",
SendingReady: "keygen_sending_ready",
SendingComplete: "keygen_sending_complete",
InvalidShareCommitment: "keygen_invalid_share_commitment",
InvalidNizkp: "keygen_invalid_nizkp",
InvalidMethod: "keygen_invalid_method",
SendingProposal: "keygen_sending_proposal",
ProcessedBroadcastMessages: "keygen_processed_broadcast_messages",
KeygenidUninitialized: "keygen_keygenid_uninitialized",
KeygenidIncomplete: "keygen_keygenid_incomplete",
NumSharesVerified: "keygen_num_shares_verified",
}
var States = struct { Phases phaseStates ReceivedSend receivedSendStates ReceivedEcho receivedEchoStates ReceivedEchoMap func() map[NodeDetailsID]receivedEchoState ReceivedReady receivedReadyStates ReceivedReadyMap func() map[NodeDetailsID]receivedReadyState }{ phaseStates{ Initial: phaseState("initial"), Started: phaseState("started"), Proposing: phaseState("proposing"), Ended: phaseState("ended"), }, receivedSendStates{ True: receivedSendState(true), False: receivedSendState(false), }, receivedEchoStates{ True: receivedEchoState(true), False: receivedEchoState(false), }, CreateReceivedEchoMap, receivedReadyStates{ True: receivedReadyState(true), False: receivedReadyState(false), }, CreateReceivedReadyMap, }
Functions ¶
func CreateReceivedEchoMap ¶
func CreateReceivedEchoMap() map[NodeDetailsID]receivedEchoState
func CreateReceivedReadyMap ¶
func CreateReceivedReadyMap() map[NodeDetailsID]receivedReadyState
func GetPointArrayFromMap ¶
func GetPointArrayFromMap(m map[NodeDetailsID]common.Point) (res []common.Point)
func SignedTextToProposeProof ¶
func SignedTextToProposeProof(c00 common.Point, st map[NodeDetailsID]SignedText) (pp map[NodeDetailsID]ProposeProof)
Types ¶
type C ¶
type C struct { CID CID C [][]common.Point EC int RC int AC map[NodeDetailsID]common.Point ACprime map[NodeDetailsID]common.Point BC map[NodeDetailsID]common.Point BCprime map[NodeDetailsID]common.Point Abar []big.Int Abarprime []big.Int Bbar []big.Int Bbarprime []big.Int SignedTextStore map[NodeDetailsID]SignedText }
type KeyStorage ¶
type KeygenIDDetails ¶
func (*KeygenIDDetails) FromKeygenID ¶
func (keygenIDDetails *KeygenIDDetails) FromKeygenID(keygenID KeygenID) error
func (*KeygenIDDetails) ToKeygenID ¶
func (keygenIDDetails *KeygenIDDetails) ToKeygenID() KeygenID
type KeygenMessage ¶
type KeygenMsgComplete ¶
type KeygenMsgDecide ¶
type KeygenMsgEcho ¶
type KeygenMsgNIZKP ¶
type KeygenMsgPropose ¶
type KeygenMsgPropose struct { NodeDetailsID NodeDetailsID DKGID DKGID Keygens []KeygenID ProposeProofs []map[NodeDetailsID]ProposeProof }
type KeygenMsgPubKey ¶
type KeygenMsgPubKey struct { NodeDetailsID NodeDetailsID DKGID DKGID PubKeyProofs []NIZKP }
type KeygenMsgReady ¶
type KeygenMsgSend ¶
type KeygenMsgShare ¶
type KeygenMsgShare struct {
}type KeygenNode ¶
type KeygenNode struct { idmutex.Mutex NodeDetails NodeDetails CurrNodes NodeNetwork NodeIndex int DKGStore map[DKGID]*DKG Transport KeygenTransport KeygenStore map[KeygenID]*Keygen }
func NewKeygenNode ¶
func NewKeygenNode( nodeDetails common.Node, currNodeList []common.Node, currNodesT int, currNodesK int, nodeIndex int, transport KeygenTransport, ) *KeygenNode
func (*KeygenNode) ProcessBroadcastMessage ¶
func (keygenNode *KeygenNode) ProcessBroadcastMessage(keygenMessage KeygenMessage) error
ProcessBroadcastMessage is called when the node receives a message via broadcast (eg. Tendermint) It works similar to a router, processing different messages differently based on their associated method. Each method handler's code path consists of parsing the message -> logic -> state updates. Defer state changes until the end of the function call to ensure that the state is consistent in the handler.
func (*KeygenNode) ProcessMessage ¶
func (keygenNode *KeygenNode) ProcessMessage(senderDetails NodeDetails, keygenMessage KeygenMessage) error
ProcessMessage is called when the transport for the node receives a message via direct send. It works similar to a router, processing different messages differently based on their associated method. Each method handler's code path consists of parsing the message -> state checks -> logic -> state updates. Defer state changes until the end of the function call to ensure that the state is consistent in the handler. When sending messages to other nodes, it's important to use a goroutine to ensure that it isnt synchronous We assume that senderDetails have already been validated by the transport and are always correct
type KeygenState ¶
type KeygenState struct { Phase phaseState ReceivedSend receivedSendState ReceivedEcho map[NodeDetailsID]receivedEchoState ReceivedReady map[NodeDetailsID]receivedReadyState }
type KeygenTransport ¶
type KeygenTransport interface { Init() GetType() string SetKeygenNode(*KeygenNode) error Sign([]byte) ([]byte, error) Send(NodeDetails, KeygenMessage) error Receive(NodeDetails, KeygenMessage) error SendBroadcast(KeygenMessage) error ReceiveBroadcast(KeygenMessage) error Output(interface{}) Report(string, interface{}) }
type NodeDetails ¶
func (*NodeDetails) FromNodeDetailsID ¶
func (n *NodeDetails) FromNodeDetailsID(nodeDetailsID NodeDetailsID)
func (*NodeDetails) ToNodeDetailsID ¶
func (n *NodeDetails) ToNodeDetailsID() NodeDetailsID
type NodeDetailsID ¶
type NodeDetailsID string
type NodeNetwork ¶
type NodeNetwork struct { Nodes map[NodeDetailsID]NodeDetails N int T int K int ID string }
type ProposeProof ¶
type SignedText ¶
type SignedText []byte
func GetSignedTextArrayFromMap ¶
func GetSignedTextArrayFromMap(sts map[NodeDetailsID]SignedText) (res []SignedText)
type SignedTextDetails ¶
func (*SignedTextDetails) FromBytes ¶
func (s *SignedTextDetails) FromBytes(byt []byte)
func (*SignedTextDetails) ToBytes ¶
func (s *SignedTextDetails) ToBytes() []byte