Documentation
¶
Index ¶
- Constants
- Variables
- func GossipSubParams() pubsub.GossipSubParams
- func PeerScoreParams(oneEpoch, msgIDCacheTTL time.Duration, ipColocationWeight float64, ...) *pubsub.PeerScoreParams
- func PeerScoreThresholds() *pubsub.PeerScoreThresholds
- func TopicParams(opts Options) (*pubsub.TopicScoreParams, error)
- type NetworkOpts
- type Options
- type TopicOpts
Constants ¶
View Source
const ( // HeartbeatInterval interval frequency of heartbeat, milliseconds HeartbeatInterval = 700 * time.Millisecond )
Variables ¶
View Source
var ( // ErrLowValidatorsCount is returned in case the amount of validators is not sufficient // for calculating score params ErrLowValidatorsCount = errors.New("low validators count") )
Functions ¶
func GossipSubParams ¶
func GossipSubParams() pubsub.GossipSubParams
GossipSubParams creates a gossipsub parameter set.
func PeerScoreParams ¶
func PeerScoreParams(oneEpoch, msgIDCacheTTL time.Duration, ipColocationWeight float64, ipColocationThreshold int, ipWhilelist ...*net.IPNet) *pubsub.PeerScoreParams
PeerScoreParams returns peer score params according to the given options
func PeerScoreThresholds ¶
func PeerScoreThresholds() *pubsub.PeerScoreThresholds
PeerScoreThresholds returns the thresholds to use for peer scoring
func TopicParams ¶
func TopicParams(opts Options) (*pubsub.TopicScoreParams, error)
TopicParams creates pubsub.TopicScoreParams from the given TopicOpts implementation is based on ETH2.0 and prysm as a reference, with alignments to ssv: https://gist.github.com/blacktemplar/5c1862cb3f0e32a1a7fb0b25e79e6e2c
Types ¶
type NetworkOpts ¶
type NetworkOpts struct {
// ActiveValidators is the amount of validators in the network
ActiveValidators int
// Subnets is the number of subnets in the network
Subnets int
//// Groups is the amount of groups used in the network
// Groups int
// OneEpochDuration is used as a time-frame length to control scoring in a dynamic way
OneEpochDuration time.Duration
// TotalTopicsWeight is the weight of all the topics in the network
TotalTopicsWeight float64
}
NetworkOpts is the config struct for network configurations
type Options ¶
type Options struct {
Network NetworkOpts
Topic TopicOpts
}
Options is the struct used for creating topic score params
func NewSubnetTopicOpts ¶
NewSubnetTopicOpts creates new TopicOpts for a subnet topic
type TopicOpts ¶
type TopicOpts struct {
// TopicWeight is the weight of the topic
TopicWeight float64
// ExpectedMsgRate is the expected rate for the topic
ExpectedMsgRate float64
InvalidMsgDecayTime time.Duration
FirstMsgDecayTime time.Duration
MeshMsgDecayTime time.Duration
MeshMsgCapFactor float64
MeshMsgActivationTime time.Duration
// D is the gossip degree
D int
}
TopicOpts is the config struct for topic configurations
Click to show internal directories.
Click to hide internal directories.