Skip to content

Commit 8e547ee

Browse files
authored
cmd/utils: remove deprecated command line flags (#22263)
This removes support for all deprecated flags except --rpc*.
1 parent f54dc4a commit 8e547ee

13 files changed

Lines changed: 53 additions & 333 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,13 @@ ones either). To start a `geth` instance for mining, run it with all your usual
314314
by:
315315

316316
```shell
317-
$ geth <usual-flags> --mine --miner.threads=1 --etherbase=0x0000000000000000000000000000000000000000
317+
$ geth <usual-flags> --mine --miner.threads=1 --miner.etherbase=0x0000000000000000000000000000000000000000
318318
```
319319

320320
Which will start mining blocks and transactions on a single CPU thread, crediting all
321-
proceedings to the account specified by `--etherbase`. You can further tune the mining
322-
by changing the default gas limit blocks converge to (`--targetgaslimit`) and the price
323-
transactions are accepted at (`--gasprice`).
321+
proceedings to the account specified by `--miner.etherbase`. You can further tune the mining
322+
by changing the default gas limit blocks converge to (`--miner.targetgaslimit`) and the price
323+
transactions are accepted at (`--miner.gasprice`).
324324

325325
## Contribution
326326

‎cmd/clef/main.go‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@ var (
107107
Usage: "HTTP-RPC server listening port",
108108
Value: node.DefaultHTTPPort + 5,
109109
}
110-
legacyRPCPortFlag = cli.IntFlag{
111-
Name: "rpcport",
112-
Usage: "HTTP-RPC server listening port (Deprecated, please use --http.port).",
113-
Value: node.DefaultHTTPPort + 5,
114-
}
115110
signerSecretFlag = cli.StringFlag{
116111
Name: "signersecret",
117112
Usage: "A file containing the (encrypted) master seed to encrypt Clef data, e.g. keystore credentials and ruleset hash",
@@ -250,12 +245,6 @@ var AppHelpFlagGroups = []flags.FlagGroup{
250245
acceptFlag,
251246
},
252247
},
253-
{
254-
Name: "ALIASED (deprecated)",
255-
Flags: []cli.Flag{
256-
legacyRPCPortFlag,
257-
},
258-
},
259248
}
260249

261250
func init() {
@@ -283,7 +272,6 @@ func init() {
283272
testFlag,
284273
advancedMode,
285274
acceptFlag,
286-
legacyRPCPortFlag,
287275
}
288276
app.Action = signer
289277
app.Commands = []cli.Command{initCommand,
@@ -677,12 +665,6 @@ func signer(c *cli.Context) error {
677665

678666
// set port
679667
port := c.Int(rpcPortFlag.Name)
680-
if c.GlobalIsSet(legacyRPCPortFlag.Name) {
681-
if !c.GlobalIsSet(rpcPortFlag.Name) {
682-
port = c.Int(legacyRPCPortFlag.Name)
683-
}
684-
log.Warn("The flag --rpcport is deprecated and will be removed in the future, please use --http.port")
685-
}
686668

687669
// start http server
688670
httpEndpoint := fmt.Sprintf("%s:%d", c.GlobalString(utils.HTTPListenAddrFlag.Name), port)

‎cmd/geth/chaincmd.go‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ The export-preimages command export hash preimages to an RLP encoded stream`,
163163
utils.TxLookupLimitFlag,
164164
utils.GoerliFlag,
165165
utils.YoloV3Flag,
166-
utils.LegacyTestnetFlag,
167166
},
168167
Category: "BLOCKCHAIN COMMANDS",
169168
Description: `

‎cmd/geth/consolecmd.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func remoteConsole(ctx *cli.Context) error {
121121
path = ctx.GlobalString(utils.DataDirFlag.Name)
122122
}
123123
if path != "" {
124-
if ctx.GlobalBool(utils.LegacyTestnetFlag.Name) || ctx.GlobalBool(utils.RopstenFlag.Name) {
124+
if ctx.GlobalBool(utils.RopstenFlag.Name) {
125125
// Maintain compatibility with older Geth configurations storing the
126126
// Ropsten database in `testnet` instead of `ropsten`.
127127
legacyPath := filepath.Join(path, "testnet")

‎cmd/geth/consolecmd_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestConsoleWelcome(t *testing.T) {
5353
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
5454

5555
// Start a geth console, make sure it's cleaned up and terminate the console
56-
geth := runMinimalGeth(t, "--etherbase", coinbase, "console")
56+
geth := runMinimalGeth(t, "--miner.etherbase", coinbase, "console")
5757

5858
// Gather all the infos the welcome message needs to contain
5959
geth.SetTemplateFunc("goos", func() string { return runtime.GOOS })
@@ -100,7 +100,7 @@ func TestAttachWelcome(t *testing.T) {
100100
p := trulyRandInt(1024, 65533) // Yeah, sometimes this will fail, sorry :P
101101
httpPort = strconv.Itoa(p)
102102
wsPort = strconv.Itoa(p + 1)
103-
geth := runMinimalGeth(t, "--etherbase", "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182",
103+
geth := runMinimalGeth(t, "--miner.etherbase", "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182",
104104
"--ipcpath", ipc,
105105
"--http", "--http.port", httpPort,
106106
"--ws", "--ws.port", wsPort)

‎cmd/geth/main.go‎

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ var (
6161
utils.UnlockedAccountFlag,
6262
utils.PasswordFileFlag,
6363
utils.BootnodesFlag,
64-
utils.LegacyBootnodesV4Flag,
65-
utils.LegacyBootnodesV5Flag,
6664
utils.DataDirFlag,
6765
utils.AncientFlag,
6866
utils.MinFreeDiskSpaceFlag,
@@ -96,11 +94,9 @@ var (
9694
utils.SnapshotFlag,
9795
utils.TxLookupLimitFlag,
9896
utils.LightServeFlag,
99-
utils.LegacyLightServFlag,
10097
utils.LightIngressFlag,
10198
utils.LightEgressFlag,
10299
utils.LightMaxPeersFlag,
103-
utils.LegacyLightPeersFlag,
104100
utils.LightNoPruneFlag,
105101
utils.LightKDFFlag,
106102
utils.UltraLightServersFlag,
@@ -122,17 +118,12 @@ var (
122118
utils.MaxPendingPeersFlag,
123119
utils.MiningEnabledFlag,
124120
utils.MinerThreadsFlag,
125-
utils.LegacyMinerThreadsFlag,
126121
utils.MinerNotifyFlag,
127122
utils.MinerGasTargetFlag,
128-
utils.LegacyMinerGasTargetFlag,
129123
utils.MinerGasLimitFlag,
130124
utils.MinerGasPriceFlag,
131-
utils.LegacyMinerGasPriceFlag,
132125
utils.MinerEtherbaseFlag,
133-
utils.LegacyMinerEtherbaseFlag,
134126
utils.MinerExtraDataFlag,
135-
utils.LegacyMinerExtraDataFlag,
136127
utils.MinerRecommitIntervalFlag,
137128
utils.MinerNoVerfiyFlag,
138129
utils.NATFlag,
@@ -145,7 +136,6 @@ var (
145136
utils.MainnetFlag,
146137
utils.DeveloperFlag,
147138
utils.DeveloperPeriodFlag,
148-
utils.LegacyTestnetFlag,
149139
utils.RopstenFlag,
150140
utils.RinkebyFlag,
151141
utils.GoerliFlag,
@@ -158,9 +148,7 @@ var (
158148
utils.FakePoWFlag,
159149
utils.NoCompactionFlag,
160150
utils.GpoBlocksFlag,
161-
utils.LegacyGpoBlocksFlag,
162151
utils.GpoPercentileFlag,
163-
utils.LegacyGpoPercentileFlag,
164152
utils.GpoMaxGasPriceFlag,
165153
utils.EWASMInterpreterFlag,
166154
utils.EVMInterpreterFlag,
@@ -178,22 +166,18 @@ var (
178166
utils.LegacyRPCPortFlag,
179167
utils.LegacyRPCCORSDomainFlag,
180168
utils.LegacyRPCVirtualHostsFlag,
169+
utils.LegacyRPCApiFlag,
181170
utils.GraphQLEnabledFlag,
182171
utils.GraphQLCORSDomainFlag,
183172
utils.GraphQLVirtualHostsFlag,
184173
utils.HTTPApiFlag,
185174
utils.HTTPPathPrefixFlag,
186-
utils.LegacyRPCApiFlag,
187175
utils.WSEnabledFlag,
188176
utils.WSListenAddrFlag,
189-
utils.LegacyWSListenAddrFlag,
190177
utils.WSPortFlag,
191-
utils.LegacyWSPortFlag,
192178
utils.WSApiFlag,
193-
utils.LegacyWSApiFlag,
194179
utils.WSAllowedOriginsFlag,
195180
utils.WSPathPrefixFlag,
196-
utils.LegacyWSAllowedOriginsFlag,
197181
utils.IPCDisabledFlag,
198182
utils.IPCPathFlag,
199183
utils.InsecureUnlockAllowedFlag,
@@ -267,7 +251,6 @@ func init() {
267251
app.Flags = append(app.Flags, rpcFlags...)
268252
app.Flags = append(app.Flags, consoleFlags...)
269253
app.Flags = append(app.Flags, debug.Flags...)
270-
app.Flags = append(app.Flags, debug.DeprecatedFlags...)
271254
app.Flags = append(app.Flags, whisperFlags...)
272255
app.Flags = append(app.Flags, metricsFlags...)
273256

@@ -293,11 +276,6 @@ func main() {
293276
func prepare(ctx *cli.Context) {
294277
// If we're running a known preset, log it for convenience.
295278
switch {
296-
case ctx.GlobalIsSet(utils.LegacyTestnetFlag.Name):
297-
log.Info("Starting Geth on Ropsten testnet...")
298-
log.Warn("The --testnet flag is ambiguous! Please specify one of --goerli, --rinkeby, or --ropsten.")
299-
log.Warn("The generic --testnet flag is deprecated and will be removed in the future!")
300-
301279
case ctx.GlobalIsSet(utils.RopstenFlag.Name):
302280
log.Info("Starting Geth on Ropsten testnet...")
303281

@@ -316,7 +294,7 @@ func prepare(ctx *cli.Context) {
316294
// If we're a full node on mainnet without --cache specified, bump default cache allowance
317295
if ctx.GlobalString(utils.SyncModeFlag.Name) != "light" && !ctx.GlobalIsSet(utils.CacheFlag.Name) && !ctx.GlobalIsSet(utils.NetworkIdFlag.Name) {
318296
// Make sure we're not on any supported preconfigured testnet either
319-
if !ctx.GlobalIsSet(utils.LegacyTestnetFlag.Name) && !ctx.GlobalIsSet(utils.RopstenFlag.Name) && !ctx.GlobalIsSet(utils.RinkebyFlag.Name) && !ctx.GlobalIsSet(utils.GoerliFlag.Name) && !ctx.GlobalIsSet(utils.DeveloperFlag.Name) {
297+
if !ctx.GlobalIsSet(utils.RopstenFlag.Name) && !ctx.GlobalIsSet(utils.RinkebyFlag.Name) && !ctx.GlobalIsSet(utils.GoerliFlag.Name) && !ctx.GlobalIsSet(utils.DeveloperFlag.Name) {
320298
// Nope, we're really on mainnet. Bump that cache up!
321299
log.Info("Bumping default cache on mainnet", "provided", ctx.GlobalInt(utils.CacheFlag.Name), "updated", 4096)
322300
ctx.GlobalSet(utils.CacheFlag.Name, strconv.Itoa(4096))
@@ -461,19 +439,11 @@ func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend) {
461439
if !ok {
462440
utils.Fatalf("Ethereum service not running: %v", err)
463441
}
464-
465442
// Set the gas price to the limits from the CLI and start mining
466443
gasprice := utils.GlobalBig(ctx, utils.MinerGasPriceFlag.Name)
467-
if ctx.GlobalIsSet(utils.LegacyMinerGasPriceFlag.Name) && !ctx.GlobalIsSet(utils.MinerGasPriceFlag.Name) {
468-
gasprice = utils.GlobalBig(ctx, utils.LegacyMinerGasPriceFlag.Name)
469-
}
470444
ethBackend.TxPool().SetGasPrice(gasprice)
471445
// start mining
472446
threads := ctx.GlobalInt(utils.MinerThreadsFlag.Name)
473-
if ctx.GlobalIsSet(utils.LegacyMinerThreadsFlag.Name) && !ctx.GlobalIsSet(utils.MinerThreadsFlag.Name) {
474-
threads = ctx.GlobalInt(utils.LegacyMinerThreadsFlag.Name)
475-
log.Warn("The flag --minerthreads is deprecated and will be removed in the future, please use --miner.threads")
476-
}
477447
if err := ethBackend.StartMining(threads); err != nil {
478448
utils.Fatalf("Failed to start mining: %v", err)
479449
}

‎cmd/geth/run_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func runGeth(t *testing.T, args ...string) *testgeth {
7575
if i < len(args)-1 {
7676
tt.Datadir = args[i+1]
7777
}
78-
case "--etherbase":
78+
case "--miner.etherbase":
7979
if i < len(args)-1 {
8080
tt.Etherbase = args[i+1]
8181
}

‎cmd/geth/snapshot.go‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ var (
6060
utils.RopstenFlag,
6161
utils.RinkebyFlag,
6262
utils.GoerliFlag,
63-
utils.LegacyTestnetFlag,
6463
utils.CacheTrieJournalFlag,
6564
utils.BloomFilterSizeFlag,
6665
},
@@ -90,7 +89,6 @@ the trie clean cache with default directory will be deleted.
9089
utils.RopstenFlag,
9190
utils.RinkebyFlag,
9291
utils.GoerliFlag,
93-
utils.LegacyTestnetFlag,
9492
},
9593
Description: `
9694
geth snapshot verify-state <state-root>
@@ -110,7 +108,6 @@ In other words, this command does the snapshot to trie conversion.
110108
utils.RopstenFlag,
111109
utils.RinkebyFlag,
112110
utils.GoerliFlag,
113-
utils.LegacyTestnetFlag,
114111
},
115112
Description: `
116113
geth snapshot traverse-state <state-root>
@@ -132,7 +129,6 @@ It's also usable without snapshot enabled.
132129
utils.RopstenFlag,
133130
utils.RinkebyFlag,
134131
utils.GoerliFlag,
135-
utils.LegacyTestnetFlag,
136132
},
137133
Description: `
138134
geth snapshot traverse-rawstate <state-root>

‎cmd/geth/usage.go‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@ var AppHelpFlagGroups = []flags.FlagGroup{
161161
Name: "NETWORKING",
162162
Flags: []cli.Flag{
163163
utils.BootnodesFlag,
164-
utils.LegacyBootnodesV4Flag,
165-
utils.LegacyBootnodesV5Flag,
166164
utils.DNSDiscoveryFlag,
167165
utils.ListenPortFlag,
168166
utils.MaxPeersFlag,
@@ -223,23 +221,15 @@ var AppHelpFlagGroups = []flags.FlagGroup{
223221
},
224222
{
225223
Name: "ALIASED (deprecated)",
226-
Flags: append([]cli.Flag{
224+
Flags: []cli.Flag{
227225
utils.NoUSBFlag,
228226
utils.LegacyRPCEnabledFlag,
229227
utils.LegacyRPCListenAddrFlag,
230228
utils.LegacyRPCPortFlag,
231229
utils.LegacyRPCCORSDomainFlag,
232230
utils.LegacyRPCVirtualHostsFlag,
233231
utils.LegacyRPCApiFlag,
234-
utils.LegacyWSListenAddrFlag,
235-
utils.LegacyWSPortFlag,
236-
utils.LegacyWSAllowedOriginsFlag,
237-
utils.LegacyWSApiFlag,
238-
utils.LegacyGpoBlocksFlag,
239-
utils.LegacyGpoPercentileFlag,
240-
utils.LegacyGraphQLListenAddrFlag,
241-
utils.LegacyGraphQLPortFlag,
242-
}, debug.DeprecatedFlags...),
232+
},
243233
},
244234
{
245235
Name: "MISC",

‎cmd/puppeth/module_node.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func deployNode(client *sshClient, network string, bootnodes []string, config *n
9494

9595
lightFlag := ""
9696
if config.peersLight > 0 {
97-
lightFlag = fmt.Sprintf("--lightpeers=%d --lightserv=50", config.peersLight)
97+
lightFlag = fmt.Sprintf("--light.maxpeers=%d --light.serve=50", config.peersLight)
9898
}
9999
dockerfile := new(bytes.Buffer)
100100
template.Must(template.New("").Parse(nodeDockerfile)).Execute(dockerfile, map[string]interface{}{

0 commit comments

Comments
 (0)