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 PSSID
- type PSSIDDetails
- type PSSMessage
- type PSSMsgComplete
- type PSSMsgDecide
- type PSSMsgEcho
- type PSSMsgPropose
- type PSSMsgReady
- type PSSMsgRecover
- type PSSMsgSend
- type PSSMsgShare
- type PSSNode
- type PSSState
- type PSSTransport
- type Recover
- type RefreshKeyStorage
- 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 PSSIDDetails ¶
func (*PSSIDDetails) FromPSSID ¶
func (pssIDDetails *PSSIDDetails) FromPSSID(pssID PSSID) error
func (*PSSIDDetails) ToPSSID ¶
func (pssIDDetails *PSSIDDetails) ToPSSID() PSSID
type PSSMessage ¶
type PSSMessage struct { PSSID PSSID `json:"pssid"` Method string `json:"type"` Data []byte `json:"data"` }
func (*PSSMessage) JSON ¶
func (pssMessage *PSSMessage) JSON() *bijson.RawMessage
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 { idmutex.Mutex NodeDetails NodeDetails OldNodes NodeNetwork NewNodes NodeNetwork NodeIndex int RecoverStore map[SharingID]*Recover CompleteStore map[SharingID]*Complete Transport PSSTransport PSSStore map[PSSID]*PSS IsDealer bool IsPlayer bool }
func NewPSSNode ¶
func NewPSSNode( nodeDetails common.Node, oldEpoch int, oldNodeList []common.Node, oldNodesT int, oldNodesK int, newEpoch int, newNodeList []common.Node, newNodesT int, newNodesK int, nodeIndex int, transport PSSTransport, isDealer bool, isPlayer bool, ) *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 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{}) Report(string, interface{}) }
type RefreshKeyStorage ¶
type SharingData ¶
type SharingID ¶
type SharingID string
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)