Documentation
¶
Index ¶
- Variables
- type Message
- type Network
- type NetworkMsg
- type Sync
- type SyncChanObj
- type SyncMessage
- func (*SyncMessage) Descriptor() ([]byte, []int)deprecated
- func (x *SyncMessage) GetError() string
- func (x *SyncMessage) GetFromPeerID() string
- func (x *SyncMessage) GetLambda() []byte
- func (x *SyncMessage) GetParams() []uint64
- func (x *SyncMessage) GetSignedMessages() []*proto1.SignedMessage
- func (x *SyncMessage) GetType() Sync
- func (*SyncMessage) ProtoMessage()
- func (x *SyncMessage) ProtoReflect() protoreflect.Message
- func (x *SyncMessage) Reset()
- func (x *SyncMessage) String() string
- type SyncStream
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NetworkMsg_name = map[int32]string{ 0: "IBFTType", 1: "DecidedType", 2: "SignatureType", 3: "SyncType", } NetworkMsg_value = map[string]int32{ "IBFTType": 0, "DecidedType": 1, "SignatureType": 2, "SyncType": 3, } )
Enum value maps for NetworkMsg.
View Source
var ( Sync_name = map[int32]string{ 0: "GetHighestType", 1: "GetInstanceRange", } Sync_value = map[string]int32{ "GetHighestType": 0, "GetInstanceRange": 1, } )
Enum value maps for Sync.
View Source
var File_network_msgs_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
SignedMessage *proto.SignedMessage
SyncMessage *SyncMessage
Stream SyncStream
Type NetworkMsg
}
Message is a container for network messages.
type Network ¶
type Network interface {
// Broadcast propagates a signed message to all peers
Broadcast(topicName []byte, msg *proto.SignedMessage) error
// ReceivedMsgChan is a channel that forwards new propagated messages to a subscriber
ReceivedMsgChan() <-chan *proto.SignedMessage
// BroadcastSignature broadcasts the given signature for the given lambda
BroadcastSignature(topicName []byte, msg *proto.SignedMessage) error
// ReceivedSignatureChan returns the channel with signatures
ReceivedSignatureChan() <-chan *proto.SignedMessage
// BroadcastDecided broadcasts a decided instance with collected signatures
BroadcastDecided(topicName []byte, msg *proto.SignedMessage) error
// ReceivedDecidedChan returns the channel for decided messages
ReceivedDecidedChan() <-chan *proto.SignedMessage
// GetHighestDecidedInstance sends a highest decided request to peers and returns answers.
// If peer list is nil, broadcasts to all.
GetHighestDecidedInstance(peerStr string, msg *SyncMessage) (*SyncMessage, error)
// RespondToHighestDecidedInstance responds to a GetHighestDecidedInstance
RespondToHighestDecidedInstance(stream SyncStream, msg *SyncMessage) error
// GetDecidedByRange returns a list of decided signed messages up to 25 in a batch.
GetDecidedByRange(peerStr string, msg *SyncMessage) (*SyncMessage, error)
// RespondToGetDecidedByRange responds to a GetDecidedByRange
RespondToGetDecidedByRange(stream SyncStream, msg *SyncMessage) error
// ReceivedSyncMsgChan returns the channel for sync messages
ReceivedSyncMsgChan() <-chan *SyncChanObj
// SubscribeToValidatorNetwork subscribing and listen to validator network
SubscribeToValidatorNetwork(validatorPk *bls.PublicKey) error
// IsSubscribeToValidatorNetwork checks if there is a subscription to the validator topic
IsSubscribeToValidatorNetwork(validatorPk *bls.PublicKey) bool
// AllPeers returns all connected peers for a validator PK
AllPeers(validatorPk []byte) ([]string, error)
}
Network represents the behavior of the network
type NetworkMsg ¶
type NetworkMsg int32
const ( // IBFTType are all iBFT related messages NetworkMsg_IBFTType NetworkMsg = 0 // DecidedType is an iBFT specific message for broadcasting post consensus decided message with signatures NetworkMsg_DecidedType NetworkMsg = 1 // SignatureType is an SSV node specific message for broadcasting post consensus signatures on eth2 duties NetworkMsg_SignatureType NetworkMsg = 2 // SyncType is an SSV iBFT specific message that a node uses to sync up with other nodes NetworkMsg_SyncType NetworkMsg = 3 )
func (NetworkMsg) Descriptor ¶ added in v0.0.13
func (NetworkMsg) Descriptor() protoreflect.EnumDescriptor
func (NetworkMsg) Enum ¶ added in v0.0.13
func (x NetworkMsg) Enum() *NetworkMsg
func (NetworkMsg) EnumDescriptor
deprecated
func (NetworkMsg) EnumDescriptor() ([]byte, []int)
Deprecated: Use NetworkMsg.Descriptor instead.
func (NetworkMsg) Number ¶ added in v0.0.13
func (x NetworkMsg) Number() protoreflect.EnumNumber
func (NetworkMsg) String ¶
func (x NetworkMsg) String() string
func (NetworkMsg) Type ¶ added in v0.0.13
func (NetworkMsg) Type() protoreflect.EnumType
type Sync ¶
type Sync int32
func (Sync) Descriptor ¶ added in v0.0.13
func (Sync) Descriptor() protoreflect.EnumDescriptor
func (Sync) EnumDescriptor
deprecated
func (Sync) Number ¶ added in v0.0.13
func (x Sync) Number() protoreflect.EnumNumber
func (Sync) Type ¶ added in v0.0.13
func (Sync) Type() protoreflect.EnumType
type SyncChanObj ¶
type SyncChanObj struct {
Msg *SyncMessage
Stream SyncStream
}
SyncChanObj is a wrapper object for streaming of sync messages
type SyncMessage ¶
type SyncMessage struct {
SignedMessages []*proto1.SignedMessage `protobuf:"bytes,1,rep,name=SignedMessages,proto3" json:"SignedMessages,omitempty"`
FromPeerID string `protobuf:"bytes,2,opt,name=FromPeerID,proto3" json:"FromPeerID,omitempty"`
Params []uint64 `protobuf:"varint,3,rep,packed,name=params,proto3" json:"params,omitempty"`
Lambda []byte `protobuf:"bytes,4,opt,name=Lambda,proto3" json:"Lambda,omitempty"`
Type Sync `protobuf:"varint,5,opt,name=Type,proto3,enum=network.Sync" json:"Type,omitempty"`
Error string `protobuf:"bytes,6,opt,name=error,proto3" json:"error,omitempty"`
// contains filtered or unexported fields
}
func (*SyncMessage) Descriptor
deprecated
func (*SyncMessage) Descriptor() ([]byte, []int)
Deprecated: Use SyncMessage.ProtoReflect.Descriptor instead.
func (*SyncMessage) GetError ¶ added in v0.0.13
func (x *SyncMessage) GetError() string
func (*SyncMessage) GetFromPeerID ¶
func (x *SyncMessage) GetFromPeerID() string
func (*SyncMessage) GetLambda ¶ added in v0.0.4
func (x *SyncMessage) GetLambda() []byte
func (*SyncMessage) GetParams ¶
func (x *SyncMessage) GetParams() []uint64
func (*SyncMessage) GetSignedMessages ¶
func (x *SyncMessage) GetSignedMessages() []*proto1.SignedMessage
func (*SyncMessage) GetType ¶
func (x *SyncMessage) GetType() Sync
func (*SyncMessage) ProtoMessage ¶
func (*SyncMessage) ProtoMessage()
func (*SyncMessage) ProtoReflect ¶ added in v0.0.13
func (x *SyncMessage) ProtoReflect() protoreflect.Message
func (*SyncMessage) Reset ¶
func (x *SyncMessage) Reset()
func (*SyncMessage) String ¶
func (x *SyncMessage) String() string
type SyncStream ¶
type SyncStream interface {
io.Reader
io.Writer
io.Closer
// CloseWrite closes the stream for writing but leaves it open for
// reading.
//
// CloseWrite does not free the stream, users must still call Close or
// Reset.
CloseWrite() error
// RemotePeer returns a string identifier of the remote peer connected to this stream
RemotePeer() string
}
SyncStream is a interface for all stream related functions for the sync process.
Click to show internal directories.
Click to hide internal directories.