From 85ede14a92e49e3ab2d2360f4e8530d7d7d47c65 Mon Sep 17 00:00:00 2001 From: JukLee0ira Date: Wed, 13 Nov 2024 11:42:32 +0800 Subject: [PATCH] cmd: retire whisper flags (#22421) --- cmd/XDC/config.go | 28 +--------------------------- cmd/XDC/consolecmd.go | 2 +- cmd/XDC/main.go | 7 ------- cmd/XDC/usage.go | 4 ---- cmd/utils/flags.go | 23 ----------------------- 5 files changed, 2 insertions(+), 62 deletions(-) diff --git a/cmd/XDC/config.go b/cmd/XDC/config.go index f2c0b525f6f4..dacc11b497c7 100644 --- a/cmd/XDC/config.go +++ b/cmd/XDC/config.go @@ -46,7 +46,7 @@ var ( Name: "dumpconfig", Usage: "Show configuration values", ArgsUsage: "", - Flags: append(append(nodeFlags, rpcFlags...), whisperFlags...), + Flags: append(nodeFlags, rpcFlags...), Category: "MISCELLANEOUS COMMANDS", Description: `The dumpconfig command shows configuration values.`, } @@ -88,19 +88,8 @@ type Bootnodes struct { Testnet []string } -// whisper has been deprecated, but clients out there might still have [Shh] -// in their config, which will crash. Cut them some slack by keeping the -// config, and displaying a message that those config switches are ineffectual. -// To be removed circa Q1 2021 -- @gballet. -type whisperDeprecatedConfig struct { - MaxMessageSize uint32 `toml:",omitempty"` - MinimumAcceptedPOW float64 `toml:",omitempty"` - RestrictConnectionBetweenLightClients bool `toml:",omitempty"` -} - type XDCConfig struct { Eth ethconfig.Config - Shh whisperDeprecatedConfig Node node.Config Ethstats ethstatsConfig XDCX XDCx.Config @@ -150,10 +139,6 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) { if err := loadConfig(file, &cfg); err != nil { utils.Fatalf("%v", err) } - - if cfg.Shh != (whisperDeprecatedConfig{}) { - log.Warn("Deprecated whisper config detected. Whisper has been moved to github.com/ethereum/whisper") - } } if ctx.GlobalIsSet(utils.StakingEnabledFlag.Name) { cfg.StakeEnable = ctx.GlobalBool(utils.StakingEnabledFlag.Name) @@ -224,7 +209,6 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) { cfg.Ethstats.URL = ctx.GlobalString(utils.EthStatsURLFlag.Name) } - utils.SetShhConfig(ctx, stack) utils.SetXDCXConfig(ctx, &cfg.XDCX, cfg.Node.DataDir) return stack, cfg } @@ -242,15 +226,6 @@ func applyValues(values []string, params *[]string) { } -// checkWhisper returns true in case one of the whisper flags is set. -func checkWhisper(ctx *cli.Context) { - for _, flag := range whisperFlags { - if ctx.GlobalIsSet(flag.GetName()) { - log.Warn("deprecated whisper flag detected. Whisper has been moved to github.com/ethereum/whisper") - } - } -} - func makeFullNode(ctx *cli.Context) (*node.Node, XDCConfig) { stack, cfg := makeConfigNode(ctx) @@ -259,7 +234,6 @@ func makeFullNode(ctx *cli.Context) (*node.Node, XDCConfig) { utils.RegisterXDCXService(stack, &cfg.XDCX) utils.RegisterEthService(stack, &cfg.Eth) - checkWhisper(ctx) // Add the Ethereum Stats daemon if requested. if cfg.Ethstats.URL != "" { utils.RegisterEthStatsService(stack, cfg.Ethstats.URL) diff --git a/cmd/XDC/consolecmd.go b/cmd/XDC/consolecmd.go index 6eb2b52fc9e8..e36dda489cc9 100644 --- a/cmd/XDC/consolecmd.go +++ b/cmd/XDC/consolecmd.go @@ -38,7 +38,7 @@ var ( Action: utils.MigrateFlags(localConsole), Name: "console", Usage: "Start an interactive JavaScript environment", - Flags: append(append(append(nodeFlags, rpcFlags...), consoleFlags...), whisperFlags...), + Flags: append(append(nodeFlags, rpcFlags...), consoleFlags...), Category: "CONSOLE COMMANDS", Description: ` The XDC console is an interactive shell for the JavaScript runtime environment diff --git a/cmd/XDC/main.go b/cmd/XDC/main.go index dcaad38cd9c2..88d5a4bd7832 100644 --- a/cmd/XDC/main.go +++ b/cmd/XDC/main.go @@ -160,12 +160,6 @@ var ( utils.IPCPathFlag, utils.RPCGlobalTxFeeCap, } - - whisperFlags = []cli.Flag{ - utils.WhisperEnabledFlag, - utils.WhisperMaxMessageSizeFlag, - utils.WhisperMinPOWFlag, - } ) func init() { @@ -198,7 +192,6 @@ func init() { app.Flags = append(app.Flags, rpcFlags...) app.Flags = append(app.Flags, consoleFlags...) app.Flags = append(app.Flags, debug.Flags...) - app.Flags = append(app.Flags, whisperFlags...) app.Before = func(ctx *cli.Context) error { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/cmd/XDC/usage.go b/cmd/XDC/usage.go index 9c1fb8193e05..2fdfdd9576c2 100644 --- a/cmd/XDC/usage.go +++ b/cmd/XDC/usage.go @@ -217,10 +217,6 @@ var AppHelpFlagGroups = []flagGroup{ //utils.NoCompactionFlag, }, debug.Flags...), }, - //{ - // Name: "WHISPER (deprecated)", - // Flags: whisperFlags, - //}, { Name: "DEPRECATED", Flags: []cli.Flag{ diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 25a9d7275851..ef937b9d727f 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -590,20 +590,6 @@ var ( Usage: "Gas price below which gpo will ignore transactions", Value: ethconfig.Defaults.GPO.IgnorePrice.Int64(), } - WhisperEnabledFlag = cli.BoolFlag{ - Name: "shh", - Usage: "Enable Whisper", - } - WhisperMaxMessageSizeFlag = cli.IntFlag{ - Name: "shh.maxmessagesize", - Usage: "Max message size accepted", - Value: 1024 * 1024, - } - WhisperMinPOWFlag = cli.Float64Flag{ - Name: "shh.pow", - Usage: "Minimum POW accepted", - Value: 0.2, - } XDCXDataDirFlag = DirectoryFlag{ Name: "XDCx.datadir", Usage: "Data directory for the XDCX databases", @@ -1143,15 +1129,6 @@ func checkExclusive(ctx *cli.Context, args ...interface{}) { } } -// SetShhConfig applies shh-related command line flags to the config. -func SetShhConfig(ctx *cli.Context, stack *node.Node) { - if ctx.GlobalIsSet(WhisperEnabledFlag.Name) || - ctx.GlobalIsSet(WhisperMaxMessageSizeFlag.Name) || - ctx.GlobalIsSet(WhisperMinPOWFlag.Name) { - log.Warn("Whisper support has been deprecated and the code has been moved to github.com/ethereum/whisper") - } -} - func SetXDCXConfig(ctx *cli.Context, cfg *XDCx.Config, XDCDataDir string) { if ctx.GlobalIsSet(XDCXDataDirFlag.Name) { cfg.DataDir = ctx.GlobalString(XDCXDataDirFlag.Name)