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 DKGStoreSyncMap
- func (m *DKGStoreSyncMap) Complete(dkgID DKGID)
- func (m *DKGStoreSyncMap) Get(dkgID DKGID) (dkg *DKG, found bool)
- func (m *DKGStoreSyncMap) GetOrSet(dkgID DKGID, input *DKG) (dkg *DKG, found bool)
- func (m *DKGStoreSyncMap) GetOrSetIfNotComplete(dkgID DKGID, input *DKG) (dkg *DKG, complete bool)
- func (m *DKGStoreSyncMap) Set(dkgID DKGID, dkg *DKG)
- type KeyStorage
- type Keygen
- type KeygenID
- type KeygenIDDetails
- type KeygenMessage
- type KeygenMessageRaw
- type KeygenMsgComplete
- type KeygenMsgDecide
- type KeygenMsgEcho
- type KeygenMsgNIZKP
- type KeygenMsgPropose
- type KeygenMsgPubKey
- type KeygenMsgReady
- type KeygenMsgSend
- type KeygenMsgShare
- type KeygenNode
- type KeygenState
- type KeygenStoreSyncMap
- func (m *KeygenStoreSyncMap) Complete(dkgID DKGID)
- func (m *KeygenStoreSyncMap) Get(keygenID KeygenID) (keygen *Keygen, found bool)
- func (m *KeygenStoreSyncMap) GetOrSet(keygenID KeygenID, input *Keygen) (keygen *Keygen, found bool)
- func (m *KeygenStoreSyncMap) GetOrSetIfNotComplete(keygenID KeygenID, input *Keygen) (keygen *Keygen, complete bool)
- func (m *KeygenStoreSyncMap) Set(keygenID KeygenID, keygen *Keygen)
- type KeygenTransport
- type NIZKP
- type NodeDetails
- type NodeDetailsID
- type NodeNetwork
- type ProposeProof
- type ShareStoreSyncMap
- func (m *ShareStoreSyncMap) Complete(dkgID DKGID)
- func (m *ShareStoreSyncMap) Get(dkgID DKGID) (sharing *Sharing, found bool)
- func (m *ShareStoreSyncMap) GetOrSet(dkgID DKGID, input *Sharing) (sharing *Sharing, found bool)
- func (m *ShareStoreSyncMap) IsComplete(dkgID DKGID) (complete bool)
- func (m *ShareStoreSyncMap) Set(dkgID DKGID, sharing *Sharing)
- type Sharing
- type SignedText
- type SignedTextDetails
Constants ¶
const NullKeygenID = KeygenID("")
Variables ¶
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 DKGStoreSyncMap ¶
func (*DKGStoreSyncMap) Complete ¶
func (m *DKGStoreSyncMap) Complete(dkgID DKGID)
func (*DKGStoreSyncMap) GetOrSet ¶
func (m *DKGStoreSyncMap) GetOrSet(dkgID DKGID, input *DKG) (dkg *DKG, found bool)
func (*DKGStoreSyncMap) GetOrSetIfNotComplete ¶
func (m *DKGStoreSyncMap) GetOrSetIfNotComplete(dkgID DKGID, input *DKG) (dkg *DKG, complete bool)
func (*DKGStoreSyncMap) Set ¶
func (m *DKGStoreSyncMap) Set(dkgID DKGID, dkg *DKG)
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 KeygenMessage struct { Version keygenMessageVersion `json:"version,omitempty"` KeygenID KeygenID `json:"keygenid"` Method string `json:"type"` Data []byte `json:"data"` }
func CreateKeygenMessage ¶
func CreateKeygenMessage(r KeygenMessageRaw) KeygenMessage
type KeygenMessageRaw ¶
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 { NodeDetails NodeDetails CurrNodes NodeNetwork NodeIndex int DKGStore *DKGStoreSyncMap Transport KeygenTransport KeygenStore *KeygenStoreSyncMap CleanUp func(*KeygenNode, DKGID) error // contains filtered or unexported fields }
func NewKeygenNode ¶
func NewKeygenNode( nodeDetails pcmn.Node, currNodeList []pcmn.Node, currNodesT int, currNodesK int, nodeIndex int, transport KeygenTransport, staggerDelay int, ) *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 KeygenStoreSyncMap ¶
func (*KeygenStoreSyncMap) Complete ¶
func (m *KeygenStoreSyncMap) Complete(dkgID DKGID)
func (*KeygenStoreSyncMap) Get ¶
func (m *KeygenStoreSyncMap) Get(keygenID KeygenID) (keygen *Keygen, found bool)
func (*KeygenStoreSyncMap) GetOrSet ¶
func (m *KeygenStoreSyncMap) GetOrSet(keygenID KeygenID, input *Keygen) (keygen *Keygen, found bool)
func (*KeygenStoreSyncMap) GetOrSetIfNotComplete ¶
func (m *KeygenStoreSyncMap) GetOrSetIfNotComplete(keygenID KeygenID, input *Keygen) (keygen *Keygen, complete bool)
func (*KeygenStoreSyncMap) Set ¶
func (m *KeygenStoreSyncMap) Set(keygenID KeygenID, keygen *Keygen)
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{}) // For Storage Optimization of NIZKP CheckIfNIZKPProcessed(keyIndex big.Int) bool }
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 ShareStoreSyncMap ¶
type ShareStoreSyncMap struct {
}func (*ShareStoreSyncMap) Complete ¶
func (m *ShareStoreSyncMap) Complete(dkgID DKGID)
func (*ShareStoreSyncMap) Get ¶
func (m *ShareStoreSyncMap) Get(dkgID DKGID) (sharing *Sharing, found bool)
func (*ShareStoreSyncMap) GetOrSet ¶
func (m *ShareStoreSyncMap) GetOrSet(dkgID DKGID, input *Sharing) (sharing *Sharing, found bool)
func (*ShareStoreSyncMap) IsComplete ¶
func (m *ShareStoreSyncMap) IsComplete(dkgID DKGID) (complete bool)
func (*ShareStoreSyncMap) Set ¶
func (m *ShareStoreSyncMap) Set(dkgID DKGID, sharing *Sharing)
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