params

package
v1.3.7 Latest Latest
Warning

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

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

Documentation

Index

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, 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, 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
	// 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

func NewSubnetTopicOpts

func NewSubnetTopicOpts(activeValidators, subnets int) Options

NewSubnetTopicOpts creates new TopicOpts for a subnet topic

type TopicOpts

type TopicOpts struct {
	// D is the gossip degree
	D int

	//  ExpectedMsgRate is the expected rate for the topic
	ExpectedMsgRate float64

	// TopicWeight is the weight of the topic
	TopicWeight float64

	// P1
	MaxTimeInMeshScore   float64
	TimeInMeshQuantum    int
	TimeInMeshQuantumCap int

	// P2
	FirstDeliveryDecayEpochs time.Duration
	MaxFirstDeliveryScore    float64

	// P3
	MeshDeliveryDecayEpochs     time.Duration
	MeshDeliveryDampeningFactor float64
	MeshDeliveryCapFactor       float64
	MeshDeliveryActivationTime  time.Duration

	// P4
	InvalidMessageDecayEpochs time.Duration
	MaxInvalidMessagesAllowed 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