params

package
v0.5.5-jatov2-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

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")
)
View Source
var (

	// HeartbeatInterval interval frequency of heartbeat, milliseconds
	HeartbeatInterval = 700 * time.Millisecond
)

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 NewOpts

func NewOpts(activeValidators, subnets int) Options

NewOpts creates new TopicOpts instance with defaults

func NewSubnetTopicOpts

func NewSubnetTopicOpts(activeValidators, subnets int) Options

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

Jump to

Keyboard shortcuts

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