github.com/ethereum/go-ethereum@v1.14.4-0.20240516095835-473ee8fc07a3/cmd/utils/flags_legacy.go (about)

     1  // Copyright 2020 The go-ethereum Authors
     2  // This file is part of go-ethereum.
     3  //
     4  // go-ethereum is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // go-ethereum is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU General Public License
    15  // along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package utils
    18  
    19  import (
    20  	"fmt"
    21  
    22  	"github.com/ethereum/go-ethereum/eth/ethconfig"
    23  	"github.com/ethereum/go-ethereum/internal/flags"
    24  	"github.com/urfave/cli/v2"
    25  )
    26  
    27  var ShowDeprecated = &cli.Command{
    28  	Action:      showDeprecated,
    29  	Name:        "show-deprecated-flags",
    30  	Usage:       "Show flags that have been deprecated",
    31  	ArgsUsage:   " ",
    32  	Description: "Show flags that have been deprecated and will soon be removed",
    33  }
    34  
    35  var DeprecatedFlags = []cli.Flag{
    36  	NoUSBFlag,
    37  	LegacyWhitelistFlag,
    38  	CacheTrieJournalFlag,
    39  	CacheTrieRejournalFlag,
    40  	LegacyDiscoveryV5Flag,
    41  	TxLookupLimitFlag,
    42  	LightServeFlag,
    43  	LightIngressFlag,
    44  	LightEgressFlag,
    45  	LightMaxPeersFlag,
    46  	LightNoPruneFlag,
    47  	LightNoSyncServeFlag,
    48  	LogBacktraceAtFlag,
    49  	LogDebugFlag,
    50  	MinerNewPayloadTimeoutFlag,
    51  	MinerEtherbaseFlag,
    52  	MiningEnabledFlag,
    53  }
    54  
    55  var (
    56  	// Deprecated May 2020, shown in aliased flags section
    57  	NoUSBFlag = &cli.BoolFlag{
    58  		Name:     "nousb",
    59  		Usage:    "Disables monitoring for and managing USB hardware wallets (deprecated)",
    60  		Category: flags.DeprecatedCategory,
    61  	}
    62  	// Deprecated March 2022
    63  	LegacyWhitelistFlag = &cli.StringFlag{
    64  		Name:     "whitelist",
    65  		Usage:    "Comma separated block number-to-hash mappings to enforce (<number>=<hash>) (deprecated in favor of --eth.requiredblocks)",
    66  		Category: flags.DeprecatedCategory,
    67  	}
    68  	// Deprecated July 2023
    69  	CacheTrieJournalFlag = &cli.StringFlag{
    70  		Name:     "cache.trie.journal",
    71  		Usage:    "Disk journal directory for trie cache to survive node restarts",
    72  		Category: flags.DeprecatedCategory,
    73  	}
    74  	CacheTrieRejournalFlag = &cli.DurationFlag{
    75  		Name:     "cache.trie.rejournal",
    76  		Usage:    "Time interval to regenerate the trie cache journal",
    77  		Category: flags.DeprecatedCategory,
    78  	}
    79  	LegacyDiscoveryV5Flag = &cli.BoolFlag{
    80  		Name:     "v5disc",
    81  		Usage:    "Enables the experimental RLPx V5 (Topic Discovery) mechanism (deprecated, use --discv5 instead)",
    82  		Category: flags.DeprecatedCategory,
    83  	}
    84  	// Deprecated August 2023
    85  	TxLookupLimitFlag = &cli.Uint64Flag{
    86  		Name:     "txlookuplimit",
    87  		Usage:    "Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain) (deprecated, use history.transactions instead)",
    88  		Value:    ethconfig.Defaults.TransactionHistory,
    89  		Category: flags.DeprecatedCategory,
    90  	}
    91  	// Light server and client settings, Deprecated November 2023
    92  	LightServeFlag = &cli.IntFlag{
    93  		Name:     "light.serve",
    94  		Usage:    "Maximum percentage of time allowed for serving LES requests (deprecated)",
    95  		Value:    ethconfig.Defaults.LightServ,
    96  		Category: flags.DeprecatedCategory,
    97  	}
    98  	LightIngressFlag = &cli.IntFlag{
    99  		Name:     "light.ingress",
   100  		Usage:    "Incoming bandwidth limit for serving light clients (deprecated)",
   101  		Value:    ethconfig.Defaults.LightIngress,
   102  		Category: flags.DeprecatedCategory,
   103  	}
   104  	LightEgressFlag = &cli.IntFlag{
   105  		Name:     "light.egress",
   106  		Usage:    "Outgoing bandwidth limit for serving light clients (deprecated)",
   107  		Value:    ethconfig.Defaults.LightEgress,
   108  		Category: flags.DeprecatedCategory,
   109  	}
   110  	LightMaxPeersFlag = &cli.IntFlag{
   111  		Name:     "light.maxpeers",
   112  		Usage:    "Maximum number of light clients to serve, or light servers to attach to (deprecated)",
   113  		Value:    ethconfig.Defaults.LightPeers,
   114  		Category: flags.DeprecatedCategory,
   115  	}
   116  	LightNoPruneFlag = &cli.BoolFlag{
   117  		Name:     "light.nopruning",
   118  		Usage:    "Disable ancient light chain data pruning (deprecated)",
   119  		Category: flags.DeprecatedCategory,
   120  	}
   121  	LightNoSyncServeFlag = &cli.BoolFlag{
   122  		Name:     "light.nosyncserve",
   123  		Usage:    "Enables serving light clients before syncing (deprecated)",
   124  		Category: flags.DeprecatedCategory,
   125  	}
   126  	// Deprecated November 2023
   127  	LogBacktraceAtFlag = &cli.StringFlag{
   128  		Name:     "log.backtrace",
   129  		Usage:    "Request a stack trace at a specific logging statement (deprecated)",
   130  		Value:    "",
   131  		Category: flags.DeprecatedCategory,
   132  	}
   133  	LogDebugFlag = &cli.BoolFlag{
   134  		Name:     "log.debug",
   135  		Usage:    "Prepends log messages with call-site location (deprecated)",
   136  		Category: flags.DeprecatedCategory,
   137  	}
   138  	// Deprecated February 2024
   139  	MinerNewPayloadTimeoutFlag = &cli.DurationFlag{
   140  		Name:     "miner.newpayload-timeout",
   141  		Usage:    "Specify the maximum time allowance for creating a new payload (deprecated)",
   142  		Value:    ethconfig.Defaults.Miner.Recommit,
   143  		Category: flags.DeprecatedCategory,
   144  	}
   145  	MinerEtherbaseFlag = &cli.StringFlag{
   146  		Name:     "miner.etherbase",
   147  		Usage:    "0x prefixed public address for block mining rewards (deprecated)",
   148  		Category: flags.DeprecatedCategory,
   149  	}
   150  	MiningEnabledFlag = &cli.BoolFlag{
   151  		Name:     "mine",
   152  		Usage:    "Enable mining (deprecated)",
   153  		Category: flags.DeprecatedCategory,
   154  	}
   155  	MetricsEnabledExpensiveFlag = &cli.BoolFlag{
   156  		Name:     "metrics.expensive",
   157  		Usage:    "Enable expensive metrics collection and reporting (deprecated)",
   158  		Category: flags.DeprecatedCategory,
   159  	}
   160  )
   161  
   162  // showDeprecated displays deprecated flags that will be soon removed from the codebase.
   163  func showDeprecated(*cli.Context) error {
   164  	fmt.Println("--------------------------------------------------------------------")
   165  	fmt.Println("The following flags are deprecated and will be removed in the future!")
   166  	fmt.Println("--------------------------------------------------------------------")
   167  	fmt.Println()
   168  	for _, flag := range DeprecatedFlags {
   169  		fmt.Println(flag.String())
   170  	}
   171  	fmt.Println()
   172  	return nil
   173  }