Documentation ¶
Index ¶
- Constants
- Variables
- func CreateReceivedEchoMap() map[NodeDetailsID]receivedEchoState
- func CreateReceivedReadyMap() map[NodeDetailsID]receivedReadyState
- func GetPointArrayFromMap(m map[NodeDetailsID]common.Point) (res []common.Point)
- type C
- type CID
- type Complete
- type KeygenID
- type NodeDetails
- type NodeDetailsID
- type NodeNetwork
- type PSS
- type PSSDataSource
- type PSSID
- type PSSIDDetails
- type PSSMessage
- type PSSMessageRaw
- type PSSMsgComplete
- type PSSMsgDecide
- type PSSMsgEcho
- type PSSMsgPropose
- type PSSMsgReady
- type PSSMsgRecover
- type PSSMsgSend
- type PSSMsgShare
- type PSSNode
- type PSSState
- type PSSStoreSyncMap
- func (m *PSSStoreSyncMap) Complete(sharingID SharingID)
- func (m *PSSStoreSyncMap) Get(pssid PSSID) (pss *PSS, found bool)
- func (m *PSSStoreSyncMap) GetOrSet(pssid PSSID, input *PSS) (pss *PSS, found bool)
- func (m *PSSStoreSyncMap) GetOrSetIfNotComplete(pssid PSSID, input *PSS) (pss *PSS, complete bool)
- func (m *PSSStoreSyncMap) Set(pssid PSSID, pss *PSS)
- type PSSTransport
- type Recover
- type RecoverStoreSyncMap
- func (m *RecoverStoreSyncMap) Complete(sharingID SharingID)
- func (m *RecoverStoreSyncMap) Get(sharingID SharingID) (recover *Recover, found bool)
- func (m *RecoverStoreSyncMap) GetOrSet(sharingID SharingID, input *Recover) (recover *Recover, found bool)
- func (m *RecoverStoreSyncMap) GetOrSetIfNotComplete(sharingID SharingID, input *Recover) (recover *Recover, complete bool)
- func (m *RecoverStoreSyncMap) Set(sharingID SharingID, recover *Recover)
- type RefreshKeyStorage
- type ShareStoreSyncMap
- type Sharing
- type SharingData
- type SharingID
- type SignedText
- type VID
Constants ¶
const NullNodeDetails = NodeDetailsID("")
const NullPSSID = PSSID("")
Variables ¶
var States = struct { Phases phaseStates Dealer dealerStates Player playerStates 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"), }, dealerStates{ IsDealer: dealerState(true), NotDealer: dealerState(false), }, playerStates{ IsPlayer: playerState(true), NotPlayer: playerState(false), }, 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)
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 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 EpochID int }
type PSSDataSource ¶
type PSSID ¶
type PSSID string
PSSID is the identifying string for PSSMessage, each PSS has n PSSIDs, all associated with a single SharingID
type PSSIDDetails ¶
func (*PSSIDDetails) FromPSSID ¶
func (pssIDDetails *PSSIDDetails) FromPSSID(pssID PSSID) error
func (*PSSIDDetails) ToPSSID ¶
func (pssIDDetails *PSSIDDetails) ToPSSID() PSSID
type PSSMessage ¶
type PSSMessage struct { Version pssMessageVersion `json:"version,omitempty"` PSSID PSSID `json:"pssid"` Method string `json:"type"` Data []byte `json:"data"` }
func CreatePSSMessage ¶
func CreatePSSMessage(r PSSMessageRaw) PSSMessage
type PSSMessageRaw ¶
type PSSMsgComplete ¶
type PSSMsgDecide ¶
type PSSMsgEcho ¶
type PSSMsgPropose ¶
type PSSMsgPropose struct { NodeDetailsID NodeDetailsID SharingID SharingID PSSs []PSSID SignedTexts []map[NodeDetailsID]SignedText }
type PSSMsgReady ¶
type PSSMsgRecover ¶
type PSSMsgSend ¶
type PSSMsgShare ¶
type PSSMsgShare struct {
}type PSSNode ¶
type PSSNode struct { NodeDetails NodeDetails OldNodes NodeNetwork NewNodes NodeNetwork NodeIndex int DataSource PSSDataSource Transport PSSTransport RecoverStore *RecoverStoreSyncMap PSSStore *PSSStoreSyncMap IsDealer bool IsPlayer bool CleanUp func(*PSSNode, SharingID) error // contains filtered or unexported fields }
func NewPSSNode ¶
func NewPSSNode( nodeDetails pcmn.Node, oldEpoch int, oldNodeList []pcmn.Node, oldNodesT int, oldNodesK int, newEpoch int, newNodeList []pcmn.Node, newNodesT int, newNodesK int, nodeIndex int, dataSource PSSDataSource, transport PSSTransport, isDealer bool, isPlayer bool, staggerDelay int, ) *PSSNode
NewPSSNode creates a new pss node instance
func (*PSSNode) ProcessBroadcastMessage ¶
func (pssNode *PSSNode) ProcessBroadcastMessage(pssMessage PSSMessage) error
ProcessBroadcastMessage is called when the node receives a message via broadcast (eg. Tendermint)
func (*PSSNode) ProcessMessage ¶
func (pssNode *PSSNode) ProcessMessage(senderDetails NodeDetails, pssMessage PSSMessage) 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 PSSState ¶
type PSSState struct { Phase phaseState Dealer dealerState Player playerState // Recover recoverState ReceivedSend receivedSendState ReceivedEcho map[NodeDetailsID]receivedEchoState ReceivedReady map[NodeDetailsID]receivedReadyState }
type PSSStoreSyncMap ¶
func (*PSSStoreSyncMap) Complete ¶
func (m *PSSStoreSyncMap) Complete(sharingID SharingID)
func (*PSSStoreSyncMap) GetOrSet ¶
func (m *PSSStoreSyncMap) GetOrSet(pssid PSSID, input *PSS) (pss *PSS, found bool)
func (*PSSStoreSyncMap) GetOrSetIfNotComplete ¶
func (m *PSSStoreSyncMap) GetOrSetIfNotComplete(pssid PSSID, input *PSS) (pss *PSS, complete bool)
func (*PSSStoreSyncMap) Set ¶
func (m *PSSStoreSyncMap) Set(pssid PSSID, pss *PSS)
type PSSTransport ¶
type PSSTransport interface { Init() GetType() string SetPSSNode(*PSSNode) error Sign([]byte) ([]byte, error) Send(NodeDetails, PSSMessage) error Receive(NodeDetails, PSSMessage) error SendBroadcast(PSSMessage) error ReceiveBroadcast(PSSMessage) error Output(interface{}) }
type RecoverStoreSyncMap ¶
func (*RecoverStoreSyncMap) Complete ¶
func (m *RecoverStoreSyncMap) Complete(sharingID SharingID)
func (*RecoverStoreSyncMap) Get ¶
func (m *RecoverStoreSyncMap) Get(sharingID SharingID) (recover *Recover, found bool)
func (*RecoverStoreSyncMap) GetOrSet ¶
func (m *RecoverStoreSyncMap) GetOrSet(sharingID SharingID, input *Recover) (recover *Recover, found bool)
func (*RecoverStoreSyncMap) GetOrSetIfNotComplete ¶
func (m *RecoverStoreSyncMap) GetOrSetIfNotComplete(sharingID SharingID, input *Recover) (recover *Recover, complete bool)
func (*RecoverStoreSyncMap) Set ¶
func (m *RecoverStoreSyncMap) Set(sharingID SharingID, recover *Recover)
type RefreshKeyStorage ¶
type ShareStoreSyncMap ¶
type ShareStoreSyncMap struct {
}func (*ShareStoreSyncMap) Complete ¶
func (m *ShareStoreSyncMap) Complete(keygenID KeygenID)
func (*ShareStoreSyncMap) Get ¶
func (m *ShareStoreSyncMap) Get(keygenID KeygenID) (sharing *Sharing, found bool)
func (*ShareStoreSyncMap) Set ¶
func (m *ShareStoreSyncMap) Set(keygenID KeygenID, sharing *Sharing)
type SharingData ¶
type SharingID ¶
type SharingID string
Unique string that contains information about pss parameters (epoch numbers, thresholds) and keygenID (tied to each key index)
func (*SharingID) GetEpochParams ¶
GetEpochParams - returns values for epochOld, nOld, kOld, tOld, epochNew, nNew, kNew, tNew
func (*SharingID) GetKeygenID ¶
type SignedText ¶
type SignedText []byte
func GetSignedTextArrayFromMap ¶
func GetSignedTextArrayFromMap(sts map[NodeDetailsID]SignedText) (res []SignedText)