Documentation
¶
Index ¶
- func SignOutput(output *Output, privKey *ecdsa.PrivateKey) (types.Signature, error)
- type Config
- type Init
- type KeyGenOutput
- type KeyGenProtocol
- type Message
- type MsgType
- type Network
- type Node
- type Operator
- type Output
- type PartialDepositData
- type RequestID
- type Runner
- type Runners
- type SignedMessage
- type SignedOutput
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SignOutput ¶
Types ¶
type Config ¶
type Config struct {
// Protocol the DKG protocol implementation
Protocol func(network Network, operatorID types.OperatorID, identifier RequestID) KeyGenProtocol
Network Network
Storage Storage
SignatureDomainType types.DomainType
Signer types.DKGSigner
}
type Init ¶
type Init struct {
// OperatorIDs are the operators selected for the DKG
OperatorIDs []types.OperatorID
// Threshold DKG threshold for signature reconstruction
Threshold uint16
// WithdrawalCredentials used when signing the deposit data
WithdrawalCredentials []byte
// Fork is eth2 fork version
Fork phase0.Version
}
Init is the first message in a DKG which initiates a DKG
type KeyGenOutput ¶
type KeyGenOutput struct {
OperatorPubKeys map[types.OperatorID]*bls.PublicKey
ValidatorPK types.ValidatorPK
}
KeyGenOutput is the bare minimum output from the protocol
type KeyGenProtocol ¶
type KeyGenProtocol interface {
Start(init *Init) error
// ProcessMsg returns true and a bls share if finished
ProcessMsg(msg *SignedMessage) (bool, *KeyGenOutput, error)
}
KeyGenProtocol is an interface for all DKG protocol to support a variety of protocols for future upgrades
type Message ¶
type MsgType ¶
type MsgType int
const ( // InitMsgType sent when DKG instance is started by requester InitMsgType MsgType = iota // ProtocolMsgType is the DKG itself ProtocolMsgType // DepositDataMsgType post DKG deposit data signatures DepositDataMsgType // OutputMsgType final output msg used by requester to make deposits and register validator with SSV OutputMsgType )
type Network ¶
type Network interface {
// StreamDKGOutput will stream to any subscriber the result of the DKG
StreamDKGOutput(output map[types.OperatorID]*SignedOutput) error
// BroadcastDKGMessage will broadcast a msg to the dkg network
BroadcastDKGMessage(msg *SignedMessage) error
}
Network is a collection of funcs for DKG
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is responsible for receiving and managing DKG session and messages
func (*Node) ProcessMessage ¶
func (n *Node) ProcessMessage(msg *types.SSVMessage) error
ProcessMessage processes network Messages of all types
type Operator ¶
type Operator struct {
// OperatorID the node's Operator ID
OperatorID types.OperatorID
// ETHAddress the operator's eth address used to sign and verify messages against
ETHAddress common.Address
// EncryptionPubKey encryption pubkey for shares
EncryptionPubKey *rsa.PublicKey
}
Operator holds all info regarding a DKG Operator on the network
type Output ¶
type Output struct {
// RequestID for the DKG instance (not used for signing)
RequestID RequestID
EncryptedShare []byte
SharePubKey []byte
// ValidatorPubKey the resulting public key corresponding to the shared private key
ValidatorPubKey types.ValidatorPK
// DepositDataSignature reconstructed signature of DepositMessage according to eth2 spec
DepositDataSignature types.Signature
}
Output is the last message in every DKG which marks a specific node's end of process
type PartialDepositData ¶
type PartialDepositData struct {
Signer types.OperatorID
Root []byte
Signature types.Signature
}
PartialDepositData contains a partial deposit data signature
func (*PartialDepositData) Decode ¶
func (msg *PartialDepositData) Decode(data []byte) error
Decode returns error if decoding failed
func (*PartialDepositData) Encode ¶
func (msg *PartialDepositData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
type RequestID ¶
type RequestID [24]byte
func (RequestID) GetETHAddress ¶
func (RequestID) GetRoleType ¶
type Runner ¶
type Runner struct {
Operator *Operator
// InitMsg holds the init method which started this runner
InitMsg *Init
// Identifier unique for DKG session
Identifier RequestID
// KeyGenOutput holds the protocol output once it finishes
KeyGenOutput *KeyGenOutput
// DepositDataRoot is the signing root for the deposit data
DepositDataRoot []byte
// DepositDataSignatures holds partial sigs on deposit data
DepositDataSignatures map[types.OperatorID]*PartialDepositData
// OutputMsgs holds all output messages received
OutputMsgs map[types.OperatorID]*SignedOutput
// contains filtered or unexported fields
}
Runner manages the execution of a DKG, start to finish.
func (*Runner) ProcessMsg ¶
func (r *Runner) ProcessMsg(msg *SignedMessage) (bool, map[types.OperatorID]*SignedOutput, error)
ProcessMsg processes a DKG signed message and returns true and signed output if finished
type Runners ¶
Runners is a map of dkg runners mapped by dkg ID.
func (Runners) DeleteRunner ¶
func (Runners) RunnerForID ¶
RunnerForID returns a Runner from the provided msg ID, or nil if not found
type SignedMessage ¶
type SignedMessage struct {
Message *Message
Signer types.OperatorID
Signature types.Signature
}
func (*SignedMessage) Decode ¶
func (signedMsg *SignedMessage) Decode(data []byte) error
Decode returns error if decoding failed
func (*SignedMessage) Encode ¶
func (signedMsg *SignedMessage) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*SignedMessage) GetRoot ¶
func (signedMsg *SignedMessage) GetRoot() ([]byte, error)
func (*SignedMessage) Validate ¶
func (signedMsg *SignedMessage) Validate() error
type SignedOutput ¶
type SignedOutput struct {
// Data signed
Data *Output
// Signer Operator ID which signed
Signer types.OperatorID
// Signature over Data.GetRoot()
Signature types.Signature
}
func (*SignedOutput) Decode ¶
func (msg *SignedOutput) Decode(data []byte) error
Decode returns error if decoding failed
func (*SignedOutput) Encode ¶
func (msg *SignedOutput) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error