Update Gossipsub Parameters (#7869)

* add param and flag

* change back
This commit is contained in:
Nishant Das 2020-11-20 23:36:02 +08:00 committed by GitHub
parent 90a66df529
commit 60cdd69b05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 3 deletions

View File

@ -10,8 +10,8 @@ import (
const (
// overlay parameters
gossipSubD = 6 // topic stable mesh target count
gossipSubDlo = 5 // topic stable mesh low watermark
gossipSubD = 8 // topic stable mesh target count
gossipSubDlo = 6 // topic stable mesh low watermark
gossipSubDhi = 12 // topic stable mesh high watermark
// gossip parameters

View File

@ -116,9 +116,19 @@ func msgIDFunction(pmsg *pubsub_pb.Message) string {
func setPubSubParameters() {
heartBeatInterval := 700 * time.Millisecond
pubsub.GossipSubDlo = 5
pubsub.GossipSubDlo = 6
pubsub.GossipSubD = 8
pubsub.GossipSubHeartbeatInterval = heartBeatInterval
pubsub.GossipSubHistoryLength = 6
pubsub.GossipSubHistoryGossip = 3
pubsub.TimeCacheDuration = 550 * heartBeatInterval
// Set a larger gossip history to ensure that slower
// messages have a longer time to be propagated. This
// comes with the tradeoff of larger memory usage and
// size of the seen message cache.
if featureconfig.Get().EnableLargerGossipHistory {
pubsub.GossipSubHistoryLength = 12
pubsub.GossipSubHistoryLength = 5
}
}

View File

@ -47,6 +47,7 @@ type Flags struct {
EnablePeerScorer bool // EnablePeerScorer enables experimental peer scoring in p2p.
EnablePruningDepositProofs bool // EnablePruningDepositProofs enables pruning deposit proofs which significantly reduces the size of a deposit
EnableSyncBacktracking bool // EnableSyncBacktracking enables backtracking algorithm when searching for alternative forks during initial sync.
EnableLargerGossipHistory bool // EnableLargerGossipHistory increases the gossip history we store in our caches.
// Logging related toggles.
DisableGRPCConnectionLogs bool // Disables logging when a new grpc client has connected.
@ -174,6 +175,10 @@ func ConfigureBeaconChain(ctx *cli.Context) {
log.Warn("Enabling init-sync backtracking algorithm")
cfg.EnableSyncBacktracking = true
}
if ctx.Bool(enableLargerGossipHistory.Name) {
log.Warn("Using a larger gossip history for the node")
cfg.EnableLargerGossipHistory = true
}
Init(cfg)
}

View File

@ -80,11 +80,16 @@ var (
Name: "enable-sync-backtracking",
Usage: "Enable experimental fork exploration backtracking algorithm",
}
enableLargerGossipHistory = &cli.BoolFlag{
Name: "enable-larger-gossip-history",
Usage: "Enables the node to store a larger amount of gossip messages in its cache.",
}
)
// devModeFlags holds list of flags that are set when development mode is on.
var devModeFlags = []cli.Flag{
enableSyncBacktracking,
enableLargerGossipHistory,
}
// ValidatorFlags contains a list of all the feature flags that apply to the validator client.
@ -121,6 +126,7 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{
disableBlst,
disableEth1DataMajorityVote,
enablePeerScorer,
enableLargerGossipHistory,
checkPtInfoCache,
disablePruningDepositProofs,
enableSyncBacktracking,