Documentation ¶
Index ¶
- Constants
- func IsDuplicateMessageIDErr(err error) bool
- func IsDuplicateTopicErr(err error) bool
- func IsErrActiveClusterIDsNotSet(err error) bool
- func IsErrUnstakedPeer(err error) bool
- func IsIWantCacheMissThresholdErr(err error) bool
- func IsIWantDuplicateMsgIDThresholdErr(err error) bool
- func IsInvalidRpcPublishMessagesErr(err error) bool
- type ControlMsgValidationInspector
- func (c *ControlMsgValidationInspector) ActiveClustersChanged(clusterIDList flow.ChainIDList)
- func (c *ControlMsgValidationInspector) Inspect(from peer.ID, rpc *pubsub.RPC) error
- func (c *ControlMsgValidationInspector) Name() string
- func (c *ControlMsgValidationInspector) Start(parent irrecoverable.SignalerContext)
- type DuplicateMessageIDErr
- type DuplicateTopicErr
- type ErrActiveClusterIdsNotSet
- type ErrUnstakedPeer
- type IWantCacheMissThresholdErr
- type IWantDuplicateMsgIDThresholdErr
- type InspectRPCRequest
- type InspectorParams
- type InvalidRpcPublishMessagesErr
Constants ¶
const ( // DefaultNumberOfWorkers default number of workers for the inspector component. DefaultNumberOfWorkers = 5 // DefaultControlMsgValidationInspectorQueueCacheSize is the default size of the inspect message queue. DefaultControlMsgValidationInspectorQueueCacheSize = 100 // DefaultClusterPrefixedControlMsgsReceivedCacheSize is the default size of the cluster prefixed topics received record cache. DefaultClusterPrefixedControlMsgsReceivedCacheSize = 150 // DefaultClusterPrefixedControlMsgsReceivedCacheDecay the default cache decay value for cluster prefixed topics received cached counters. DefaultClusterPrefixedControlMsgsReceivedCacheDecay = 0.99 )
Variables ¶
This section is empty.
Functions ¶
func IsDuplicateMessageIDErr ¶ added in v0.32.0
IsDuplicateMessageIDErr returns true if an error is DuplicateMessageIDErr.
func IsDuplicateTopicErr ¶ added in v0.32.0
IsDuplicateTopicErr returns true if an error is DuplicateTopicErr.
func IsErrActiveClusterIDsNotSet ¶ added in v0.31.0
IsErrActiveClusterIDsNotSet returns true if an error is ErrActiveClusterIdsNotSet.
func IsErrUnstakedPeer ¶ added in v0.31.0
IsErrUnstakedPeer returns true if an error is ErrUnstakedPeer.
func IsIWantCacheMissThresholdErr ¶ added in v0.32.0
IsIWantCacheMissThresholdErr returns true if an error is IWantCacheMissThresholdErr
func IsIWantDuplicateMsgIDThresholdErr ¶ added in v0.32.0
IsIWantDuplicateMsgIDThresholdErr returns true if an error is IWantDuplicateMsgIDThresholdErr
func IsInvalidRpcPublishMessagesErr ¶ added in v0.33.1
IsInvalidRpcPublishMessagesErr returns true if an error is InvalidRpcPublishMessagesErr.
Types ¶
type ControlMsgValidationInspector ¶
type ControlMsgValidationInspector struct { component.Component events.Noop // contains filtered or unexported fields }
ControlMsgValidationInspector RPC message inspector that inspects control messages and performs some validation on them, when some validation rule is broken feedback is given via the Peer scoring notifier.
func NewControlMsgValidationInspector ¶
func NewControlMsgValidationInspector(params *InspectorParams) (*ControlMsgValidationInspector, error)
NewControlMsgValidationInspector returns new ControlMsgValidationInspector Args:
- *InspectorParams: params used to create the inspector.
Returns:
- *ControlMsgValidationInspector: a new control message validation inspector.
- error: an error if there is any error while creating the inspector. All errors are irrecoverable and unexpected.
func (*ControlMsgValidationInspector) ActiveClustersChanged ¶ added in v0.31.0
func (c *ControlMsgValidationInspector) ActiveClustersChanged(clusterIDList flow.ChainIDList)
ActiveClustersChanged consumes cluster ID update protocol events.
func (*ControlMsgValidationInspector) Inspect ¶
Inspect is called by gossipsub upon reception of a rpc from a remote node. It creates a new InspectRPCRequest for the RPC to be inspected async by the worker pool. Args:
- from: the sender.
- rpc: the control message RPC.
Returns:
- error: if a new inspect rpc request cannot be created, all errors returned are considered irrecoverable.
func (*ControlMsgValidationInspector) Name ¶
func (c *ControlMsgValidationInspector) Name() string
Name returns the name of the rpc inspector.
func (*ControlMsgValidationInspector) Start ¶ added in v0.33.1
func (c *ControlMsgValidationInspector) Start(parent irrecoverable.SignalerContext)
type DuplicateMessageIDErr ¶ added in v0.32.0
type DuplicateMessageIDErr struct {
// contains filtered or unexported fields
}
DuplicateMessageIDErr error that indicates a duplicate message ID has been detected in a IHAVE or IWANT control message.
func NewDuplicateMessageIDErr ¶ added in v0.32.0
func NewDuplicateMessageIDErr(id string, msgType p2pmsg.ControlMessageType) DuplicateMessageIDErr
NewDuplicateMessageIDErr returns a new DuplicateMessageIDErr.
func (DuplicateMessageIDErr) Error ¶ added in v0.32.0
func (e DuplicateMessageIDErr) Error() string
type DuplicateTopicErr ¶ added in v0.32.0
type DuplicateTopicErr struct {
// contains filtered or unexported fields
}
DuplicateTopicErr error that indicates a duplicate has been detected. This can be duplicate topic or message ID tracking.
func NewDuplicateTopicErr ¶ added in v0.31.0
func NewDuplicateTopicErr(topic string, msgType p2pmsg.ControlMessageType) DuplicateTopicErr
NewDuplicateTopicErr returns a new DuplicateTopicErr.
func (DuplicateTopicErr) Error ¶ added in v0.32.0
func (e DuplicateTopicErr) Error() string
type ErrActiveClusterIdsNotSet ¶ added in v0.31.0
type ErrActiveClusterIdsNotSet struct {
// contains filtered or unexported fields
}
ErrActiveClusterIdsNotSet error that indicates a cluster prefixed control message has been received but the cluster IDs have not been set yet.
func NewActiveClusterIdsNotSetErr ¶ added in v0.31.0
func NewActiveClusterIdsNotSetErr(topic channels.Topic) ErrActiveClusterIdsNotSet
NewActiveClusterIdsNotSetErr returns a new ErrActiveClusterIdsNotSet.
func (ErrActiveClusterIdsNotSet) Error ¶ added in v0.31.0
func (e ErrActiveClusterIdsNotSet) Error() string
type ErrUnstakedPeer ¶ added in v0.31.0
type ErrUnstakedPeer struct {
// contains filtered or unexported fields
}
ErrUnstakedPeer error that indicates a cluster prefixed control message has been from an unstaked peer.
func NewUnstakedPeerErr ¶ added in v0.31.0
func NewUnstakedPeerErr(err error) ErrUnstakedPeer
NewUnstakedPeerErr returns a new ErrUnstakedPeer.
func (ErrUnstakedPeer) Error ¶ added in v0.31.0
func (e ErrUnstakedPeer) Error() string
type IWantCacheMissThresholdErr ¶ added in v0.32.0
type IWantCacheMissThresholdErr struct {
// contains filtered or unexported fields
}
IWantCacheMissThresholdErr indicates that the amount of cache misses exceeds the allowed threshold.
func NewIWantCacheMissThresholdErr ¶ added in v0.32.0
func NewIWantCacheMissThresholdErr(cacheMissCount int, sampleSize uint, threshold float64) IWantCacheMissThresholdErr
NewIWantCacheMissThresholdErr returns a new IWantCacheMissThresholdErr.
func (IWantCacheMissThresholdErr) Error ¶ added in v0.32.0
func (e IWantCacheMissThresholdErr) Error() string
type IWantDuplicateMsgIDThresholdErr ¶ added in v0.32.0
type IWantDuplicateMsgIDThresholdErr struct {
// contains filtered or unexported fields
}
IWantDuplicateMsgIDThresholdErr indicates that the amount of duplicate message ids exceeds the allowed threshold.
func NewIWantDuplicateMsgIDThresholdErr ¶ added in v0.32.0
func NewIWantDuplicateMsgIDThresholdErr(duplicates int, sampleSize uint, threshold float64) IWantDuplicateMsgIDThresholdErr
NewIWantDuplicateMsgIDThresholdErr returns a new IWantDuplicateMsgIDThresholdErr.
func (IWantDuplicateMsgIDThresholdErr) Error ¶ added in v0.32.0
func (e IWantDuplicateMsgIDThresholdErr) Error() string
type InspectRPCRequest ¶ added in v0.32.0
type InspectRPCRequest struct { // Nonce adds random value so that when msg req is stored on hero store a unique ID can be created from the struct fields. Nonce []byte // Peer sender of the message. Peer peer.ID // contains filtered or unexported fields }
InspectRPCRequest represents a short digest of an RPC control message. It is used for further message inspection by component workers.
func NewInspectRPCRequest ¶ added in v0.32.0
NewInspectRPCRequest returns a new *InspectRPCRequest.
type InspectorParams ¶ added in v0.33.1
type InspectorParams struct { // Logger the logger used by the inspector. Logger zerolog.Logger `validate:"required"` // SporkID the current spork ID. SporkID flow.Identifier `validate:"required"` // Config inspector configuration. Config *p2pconfig.RpcValidationInspector `validate:"required"` // Distributor gossipsub inspector notification distributor. Distributor p2p.GossipSubInspectorNotifDistributor `validate:"required"` // HeroCacheMetricsFactory the metrics factory. HeroCacheMetricsFactory metrics.HeroCacheMetricsFactory `validate:"required"` // IdProvider identity provider is used to get the flow identifier for a peer. IdProvider module.IdentityProvider `validate:"required"` // InspectorMetrics metrics for the validation inspector. InspectorMetrics module.GossipSubRpcValidationInspectorMetrics `validate:"required"` // RpcTracker tracker used to track iHave RPC's sent and last size. RpcTracker p2p.RpcControlTracking `validate:"required"` // NetworkingType the networking type of the node. NetworkingType network.NetworkingType `validate:"required"` // TopicOracle callback used to retrieve the current subscribed topics of the libp2p node. // It is set as a callback to avoid circular dependencies between the topic oracle and the inspector. TopicOracle func() p2p.TopicProvider `validate:"required"` }
type InvalidRpcPublishMessagesErr ¶ added in v0.33.1
type InvalidRpcPublishMessagesErr struct {
// contains filtered or unexported fields
}
InvalidRpcPublishMessagesErr error indicates that rpc publish message validation failed.
func NewInvalidRpcPublishMessagesErr ¶ added in v0.33.1
func NewInvalidRpcPublishMessagesErr(err error, count int) InvalidRpcPublishMessagesErr
NewInvalidRpcPublishMessagesErr returns a new InvalidRpcPublishMessagesErr.
func (InvalidRpcPublishMessagesErr) Error ¶ added in v0.33.1
func (e InvalidRpcPublishMessagesErr) Error() string