heartbeat

package
v1.999.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2022 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthHeartbeat        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowHeartbeat          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupHeartbeat = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ErrEmptySendTopic = errors.New("empty topic for sending messages")

ErrEmptySendTopic signals that an empty topic string was provided

View Source
var ErrFetchGenesisTimeFromDb = errors.New("monitor: can't get genesis time from db")

ErrFetchGenesisTimeFromDb signals that the genesis time cannot be fetched from db

View Source
var ErrHeartbeatPidMismatch = errors.New("heartbeat peer id mismatch")

ErrHeartbeatPidMismatch signals that a received hearbeat did not come from the correct originator

View Source
var ErrInvalidDurationToConsiderUnresponsiveInSec = errors.New("value DurationToConsiderUnresponsiveInSec is less than 1")

ErrInvalidDurationToConsiderUnresponsiveInSec is raised when a value less than 1 has been provided

View Source
var ErrInvalidMaxDurationPeerUnresponsive = errors.New("invalid max duration to declare the peer unresponsive")

ErrInvalidMaxDurationPeerUnresponsive signals that the duration provided is invalid

View Source
var ErrInvalidThreshold = errors.New("invalid threshold")

ErrInvalidThreshold signals that an invalid threshold was provided

View Source
var ErrInvalidTimeDuration = errors.New("invalid time duration")

ErrInvalidTimeDuration signals that an invalid time duration was provided

View Source
var ErrInvalidValue = errors.New("invalid value")

ErrInvalidValue signals that an invalid value has been provided

View Source
var ErrMarshalGenesisTime = errors.New("monitor: can't marshal genesis time")

ErrMarshalGenesisTime signals that the marshaling of the genesis time didn't work

View Source
var ErrNegativeMaxTimeToWaitBetweenBroadcastsInSec = errors.New("value MaxTimeToWaitBetweenBroadcastsInSec is less than 1")

ErrNegativeMaxTimeToWaitBetweenBroadcastsInSec is raised when a value less than 1 has been provided

View Source
var ErrNegativeMinTimeToWaitBetweenBroadcastsInSec = errors.New("value MinTimeToWaitBetweenBroadcastsInSec is less than 1")

ErrNegativeMinTimeToWaitBetweenBroadcastsInSec is raised when a value less than 1 has been provided

View Source
var ErrNilAntifloodHandler = errors.New("nil antiflood handler")

ErrNilAntifloodHandler signals that a nil antiflood handler has been provided

View Source
var ErrNilAppStatusHandler = errors.New("nil AppStatusHandler")

ErrNilAppStatusHandler defines the error for setting a nil AppStatusHandler

View Source
var ErrNilCacher = errors.New("nil cacher")

ErrNilCacher signals that a nil cache has been provided

View Source
var ErrNilCurrentBlockProvider = errors.New("nil current block provider")

ErrNilCurrentBlockProvider signals that a nil current block provider

View Source
var ErrNilDataToProcess = errors.New("nil data to process")

ErrNilDataToProcess signals that nil data was provided

View Source
var ErrNilEpochNotifier = errors.New("nil epoch notifier")

ErrNilEpochNotifier signals that a nil epoch notifier has been provided

View Source
var ErrNilHardforkTrigger = errors.New("nil hardfork trigger")

ErrNilHardforkTrigger signals that a nil hardfork trigger has been provided

View Source
var ErrNilHeartbeatMonitor = errors.New("nil heartbeat monitor")

ErrNilHeartbeatMonitor signals that a nil heartbeat monitor was provided

View Source
var ErrNilHeartbeatSenderInfoProvider = errors.New("nil heartbeat sender info provider")

ErrNilHeartbeatSenderInfoProvider signals that a nil heartbeat sender info provider was provided

View Source
var ErrNilHeartbeatStorer = errors.New("nil heartbeat storer")

ErrNilHeartbeatStorer signals that the provided heartbeat storer is nil

View Source
var ErrNilMarshaller = errors.New("nil marshaller")

ErrNilMarshaller signals that a nil marshaller has been provided

View Source
var ErrNilMessage = errors.New("nil message")

ErrNilMessage signals that a nil message has been received

View Source
var ErrNilMessageHandler = errors.New("nil message handler")

ErrNilMessageHandler signals that the provided message handler is nil

View Source
var ErrNilMessenger = errors.New("nil P2P Messenger")

ErrNilMessenger signals that a nil p2p messenger has been provided

View Source
var ErrNilMonitorDb = errors.New("nil monitor db")

ErrNilMonitorDb signals that a nil monitor db was provided

View Source
var ErrNilNetworkShardingCollector = errors.New("nil network sharding collector")

ErrNilNetworkShardingCollector defines the error for setting a nil network sharding collector

View Source
var ErrNilNodesCoordinator = errors.New("nil nodes coordinator")

ErrNilNodesCoordinator signals that an operation has been attempted to or with a nil nodes coordinator

View Source
var ErrNilPeerAuthenticationPool = errors.New("nil peer authentication pool")

ErrNilPeerAuthenticationPool signals that a nil peer authentication pool has been provided

View Source
var ErrNilPeerShardMapper = errors.New("nil peer shard mapper")

ErrNilPeerShardMapper signals that a nil peer shard mapper has been provided

View Source
var ErrNilPeerSignatureHandler = errors.New("trying to set nil peerSignatureHandler")

ErrNilPeerSignatureHandler signals that a nil peerSignatureHandler object has been provided

View Source
var ErrNilPeerTypeProvider = errors.New("nil peer type provider")

ErrNilPeerTypeProvider signals that a nil peer type provider has been given

View Source
var ErrNilPrivateKey = errors.New("nil private key")

ErrNilPrivateKey signals that a nil private key has been provided

View Source
var ErrNilPubkeyConverter = errors.New("trying to use a nil pubkey converter")

ErrNilPubkeyConverter signals that a nil public key converter has been provided

View Source
var ErrNilPublicKeysMap = errors.New("nil public keys map")

ErrNilPublicKeysMap signals that a nil public keys map has been provided

View Source
var ErrNilRandomizer = errors.New("nil randomizer")

ErrNilRandomizer signals that a nil randomizer has been provided

View Source
var ErrNilRedundancyHandler = errors.New("nil redundancy handler")

ErrNilRedundancyHandler signals that a nil redundancy handler was provided

View Source
var ErrNilRequestHandler = errors.New("nil request handler")

ErrNilRequestHandler signals that a nil request handler interface was provided

View Source
var ErrNilShardCoordinator = errors.New("nil shard coordinator")

ErrNilShardCoordinator signals that an operation has been attempted to or with a nil shard coordinator

View Source
var ErrNilTimer = errors.New("nil time getter handler")

ErrNilTimer signals that a nil time getter handler has been provided

View Source
var ErrPropertyTooLong = errors.New("property too long in Heartbeat")

ErrPropertyTooLong signals that one of the properties is too long

View Source
var ErrShouldSkipValidator = errors.New("validator should be skipped")

ErrShouldSkipValidator signals that the validator should be skipped

View Source
var ErrStoreGenesisTimeToDb = errors.New("monitor: can't store genesis time")

ErrStoreGenesisTimeToDb signals that the genesis time cannot be store to db

View Source
var ErrUnmarshalGenesisTime = errors.New("monitor: can't unmarshal genesis time")

ErrUnmarshalGenesisTime signals that the unmarshaling of the genesis time didn't work

View Source
var ErrWrongValues = errors.New("wrong values for heartbeat parameters")

ErrWrongValues signals that wrong values were provided

View Source
var ErrZeroHeartbeatRefreshIntervalInSec = errors.New("zero heartbeatRefreshInterval")

ErrZeroHeartbeatRefreshIntervalInSec signals that a zero value was provided for the HeartbeatRefreshIntervalInSec

View Source
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) MarshalTo

func (m *HeartbeatV2) MarshalTo(dAtA []byte) (int, 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) Descriptor() ([]byte, []int)

func (*Payload) Equal

func (this *Payload) Equal(that interface{}) bool

func (*Payload) GetHardforkMessage

func (m *Payload) GetHardforkMessage() string

func (*Payload) GetTimestamp

func (m *Payload) GetTimestamp() int64

func (*Payload) GoString

func (this *Payload) GoString() string

func (*Payload) Marshal

func (m *Payload) Marshal() (dAtA []byte, err error)

func (*Payload) MarshalTo

func (m *Payload) MarshalTo(dAtA []byte) (int, error)

func (*Payload) MarshalToSizedBuffer

func (m *Payload) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Payload) ProtoMessage

func (*Payload) ProtoMessage()

func (*Payload) Reset

func (m *Payload) Reset()

func (*Payload) Size

func (m *Payload) Size() (n int)

func (*Payload) String

func (this *Payload) String() string

func (*Payload) Unmarshal

func (m *Payload) Unmarshal(dAtA []byte) error

func (*Payload) XXX_DiscardUnknown

func (m *Payload) XXX_DiscardUnknown()

func (*Payload) XXX_Marshal

func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Payload) XXX_Merge

func (m *Payload) XXX_Merge(src proto.Message)

func (*Payload) XXX_Size

func (m *Payload) XXX_Size() int

func (*Payload) XXX_Unmarshal

func (m *Payload) XXX_Unmarshal(b []byte) error

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 Timer

type Timer interface {
	Now() time.Time
	IsInterfaceNil() bool
}

Timer defines an interface for tracking time

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL