Documentation
¶
Index ¶
- func SignOutput(output *Output, privKey *ecdsa.PrivateKey) (types.Signature, error)
- type BlameOutput
- type Config
- type Init
- type KeyGenOutput
- type Message
- type MsgType
- type Network
- type Node
- type Operator
- type Output
- type PartialDepositData
- type Protocol
- type ProtocolOutcome
- type RequestID
- type Reshare
- 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 BlameOutput ¶ added in v0.2.7
BlameOutput is the output of blame round
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
Threshold uint64
}
KeyGenOutput is the bare minimum output from the protocol
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 ReshareMsgType )
type Network ¶
type Network interface {
// StreamDKGBlame will stream to any subscriber the blame result of the DKG
StreamDKGBlame(blame *BlameOutput) error
// 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 Protocol ¶ added in v0.2.7
type Protocol interface {
Start() error
// ProcessMsg returns true and a bls share if finished
ProcessMsg(msg *SignedMessage) (bool, *ProtocolOutcome, error)
}
Protocol is an interface for all DKG protocol to support a variety of protocols for future upgrades
type ProtocolOutcome ¶ added in v0.2.7
type ProtocolOutcome struct {
ProtocolOutput *KeyGenOutput
BlameOutput *BlameOutput
}
func (*ProtocolOutcome) IsFailedWithBlame ¶ added in v0.2.7
func (o *ProtocolOutcome) IsFailedWithBlame() (bool, error)
type RequestID ¶
type RequestID [24]byte
func (RequestID) GetETHAddress ¶
func (RequestID) GetRoleType ¶
type Reshare ¶ added in v0.2.7
type Reshare struct {
ValidatorPK types.ValidatorPK
OperatorIDs []types.OperatorID
Threshold uint16
}
Reshare triggers the resharing protocol
type Runner ¶
type Runner interface {
ProcessMsg(msg *SignedMessage) (bool, error)
}
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
type Storage ¶
type Storage interface {
// GetDKGOperator returns true and operator object if found by operator ID
GetDKGOperator(operatorID types.OperatorID) (bool, *Operator, error)
SaveKeyGenOutput(output *KeyGenOutput) error
GetKeyGenOutput(pk types.ValidatorPK) (*KeyGenOutput, error)
}