cmd/utils: make uncategorized flags of geth categorized (#1877)

This commit is contained in:
Nathan 2023-09-18 20:07:03 +08:00 committed by GitHub
parent e379117b79
commit 9edad94115
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 103 additions and 78 deletions

@ -93,28 +93,34 @@ var (
Category: flags.EthCategory, Category: flags.EthCategory,
} }
DirectBroadcastFlag = &cli.BoolFlag{ DirectBroadcastFlag = &cli.BoolFlag{
Name: "directbroadcast", Name: "directbroadcast",
Usage: "Enable directly broadcast mined block to all peers", Usage: "Enable directly broadcast mined block to all peers",
Category: flags.EthCategory,
} }
DisableSnapProtocolFlag = &cli.BoolFlag{ DisableSnapProtocolFlag = &cli.BoolFlag{
Name: "disablesnapprotocol", Name: "disablesnapprotocol",
Usage: "Disable snap protocol", Usage: "Disable snap protocol",
Category: flags.EthCategory,
} }
EnableTrustProtocolFlag = &cli.BoolFlag{ EnableTrustProtocolFlag = &cli.BoolFlag{
Name: "enabletrustprotocol", Name: "enabletrustprotocol",
Usage: "Enable trust protocol", Usage: "Enable trust protocol",
Category: flags.FastNodeCategory,
} }
PipeCommitFlag = &cli.BoolFlag{ PipeCommitFlag = &cli.BoolFlag{
Name: "pipecommit", Name: "pipecommit",
Usage: "Enable MPT pipeline commit, it will improve syncing performance. It is an experimental feature(default is false)", Usage: "Enable MPT pipeline commit, it will improve syncing performance. It is an experimental feature(default is false)",
Category: flags.DeprecatedCategory,
} }
RangeLimitFlag = &cli.BoolFlag{ RangeLimitFlag = &cli.BoolFlag{
Name: "rangelimit", Name: "rangelimit",
Usage: "Enable 5000 blocks limit for range query", Usage: "Enable 5000 blocks limit for range query",
Category: flags.APICategory,
} }
DiffFlag = flags.DirectoryFlag{ DiffFlag = flags.DirectoryFlag{
Name: "datadir.diff", Name: "datadir.diff",
Usage: "Data directory for difflayer segments (default = inside chaindata)", Usage: "Data directory for difflayer segments (default = inside chaindata)",
Category: flags.FastNodeCategory,
} }
RemoteDBFlag = &cli.StringFlag{ RemoteDBFlag = &cli.StringFlag{
Name: "remotedb", Name: "remotedb",
@ -165,8 +171,9 @@ var (
Category: flags.EthCategory, Category: flags.EthCategory,
} }
DeveloperFlag = &cli.BoolFlag{ DeveloperFlag = &cli.BoolFlag{
Name: "dev", Name: "dev",
Usage: "Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled", Usage: "Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled",
Category: flags.DevCategory,
} }
DeveloperPeriodFlag = &cli.Uint64Flag{ DeveloperPeriodFlag = &cli.Uint64Flag{
Name: "dev.period", Name: "dev.period",
@ -268,9 +275,10 @@ var (
Category: flags.EthCategory, Category: flags.EthCategory,
} }
TriesInMemoryFlag = &cli.Uint64Flag{ TriesInMemoryFlag = &cli.Uint64Flag{
Name: "triesInMemory", Name: "triesInMemory",
Usage: "The layer of tries trees that keep in memory", Usage: "The layer of tries trees that keep in memory",
Value: 128, Value: 128,
Category: flags.PerfCategory,
} }
defaultVerifyMode = ethconfig.Defaults.TriesVerifyMode defaultVerifyMode = ethconfig.Defaults.TriesVerifyMode
TriesVerifyModeFlag = &flags.TextMarshalerFlag{ TriesVerifyModeFlag = &flags.TextMarshalerFlag{
@ -284,7 +292,8 @@ var (
"none: no merkle state root verification at all, there is no need to setup or connect remote verify node at all, "none: no merkle state root verification at all, there is no need to setup or connect remote verify node at all,
it is more light comparing to full and insecure mode, but get a very small chance that the state is not consistent it is more light comparing to full and insecure mode, but get a very small chance that the state is not consistent
with other peers."`, with other peers."`,
Value: &defaultVerifyMode, Value: &defaultVerifyMode,
Category: flags.FastNodeCategory,
} }
OverrideCancun = &cli.Uint64Flag{ OverrideCancun = &cli.Uint64Flag{
Name: "override.cancun", Name: "override.cancun",
@ -462,17 +471,20 @@ var (
Category: flags.PerfCategory, Category: flags.PerfCategory,
} }
PersistDiffFlag = &cli.BoolFlag{ PersistDiffFlag = &cli.BoolFlag{
Name: "persistdiff", Name: "persistdiff",
Usage: "Enable persistence of the diff layer", Usage: "Enable persistence of the diff layer",
Category: flags.FastNodeCategory,
} }
DiffBlockFlag = &cli.Uint64Flag{ DiffBlockFlag = &cli.Uint64Flag{
Name: "diffblock", Name: "diffblock",
Usage: "The number of blocks should be persisted in db (default = 86400)", Usage: "The number of blocks should be persisted in db (default = 86400)",
Value: uint64(86400), Value: uint64(86400),
Category: flags.FastNodeCategory,
} }
PruneAncientDataFlag = &cli.BoolFlag{ PruneAncientDataFlag = &cli.BoolFlag{
Name: "pruneancient", Name: "pruneancient",
Usage: "Prune ancient data, is an optional config and disabled by default. Only keep the latest 9w blocks' data,the older blocks' data will be permanently pruned. Notice:the geth/chaindata/ancient dir will be removed, if restart without the flag, the ancient data will start with the previous point that the oldest unpruned block number. Recommends to the user who don't care about the ancient data.", Usage: "Prune ancient data, is an optional config and disabled by default. Only keep the latest 9w blocks' data,the older blocks' data will be permanently pruned. Notice:the geth/chaindata/ancient dir will be removed, if restart without the flag, the ancient data will start with the previous point that the oldest unpruned block number. Recommends to the user who don't care about the ancient data.",
Category: flags.HistoryCategory,
} }
CacheLogSizeFlag = &cli.IntFlag{ CacheLogSizeFlag = &cli.IntFlag{
Name: "cache.blocklogs", Name: "cache.blocklogs",
@ -591,27 +603,27 @@ var (
} }
// Authenticated RPC HTTP settings // Authenticated RPC HTTP settings
AuthListenFlag = &cli.StringFlag{ AuthListenFlag = &cli.StringFlag{
Name: "authrpc.addr", Name: "authrpc.addr",
Usage: "Listening address for authenticated APIs", Usage: "Listening address for authenticated APIs",
Value: node.DefaultConfig.AuthAddr, Value: node.DefaultConfig.AuthAddr,
Category: flags.APICategory, // Category: flags.APICategory,
} }
AuthPortFlag = &cli.IntFlag{ AuthPortFlag = &cli.IntFlag{
Name: "authrpc.port", Name: "authrpc.port",
Usage: "Listening port for authenticated APIs", Usage: "Listening port for authenticated APIs",
Value: node.DefaultConfig.AuthPort, Value: node.DefaultConfig.AuthPort,
Category: flags.APICategory, // Category: flags.APICategory,
} }
AuthVirtualHostsFlag = &cli.StringFlag{ AuthVirtualHostsFlag = &cli.StringFlag{
Name: "authrpc.vhosts", Name: "authrpc.vhosts",
Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.", Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.",
Value: strings.Join(node.DefaultConfig.AuthVirtualHosts, ","), Value: strings.Join(node.DefaultConfig.AuthVirtualHosts, ","),
Category: flags.APICategory, // Category: flags.APICategory,
} }
JWTSecretFlag = &flags.DirectoryFlag{ JWTSecretFlag = &flags.DirectoryFlag{
Name: "authrpc.jwtsecret", Name: "authrpc.jwtsecret",
Usage: "Path to a JWT secret to use for authenticated RPC endpoints", Usage: "Path to a JWT secret to use for authenticated RPC endpoints",
Category: flags.APICategory, // Category: flags.APICategory,
} }
// Logging and debug settings // Logging and debug settings
@ -780,9 +792,10 @@ var (
} }
MaxPeersPerIPFlag = &cli.IntFlag{ MaxPeersPerIPFlag = &cli.IntFlag{
Name: "maxpeersperip", Name: "maxpeersperip",
Usage: "Maximum number of network peers from a single IP address, (default used if set to <= 0, which is same as MaxPeers)", Usage: "Maximum number of network peers from a single IP address, (default used if set to <= 0, which is same as MaxPeers)",
Value: node.DefaultConfig.P2P.MaxPeersPerIP, Value: node.DefaultConfig.P2P.MaxPeersPerIP,
Category: flags.NetworkingCategory,
} }
MaxPendingPeersFlag = &cli.IntFlag{ MaxPendingPeersFlag = &cli.IntFlag{
@ -1014,48 +1027,57 @@ Please note that --` + MetricsHTTPFlag.Name + ` must be set to start the server.
} }
BlockAmountReserved = &cli.Uint64Flag{ BlockAmountReserved = &cli.Uint64Flag{
Name: "block-amount-reserved", Name: "block-amount-reserved",
Usage: "Sets the expected remained amount of blocks for offline block prune", Usage: "Sets the expected remained amount of blocks for offline block prune",
Category: flags.HistoryCategory,
} }
CheckSnapshotWithMPT = &cli.BoolFlag{ CheckSnapshotWithMPT = &cli.BoolFlag{
Name: "check-snapshot-with-mpt", Name: "check-snapshot-with-mpt",
Usage: "Enable checking between snapshot and MPT ", Usage: "Enable checking between snapshot and MPT ",
Category: flags.FastNodeCategory,
} }
EnableDoubleSignMonitorFlag = &cli.BoolFlag{ EnableDoubleSignMonitorFlag = &cli.BoolFlag{
Name: "monitor.doublesign", Name: "monitor.doublesign",
Usage: "Enable double sign monitor to check whether any validator signs multiple blocks", Usage: "Enable double sign monitor to check whether any validator signs multiple blocks",
Category: flags.FastFinalityCategory,
} }
VotingEnabledFlag = &cli.BoolFlag{ VotingEnabledFlag = &cli.BoolFlag{
Name: "vote", Name: "vote",
Usage: "Enable voting when mining", Usage: "Enable voting when mining",
Category: flags.FastFinalityCategory,
} }
DisableVoteAttestationFlag = &cli.BoolFlag{ DisableVoteAttestationFlag = &cli.BoolFlag{
Name: "disablevoteattestation", Name: "disablevoteattestation",
Usage: "Disable assembling vote attestation ", Usage: "Disable assembling vote attestation ",
Category: flags.FastFinalityCategory,
} }
EnableMaliciousVoteMonitorFlag = &cli.BoolFlag{ EnableMaliciousVoteMonitorFlag = &cli.BoolFlag{
Name: "monitor.maliciousvote", Name: "monitor.maliciousvote",
Usage: "Enable malicious vote monitor to check whether any validator violates the voting rules of fast finality", Usage: "Enable malicious vote monitor to check whether any validator violates the voting rules of fast finality",
Category: flags.FastFinalityCategory,
} }
BLSPasswordFileFlag = &cli.StringFlag{ BLSPasswordFileFlag = &cli.StringFlag{
Name: "blspassword", Name: "blspassword",
Usage: "File path for the BLS password, which contains the password to unlock BLS wallet for managing votes in fast_finality feature", Usage: "File path for the BLS password, which contains the password to unlock BLS wallet for managing votes in fast_finality feature",
Category: flags.FastFinalityCategory,
} }
BLSWalletDirFlag = &flags.DirectoryFlag{ BLSWalletDirFlag = &flags.DirectoryFlag{
Name: "blswallet", Name: "blswallet",
Usage: "Path for the blsWallet dir in fast finality feature (default = inside the datadir)", Usage: "Path for the blsWallet dir in fast finality feature (default = inside the datadir)",
Category: flags.FastFinalityCategory,
} }
VoteJournalDirFlag = &flags.DirectoryFlag{ VoteJournalDirFlag = &flags.DirectoryFlag{
Name: "vote-journal-path", Name: "vote-journal-path",
Usage: "Path for the voteJournal dir in fast finality feature (default = inside the datadir)", Usage: "Path for the voteJournal dir in fast finality feature (default = inside the datadir)",
Category: flags.FastFinalityCategory,
} }
) )

@ -19,23 +19,26 @@ package flags
import "github.com/urfave/cli/v2" import "github.com/urfave/cli/v2"
const ( const (
EthCategory = "ETHEREUM" EthCategory = "ETHEREUM"
LightCategory = "LIGHT CLIENT" LightCategory = "LIGHT CLIENT"
DevCategory = "DEVELOPER CHAIN" DevCategory = "DEVELOPER CHAIN"
EthashCategory = "ETHASH" EthashCategory = "ETHASH"
TxPoolCategory = "TRANSACTION POOL (EVM)" TxPoolCategory = "TRANSACTION POOL (EVM)"
BlobPoolCategory = "TRANSACTION POOL (BLOB)" BlobPoolCategory = "TRANSACTION POOL (BLOB)"
PerfCategory = "PERFORMANCE TUNING" PerfCategory = "PERFORMANCE TUNING"
AccountCategory = "ACCOUNT" AccountCategory = "ACCOUNT"
APICategory = "API AND CONSOLE" APICategory = "API AND CONSOLE"
NetworkingCategory = "NETWORKING" NetworkingCategory = "NETWORKING"
MinerCategory = "MINER" MinerCategory = "MINER"
GasPriceCategory = "GAS PRICE ORACLE" GasPriceCategory = "GAS PRICE ORACLE"
VMCategory = "VIRTUAL MACHINE" VMCategory = "VIRTUAL MACHINE"
LoggingCategory = "LOGGING AND DEBUGGING" LoggingCategory = "LOGGING AND DEBUGGING"
MetricsCategory = "METRICS AND STATS" MetricsCategory = "METRICS AND STATS"
MiscCategory = "MISC" MiscCategory = "MISC"
DeprecatedCategory = "ALIASED (deprecated)" DeprecatedCategory = "ALIASED (deprecated)"
FastNodeCategory = "FAST NODE"
FastFinalityCategory = "FAST FINALITY"
HistoryCategory = "HISTORY"
) )
func init() { func init() {