Skip to content

Commit

Permalink
cmd: retire whisper flags (ethereum#22421)
Browse files Browse the repository at this point in the history
  • Loading branch information
JukLee0ira committed Nov 13, 2024
1 parent cfb7250 commit 85ede14
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 62 deletions.
28 changes: 1 addition & 27 deletions cmd/XDC/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.`,
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand All @@ -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)

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/XDC/consolecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions cmd/XDC/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,6 @@ var (
utils.IPCPathFlag,
utils.RPCGlobalTxFeeCap,
}

whisperFlags = []cli.Flag{
utils.WhisperEnabledFlag,
utils.WhisperMaxMessageSizeFlag,
utils.WhisperMinPOWFlag,
}
)

func init() {
Expand Down Expand Up @@ -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())
Expand Down
4 changes: 0 additions & 4 deletions cmd/XDC/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,6 @@ var AppHelpFlagGroups = []flagGroup{
//utils.NoCompactionFlag,
}, debug.Flags...),
},
//{
// Name: "WHISPER (deprecated)",
// Flags: whisperFlags,
//},
{
Name: "DEPRECATED",
Flags: []cli.Flag{
Expand Down
23 changes: 0 additions & 23 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 85ede14

Please sign in to comment.