Skip to content

Commit

Permalink
Update Gossipsub Parameters (#7869)
Browse files Browse the repository at this point in the history
* add param and flag

* change back
  • Loading branch information
nisdas committed Nov 20, 2020
1 parent 90a66df commit 60cdd69
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
4 changes: 2 additions & 2 deletions beacon-chain/p2p/parameter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion beacon-chain/p2p/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
5 changes: 5 additions & 0 deletions shared/featureconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
}

Expand Down
6 changes: 6 additions & 0 deletions shared/featureconfig/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -121,6 +126,7 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{
disableBlst,
disableEth1DataMajorityVote,
enablePeerScorer,
enableLargerGossipHistory,
checkPtInfoCache,
disablePruningDepositProofs,
enableSyncBacktracking,
Expand Down

0 comments on commit 60cdd69

Please sign in to comment.