diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 3a79c5d8b3..d4b9774515 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -94,11 +94,11 @@ var ( utils.GCModeFlag, utils.SnapshotFlag, utils.LightServeFlag, - utils.LightLegacyServFlag, + utils.LegacyLightServFlag, utils.LightIngressFlag, utils.LightEgressFlag, utils.LightMaxPeersFlag, - utils.LightLegacyPeersFlag, + utils.LegacyLightPeersFlag, utils.LightKDFFlag, utils.UltraLightServersFlag, utils.UltraLightFractionFlag, @@ -115,17 +115,17 @@ var ( utils.MaxPendingPeersFlag, utils.MiningEnabledFlag, utils.MinerThreadsFlag, - utils.MinerLegacyThreadsFlag, + utils.LegacyMinerThreadsFlag, utils.MinerNotifyFlag, utils.MinerGasTargetFlag, - utils.MinerLegacyGasTargetFlag, + utils.LegacyMinerGasTargetFlag, utils.MinerGasLimitFlag, utils.MinerGasPriceFlag, - utils.MinerLegacyGasPriceFlag, + utils.LegacyMinerGasPriceFlag, utils.MinerEtherbaseFlag, - utils.MinerLegacyEtherbaseFlag, + utils.LegacyMinerEtherbaseFlag, utils.MinerExtraDataFlag, - utils.MinerLegacyExtraDataFlag, + utils.LegacyMinerExtraDataFlag, utils.MinerRecommitIntervalFlag, utils.MinerNoVerfiyFlag, utils.NATFlag, @@ -147,9 +147,9 @@ var ( utils.FakePoWFlag, utils.NoCompactionFlag, utils.GpoBlocksFlag, - utils.GpoLegacyBlocksFlag, + utils.LegacyGpoBlocksFlag, utils.GpoPercentileFlag, - utils.GpoLegacyPercentileFlag, + utils.LegacyGpoPercentileFlag, utils.EWASMInterpreterFlag, utils.EVMInterpreterFlag, configFileFlag, @@ -161,27 +161,27 @@ var ( utils.HTTPPortFlag, utils.HTTPCORSDomainFlag, utils.HTTPVirtualHostsFlag, - utils.RPCLegacyEnabledFlag, - utils.RPCLegacyListenAddrFlag, - utils.RPCLegacyPortFlag, - utils.RPCLegacyCORSDomainFlag, - utils.RPCLegacyVirtualHostsFlag, + utils.LegacyRPCEnabledFlag, + utils.LegacyRPCListenAddrFlag, + utils.LegacyRPCPortFlag, + utils.LegacyRPCCORSDomainFlag, + utils.LegacyRPCVirtualHostsFlag, utils.GraphQLEnabledFlag, utils.GraphQLListenAddrFlag, utils.GraphQLPortFlag, utils.GraphQLCORSDomainFlag, utils.GraphQLVirtualHostsFlag, utils.HTTPApiFlag, - utils.RPCLegacyApiFlag, + utils.LegacyRPCApiFlag, utils.WSEnabledFlag, utils.WSListenAddrFlag, - utils.WSLegacyListenAddrFlag, + utils.LegacyWSListenAddrFlag, utils.WSPortFlag, - utils.WSLegacyPortFlag, + utils.LegacyWSPortFlag, utils.WSApiFlag, - utils.WSLegacyApiFlag, + utils.LegacyWSApiFlag, utils.WSAllowedOriginsFlag, - utils.WSLegacyAllowedOriginsFlag, + utils.LegacyWSAllowedOriginsFlag, utils.IPCDisabledFlag, utils.IPCPathFlag, utils.InsecureUnlockAllowedFlag, @@ -374,7 +374,7 @@ func startNode(ctx *cli.Context, stack *node.Node) { // Set contract backend for ethereum service if local node // is serving LES requests. - if ctx.GlobalInt(utils.LightLegacyServFlag.Name) > 0 || ctx.GlobalInt(utils.LightServeFlag.Name) > 0 { + if ctx.GlobalInt(utils.LegacyLightServFlag.Name) > 0 || ctx.GlobalInt(utils.LightServeFlag.Name) > 0 { var ethService *eth.Ethereum if err := stack.Service(ðService); err != nil { utils.Fatalf("Failed to retrieve ethereum service: %v", err) @@ -460,16 +460,16 @@ func startNode(ctx *cli.Context, stack *node.Node) { } // Set the gas price to the limits from the CLI and start mining var gasprice *big.Int - if ctx.IsSet(utils.MinerLegacyGasPriceFlag.Name) { - gasprice = utils.GlobalBig(ctx, utils.MinerLegacyGasPriceFlag.Name) + if ctx.IsSet(utils.LegacyMinerGasPriceFlag.Name) { + gasprice = utils.GlobalBig(ctx, utils.LegacyMinerGasPriceFlag.Name) log.Warn("The flag --gasprice is deprecated and will be removed in the future, please use --miner.gasprice") } gasprice = utils.GlobalBig(ctx, utils.MinerGasPriceFlag.Name) ethereum.TxPool().SetGasPrice(gasprice) var threads int - if ctx.GlobalIsSet(utils.MinerLegacyThreadsFlag.Name) { - threads = ctx.GlobalInt(utils.MinerLegacyThreadsFlag.Name) + if ctx.GlobalIsSet(utils.LegacyMinerThreadsFlag.Name) { + threads = ctx.GlobalInt(utils.LegacyMinerThreadsFlag.Name) log.Warn("The flag --minerthreads is deprecated and will be removed in the future, please use --miner.threads") } threads = ctx.GlobalInt(utils.MinerThreadsFlag.Name) diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go index 51870a91ec..30f65e1fb7 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -244,20 +244,25 @@ var AppHelpFlagGroups = []flagGroup{ }, { Name: "ALIASED (deprecated)", - Flags: append([]cli.Flag{ - utils.RPCLegacyEnabledFlag, - utils.RPCLegacyListenAddrFlag, - utils.RPCLegacyPortFlag, - utils.RPCLegacyCORSDomainFlag, - utils.RPCLegacyVirtualHostsFlag, - utils.RPCLegacyApiFlag, - utils.WSLegacyListenAddrFlag, - utils.WSLegacyPortFlag, - utils.WSLegacyAllowedOriginsFlag, - utils.WSLegacyApiFlag, - utils.GpoLegacyBlocksFlag, - utils.GpoLegacyPercentileFlag, - }, debug.DeprecatedFlags...), + Flags: []cli.Flag{ + utils.LegacyRPCEnabledFlag, + utils.LegacyRPCListenAddrFlag, + utils.LegacyRPCPortFlag, + utils.LegacyRPCCORSDomainFlag, + utils.LegacyRPCVirtualHostsFlag, + utils.LegacyRPCApiFlag, + utils.LegacyWSListenAddrFlag, + utils.LegacyWSPortFlag, + utils.LegacyWSAllowedOriginsFlag, + utils.LegacyWSApiFlag, + utils.LegacyGpoBlocksFlag, + utils.LegacyGpoPercentileFlag, + utils.LegacyPprofAddrFlag, + utils.LegacyPprofPortFlag, + utils.LegacyMemprofilerateFlag, + utils.LegacyBlockprofilerateFlag, + utils.LegacyCpuprofileFlag, + }, }, { Name: "MISC", diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 3ddd920ba9..bf0c5d33c8 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -886,10 +886,10 @@ func splitAndTrim(input string) []string { // setHTTP creates the HTTP RPC listener interface string from the set // command line flags, returning empty if the HTTP endpoint is disabled. func setHTTP(ctx *cli.Context, cfg *node.Config) { - if ctx.GlobalBool(RPCLegacyEnabledFlag.Name) && cfg.HTTPHost == "" { + if ctx.GlobalBool(LegacyRPCEnabledFlag.Name) && cfg.HTTPHost == "" { cfg.HTTPHost = "127.0.0.1" - if ctx.GlobalIsSet(RPCLegacyListenAddrFlag.Name) { - cfg.HTTPHost = ctx.GlobalString(RPCLegacyListenAddrFlag.Name) + if ctx.GlobalIsSet(LegacyRPCListenAddrFlag.Name) { + cfg.HTTPHost = ctx.GlobalString(LegacyRPCListenAddrFlag.Name) log.Warn("The flag --rpcaddr is deprecated and will be removed in the future, please use --http.addr") } } @@ -900,32 +900,32 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) { } } - if ctx.GlobalIsSet(RPCLegacyPortFlag.Name) { - cfg.HTTPPort = ctx.GlobalInt(RPCLegacyPortFlag.Name) + if ctx.GlobalIsSet(LegacyRPCPortFlag.Name) { + cfg.HTTPPort = ctx.GlobalInt(LegacyRPCPortFlag.Name) log.Warn("The flag --rpcport is deprecated and will be removed in the future, please use --http.port") } if ctx.GlobalIsSet(HTTPPortFlag.Name) { cfg.HTTPPort = ctx.GlobalInt(HTTPPortFlag.Name) } - if ctx.GlobalIsSet(RPCLegacyCORSDomainFlag.Name) { - cfg.HTTPCors = splitAndTrim(ctx.GlobalString(RPCLegacyCORSDomainFlag.Name)) + if ctx.GlobalIsSet(LegacyRPCCORSDomainFlag.Name) { + cfg.HTTPCors = splitAndTrim(ctx.GlobalString(LegacyRPCCORSDomainFlag.Name)) log.Warn("The flag --rpccorsdomain is deprecated and will be removed in the future, please use --http.corsdomain") } if ctx.GlobalIsSet(HTTPCORSDomainFlag.Name) { cfg.HTTPCors = splitAndTrim(ctx.GlobalString(HTTPCORSDomainFlag.Name)) } - if ctx.GlobalIsSet(RPCLegacyApiFlag.Name) { - cfg.HTTPModules = splitAndTrim(ctx.GlobalString(RPCLegacyApiFlag.Name)) + if ctx.GlobalIsSet(LegacyRPCApiFlag.Name) { + cfg.HTTPModules = splitAndTrim(ctx.GlobalString(LegacyRPCApiFlag.Name)) log.Warn("The flag --rpcapi is deprecated and will be removed in the future, please use --http.api") } if ctx.GlobalIsSet(HTTPApiFlag.Name) { cfg.HTTPModules = splitAndTrim(ctx.GlobalString(HTTPApiFlag.Name)) } - if ctx.GlobalIsSet(RPCLegacyVirtualHostsFlag.Name) { - cfg.HTTPVirtualHosts = splitAndTrim(ctx.GlobalString(RPCLegacyVirtualHostsFlag.Name)) + if ctx.GlobalIsSet(LegacyRPCVirtualHostsFlag.Name) { + cfg.HTTPVirtualHosts = splitAndTrim(ctx.GlobalString(LegacyRPCVirtualHostsFlag.Name)) log.Warn("The flag --rpcvhosts is deprecated and will be removed in the future, please use --http.vhosts") } if ctx.GlobalIsSet(HTTPVirtualHostsFlag.Name) { @@ -956,32 +956,32 @@ func setGraphQL(ctx *cli.Context, cfg *node.Config) { func setWS(ctx *cli.Context, cfg *node.Config) { if ctx.GlobalBool(WSEnabledFlag.Name) && cfg.WSHost == "" { cfg.WSHost = "127.0.0.1" - if ctx.GlobalIsSet(WSLegacyListenAddrFlag.Name) { - cfg.WSHost = ctx.GlobalString(WSLegacyListenAddrFlag.Name) + if ctx.GlobalIsSet(LegacyWSListenAddrFlag.Name) { + cfg.WSHost = ctx.GlobalString(LegacyWSListenAddrFlag.Name) log.Warn("The flag --wsaddr is deprecated and will be removed in the future, please use --ws.addr") } if ctx.GlobalIsSet(WSListenAddrFlag.Name) { cfg.WSHost = ctx.GlobalString(WSListenAddrFlag.Name) } } - if ctx.GlobalIsSet(WSLegacyPortFlag.Name) { - cfg.WSPort = ctx.GlobalInt(WSLegacyPortFlag.Name) + if ctx.GlobalIsSet(LegacyWSPortFlag.Name) { + cfg.WSPort = ctx.GlobalInt(LegacyWSPortFlag.Name) log.Warn("The flag --wsport is deprecated and will be removed in the future, please use --ws.port") } if ctx.GlobalIsSet(WSPortFlag.Name) { cfg.WSPort = ctx.GlobalInt(WSPortFlag.Name) } - if ctx.GlobalIsSet(WSLegacyAllowedOriginsFlag.Name) { - cfg.WSOrigins = splitAndTrim(ctx.GlobalString(WSLegacyAllowedOriginsFlag.Name)) + if ctx.GlobalIsSet(LegacyWSAllowedOriginsFlag.Name) { + cfg.WSOrigins = splitAndTrim(ctx.GlobalString(LegacyWSAllowedOriginsFlag.Name)) log.Warn("The flag --wsorigins is deprecated and will be removed in the future, please use --ws.origins") } if ctx.GlobalIsSet(WSAllowedOriginsFlag.Name) { cfg.WSOrigins = splitAndTrim(ctx.GlobalString(WSAllowedOriginsFlag.Name)) } - if ctx.GlobalIsSet(WSLegacyApiFlag.Name) { - cfg.WSModules = splitAndTrim(ctx.GlobalString(WSLegacyApiFlag.Name)) + if ctx.GlobalIsSet(LegacyWSApiFlag.Name) { + cfg.WSModules = splitAndTrim(ctx.GlobalString(LegacyWSApiFlag.Name)) log.Warn("The flag --wsapi is deprecated and will be removed in the future, please use --ws.api") } if ctx.GlobalIsSet(WSApiFlag.Name) { @@ -1003,8 +1003,8 @@ func setIPC(ctx *cli.Context, cfg *node.Config) { // setLes configures the les server and ultra light client settings from the command line flags. func setLes(ctx *cli.Context, cfg *eth.Config) { - if ctx.GlobalIsSet(LightLegacyServFlag.Name) { - cfg.LightServ = ctx.GlobalInt(LightLegacyServFlag.Name) + if ctx.GlobalIsSet(LegacyLightServFlag.Name) { + cfg.LightServ = ctx.GlobalInt(LegacyLightServFlag.Name) log.Warn("The flag --lightserv is deprecated and will be removed in the future, please use --light.serve") } if ctx.GlobalIsSet(LightServeFlag.Name) { @@ -1016,8 +1016,8 @@ func setLes(ctx *cli.Context, cfg *eth.Config) { if ctx.GlobalIsSet(LightEgressFlag.Name) { cfg.LightEgress = ctx.GlobalInt(LightEgressFlag.Name) } - if ctx.GlobalIsSet(LightLegacyPeersFlag.Name) { - cfg.LightPeers = ctx.GlobalInt(LightLegacyPeersFlag.Name) + if ctx.GlobalIsSet(LegacyLightPeersFlag.Name) { + cfg.LightPeers = ctx.GlobalInt(LegacyLightPeersFlag.Name) log.Warn("The flag --lightpeers is deprecated and will be removed in the future, please use --light.maxpeers") } if ctx.GlobalIsSet(LightMaxPeersFlag.Name) { @@ -1082,8 +1082,8 @@ func MakeAddress(ks *keystore.KeyStore, account string) (accounts.Account, error func setEtherbase(ctx *cli.Context, ks *keystore.KeyStore, cfg *eth.Config) { // Extract the current etherbase, new flag overriding legacy one var etherbase string - if ctx.GlobalIsSet(MinerLegacyEtherbaseFlag.Name) { - etherbase = ctx.GlobalString(MinerLegacyEtherbaseFlag.Name) + if ctx.GlobalIsSet(LegacyMinerEtherbaseFlag.Name) { + etherbase = ctx.GlobalString(LegacyMinerEtherbaseFlag.Name) log.Warn("The flag --etherbase is deprecated and will be removed in the future, please use --miner.etherbase") } @@ -1130,27 +1130,27 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) { setBootstrapNodesV5(ctx, cfg) lightClient := ctx.GlobalString(SyncModeFlag.Name) == "light" - lightServer := (ctx.GlobalInt(LightLegacyServFlag.Name) != 0 || ctx.GlobalInt(LightServeFlag.Name) != 0) + lightServer := (ctx.GlobalInt(LegacyLightServFlag.Name) != 0 || ctx.GlobalInt(LightServeFlag.Name) != 0) - lightPeers := ctx.GlobalInt(LightLegacyPeersFlag.Name) + lightPeers := ctx.GlobalInt(LegacyLightPeersFlag.Name) if ctx.GlobalIsSet(LightMaxPeersFlag.Name) { lightPeers = ctx.GlobalInt(LightMaxPeersFlag.Name) } - if lightClient && !ctx.GlobalIsSet(LightLegacyPeersFlag.Name) && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) { + if lightClient && !ctx.GlobalIsSet(LegacyLightPeersFlag.Name) && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) { // dynamic default - for clients we use 1/10th of the default for servers lightPeers /= 10 } if ctx.GlobalIsSet(MaxPeersFlag.Name) { cfg.MaxPeers = ctx.GlobalInt(MaxPeersFlag.Name) - if lightServer && !ctx.GlobalIsSet(LightLegacyPeersFlag.Name) && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) { + if lightServer && !ctx.GlobalIsSet(LegacyLightPeersFlag.Name) && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) { cfg.MaxPeers += lightPeers } } else { if lightServer { cfg.MaxPeers += lightPeers } - if lightClient && (ctx.GlobalIsSet(LightLegacyPeersFlag.Name) || ctx.GlobalIsSet(LightMaxPeersFlag.Name)) && cfg.MaxPeers < lightPeers { + if lightClient && (ctx.GlobalIsSet(LegacyLightPeersFlag.Name) || ctx.GlobalIsSet(LightMaxPeersFlag.Name)) && cfg.MaxPeers < lightPeers { cfg.MaxPeers = lightPeers } } @@ -1270,16 +1270,16 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) { } func setGPO(ctx *cli.Context, cfg *gasprice.Config) { - if ctx.GlobalIsSet(GpoLegacyBlocksFlag.Name) { - cfg.Blocks = ctx.GlobalInt(GpoLegacyBlocksFlag.Name) + if ctx.GlobalIsSet(LegacyGpoBlocksFlag.Name) { + cfg.Blocks = ctx.GlobalInt(LegacyGpoBlocksFlag.Name) log.Warn("The flag --gpoblocks is deprecated and will be removed in the future, please use --gpo.blocks") } if ctx.GlobalIsSet(GpoBlocksFlag.Name) { cfg.Blocks = ctx.GlobalInt(GpoBlocksFlag.Name) } - if ctx.GlobalIsSet(GpoLegacyPercentileFlag.Name) { - cfg.Percentile = ctx.GlobalInt(GpoLegacyPercentileFlag.Name) + if ctx.GlobalIsSet(LegacyGpoPercentileFlag.Name) { + cfg.Percentile = ctx.GlobalInt(LegacyGpoPercentileFlag.Name) log.Warn("The flag --gpopercentile is deprecated and will be removed in the future, please use --gpo.percentile") } if ctx.GlobalIsSet(GpoPercentileFlag.Name) { @@ -1361,15 +1361,15 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) { if ctx.GlobalIsSet(MinerNotifyFlag.Name) { cfg.Notify = strings.Split(ctx.GlobalString(MinerNotifyFlag.Name), ",") } - if ctx.GlobalIsSet(MinerLegacyExtraDataFlag.Name) { - cfg.ExtraData = []byte(ctx.GlobalString(MinerLegacyExtraDataFlag.Name)) + if ctx.GlobalIsSet(LegacyMinerExtraDataFlag.Name) { + cfg.ExtraData = []byte(ctx.GlobalString(LegacyMinerExtraDataFlag.Name)) log.Warn("The flag --extradata is deprecated and will be removed in the future, please use --miner.extradata") } if ctx.GlobalIsSet(MinerExtraDataFlag.Name) { cfg.ExtraData = []byte(ctx.GlobalString(MinerExtraDataFlag.Name)) } - if ctx.GlobalIsSet(MinerLegacyGasTargetFlag.Name) { - cfg.GasFloor = ctx.GlobalUint64(MinerLegacyGasTargetFlag.Name) + if ctx.GlobalIsSet(LegacyMinerGasTargetFlag.Name) { + cfg.GasFloor = ctx.GlobalUint64(LegacyMinerGasTargetFlag.Name) log.Warn("The flag --targetgaslimit is deprecated and will be removed in the future, please use --miner.gastarget") } if ctx.GlobalIsSet(MinerGasTargetFlag.Name) { @@ -1378,8 +1378,8 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) { if ctx.GlobalIsSet(MinerGasLimitFlag.Name) { cfg.GasCeil = ctx.GlobalUint64(MinerGasLimitFlag.Name) } - if ctx.GlobalIsSet(MinerLegacyGasPriceFlag.Name) { - cfg.GasPrice = GlobalBig(ctx, MinerLegacyGasPriceFlag.Name) + if ctx.GlobalIsSet(LegacyMinerGasPriceFlag.Name) { + cfg.GasPrice = GlobalBig(ctx, LegacyMinerGasPriceFlag.Name) log.Warn("The flag --gasprice is deprecated and will be removed in the future, please use --miner.gasprice") } if ctx.GlobalIsSet(MinerGasPriceFlag.Name) { @@ -1474,7 +1474,7 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) { func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { // Avoid conflicting network flags CheckExclusive(ctx, DeveloperFlag, LegacyTestnetFlag, RopstenFlag, RinkebyFlag, GoerliFlag) - CheckExclusive(ctx, LightLegacyServFlag, LightServeFlag, SyncModeFlag, "light") + CheckExclusive(ctx, LegacyLightServFlag, LightServeFlag, SyncModeFlag, "light") CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer var ks *keystore.KeyStore @@ -1594,7 +1594,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { log.Info("Using developer account", "address", developer.Address) cfg.Genesis = core.DeveloperGenesisBlock(uint64(ctx.GlobalInt(DeveloperPeriodFlag.Name)), developer.Address) - if !ctx.GlobalIsSet(MinerGasPriceFlag.Name) && !ctx.GlobalIsSet(MinerLegacyGasPriceFlag.Name) { + if !ctx.GlobalIsSet(MinerGasPriceFlag.Name) && !ctx.GlobalIsSet(LegacyMinerGasPriceFlag.Name) { cfg.Miner.GasPrice = big.NewInt(1) } default: diff --git a/cmd/utils/flags_legacy.go b/cmd/utils/flags_legacy.go index 47fe99a757..39170cfba0 100644 --- a/cmd/utils/flags_legacy.go +++ b/cmd/utils/flags_legacy.go @@ -21,6 +21,7 @@ import ( "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/node" "gopkg.in/urfave/cli.v1" + "runtime" "strings" ) @@ -31,13 +32,13 @@ var ( Usage: "Show flags that have been deprecated", Flags: []cli.Flag{ LegacyTestnetFlag, - LightLegacyServFlag, - LightLegacyPeersFlag, - MinerLegacyThreadsFlag, - MinerLegacyGasTargetFlag, - MinerLegacyGasPriceFlag, - MinerLegacyEtherbaseFlag, - MinerLegacyExtraDataFlag, + LegacyLightServFlag, + LegacyLightPeersFlag, + LegacyMinerThreadsFlag, + LegacyMinerGasTargetFlag, + LegacyMinerGasPriceFlag, + LegacyMinerEtherbaseFlag, + LegacyMinerExtraDataFlag, }, Description: "Show flags that have been deprecated and will soon be removed", } @@ -45,99 +46,122 @@ var ( Name: "testnet", Usage: "Pre-configured test network (Deprecated: Please choose one of --goerli, --rinkeby, or --ropsten.)", } - LightLegacyServFlag = cli.IntFlag{ // Deprecated in favor of light.serve, remove in 2021 + LegacyLightServFlag = cli.IntFlag{ // Deprecated in favor of light.serve, remove in 2021 Name: "lightserv", Usage: "Maximum percentage of time allowed for serving LES requests (deprecated, use --light.serve)", Value: eth.DefaultConfig.LightServ, } - LightLegacyPeersFlag = cli.IntFlag{ // Deprecated in favor of light.maxpeers, remove in 2021 + LegacyLightPeersFlag = cli.IntFlag{ // Deprecated in favor of light.maxpeers, remove in 2021 Name: "lightpeers", Usage: "Maximum number of light clients to serve, or light servers to attach to (deprecated, use --light.maxpeers)", Value: eth.DefaultConfig.LightPeers, } - MinerLegacyThreadsFlag = cli.IntFlag{ + LegacyMinerThreadsFlag = cli.IntFlag{ Name: "minerthreads", Usage: "Number of CPU threads to use for mining (deprecated, use --miner.threads)", Value: 0, } - MinerLegacyGasTargetFlag = cli.Uint64Flag{ + LegacyMinerGasTargetFlag = cli.Uint64Flag{ Name: "targetgaslimit", Usage: "Target gas floor for mined blocks (deprecated, use --miner.gastarget)", Value: eth.DefaultConfig.Miner.GasFloor, } - MinerLegacyGasPriceFlag = BigFlag{ + LegacyMinerGasPriceFlag = BigFlag{ Name: "gasprice", Usage: "Minimum gas price for mining a transaction (deprecated, use --miner.gasprice)", Value: eth.DefaultConfig.Miner.GasPrice, } - MinerLegacyEtherbaseFlag = cli.StringFlag{ + LegacyMinerEtherbaseFlag = cli.StringFlag{ Name: "etherbase", Usage: "Public address for block mining rewards (default = first account, deprecated, use --miner.etherbase)", Value: "0", } - MinerLegacyExtraDataFlag = cli.StringFlag{ + LegacyMinerExtraDataFlag = cli.StringFlag{ Name: "extradata", Usage: "Block extra data set by the miner (default = client version, deprecated, use --miner.extradata)", } - RPCLegacyEnabledFlag = cli.BoolFlag{ + LegacyRPCEnabledFlag = cli.BoolFlag{ Name: "rpc", Usage: "Enable the HTTP-RPC server (deprecated, use --http)", } - RPCLegacyListenAddrFlag = cli.StringFlag{ + LegacyRPCListenAddrFlag = cli.StringFlag{ Name: "rpcaddr", Usage: "HTTP-RPC server listening interface (deprecated, use --http.addr)", Value: node.DefaultHTTPHost, } - RPCLegacyPortFlag = cli.IntFlag{ + LegacyRPCPortFlag = cli.IntFlag{ Name: "rpcport", Usage: "HTTP-RPC server listening port (deprecated, use --http.port)", Value: node.DefaultHTTPPort, } - RPCLegacyCORSDomainFlag = cli.StringFlag{ + LegacyRPCCORSDomainFlag = cli.StringFlag{ Name: "rpccorsdomain", Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced) (deprecated, use --http.corsdomain)", Value: "", } - RPCLegacyVirtualHostsFlag = cli.StringFlag{ + LegacyRPCVirtualHostsFlag = cli.StringFlag{ Name: "rpcvhosts", Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (deprecated, use --http.vhosts)", Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","), } - RPCLegacyApiFlag = cli.StringFlag{ + LegacyRPCApiFlag = cli.StringFlag{ Name: "rpcapi", Usage: "API's offered over the HTTP-RPC interface (deprecated, use --http.api)", Value: "", } - WSLegacyListenAddrFlag = cli.StringFlag{ + LegacyWSListenAddrFlag = cli.StringFlag{ Name: "wsaddr", Usage: "WS-RPC server listening interface (deprecated, use --ws.addr)", Value: node.DefaultWSHost, } - WSLegacyPortFlag = cli.IntFlag{ + LegacyWSPortFlag = cli.IntFlag{ Name: "wsport", Usage: "WS-RPC server listening port (deprecated, use --ws.port)", Value: node.DefaultWSPort, } - WSLegacyApiFlag = cli.StringFlag{ + LegacyWSApiFlag = cli.StringFlag{ Name: "wsapi", Usage: "API's offered over the WS-RPC interface (deprecated, use --ws.api)", Value: "", } - WSLegacyAllowedOriginsFlag = cli.StringFlag{ + LegacyWSAllowedOriginsFlag = cli.StringFlag{ Name: "wsorigins", Usage: "Origins from which to accept websockets requests (deprecated, use --ws.origins)", Value: "", } - GpoLegacyBlocksFlag = cli.IntFlag{ + LegacyGpoBlocksFlag = cli.IntFlag{ Name: "gpoblocks", Usage: "Number of recent blocks to check for gas prices (deprecated, use --gpo.blocks)", Value: eth.DefaultConfig.GPO.Blocks, } - GpoLegacyPercentileFlag = cli.IntFlag{ + LegacyGpoPercentileFlag = cli.IntFlag{ Name: "gpopercentile", Usage: "Suggested gas price is the given percentile of a set of recent transaction gas prices (deprecated, use --gpo.percentile)", Value: eth.DefaultConfig.GPO.Percentile, } + LegacyPprofPortFlag = cli.IntFlag{ + Name: "pprofport", + Usage: "pprof HTTP server listening port (deprecated, use --pprof.port)", + Value: 6060, + } + LegacyPprofAddrFlag = cli.StringFlag{ + Name: "pprofaddr", + Usage: "pprof HTTP server listening interface (deprecated, use --pprof.addr)", + Value: "127.0.0.1", + } + LegacyMemprofilerateFlag = cli.IntFlag{ + Name: "memprofilerate", + Usage: "Turn on memory profiling with the given rate (deprecated, use --pprof.memprofilerate)", + Value: runtime.MemProfileRate, + } + LegacyBlockprofilerateFlag = cli.IntFlag{ + Name: "blockprofilerate", + Usage: "Turn on block profiling with the given rate (deprecated, use --pprof.blockprofilerate)", + } + LegacyCpuprofileFlag = cli.StringFlag{ + Name: "cpuprofile", + Usage: "Write CPU profile to the given file (deprecated, use --pprof.cpuprofile)", + } ) func showDeprecated(c *cli.Context) { diff --git a/internal/debug/flags.go b/internal/debug/flags.go index 948229e556..b350d0ca06 100644 --- a/internal/debug/flags.go +++ b/internal/debug/flags.go @@ -18,6 +18,7 @@ package debug import ( "fmt" + "github.com/ethereum/go-ethereum/cmd/utils" "io" "net/http" _ "net/http/pprof" @@ -64,47 +65,24 @@ var ( Usage: "pprof HTTP server listening port", Value: 6060, } - pprofLegacyPortFlag = cli.IntFlag{ - Name: "pprofport", - Usage: "pprof HTTP server listening port (deprecated, use --pprof.port)", - Value: 6060, - } pprofAddrFlag = cli.StringFlag{ Name: "pprof.addr", Usage: "pprof HTTP server listening interface", Value: "127.0.0.1", } - pprofLegacyAddrFlag = cli.StringFlag{ - Name: "pprofaddr", - Usage: "pprof HTTP server listening interface (deprecated, use --pprof.addr)", - Value: "127.0.0.1", - } memprofilerateFlag = cli.IntFlag{ Name: "pprof.memprofilerate", Usage: "Turn on memory profiling with the given rate", Value: runtime.MemProfileRate, } - memprofilerateLegacyFlag = cli.IntFlag{ - Name: "memprofilerate", - Usage: "Turn on memory profiling with the given rate (deprecated, use --pprof.memprofilerate)", - Value: runtime.MemProfileRate, - } blockprofilerateFlag = cli.IntFlag{ Name: "pprof.blockprofilerate", Usage: "Turn on block profiling with the given rate", } - blockprofilerateLegacyFlag = cli.IntFlag{ - Name: "blockprofilerate", - Usage: "Turn on block profiling with the given rate (deprecated, use --pprof.blockprofilerate)", - } cpuprofileFlag = cli.StringFlag{ Name: "pprof.cpuprofile", Usage: "Write CPU profile to the given file", } - cpuprofileLegacyFlag = cli.StringFlag{ - Name: "cpuprofile", - Usage: "Write CPU profile to the given file (deprecated, use --pprof.cpuprofile)", - } traceFlag = cli.StringFlag{ Name: "trace", Usage: "Write execution trace to the given file", @@ -117,10 +95,6 @@ var Flags = []cli.Flag{ pprofFlag, pprofAddrFlag, pprofPortFlag, memprofilerateFlag, blockprofilerateFlag, cpuprofileFlag, traceFlag, } -var DeprecatedFlags = []cli.Flag{ - pprofLegacyAddrFlag, pprofLegacyPortFlag, memprofilerateLegacyFlag, - blockprofilerateLegacyFlag, cpuprofileLegacyFlag, -} var ( ostream log.Handler @@ -148,14 +122,14 @@ func Setup(ctx *cli.Context) error { log.Root().SetHandler(glogger) // profiling, tracing - if ctx.GlobalIsSet(memprofilerateLegacyFlag.Name) { - runtime.MemProfileRate = ctx.GlobalInt(memprofilerateLegacyFlag.Name) + if ctx.GlobalIsSet(utils.LegacyMemprofilerateFlag.Name) { + runtime.MemProfileRate = ctx.GlobalInt(utils.LegacyMemprofilerateFlag.Name) log.Warn("The flag --memprofilerate is deprecated and will be removed in the future, please use --pprof.memprofilerate") } runtime.MemProfileRate = ctx.GlobalInt(memprofilerateFlag.Name) - if ctx.GlobalIsSet(blockprofilerateLegacyFlag.Name) { - Handler.SetBlockProfileRate(ctx.GlobalInt(blockprofilerateLegacyFlag.Name)) + if ctx.GlobalIsSet(utils.LegacyBlockprofilerateFlag.Name) { + Handler.SetBlockProfileRate(ctx.GlobalInt(utils.LegacyBlockprofilerateFlag.Name)) log.Warn("The flag --blockprofilerate is deprecated and will be removed in the future, please use --pprof.blockprofilerate") } Handler.SetBlockProfileRate(ctx.GlobalInt(blockprofilerateFlag.Name)) @@ -171,7 +145,7 @@ func Setup(ctx *cli.Context) error { return err } } - if cpuFile := ctx.GlobalString(cpuprofileLegacyFlag.Name); cpuFile != "" { + if cpuFile := ctx.GlobalString(utils.LegacyCpuprofileFlag.Name); cpuFile != "" { log.Warn("The flag --cpuprofile is deprecated and will be removed in the future, please use --pprof.cpuprofile") if err := Handler.StartCPUProfile(cpuFile); err != nil { return err @@ -181,14 +155,14 @@ func Setup(ctx *cli.Context) error { // pprof server if ctx.GlobalBool(pprofFlag.Name) { listenHost := ctx.GlobalString(pprofAddrFlag.Name) - if ctx.GlobalIsSet(pprofLegacyAddrFlag.Name) && !ctx.GlobalIsSet(pprofAddrFlag.Name) { - listenHost = ctx.GlobalString(pprofLegacyAddrFlag.Name) + if ctx.GlobalIsSet(utils.LegacyPprofAddrFlag.Name) && !ctx.GlobalIsSet(pprofAddrFlag.Name) { + listenHost = ctx.GlobalString(utils.LegacyPprofAddrFlag.Name) log.Warn("The flag --pprofaddr is deprecated and will be removed in the future, please use --pprof.addr") } port := ctx.GlobalInt(pprofPortFlag.Name) - if ctx.GlobalIsSet(pprofLegacyPortFlag.Name) && !ctx.GlobalIsSet(pprofPortFlag.Name) { - port = ctx.GlobalInt(pprofLegacyPortFlag.Name) + if ctx.GlobalIsSet(utils.LegacyPprofPortFlag.Name) && !ctx.GlobalIsSet(pprofPortFlag.Name) { + port = ctx.GlobalInt(utils.LegacyPprofPortFlag.Name) log.Warn("The flag --pprofport is deprecated and will be removed in the future, please use --pprof.port") }