github.com/ava-labs/avalanchego@v1.11.11/vms/platformvm/network/config.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package network 5 6 import ( 7 "time" 8 9 "github.com/ava-labs/avalanchego/utils/units" 10 ) 11 12 var DefaultConfig = Config{ 13 MaxValidatorSetStaleness: time.Minute, 14 TargetGossipSize: 20 * units.KiB, 15 PushGossipPercentStake: .9, 16 PushGossipNumValidators: 100, 17 PushGossipNumPeers: 0, 18 PushRegossipNumValidators: 10, 19 PushRegossipNumPeers: 0, 20 PushGossipDiscardedCacheSize: 16384, 21 PushGossipMaxRegossipFrequency: 30 * time.Second, 22 PushGossipFrequency: 500 * time.Millisecond, 23 PullGossipPollSize: 1, 24 PullGossipFrequency: 1500 * time.Millisecond, 25 PullGossipThrottlingPeriod: 10 * time.Second, 26 PullGossipThrottlingLimit: 2, 27 ExpectedBloomFilterElements: 8 * 1024, 28 ExpectedBloomFilterFalsePositiveProbability: .01, 29 MaxBloomFilterFalsePositiveProbability: .05, 30 } 31 32 type Config struct { 33 // MaxValidatorSetStaleness limits how old of a validator set the network 34 // will use for peer sampling and rate limiting. 35 MaxValidatorSetStaleness time.Duration `json:"max-validator-set-staleness"` 36 // TargetGossipSize is the number of bytes that will be attempted to be 37 // sent when pushing transactions and when responded to transaction pull 38 // requests. 39 TargetGossipSize int `json:"target-gossip-size"` 40 // PushGossipPercentStake is the percentage of total stake to push 41 // transactions to in the first round of gossip. Nodes with higher stake are 42 // preferred over nodes with less stake to minimize the number of messages 43 // sent over the p2p network. 44 PushGossipPercentStake float64 `json:"push-gossip-percent-stake"` 45 // PushGossipNumValidators is the number of validators to push transactions 46 // to in the first round of gossip. 47 PushGossipNumValidators int `json:"push-gossip-num-validators"` 48 // PushGossipNumPeers is the number of peers to push transactions to in the 49 // first round of gossip. 50 PushGossipNumPeers int `json:"push-gossip-num-peers"` 51 // PushRegossipNumValidators is the number of validators to push 52 // transactions to after the first round of gossip. 53 PushRegossipNumValidators int `json:"push-regossip-num-validators"` 54 // PushRegossipNumPeers is the number of peers to push transactions to after 55 // the first round of gossip. 56 PushRegossipNumPeers int `json:"push-regossip-num-peers"` 57 // PushGossipDiscardedCacheSize is the number of txIDs to cache to avoid 58 // pushing transactions that were recently dropped from the mempool. 59 PushGossipDiscardedCacheSize int `json:"push-gossip-discarded-cache-size"` 60 // PushGossipMaxRegossipFrequency is the limit for how frequently a 61 // transaction will be push gossiped. 62 PushGossipMaxRegossipFrequency time.Duration `json:"push-gossip-max-regossip-frequency"` 63 // PushGossipFrequency is how frequently rounds of push gossip are 64 // performed. 65 PushGossipFrequency time.Duration `json:"push-gossip-frequency"` 66 // PullGossipPollSize is the number of validators to sample when performing 67 // a round of pull gossip. 68 PullGossipPollSize int `json:"pull-gossip-poll-size"` 69 // PullGossipFrequency is how frequently rounds of pull gossip are 70 // performed. 71 PullGossipFrequency time.Duration `json:"pull-gossip-frequency"` 72 // PullGossipThrottlingPeriod is how large of a window the throttler should 73 // use. 74 PullGossipThrottlingPeriod time.Duration `json:"pull-gossip-throttling-period"` 75 // PullGossipThrottlingLimit is the number of pull querys that are allowed 76 // by a validator in every throttling window. 77 PullGossipThrottlingLimit int `json:"pull-gossip-throttling-limit"` 78 // ExpectedBloomFilterElements is the number of elements to expect when 79 // creating a new bloom filter. The larger this number is, the larger the 80 // bloom filter will be. 81 ExpectedBloomFilterElements int `json:"expected-bloom-filter-elements"` 82 // ExpectedBloomFilterFalsePositiveProbability is the expected probability 83 // of a false positive after having inserted ExpectedBloomFilterElements 84 // into a bloom filter. The smaller this number is, the larger the bloom 85 // filter will be. 86 ExpectedBloomFilterFalsePositiveProbability float64 `json:"expected-bloom-filter-false-positive-probability"` 87 // MaxBloomFilterFalsePositiveProbability is used to determine when the 88 // bloom filter should be refreshed. Once the expected probability of a 89 // false positive exceeds this value, the bloom filter will be regenerated. 90 // The smaller this number is, the more frequently that the bloom filter 91 // will be regenerated. 92 MaxBloomFilterFalsePositiveProbability float64 `json:"max-bloom-filter-false-positive-probability"` 93 }