From 49ef0ad2846d536c39eb114be6f1784da99839b9 Mon Sep 17 00:00:00 2001
From: Nishant Das <nishdas93@gmail.com>
Date: Wed, 17 Aug 2022 12:49:51 +0800
Subject: [PATCH] Remove Gossip History Flag (#11232)

* Remove gossip history flag

* gaz

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
---
 beacon-chain/p2p/BUILD.bazel |  1 -
 beacon-chain/p2p/pubsub.go   | 10 ----------
 config/features/config.go    |  5 -----
 config/features/flags.go     |  5 -----
 4 files changed, 21 deletions(-)

diff --git a/beacon-chain/p2p/BUILD.bazel b/beacon-chain/p2p/BUILD.bazel
index 746e52031..4e794488f 100644
--- a/beacon-chain/p2p/BUILD.bazel
+++ b/beacon-chain/p2p/BUILD.bazel
@@ -53,7 +53,6 @@ go_library(
         "//beacon-chain/p2p/peers/scorers:go_default_library",
         "//beacon-chain/p2p/types:go_default_library",
         "//cmd/beacon-chain/flags:go_default_library",
-        "//config/features:go_default_library",
         "//config/params:go_default_library",
         "//consensus-types/primitives:go_default_library",
         "//consensus-types/wrapper:go_default_library",
diff --git a/beacon-chain/p2p/pubsub.go b/beacon-chain/p2p/pubsub.go
index fd7328bb4..ea6031585 100644
--- a/beacon-chain/p2p/pubsub.go
+++ b/beacon-chain/p2p/pubsub.go
@@ -10,7 +10,6 @@ import (
 	pubsub "github.com/libp2p/go-libp2p-pubsub"
 	"github.com/pkg/errors"
 	"github.com/prysmaticlabs/prysm/v3/cmd/beacon-chain/flags"
-	"github.com/prysmaticlabs/prysm/v3/config/features"
 	"github.com/prysmaticlabs/prysm/v3/encoding/bytesutil"
 	pbrpc "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1"
 )
@@ -137,15 +136,6 @@ func pubsubGossipParam() pubsub.GossipSubParams {
 	gParams.HeartbeatInterval = gossipSubHeartbeatInterval
 	gParams.HistoryLength = gossipSubMcacheLen
 	gParams.HistoryGossip = gossipSubMcacheGossip
-
-	// 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 features.Get().EnableLargerGossipHistory {
-		gParams.HistoryLength = 12
-		gParams.HistoryGossip = 5
-	}
 	return gParams
 }
 
diff --git a/config/features/config.go b/config/features/config.go
index 0482e0005..8dda4f376 100644
--- a/config/features/config.go
+++ b/config/features/config.go
@@ -44,7 +44,6 @@ type Flags struct {
 	RemoteSlasherProtection             bool // RemoteSlasherProtection utilizes a beacon node with --slasher mode for validator slashing protection.
 	WriteSSZStateTransitions            bool // WriteSSZStateTransitions to tmp directory.
 	EnablePeerScorer                    bool // EnablePeerScorer enables experimental peer scoring in p2p.
-	EnableLargerGossipHistory           bool // EnableLargerGossipHistory increases the gossip history we store in our caches.
 	WriteWalletPasswordOnWebOnboarding  bool // WriteWalletPasswordOnWebOnboarding writes the password to disk after Prysm web signup.
 	DisableAttestingHistoryDBCache      bool // DisableAttestingHistoryDBCache for the validator client increases disk reads/writes.
 	EnableDoppelGanger                  bool // EnableDoppelGanger enables doppelganger protection on startup for the validator.
@@ -188,10 +187,6 @@ func ConfigureBeaconChain(ctx *cli.Context) error {
 		logDisabled(disablePeerScorer)
 		cfg.EnablePeerScorer = false
 	}
-	if ctx.Bool(enableLargerGossipHistory.Name) {
-		logEnabled(enableLargerGossipHistory)
-		cfg.EnableLargerGossipHistory = true
-	}
 	if ctx.Bool(disableBroadcastSlashingFlag.Name) {
 		logDisabled(disableBroadcastSlashingFlag)
 		cfg.DisableBroadcastSlashings = true
diff --git a/config/features/flags.go b/config/features/flags.go
index 2b276e86c..9b7625804 100644
--- a/config/features/flags.go
+++ b/config/features/flags.go
@@ -50,10 +50,6 @@ var (
 		Name:  "disable-peer-scorer",
 		Usage: "Disables experimental P2P peer scorer",
 	}
-	enableLargerGossipHistory = &cli.BoolFlag{
-		Name:  "enable-larger-gossip-history",
-		Usage: "Enables the node to store a larger amount of gossip messages in its cache.",
-	}
 	writeWalletPasswordOnWebOnboarding = &cli.BoolFlag{
 		Name: "write-wallet-password-on-web-onboarding",
 		Usage: "(Danger): Writes the wallet password to the wallet directory on completing Prysm web onboarding. " +
@@ -157,7 +153,6 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{
 	SepoliaTestnet,
 	Mainnet,
 	disablePeerScorer,
-	enableLargerGossipHistory,
 	disableBroadcastSlashingFlag,
 	enableSlasherFlag,
 	enableHistoricalSpaceRepresentation,