Documentation ¶
Index ¶
- Variables
- type CurrentBlockProvider
- type EligibleListProvider
- type HardforkTrigger
- type HeartbeatStorageHandler
- type HeartbeatV2
- func (*HeartbeatV2) Descriptor() ([]byte, []int)
- func (this *HeartbeatV2) Equal(that interface{}) bool
- func (m *HeartbeatV2) GetIdentity() string
- func (m *HeartbeatV2) GetNodeDisplayName() string
- func (m *HeartbeatV2) GetNonce() uint64
- func (m *HeartbeatV2) GetPayload() []byte
- func (m *HeartbeatV2) GetPeerSubType() uint32
- func (m *HeartbeatV2) GetPubkey() []byte
- func (m *HeartbeatV2) GetVersionNumber() string
- func (this *HeartbeatV2) GoString() string
- func (m *HeartbeatV2) Marshal() (dAtA []byte, err error)
- func (m *HeartbeatV2) MarshalTo(dAtA []byte) (int, error)
- func (m *HeartbeatV2) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*HeartbeatV2) ProtoMessage()
- func (m *HeartbeatV2) Reset()
- func (m *HeartbeatV2) Size() (n int)
- func (this *HeartbeatV2) String() string
- func (m *HeartbeatV2) Unmarshal(dAtA []byte) error
- func (m *HeartbeatV2) XXX_DiscardUnknown()
- func (m *HeartbeatV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *HeartbeatV2) XXX_Merge(src proto.Message)
- func (m *HeartbeatV2) XXX_Size() int
- func (m *HeartbeatV2) XXX_Unmarshal(b []byte) error
- type MessageHandler
- type NetworkShardingCollector
- type NodeRedundancyHandler
- type NodesCoordinator
- type P2PAntifloodHandler
- type P2PMessenger
- type Payload
- func (*Payload) Descriptor() ([]byte, []int)
- func (this *Payload) Equal(that interface{}) bool
- func (m *Payload) GetHardforkMessage() string
- func (m *Payload) GetTimestamp() int64
- func (this *Payload) GoString() string
- func (m *Payload) Marshal() (dAtA []byte, err error)
- func (m *Payload) MarshalTo(dAtA []byte) (int, error)
- func (m *Payload) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Payload) ProtoMessage()
- func (m *Payload) Reset()
- func (m *Payload) Size() (n int)
- func (this *Payload) String() string
- func (m *Payload) Unmarshal(dAtA []byte) error
- func (m *Payload) XXX_DiscardUnknown()
- func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Payload) XXX_Merge(src proto.Message)
- func (m *Payload) XXX_Size() int
- func (m *Payload) XXX_Unmarshal(b []byte) error
- type PeerAuthentication
- func (*PeerAuthentication) Descriptor() ([]byte, []int)
- func (this *PeerAuthentication) Equal(that interface{}) bool
- func (m *PeerAuthentication) GetPayload() []byte
- func (m *PeerAuthentication) GetPayloadSignature() []byte
- func (m *PeerAuthentication) GetPid() []byte
- func (m *PeerAuthentication) GetPubkey() []byte
- func (m *PeerAuthentication) GetSignature() []byte
- func (this *PeerAuthentication) GoString() string
- func (m *PeerAuthentication) Marshal() (dAtA []byte, err error)
- func (m *PeerAuthentication) MarshalTo(dAtA []byte) (int, error)
- func (m *PeerAuthentication) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PeerAuthentication) ProtoMessage()
- func (m *PeerAuthentication) Reset()
- func (m *PeerAuthentication) Size() (n int)
- func (this *PeerAuthentication) String() string
- func (m *PeerAuthentication) Unmarshal(dAtA []byte) error
- func (m *PeerAuthentication) XXX_DiscardUnknown()
- func (m *PeerAuthentication) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PeerAuthentication) XXX_Merge(src proto.Message)
- func (m *PeerAuthentication) XXX_Size() int
- func (m *PeerAuthentication) XXX_Unmarshal(b []byte) error
- type PeerBlackListHandler
- type PeerShardMapper
- type PeerTypeProviderHandler
- type Timer
- type ValidatorStatisticsProcessor
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthHeartbeat = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowHeartbeat = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupHeartbeat = fmt.Errorf("proto: unexpected end of group") )
var ErrEmptySendTopic = errors.New("empty topic for sending messages")
ErrEmptySendTopic signals that an empty topic string was provided
var ErrFetchGenesisTimeFromDb = errors.New("monitor: can't get genesis time from db")
ErrFetchGenesisTimeFromDb signals that the genesis time cannot be fetched from db
var ErrHeartbeatPidMismatch = errors.New("heartbeat peer id mismatch")
ErrHeartbeatPidMismatch signals that a received hearbeat did not come from the correct originator
var ErrInvalidDurationToConsiderUnresponsiveInSec = errors.New("value DurationToConsiderUnresponsiveInSec is less than 1")
ErrInvalidDurationToConsiderUnresponsiveInSec is raised when a value less than 1 has been provided
var ErrInvalidMaxDurationPeerUnresponsive = errors.New("invalid max duration to declare the peer unresponsive")
ErrInvalidMaxDurationPeerUnresponsive signals that the duration provided is invalid
var ErrInvalidThreshold = errors.New("invalid threshold")
ErrInvalidThreshold signals that an invalid threshold was provided
var ErrInvalidTimeDuration = errors.New("invalid time duration")
ErrInvalidTimeDuration signals that an invalid time duration was provided
var ErrInvalidValue = errors.New("invalid value")
ErrInvalidValue signals that an invalid value has been provided
var ErrMarshalGenesisTime = errors.New("monitor: can't marshal genesis time")
ErrMarshalGenesisTime signals that the marshaling of the genesis time didn't work
var ErrNegativeMaxTimeToWaitBetweenBroadcastsInSec = errors.New("value MaxTimeToWaitBetweenBroadcastsInSec is less than 1")
ErrNegativeMaxTimeToWaitBetweenBroadcastsInSec is raised when a value less than 1 has been provided
var ErrNegativeMinTimeToWaitBetweenBroadcastsInSec = errors.New("value MinTimeToWaitBetweenBroadcastsInSec is less than 1")
ErrNegativeMinTimeToWaitBetweenBroadcastsInSec is raised when a value less than 1 has been provided
var ErrNilAntifloodHandler = errors.New("nil antiflood handler")
ErrNilAntifloodHandler signals that a nil antiflood handler has been provided
var ErrNilAppStatusHandler = errors.New("nil AppStatusHandler")
ErrNilAppStatusHandler defines the error for setting a nil AppStatusHandler
var ErrNilCacher = errors.New("nil cacher")
ErrNilCacher signals that a nil cache has been provided
var ErrNilCurrentBlockProvider = errors.New("nil current block provider")
ErrNilCurrentBlockProvider signals that a nil current block provider
var ErrNilDataToProcess = errors.New("nil data to process")
ErrNilDataToProcess signals that nil data was provided
var ErrNilEpochNotifier = errors.New("nil epoch notifier")
ErrNilEpochNotifier signals that a nil epoch notifier has been provided
var ErrNilHardforkTrigger = errors.New("nil hardfork trigger")
ErrNilHardforkTrigger signals that a nil hardfork trigger has been provided
var ErrNilHeartbeatMonitor = errors.New("nil heartbeat monitor")
ErrNilHeartbeatMonitor signals that a nil heartbeat monitor was provided
var ErrNilHeartbeatSenderInfoProvider = errors.New("nil heartbeat sender info provider")
ErrNilHeartbeatSenderInfoProvider signals that a nil heartbeat sender info provider was provided
var ErrNilHeartbeatStorer = errors.New("nil heartbeat storer")
ErrNilHeartbeatStorer signals that the provided heartbeat storer is nil
var ErrNilMarshaller = errors.New("nil marshaller")
ErrNilMarshaller signals that a nil marshaller has been provided
var ErrNilMessage = errors.New("nil message")
ErrNilMessage signals that a nil message has been received
var ErrNilMessageHandler = errors.New("nil message handler")
ErrNilMessageHandler signals that the provided message handler is nil
var ErrNilMessenger = errors.New("nil P2P Messenger")
ErrNilMessenger signals that a nil p2p messenger has been provided
var ErrNilMonitorDb = errors.New("nil monitor db")
ErrNilMonitorDb signals that a nil monitor db was provided
var ErrNilNetworkShardingCollector = errors.New("nil network sharding collector")
ErrNilNetworkShardingCollector defines the error for setting a nil network sharding collector
var ErrNilNodesCoordinator = errors.New("nil nodes coordinator")
ErrNilNodesCoordinator signals that an operation has been attempted to or with a nil nodes coordinator
var ErrNilPeerAuthenticationPool = errors.New("nil peer authentication pool")
ErrNilPeerAuthenticationPool signals that a nil peer authentication pool has been provided
var ErrNilPeerShardMapper = errors.New("nil peer shard mapper")
ErrNilPeerShardMapper signals that a nil peer shard mapper has been provided
var ErrNilPeerSignatureHandler = errors.New("trying to set nil peerSignatureHandler")
ErrNilPeerSignatureHandler signals that a nil peerSignatureHandler object has been provided
var ErrNilPeerTypeProvider = errors.New("nil peer type provider")
ErrNilPeerTypeProvider signals that a nil peer type provider has been given
var ErrNilPrivateKey = errors.New("nil private key")
ErrNilPrivateKey signals that a nil private key has been provided
var ErrNilPubkeyConverter = errors.New("trying to use a nil pubkey converter")
ErrNilPubkeyConverter signals that a nil public key converter has been provided
var ErrNilPublicKeysMap = errors.New("nil public keys map")
ErrNilPublicKeysMap signals that a nil public keys map has been provided
var ErrNilRandomizer = errors.New("nil randomizer")
ErrNilRandomizer signals that a nil randomizer has been provided
var ErrNilRedundancyHandler = errors.New("nil redundancy handler")
ErrNilRedundancyHandler signals that a nil redundancy handler was provided
var ErrNilRequestHandler = errors.New("nil request handler")
ErrNilRequestHandler signals that a nil request handler interface was provided
var ErrNilShardCoordinator = errors.New("nil shard coordinator")
ErrNilShardCoordinator signals that an operation has been attempted to or with a nil shard coordinator
var ErrNilTimer = errors.New("nil time getter handler")
ErrNilTimer signals that a nil time getter handler has been provided
var ErrPropertyTooLong = errors.New("property too long in Heartbeat")
ErrPropertyTooLong signals that one of the properties is too long
var ErrShouldSkipValidator = errors.New("validator should be skipped")
ErrShouldSkipValidator signals that the validator should be skipped
var ErrStoreGenesisTimeToDb = errors.New("monitor: can't store genesis time")
ErrStoreGenesisTimeToDb signals that the genesis time cannot be store to db
var ErrUnmarshalGenesisTime = errors.New("monitor: can't unmarshal genesis time")
ErrUnmarshalGenesisTime signals that the unmarshaling of the genesis time didn't work
var ErrWrongValues = errors.New("wrong values for heartbeat parameters")
ErrWrongValues signals that wrong values were provided
var ErrZeroHeartbeatRefreshIntervalInSec = errors.New("zero heartbeatRefreshInterval")
ErrZeroHeartbeatRefreshIntervalInSec signals that a zero value was provided for the HeartbeatRefreshIntervalInSec
var ErrZeroHideInactiveValidatorIntervalInSec = errors.New("zero hideInactiveValidatorIntervalInSec")
ErrZeroHideInactiveValidatorIntervalInSec signals that a zero value was provided for the ErrZeroHideInactiveValidatorIntervalInSec
Functions ¶
This section is empty.
Types ¶
type CurrentBlockProvider ¶
type CurrentBlockProvider interface { GetCurrentBlockHeader() data.HeaderHandler IsInterfaceNil() bool }
CurrentBlockProvider can provide the current block that the node was able to commit
type EligibleListProvider ¶
type EligibleListProvider interface { GetAllEligibleValidatorsPublicKeys(epoch uint32) (map[uint32][][]byte, error) GetAllWaitingValidatorsPublicKeys(epoch uint32) (map[uint32][][]byte, error) IsInterfaceNil() bool }
EligibleListProvider defines what an eligible list provider should do
type HardforkTrigger ¶
type HardforkTrigger interface { TriggerReceived(payload []byte, data []byte, pkBytes []byte) (bool, error) RecordedTriggerMessage() ([]byte, bool) NotifyTriggerReceived() <-chan struct{} // TODO: remove it with heartbeat v1 cleanup NotifyTriggerReceivedV2() <-chan struct{} CreateData() []byte IsInterfaceNil() bool }
HardforkTrigger defines the behavior of a hardfork trigger
type HeartbeatStorageHandler ¶
type HeartbeatStorageHandler interface { LoadGenesisTime() (time.Time, error) UpdateGenesisTime(genesisTime time.Time) error LoadHeartBeatDTO(pubKey string) (*heartbeatData.HeartbeatDTO, error) SavePubkeyData(pubkey []byte, heartbeat *heartbeatData.HeartbeatDTO) error LoadKeys() ([][]byte, error) SaveKeys(peersSlice [][]byte) error IsInterfaceNil() bool }
HeartbeatStorageHandler defines what a heartbeat's storer should do
type HeartbeatV2 ¶
type HeartbeatV2 struct { Payload []byte `protobuf:"bytes,1,opt,name=Payload,proto3" json:"Payload,omitempty"` VersionNumber string `protobuf:"bytes,2,opt,name=VersionNumber,proto3" json:"VersionNumber,omitempty"` NodeDisplayName string `protobuf:"bytes,3,opt,name=NodeDisplayName,proto3" json:"NodeDisplayName,omitempty"` Identity string `protobuf:"bytes,4,opt,name=Identity,proto3" json:"Identity,omitempty"` Nonce uint64 `protobuf:"varint,5,opt,name=Nonce,proto3" json:"Nonce,omitempty"` PeerSubType uint32 `protobuf:"varint,6,opt,name=PeerSubType,proto3" json:"PeerSubType,omitempty"` Pubkey []byte `protobuf:"bytes,7,opt,name=Pubkey,proto3" json:"Pubkey,omitempty"` }
HeartbeatV2 represents the heartbeat message that is sent between peers from the same shard containing current node status
func (*HeartbeatV2) Descriptor ¶
func (*HeartbeatV2) Descriptor() ([]byte, []int)
func (*HeartbeatV2) Equal ¶
func (this *HeartbeatV2) Equal(that interface{}) bool
func (*HeartbeatV2) GetIdentity ¶
func (m *HeartbeatV2) GetIdentity() string
func (*HeartbeatV2) GetNodeDisplayName ¶
func (m *HeartbeatV2) GetNodeDisplayName() string
func (*HeartbeatV2) GetNonce ¶
func (m *HeartbeatV2) GetNonce() uint64
func (*HeartbeatV2) GetPayload ¶
func (m *HeartbeatV2) GetPayload() []byte
func (*HeartbeatV2) GetPeerSubType ¶
func (m *HeartbeatV2) GetPeerSubType() uint32
func (*HeartbeatV2) GetPubkey ¶
func (m *HeartbeatV2) GetPubkey() []byte
func (*HeartbeatV2) GetVersionNumber ¶
func (m *HeartbeatV2) GetVersionNumber() string
func (*HeartbeatV2) GoString ¶
func (this *HeartbeatV2) GoString() string
func (*HeartbeatV2) Marshal ¶
func (m *HeartbeatV2) Marshal() (dAtA []byte, err error)
func (*HeartbeatV2) MarshalToSizedBuffer ¶
func (m *HeartbeatV2) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*HeartbeatV2) ProtoMessage ¶
func (*HeartbeatV2) ProtoMessage()
func (*HeartbeatV2) Reset ¶
func (m *HeartbeatV2) Reset()
func (*HeartbeatV2) Size ¶
func (m *HeartbeatV2) Size() (n int)
func (*HeartbeatV2) String ¶
func (this *HeartbeatV2) String() string
func (*HeartbeatV2) Unmarshal ¶
func (m *HeartbeatV2) Unmarshal(dAtA []byte) error
func (*HeartbeatV2) XXX_DiscardUnknown ¶
func (m *HeartbeatV2) XXX_DiscardUnknown()
func (*HeartbeatV2) XXX_Marshal ¶
func (m *HeartbeatV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*HeartbeatV2) XXX_Merge ¶
func (m *HeartbeatV2) XXX_Merge(src proto.Message)
func (*HeartbeatV2) XXX_Size ¶
func (m *HeartbeatV2) XXX_Size() int
func (*HeartbeatV2) XXX_Unmarshal ¶
func (m *HeartbeatV2) XXX_Unmarshal(b []byte) error
type MessageHandler ¶
type MessageHandler interface { CreateHeartbeatFromP2PMessage(message p2p.MessageP2P) (*heartbeatData.Heartbeat, error) IsInterfaceNil() bool }
MessageHandler defines what a message processor for heartbeat should do
type NetworkShardingCollector ¶
type NetworkShardingCollector interface { UpdatePeerIDInfo(pid core.PeerID, pk []byte, shardID uint32) PutPeerIdSubType(pid core.PeerID, peerSubType core.P2PPeerSubType) IsInterfaceNil() bool }
NetworkShardingCollector defines the updating methods used by the network sharding component The interface assures that the collected data will be used by the p2p network sharding components
type NodeRedundancyHandler ¶
type NodeRedundancyHandler interface { IsRedundancyNode() bool IsMainMachineActive() bool ObserverPrivateKey() crypto.PrivateKey IsInterfaceNil() bool }
NodeRedundancyHandler defines the interface responsible for the redundancy management of the node
type NodesCoordinator ¶
type NodesCoordinator interface { GetAllEligibleValidatorsPublicKeys(epoch uint32) (map[uint32][][]byte, error) GetAllWaitingValidatorsPublicKeys(epoch uint32) (map[uint32][][]byte, error) GetValidatorWithPublicKey(publicKey []byte) (validator nodesCoordinator.Validator, shardId uint32, err error) IsInterfaceNil() bool }
NodesCoordinator defines the behavior of a struct able to do validator selection
type P2PAntifloodHandler ¶
type P2PAntifloodHandler interface { CanProcessMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error CanProcessMessagesOnTopic(peer core.PeerID, topic string, numMessages uint32, totalSize uint64, sequence []byte) error BlacklistPeer(peer core.PeerID, reason string, duration time.Duration) IsInterfaceNil() bool }
P2PAntifloodHandler defines the behavior of a component able to signal that the system is too busy (or flooded) processing p2p messages
type P2PMessenger ¶
type P2PMessenger interface { Broadcast(topic string, buff []byte) ID() core.PeerID Sign(payload []byte) ([]byte, error) ConnectedPeersOnTopic(topic string) []core.PeerID IsInterfaceNil() bool }
P2PMessenger defines a subset of the p2p.Messenger interface
type Payload ¶
type Payload struct { Timestamp int64 `protobuf:"varint,1,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"` HardforkMessage string `protobuf:"bytes,2,opt,name=HardforkMessage,proto3" json:"HardforkMessage,omitempty"` }
Payload represents the DTO used as payload for both HeartbeatV2 and PeerAuthentication messages
func (*Payload) Descriptor ¶
func (*Payload) GetHardforkMessage ¶
func (*Payload) GetTimestamp ¶
func (*Payload) MarshalToSizedBuffer ¶
func (*Payload) ProtoMessage ¶
func (*Payload) ProtoMessage()
func (*Payload) XXX_DiscardUnknown ¶
func (m *Payload) XXX_DiscardUnknown()
func (*Payload) XXX_Marshal ¶
func (*Payload) XXX_Unmarshal ¶
type PeerAuthentication ¶
type PeerAuthentication struct { Pubkey []byte `protobuf:"bytes,1,opt,name=Pubkey,proto3" json:"Pubkey,omitempty"` Signature []byte `protobuf:"bytes,2,opt,name=Signature,proto3" json:"Signature,omitempty"` Pid []byte `protobuf:"bytes,3,opt,name=Pid,proto3" json:"Pid,omitempty"` Payload []byte `protobuf:"bytes,4,opt,name=Payload,proto3" json:"Payload,omitempty"` PayloadSignature []byte `protobuf:"bytes,5,opt,name=PayloadSignature,proto3" json:"PayloadSignature,omitempty"` }
PeerAuthentication represents the DTO used to pass peer authentication information such as public key, peer id, signature, payload and the signature. This message is used to link the peerID with the associated public key
func (*PeerAuthentication) Descriptor ¶
func (*PeerAuthentication) Descriptor() ([]byte, []int)
func (*PeerAuthentication) Equal ¶
func (this *PeerAuthentication) Equal(that interface{}) bool
func (*PeerAuthentication) GetPayload ¶
func (m *PeerAuthentication) GetPayload() []byte
func (*PeerAuthentication) GetPayloadSignature ¶
func (m *PeerAuthentication) GetPayloadSignature() []byte
func (*PeerAuthentication) GetPid ¶
func (m *PeerAuthentication) GetPid() []byte
func (*PeerAuthentication) GetPubkey ¶
func (m *PeerAuthentication) GetPubkey() []byte
func (*PeerAuthentication) GetSignature ¶
func (m *PeerAuthentication) GetSignature() []byte
func (*PeerAuthentication) GoString ¶
func (this *PeerAuthentication) GoString() string
func (*PeerAuthentication) Marshal ¶
func (m *PeerAuthentication) Marshal() (dAtA []byte, err error)
func (*PeerAuthentication) MarshalTo ¶
func (m *PeerAuthentication) MarshalTo(dAtA []byte) (int, error)
func (*PeerAuthentication) MarshalToSizedBuffer ¶
func (m *PeerAuthentication) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PeerAuthentication) ProtoMessage ¶
func (*PeerAuthentication) ProtoMessage()
func (*PeerAuthentication) Reset ¶
func (m *PeerAuthentication) Reset()
func (*PeerAuthentication) Size ¶
func (m *PeerAuthentication) Size() (n int)
func (*PeerAuthentication) String ¶
func (this *PeerAuthentication) String() string
func (*PeerAuthentication) Unmarshal ¶
func (m *PeerAuthentication) Unmarshal(dAtA []byte) error
func (*PeerAuthentication) XXX_DiscardUnknown ¶
func (m *PeerAuthentication) XXX_DiscardUnknown()
func (*PeerAuthentication) XXX_Marshal ¶
func (m *PeerAuthentication) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PeerAuthentication) XXX_Merge ¶
func (m *PeerAuthentication) XXX_Merge(src proto.Message)
func (*PeerAuthentication) XXX_Size ¶
func (m *PeerAuthentication) XXX_Size() int
func (*PeerAuthentication) XXX_Unmarshal ¶
func (m *PeerAuthentication) XXX_Unmarshal(b []byte) error
type PeerBlackListHandler ¶
type PeerBlackListHandler interface { Add(pid core.PeerID) error Has(pid core.PeerID) bool Sweep() IsInterfaceNil() bool }
PeerBlackListHandler can determine if a certain peer ID is or not blacklisted
type PeerShardMapper ¶
type PeerShardMapper interface { PutPeerIdShardId(pid core.PeerID, shardID uint32) IsInterfaceNil() bool }
PeerShardMapper saves the shard for a peer ID
type PeerTypeProviderHandler ¶
type PeerTypeProviderHandler interface { ComputeForPubKey(pubKey []byte) (common.PeerType, uint32, error) GetAllPeerTypeInfos() []*state.PeerTypeInfo IsInterfaceNil() bool }
PeerTypeProviderHandler defines what a component which computes the type of a peer should do
type ValidatorStatisticsProcessor ¶
type ValidatorStatisticsProcessor interface { RootHash() ([]byte, error) GetValidatorInfoForRootHash(rootHash []byte) (map[uint32][]*state.ValidatorInfo, error) IsInterfaceNil() bool }
ValidatorStatisticsProcessor is the interface for consensus participation statistics