Refactor validator client help. (#13401)

* Define `cli.App` without mutation.

No functional change.

* `usage.go`:  Clean `appHelpTemplate`.

No functional change is added.
Modifications consist in adding prefix/suffix `-` to improve readability of
the template without adding new lines in template inference.

We now see some inconsistencies of the template:
- `if .App.Version` is around the `AUTHOR` section.
- `if .App.Copyright` is around both `COPYRIGHT` and `VERSION` sections.
- `if len .App.Authors` is around nothing.

* `usage.go`: Surround version and author correctly.

* `usage.go`: `AUTHOR` ==> `AUTHORS`

* `usage.go`: `GLOBAL` --> `global`.

* `--grpc-max-msg-size`: Remove double default.

* VC: Standardize help message.

- Flags help begin with a capital letter and end with a period.
- If a flag help begins with a verb, it is conjugated.
- Expermitemtal, danger etc... mentions are between parenthesis.

* VC help message: Wrap too long lines.
This commit is contained in:
Manu NALEPA
2024-01-02 19:02:28 +01:00
committed by GitHub
parent a602acf492
commit 886d76fe7c
14 changed files with 232 additions and 221 deletions

View File

@@ -14,7 +14,7 @@ var log = logrus.WithField("prefix", "db")
var Commands = &cli.Command{ var Commands = &cli.Command{
Name: "db", Name: "db",
Category: "db", Category: "db",
Usage: "defines commands for interacting with the Ethereum Beacon Node database", Usage: "Defines commands for interacting with the Ethereum Beacon Node database",
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
{ {
Name: "restore", Name: "restore",

View File

@@ -80,7 +80,7 @@ var (
// MonitoringPortFlag defines the http port used to serve prometheus metrics. // MonitoringPortFlag defines the http port used to serve prometheus metrics.
MonitoringPortFlag = &cli.IntFlag{ MonitoringPortFlag = &cli.IntFlag{
Name: "monitoring-port", Name: "monitoring-port",
Usage: "Port used to listening and respond metrics for prometheus.", Usage: "Port used to listening and respond metrics for Prometheus.",
Value: 8080, Value: 8080,
} }
// CertFlag defines a flag for the node's TLS certificate. // CertFlag defines a flag for the node's TLS certificate.

View File

@@ -15,12 +15,12 @@ var (
// MinimalConfigFlag declares to use the minimal config for running Ethereum consensus. // MinimalConfigFlag declares to use the minimal config for running Ethereum consensus.
MinimalConfigFlag = &cli.BoolFlag{ MinimalConfigFlag = &cli.BoolFlag{
Name: "minimal-config", Name: "minimal-config",
Usage: "Use minimal config with parameters as defined in the spec.", Usage: "Uses minimal config with parameters as defined in the spec.",
} }
// E2EConfigFlag declares to use a testing specific config for running Ethereum consensus in end-to-end testing. // E2EConfigFlag declares to use a testing specific config for running Ethereum consensus in end-to-end testing.
E2EConfigFlag = &cli.BoolFlag{ E2EConfigFlag = &cli.BoolFlag{
Name: "e2e-config", Name: "e2e-config",
Usage: "Use the E2E testing config, only for use within end-to-end testing.", Usage: "Enables the E2E testing config, only for use within end-to-end testing.",
} }
// RPCMaxPageSizeFlag defines the maximum numbers per page returned in RPC responses from this // RPCMaxPageSizeFlag defines the maximum numbers per page returned in RPC responses from this
// beacon node (default: 500). // beacon node (default: 500).
@@ -31,34 +31,35 @@ var (
// VerbosityFlag defines the logrus configuration. // VerbosityFlag defines the logrus configuration.
VerbosityFlag = &cli.StringFlag{ VerbosityFlag = &cli.StringFlag{
Name: "verbosity", Name: "verbosity",
Usage: "Logging verbosity (trace, debug, info=default, warn, error, fatal, panic)", Usage: "Logging verbosity. (trace, debug, info, warn, error, fatal, panic)",
Value: "info", Value: "info",
} }
// DataDirFlag defines a path on disk where Prysm databases are stored. // DataDirFlag defines a path on disk where Prysm databases are stored.
DataDirFlag = &cli.StringFlag{ DataDirFlag = &cli.StringFlag{
Name: "datadir", Name: "datadir",
Usage: "Data directory for the databases", Usage: "Data directory for the databases.",
Value: DefaultDataDir(), Value: DefaultDataDir(),
} }
// EnableBackupWebhookFlag for users to trigger db backups via an HTTP webhook. // EnableBackupWebhookFlag for users to trigger db backups via an HTTP webhook.
EnableBackupWebhookFlag = &cli.BoolFlag{ EnableBackupWebhookFlag = &cli.BoolFlag{
Name: "enable-db-backup-webhook", Name: "enable-db-backup-webhook",
Usage: "Serve HTTP handler to initiate database backups. The handler is served on the monitoring port at path /db/backup.", Usage: `Serves HTTP handler to initiate database backups.
The handler is served on the monitoring port at path /db/backup.`,
} }
// BackupWebhookOutputDir to customize the output directory for db backups. // BackupWebhookOutputDir to customize the output directory for db backups.
BackupWebhookOutputDir = &cli.StringFlag{ BackupWebhookOutputDir = &cli.StringFlag{
Name: "db-backup-output-dir", Name: "db-backup-output-dir",
Usage: "Output directory for db backups", Usage: "Output directory for db backups.",
} }
// EnableTracingFlag defines a flag to enable p2p message tracing. // EnableTracingFlag defines a flag to enable p2p message tracing.
EnableTracingFlag = &cli.BoolFlag{ EnableTracingFlag = &cli.BoolFlag{
Name: "enable-tracing", Name: "enable-tracing",
Usage: "Enable request tracing.", Usage: "Enables request tracing.",
} }
// TracingProcessNameFlag defines a flag to specify a process name. // TracingProcessNameFlag defines a flag to specify a process name.
TracingProcessNameFlag = &cli.StringFlag{ TracingProcessNameFlag = &cli.StringFlag{
Name: "tracing-process-name", Name: "tracing-process-name",
Usage: "The name to apply to tracing tag \"process_name\"", Usage: "Name to apply to tracing tag `process_name`.",
} }
// TracingEndpointFlag flag defines the http endpoint for serving traces to Jaeger. // TracingEndpointFlag flag defines the http endpoint for serving traces to Jaeger.
TracingEndpointFlag = &cli.StringFlag{ TracingEndpointFlag = &cli.StringFlag{
@@ -70,7 +71,7 @@ var (
// messages are sampled for tracing. // messages are sampled for tracing.
TraceSampleFractionFlag = &cli.Float64Flag{ TraceSampleFractionFlag = &cli.Float64Flag{
Name: "trace-sample-fraction", Name: "trace-sample-fraction",
Usage: "Indicate what fraction of p2p messages are sampled for tracing.", Usage: "Indicates what fraction of p2p messages are sampled for tracing.",
Value: 0.20, Value: 0.20,
} }
// MonitoringHostFlag defines the host used to serve prometheus metrics. // MonitoringHostFlag defines the host used to serve prometheus metrics.
@@ -82,13 +83,13 @@ var (
// DisableMonitoringFlag defines a flag to disable the metrics collection. // DisableMonitoringFlag defines a flag to disable the metrics collection.
DisableMonitoringFlag = &cli.BoolFlag{ DisableMonitoringFlag = &cli.BoolFlag{
Name: "disable-monitoring", Name: "disable-monitoring",
Usage: "Disable monitoring service.", Usage: "Disables monitoring service.",
} }
// NoDiscovery specifies whether we are running a local network and have no need for connecting // NoDiscovery specifies whether we are running a local network and have no need for connecting
// to the bootstrap nodes in the cloud // to the bootstrap nodes in the cloud
NoDiscovery = &cli.BoolFlag{ NoDiscovery = &cli.BoolFlag{
Name: "no-discovery", Name: "no-discovery",
Usage: "Enable only local network p2p and do not connect to cloud bootstrap nodes.", Usage: "Enable only local network p2p and do not connect to cloud bootstrap nodes",
} }
// StaticPeers specifies a set of peers to connect to explicitly. // StaticPeers specifies a set of peers to connect to explicitly.
StaticPeers = &cli.StringSliceFlag{ StaticPeers = &cli.StringSliceFlag{
@@ -185,17 +186,17 @@ var (
// ForceClearDB removes any previously stored data at the data directory. // ForceClearDB removes any previously stored data at the data directory.
ForceClearDB = &cli.BoolFlag{ ForceClearDB = &cli.BoolFlag{
Name: "force-clear-db", Name: "force-clear-db",
Usage: "Clear any previously stored data at the data directory", Usage: "Clears any previously stored data at the data directory.",
} }
// ClearDB prompts user to see if they want to remove any previously stored data at the data directory. // ClearDB prompts user to see if they want to remove any previously stored data at the data directory.
ClearDB = &cli.BoolFlag{ ClearDB = &cli.BoolFlag{
Name: "clear-db", Name: "clear-db",
Usage: "Prompt for clearing any previously stored data at the data directory", Usage: "Prompt for clearing any previously stored data at the data directory.",
} }
// LogFormat specifies the log output format. // LogFormat specifies the log output format.
LogFormat = &cli.StringFlag{ LogFormat = &cli.StringFlag{
Name: "log-format", Name: "log-format",
Usage: "Specify log formatting. Supports: text, json, fluentd, journald.", Usage: "Specifies log formatting. Supports: text, json, fluentd, journald.",
Value: "text", Value: "text",
} }
// MaxGoroutines specifies the maximum amount of goroutines tolerated, before a status check fails. // MaxGoroutines specifies the maximum amount of goroutines tolerated, before a status check fails.
@@ -207,7 +208,7 @@ var (
// LogFileName specifies the log output file name. // LogFileName specifies the log output file name.
LogFileName = &cli.StringFlag{ LogFileName = &cli.StringFlag{
Name: "log-file", Name: "log-file",
Usage: "Specify log file name, relative or absolute", Usage: "Specifies log file name, relative or absolute.",
} }
// EnableUPnPFlag specifies if UPnP should be enabled or not. The default value is false. // EnableUPnPFlag specifies if UPnP should be enabled or not. The default value is false.
EnableUPnPFlag = &cli.BoolFlag{ EnableUPnPFlag = &cli.BoolFlag{
@@ -217,27 +218,27 @@ var (
// ConfigFileFlag specifies the filepath to load flag values. // ConfigFileFlag specifies the filepath to load flag values.
ConfigFileFlag = &cli.StringFlag{ ConfigFileFlag = &cli.StringFlag{
Name: "config-file", Name: "config-file",
Usage: "The filepath to a yaml file with flag values", Usage: "Filepath to a yaml file with flag values.",
} }
// ChainConfigFileFlag specifies the filepath to load flag values. // ChainConfigFileFlag specifies the filepath to load flag values.
ChainConfigFileFlag = &cli.StringFlag{ ChainConfigFileFlag = &cli.StringFlag{
Name: "chain-config-file", Name: "chain-config-file",
Usage: "The path to a YAML file with chain config values", Usage: "Path to a YAML file with chain config values.",
} }
// GrpcMaxCallRecvMsgSizeFlag defines the max call message size for GRPC // GrpcMaxCallRecvMsgSizeFlag defines the max call message size for GRPC
GrpcMaxCallRecvMsgSizeFlag = &cli.IntFlag{ GrpcMaxCallRecvMsgSizeFlag = &cli.IntFlag{
Name: "grpc-max-msg-size", Name: "grpc-max-msg-size",
Usage: "Integer to define max receive message call size. If serving a public gRPC server, " + Usage: `Integer to define max receive message call size (in bytes).
"set this to a more reasonable size to avoid resource exhaustion from large messages. " + If serving a public gRPC server, set this to a more reasonable size to avoid
"Validators with as many as 10000 keys can be run with a max message size of less than " + resource exhaustion from large messages.
"50Mb. The default here is set to a very high value for local users. " + Validators with as many as 10000 keys can be run with a max message size of less than
"(default: 2147483647 (2Gi)).", 50Mb. The default here is set to a very high value for local users.`,
Value: math.MaxInt32, Value: math.MaxInt32,
} }
// AcceptTosFlag specifies user acceptance of ToS for non-interactive environments. // AcceptTosFlag specifies user acceptance of ToS for non-interactive environments.
AcceptTosFlag = &cli.BoolFlag{ AcceptTosFlag = &cli.BoolFlag{
Name: "accept-terms-of-use", Name: "accept-terms-of-use",
Usage: "Accept Terms and Conditions (for non-interactive environments)", Usage: "Accepts Terms and Conditions (for non-interactive environments).",
} }
// ValidatorMonitorIndicesFlag specifies a list of validator indices to // ValidatorMonitorIndicesFlag specifies a list of validator indices to
// track for performance updates // track for performance updates
@@ -261,7 +262,7 @@ var (
// ApiTimeoutFlag specifies the timeout value for API requests in seconds. A timeout of zero means no timeout. // ApiTimeoutFlag specifies the timeout value for API requests in seconds. A timeout of zero means no timeout.
ApiTimeoutFlag = &cli.IntFlag{ ApiTimeoutFlag = &cli.IntFlag{
Name: "api-timeout", Name: "api-timeout",
Usage: "Specifies the timeout value for API requests in seconds", Usage: "Specifies the timeout value for API requests in seconds.",
Value: 120, Value: 120,
} }
// JwtOutputFileFlag specifies the JWT file path that gets generated into when invoked by generate-jwt-secret. // JwtOutputFileFlag specifies the JWT file path that gets generated into when invoked by generate-jwt-secret.

View File

@@ -17,7 +17,7 @@ var log = logrus.WithField("prefix", "accounts")
var Commands = &cli.Command{ var Commands = &cli.Command{
Name: "accounts", Name: "accounts",
Category: "accounts", Category: "accounts",
Usage: "defines commands for interacting with Ethereum validator accounts", Usage: "Defines commands for interacting with Ethereum validator accounts.",
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
{ {
Name: "delete", Name: "delete",

View File

@@ -14,7 +14,7 @@ var log = logrus.WithField("prefix", "db")
var Commands = &cli.Command{ var Commands = &cli.Command{
Name: "db", Name: "db",
Category: "db", Category: "db",
Usage: "defines commands for interacting with the Prysm validator database", Usage: "Defines commands for interacting with the Prysm validator database.",
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
{ {
Name: "restore", Name: "restore",

View File

@@ -24,26 +24,26 @@ var (
// DisableAccountMetricsFlag disables the prometheus metrics for validator accounts, default false. // DisableAccountMetricsFlag disables the prometheus metrics for validator accounts, default false.
DisableAccountMetricsFlag = &cli.BoolFlag{ DisableAccountMetricsFlag = &cli.BoolFlag{
Name: "disable-account-metrics", Name: "disable-account-metrics",
Usage: "Disable prometheus metrics for validator accounts. Operators with high volumes " + Usage: `Disables prometheus metrics for validator accounts. Operators with high volumes
"of validating keys may wish to disable granular prometheus metrics as it increases " + of validating keys may wish to disable granular prometheus metrics as it increases
"the data cardinality.", the data cardinality.`,
} }
// BeaconRPCProviderFlag defines a beacon node RPC endpoint. // BeaconRPCProviderFlag defines a beacon node RPC endpoint.
BeaconRPCProviderFlag = &cli.StringFlag{ BeaconRPCProviderFlag = &cli.StringFlag{
Name: "beacon-rpc-provider", Name: "beacon-rpc-provider",
Usage: "Beacon node RPC provider endpoint", Usage: "Beacon node RPC provider endpoint.",
Value: "127.0.0.1:4000", Value: "127.0.0.1:4000",
} }
// BeaconRPCGatewayProviderFlag defines a beacon node JSON-RPC endpoint. // BeaconRPCGatewayProviderFlag defines a beacon node JSON-RPC endpoint.
BeaconRPCGatewayProviderFlag = &cli.StringFlag{ BeaconRPCGatewayProviderFlag = &cli.StringFlag{
Name: "beacon-rpc-gateway-provider", Name: "beacon-rpc-gateway-provider",
Usage: "Beacon node RPC gateway provider endpoint", Usage: "Beacon node RPC gateway provider endpoint.",
Value: "127.0.0.1:3500", Value: "127.0.0.1:3500",
} }
// BeaconRESTApiProviderFlag defines a beacon node REST API endpoint. // BeaconRESTApiProviderFlag defines a beacon node REST API endpoint.
BeaconRESTApiProviderFlag = &cli.StringFlag{ BeaconRESTApiProviderFlag = &cli.StringFlag{
Name: "beacon-rest-api-provider", Name: "beacon-rest-api-provider",
Usage: "Beacon node REST API provider endpoint", Usage: "Beacon node REST API provider endpoint.",
Value: "http://127.0.0.1:3500", Value: "http://127.0.0.1:3500",
} }
// CertFlag defines a flag for the node's TLS certificate. // CertFlag defines a flag for the node's TLS certificate.
@@ -54,25 +54,25 @@ var (
// EnableRPCFlag enables controlling the validator client via gRPC (without web UI). // EnableRPCFlag enables controlling the validator client via gRPC (without web UI).
EnableRPCFlag = &cli.BoolFlag{ EnableRPCFlag = &cli.BoolFlag{
Name: "rpc", Name: "rpc",
Usage: "Enables the RPC server for the validator client (without Web UI)", Usage: "Enables the RPC server for the validator client (without Web UI).",
Value: false, Value: false,
} }
// RPCHost defines the host on which the RPC server should listen. // RPCHost defines the host on which the RPC server should listen.
RPCHost = &cli.StringFlag{ RPCHost = &cli.StringFlag{
Name: "rpc-host", Name: "rpc-host",
Usage: "Host on which the RPC server should listen", Usage: "Host on which the RPC server should listen.",
Value: "127.0.0.1", Value: "127.0.0.1",
} }
// RPCPort defines a validator client RPC port to open. // RPCPort defines a validator client RPC port to open.
RPCPort = &cli.IntFlag{ RPCPort = &cli.IntFlag{
Name: "rpc-port", Name: "rpc-port",
Usage: "RPC port exposed by a validator client", Usage: "RPC port exposed by a validator client.",
Value: 7000, Value: 7000,
} }
// SlasherRPCProviderFlag defines a slasher node RPC endpoint. // SlasherRPCProviderFlag defines a slasher node RPC endpoint.
SlasherRPCProviderFlag = &cli.StringFlag{ SlasherRPCProviderFlag = &cli.StringFlag{
Name: "slasher-rpc-provider", Name: "slasher-rpc-provider",
Usage: "Slasher node RPC provider endpoint", Usage: "Slasher node RPC provider endpoint.",
Value: "127.0.0.1:4002", Value: "127.0.0.1:4002",
} }
// SlasherCertFlag defines a flag for the slasher node's TLS certificate. // SlasherCertFlag defines a flag for the slasher node's TLS certificate.
@@ -83,85 +83,86 @@ var (
// DisablePenaltyRewardLogFlag defines the ability to not log reward/penalty information during deployment // DisablePenaltyRewardLogFlag defines the ability to not log reward/penalty information during deployment
DisablePenaltyRewardLogFlag = &cli.BoolFlag{ DisablePenaltyRewardLogFlag = &cli.BoolFlag{
Name: "disable-rewards-penalties-logging", Name: "disable-rewards-penalties-logging",
Usage: "Disable reward/penalty logging during cluster deployment", Usage: "Disables reward/penalty logging during cluster deployment.",
} }
// GraffitiFlag defines the graffiti value included in proposed blocks // GraffitiFlag defines the graffiti value included in proposed blocks
GraffitiFlag = &cli.StringFlag{ GraffitiFlag = &cli.StringFlag{
Name: "graffiti", Name: "graffiti",
Usage: "String to include in proposed blocks", Usage: "String to include in proposed blocks.",
} }
// GrpcRetriesFlag defines the number of times to retry a failed gRPC request. // GrpcRetriesFlag defines the number of times to retry a failed gRPC request.
GrpcRetriesFlag = &cli.UintFlag{ GrpcRetriesFlag = &cli.UintFlag{
Name: "grpc-retries", Name: "grpc-retries",
Usage: "Number of attempts to retry gRPC requests", Usage: "Number of attempts to retry gRPC requests.",
Value: 5, Value: 5,
} }
// GrpcRetryDelayFlag defines the interval to retry a failed gRPC request. // GrpcRetryDelayFlag defines the interval to retry a failed gRPC request.
GrpcRetryDelayFlag = &cli.DurationFlag{ GrpcRetryDelayFlag = &cli.DurationFlag{
Name: "grpc-retry-delay", Name: "grpc-retry-delay",
Usage: "The amount of time between gRPC retry requests.", Usage: "Amount of time between gRPC retry requests.",
Value: 1 * time.Second, Value: 1 * time.Second,
} }
// GrpcHeadersFlag defines a list of headers to send with all gRPC requests. // GrpcHeadersFlag defines a list of headers to send with all gRPC requests.
GrpcHeadersFlag = &cli.StringFlag{ GrpcHeadersFlag = &cli.StringFlag{
Name: "grpc-headers", Name: "grpc-headers",
Usage: "A comma separated list of key value pairs to pass as gRPC headers for all gRPC " + Usage: `Comma separated list of key value pairs to pass as gRPC headers for all gRPC calls.
"calls. Example: --grpc-headers=key=value", Example: --grpc-headers=key=value`,
} }
// GRPCGatewayHost specifies a gRPC gateway host for the validator client. // GRPCGatewayHost specifies a gRPC gateway host for the validator client.
GRPCGatewayHost = &cli.StringFlag{ GRPCGatewayHost = &cli.StringFlag{
Name: "grpc-gateway-host", Name: "grpc-gateway-host",
Usage: "The host on which the gateway server runs on", Usage: "Host on which the gateway server runs on.",
Value: DefaultGatewayHost, Value: DefaultGatewayHost,
} }
// GRPCGatewayPort enables a gRPC gateway to be exposed for the validator client. // GRPCGatewayPort enables a gRPC gateway to be exposed for the validator client.
GRPCGatewayPort = &cli.IntFlag{ GRPCGatewayPort = &cli.IntFlag{
Name: "grpc-gateway-port", Name: "grpc-gateway-port",
Usage: "Enable gRPC gateway for JSON requests", Usage: "Enables gRPC gateway for JSON requests.",
Value: 7500, Value: 7500,
} }
// GPRCGatewayCorsDomain serves preflight requests when serving gRPC JSON gateway. // GPRCGatewayCorsDomain serves preflight requests when serving gRPC JSON gateway.
GPRCGatewayCorsDomain = &cli.StringFlag{ GPRCGatewayCorsDomain = &cli.StringFlag{
Name: "grpc-gateway-corsdomain", Name: "grpc-gateway-corsdomain",
Usage: "Comma separated list of domains from which to accept cross origin requests " + Usage: `Comma separated list of domains from which to accept cross origin requests (browser enforced).
"(browser enforced). This flag has no effect if not used with --grpc-gateway-port.", This flag has no effect if not used with --grpc-gateway-port.
`,
Value: "http://localhost:7500,http://127.0.0.1:7500,http://0.0.0.0:7500,http://localhost:4242,http://127.0.0.1:4242,http://localhost:4200,http://0.0.0.0:4242,http://127.0.0.1:4200,http://0.0.0.0:4200,http://localhost:3000,http://0.0.0.0:3000,http://127.0.0.1:3000"} Value: "http://localhost:7500,http://127.0.0.1:7500,http://0.0.0.0:7500,http://localhost:4242,http://127.0.0.1:4242,http://localhost:4200,http://0.0.0.0:4242,http://127.0.0.1:4200,http://0.0.0.0:4200,http://localhost:3000,http://0.0.0.0:3000,http://127.0.0.1:3000"}
// MonitoringPortFlag defines the http port used to serve prometheus metrics. // MonitoringPortFlag defines the http port used to serve prometheus metrics.
MonitoringPortFlag = &cli.IntFlag{ MonitoringPortFlag = &cli.IntFlag{
Name: "monitoring-port", Name: "monitoring-port",
Usage: "Port used to listening and respond metrics for prometheus.", Usage: "Port used to listening and respond metrics for Prometheus.",
Value: 8081, Value: 8081,
} }
// WalletDirFlag defines the path to a wallet directory for Prysm accounts. // WalletDirFlag defines the path to a wallet directory for Prysm accounts.
WalletDirFlag = &cli.StringFlag{ WalletDirFlag = &cli.StringFlag{
Name: "wallet-dir", Name: "wallet-dir",
Usage: "Path to a wallet directory on-disk for Prysm validator accounts", Usage: "Path to a wallet directory on-disk for Prysm validator accounts.",
Value: filepath.Join(DefaultValidatorDir(), WalletDefaultDirName), Value: filepath.Join(DefaultValidatorDir(), WalletDefaultDirName),
} }
// AccountPasswordFileFlag is path to a file containing a password for a validator account. // AccountPasswordFileFlag is path to a file containing a password for a validator account.
AccountPasswordFileFlag = &cli.StringFlag{ AccountPasswordFileFlag = &cli.StringFlag{
Name: "account-password-file", Name: "account-password-file",
Usage: "Path to a plain-text, .txt file containing a password for a validator account", Usage: "Path to a plain-text, .txt file containing a password for a validator account.",
} }
// WalletPasswordFileFlag is the path to a file containing your wallet password. // WalletPasswordFileFlag is the path to a file containing your wallet password.
WalletPasswordFileFlag = &cli.StringFlag{ WalletPasswordFileFlag = &cli.StringFlag{
Name: "wallet-password-file", Name: "wallet-password-file",
Usage: "Path to a plain-text, .txt file containing your wallet password", Usage: "Path to a plain-text, .txt file containing your wallet password.",
} }
// Mnemonic25thWordFileFlag defines a path to a file containing a "25th" word mnemonic passphrase for advanced users. // Mnemonic25thWordFileFlag defines a path to a file containing a "25th" word mnemonic passphrase for advanced users.
Mnemonic25thWordFileFlag = &cli.StringFlag{ Mnemonic25thWordFileFlag = &cli.StringFlag{
Name: "mnemonic-25th-word-file", Name: "mnemonic-25th-word-file",
Usage: "(Advanced) Path to a plain-text, .txt file containing a 25th word passphrase for your mnemonic for HD wallets", Usage: "(Advanced) Path to a plain-text, `.txt` file containing a 25th word passphrase for your mnemonic for HD wallets.",
} }
// SkipMnemonic25thWordCheckFlag allows for skipping a check for mnemonic 25th word passphrases for HD wallets. // SkipMnemonic25thWordCheckFlag allows for skipping a check for mnemonic 25th word passphrases for HD wallets.
SkipMnemonic25thWordCheckFlag = &cli.StringFlag{ SkipMnemonic25thWordCheckFlag = &cli.StringFlag{
Name: "skip-mnemonic-25th-word-check", Name: "skip-mnemonic-25th-word-check",
Usage: "Allows for skipping the check for a mnemonic 25th word passphrase for HD wallets", Usage: "Allows for skipping the check for a mnemonic 25th word passphrase for HD wallets.",
} }
// ImportPrivateKeyFileFlag allows for directly importing a private key hex string as an account. // ImportPrivateKeyFileFlag allows for directly importing a private key hex string as an account.
ImportPrivateKeyFileFlag = &cli.StringFlag{ ImportPrivateKeyFileFlag = &cli.StringFlag{
Name: "import-private-key-file", Name: "import-private-key-file",
Usage: "Path to a plain-text, .txt file containing a hex string representation of a private key to import", Usage: "Path to a plain-text, .txt file containing a hex string representation of a private key to import.",
} }
// MnemonicFileFlag is used to enter a file to mnemonic phrase for new wallet creation, non-interactively. // MnemonicFileFlag is used to enter a file to mnemonic phrase for new wallet creation, non-interactively.
MnemonicFileFlag = &cli.StringFlag{ MnemonicFileFlag = &cli.StringFlag{
@@ -171,113 +172,113 @@ var (
// MnemonicLanguageFlag is used to specify the language of the mnemonic. // MnemonicLanguageFlag is used to specify the language of the mnemonic.
MnemonicLanguageFlag = &cli.StringFlag{ MnemonicLanguageFlag = &cli.StringFlag{
Name: "mnemonic-language", Name: "mnemonic-language",
Usage: "Allows specifying mnemonic language. Supported languages are: english|chinese_traditional|chinese_simplified|czech|french|japanese|korean|italian|spanish", Usage: "Allows specifying mnemonic language. Supported languages are: english|chinese_traditional|chinese_simplified|czech|french|japanese|korean|italian|spanish.",
} }
// ShowDepositDataFlag for accounts. // ShowDepositDataFlag for accounts.
ShowDepositDataFlag = &cli.BoolFlag{ ShowDepositDataFlag = &cli.BoolFlag{
Name: "show-deposit-data", Name: "show-deposit-data",
Usage: "Display raw eth1 tx deposit data for validator accounts", Usage: "Displays raw eth1 tx deposit data for validator accounts.",
Value: false, Value: false,
} }
// ShowPrivateKeysFlag for accounts. // ShowPrivateKeysFlag for accounts.
ShowPrivateKeysFlag = &cli.BoolFlag{ ShowPrivateKeysFlag = &cli.BoolFlag{
Name: "show-private-keys", Name: "show-private-keys",
Usage: "Display the private keys for validator accounts", Usage: "Displays the private keys for validator accounts.",
Value: false, Value: false,
} }
// ListValidatorIndices for accounts. // ListValidatorIndices for accounts.
ListValidatorIndices = &cli.BoolFlag{ ListValidatorIndices = &cli.BoolFlag{
Name: "list-validator-indices", Name: "list-validator-indices",
Usage: "List validator indices", Usage: "Lists validator indices.",
Value: false, Value: false,
} }
// NumAccountsFlag defines the amount of accounts to generate for derived wallets. // NumAccountsFlag defines the amount of accounts to generate for derived wallets.
NumAccountsFlag = &cli.IntFlag{ NumAccountsFlag = &cli.IntFlag{
Name: "num-accounts", Name: "num-accounts",
Usage: "Number of accounts to generate for derived wallets", Usage: "Number of accounts to generate for derived wallets.",
Value: 1, Value: 1,
} }
// DeletePublicKeysFlag defines a comma-separated list of hex string public keys // DeletePublicKeysFlag defines a comma-separated list of hex string public keys
// for accounts which a user desires to delete from their wallet. // for accounts which a user desires to delete from their wallet.
DeletePublicKeysFlag = &cli.StringFlag{ DeletePublicKeysFlag = &cli.StringFlag{
Name: "delete-public-keys", Name: "delete-public-keys",
Usage: "Comma-separated list of public key hex strings to specify which validator accounts to delete", Usage: "Comma separated list of public key hex strings to specify which validator accounts to delete.",
Value: "", Value: "",
} }
// BackupPublicKeysFlag defines a comma-separated list of hex string public keys // BackupPublicKeysFlag defines a comma-separated list of hex string public keys
// for accounts which a user desires to backup from their wallet. // for accounts which a user desires to backup from their wallet.
BackupPublicKeysFlag = &cli.StringFlag{ BackupPublicKeysFlag = &cli.StringFlag{
Name: "backup-public-keys", Name: "backup-public-keys",
Usage: "Comma-separated list of public key hex strings to specify which validator accounts to backup", Usage: "Comma separated list of public key hex strings to specify which validator accounts to backup.",
Value: "", Value: "",
} }
// VoluntaryExitPublicKeysFlag defines a comma-separated list of hex string public keys // VoluntaryExitPublicKeysFlag defines a comma-separated list of hex string public keys
// for accounts on which a user wants to perform a voluntary exit. // for accounts on which a user wants to perform a voluntary exit.
VoluntaryExitPublicKeysFlag = &cli.StringFlag{ VoluntaryExitPublicKeysFlag = &cli.StringFlag{
Name: "public-keys", Name: "public-keys",
Usage: "Comma-separated list of public key hex strings to specify on which validator accounts to perform " + Usage: "Comma separated list of public key hex strings to specify on which validator accounts to perform " +
"a voluntary exit", "a voluntary exit.",
Value: "", Value: "",
} }
// ExitAllFlag allows stakers to select all validating keys for exit. This will still require the staker // ExitAllFlag allows stakers to select all validating keys for exit. This will still require the staker
// to confirm a userprompt for this action given it is a dangerous one. // to confirm a userprompt for this action given it is a dangerous one.
ExitAllFlag = &cli.BoolFlag{ ExitAllFlag = &cli.BoolFlag{
Name: "exit-all", Name: "exit-all",
Usage: "Exit all validators. This will still require the staker to confirm a userprompt for the action", Usage: "Exits all validators. This will still require the staker to confirm a userprompt for the action.",
} }
// ForceExitFlag to exit without displaying the confirmation prompt. // ForceExitFlag to exit without displaying the confirmation prompt.
ForceExitFlag = &cli.BoolFlag{ ForceExitFlag = &cli.BoolFlag{
Name: "force-exit", Name: "force-exit",
Usage: "Exit without displaying the confirmation prompt", Usage: "Exits without displaying the confirmation prompt.",
} }
VoluntaryExitJSONOutputPath = &cli.StringFlag{ VoluntaryExitJSONOutputPath = &cli.StringFlag{
Name: "exit-json-output-dir", Name: "exit-json-output-dir",
Usage: "The output directory to write voluntary exits as individual unencrypted JSON " + Usage: "Output directory to write voluntary exits as individual unencrypted JSON " +
"files. If this flag is provided, voluntary exits will be written to the provided " + "files. If this flag is provided, voluntary exits will be written to the provided " +
"directory and will not be broadcasted.", "directory and will not be broadcasted.",
} }
// BackupPasswordFile for encrypting accounts a user wishes to back up. // BackupPasswordFile for encrypting accounts a user wishes to back up.
BackupPasswordFile = &cli.StringFlag{ BackupPasswordFile = &cli.StringFlag{
Name: "backup-password-file", Name: "backup-password-file",
Usage: "Path to a plain-text, .txt file containing the desired password for your backed up accounts", Usage: "Path to a plain-text, .txt file containing the desired password for your backed up accounts.",
Value: "", Value: "",
} }
// BackupDirFlag defines the path for the zip backup of the wallet will be created. // BackupDirFlag defines the path for the zip backup of the wallet will be created.
BackupDirFlag = &cli.StringFlag{ BackupDirFlag = &cli.StringFlag{
Name: "backup-dir", Name: "backup-dir",
Usage: "Path to a directory where accounts will be backed up into a zip file", Usage: "Path to a directory where accounts will be backed up into a zip file.",
Value: DefaultValidatorDir(), Value: DefaultValidatorDir(),
} }
// SlashingProtectionJSONFileFlag is used to enter the file path of the slashing protection JSON. // SlashingProtectionJSONFileFlag is used to enter the file path of the slashing protection JSON.
SlashingProtectionJSONFileFlag = &cli.StringFlag{ SlashingProtectionJSONFileFlag = &cli.StringFlag{
Name: "slashing-protection-json-file", Name: "slashing-protection-json-file",
Usage: "Path to an EIP-3076 compliant JSON file containing a user's slashing protection history", Usage: "Path to an EIP-3076 compliant JSON file containing a user's slashing protection history.",
} }
// KeysDirFlag defines the path for a directory where keystores to be imported at stored. // KeysDirFlag defines the path for a directory where keystores to be imported at stored.
KeysDirFlag = &cli.StringFlag{ KeysDirFlag = &cli.StringFlag{
Name: "keys-dir", Name: "keys-dir",
Usage: "Path to a directory where keystores to be imported are stored", Usage: "Path to a directory where keystores to be imported are stored.",
} }
// RemoteSignerCertPathFlag defines the path to a client.crt file for a wallet to connect to // RemoteSignerCertPathFlag defines the path to a client.crt file for a wallet to connect to
// a secure signer via TLS and gRPC. // a secure signer via TLS and gRPC.
RemoteSignerCertPathFlag = &cli.StringFlag{ RemoteSignerCertPathFlag = &cli.StringFlag{
Name: "remote-signer-crt-path", Name: "remote-signer-crt-path",
Usage: "/path/to/client.crt for establishing a secure, TLS gRPC connection to a remote signer server", Usage: "/path/to/client.crt for establishing a secure, TLS gRPC connection to a remote signer server.",
Value: "", Value: "",
} }
// RemoteSignerKeyPathFlag defines the path to a client.key file for a wallet to connect to // RemoteSignerKeyPathFlag defines the path to a client.key file for a wallet to connect to
// a secure signer via TLS and gRPC. // a secure signer via TLS and gRPC.
RemoteSignerKeyPathFlag = &cli.StringFlag{ RemoteSignerKeyPathFlag = &cli.StringFlag{
Name: "remote-signer-key-path", Name: "remote-signer-key-path",
Usage: "/path/to/client.key for establishing a secure, TLS gRPC connection to a remote signer server", Usage: "/path/to/client.key for establishing a secure, TLS gRPC connection to a remote signer server.",
Value: "", Value: "",
} }
// RemoteSignerCACertPathFlag defines the path to a ca.crt file for a wallet to connect to // RemoteSignerCACertPathFlag defines the path to a ca.crt file for a wallet to connect to
// a secure signer via TLS and gRPC. // a secure signer via TLS and gRPC.
RemoteSignerCACertPathFlag = &cli.StringFlag{ RemoteSignerCACertPathFlag = &cli.StringFlag{
Name: "remote-signer-ca-crt-path", Name: "remote-signer-ca-crt-path",
Usage: "/path/to/ca.crt for establishing a secure, TLS gRPC connection to a remote signer server", Usage: "/path/to/ca.crt for establishing a secure, TLS gRPC connection to a remote signer server.",
Value: "", Value: "",
} }
// Web3SignerURLFlag defines the URL for a web3signer to connect to. // Web3SignerURLFlag defines the URL for a web3signer to connect to.
@@ -285,7 +286,7 @@ var (
// web3signer documentation can be found in Consensys' web3signer project docs // web3signer documentation can be found in Consensys' web3signer project docs
Web3SignerURLFlag = &cli.StringFlag{ Web3SignerURLFlag = &cli.StringFlag{
Name: "validators-external-signer-url", Name: "validators-external-signer-url",
Usage: "URL for consensys' web3signer software to use with the Prysm validator client", Usage: "URL for consensys' web3signer software to use with the Prysm validator client.",
Value: "", Value: "",
} }
@@ -295,65 +296,70 @@ var (
// web3signer documentation can be found in Consensys' web3signer project docs``` // web3signer documentation can be found in Consensys' web3signer project docs```
Web3SignerPublicValidatorKeysFlag = &cli.StringSliceFlag{ Web3SignerPublicValidatorKeysFlag = &cli.StringSliceFlag{
Name: "validators-external-signer-public-keys", Name: "validators-external-signer-public-keys",
Usage: "comma separated list of public keys OR an external url endpoint for the validator to retrieve public keys from for usage with web3signer", Usage: "Comma separated list of public keys OR an external url endpoint for the validator to retrieve public keys from for usage with web3signer.",
} }
// KeymanagerKindFlag defines the kind of keymanager desired by a user during wallet creation. // KeymanagerKindFlag defines the kind of keymanager desired by a user during wallet creation.
KeymanagerKindFlag = &cli.StringFlag{ KeymanagerKindFlag = &cli.StringFlag{
Name: "keymanager-kind", Name: "keymanager-kind",
Usage: "Kind of keymanager, either imported, derived, or remote, specified during wallet creation", Usage: "Kind of keymanager, either imported, derived, or remote, specified during wallet creation.",
Value: "", Value: "",
} }
// SkipDepositConfirmationFlag skips the y/n confirmation userprompt for sending a deposit to the deposit contract. // SkipDepositConfirmationFlag skips the y/n confirmation userprompt for sending a deposit to the deposit contract.
SkipDepositConfirmationFlag = &cli.BoolFlag{ SkipDepositConfirmationFlag = &cli.BoolFlag{
Name: "skip-deposit-confirmation", Name: "skip-deposit-confirmation",
Usage: "Skips the y/n confirmation userprompt for sending a deposit to the deposit contract", Usage: "Skips the y/n confirmation userprompt for sending a deposit to the deposit contract.",
Value: false, Value: false,
} }
// EnableWebFlag enables controlling the validator client via the Prysm web ui. This is a work in progress. // EnableWebFlag enables controlling the validator client via the Prysm web ui. This is a work in progress.
EnableWebFlag = &cli.BoolFlag{ EnableWebFlag = &cli.BoolFlag{
Name: "web", Name: "web",
Usage: "Enables the web portal for the validator client (work in progress)", Usage: "(Work in progress): Enables the web portal for the validator client.",
Value: false, Value: false,
} }
// SlashingProtectionExportDirFlag allows specifying the outpt directory // SlashingProtectionExportDirFlag allows specifying the outpt directory
// for a validator's slashing protection history. // for a validator's slashing protection history.
SlashingProtectionExportDirFlag = &cli.StringFlag{ SlashingProtectionExportDirFlag = &cli.StringFlag{
Name: "slashing-protection-export-dir", Name: "slashing-protection-export-dir",
Usage: "Allows users to specify the output directory to export their slashing protection EIP-3076 standard JSON File", Usage: "Allows users to specify the output directory to export their slashing protection EIP-3076 standard JSON File.",
Value: "", Value: "",
} }
// GraffitiFileFlag specifies the file path to load graffiti values. // GraffitiFileFlag specifies the file path to load graffiti values.
GraffitiFileFlag = &cli.StringFlag{ GraffitiFileFlag = &cli.StringFlag{
Name: "graffiti-file", Name: "graffiti-file",
Usage: "The path to a YAML file with graffiti values", Usage: "Path to a YAML file with graffiti values.",
} }
// ProposerSettingsFlag defines the path or URL to a file with proposer config. // ProposerSettingsFlag defines the path or URL to a file with proposer config.
ProposerSettingsFlag = &cli.StringFlag{ ProposerSettingsFlag = &cli.StringFlag{
Name: "proposer-settings-file", Name: "proposer-settings-file",
Usage: "Set path to a YAML or JSON file containing validator settings used when proposing blocks such as (fee recipient and gas limit) (i.e. --proposer-settings-file=/path/to/proposer.json). File format found in docs", Usage: `Sets path to a YAML or JSON file containing validator settings used when proposing blocks such as
fee recipient and gas limit. File format found in docs.`,
Value: "", Value: "",
} }
// ProposerSettingsURLFlag defines the path or URL to a file with proposer config. // ProposerSettingsURLFlag defines the path or URL to a file with proposer config.
ProposerSettingsURLFlag = &cli.StringFlag{ ProposerSettingsURLFlag = &cli.StringFlag{
Name: "proposer-settings-url", Name: "proposer-settings-url",
Usage: "Set URL to a REST endpoint containing validator settings used when proposing blocks such as (fee recipient) (i.e. --proposer-settings-url=https://example.com/api/getConfig). File format found in docs", Usage: `Sets URL to a REST endpoint containing validator settings used when proposing blocks such as
fee recipient and gas limit. File format found in docs`,
Value: "", Value: "",
} }
// SuggestedFeeRecipientFlag defines the address of the fee recipient. // SuggestedFeeRecipientFlag defines the address of the fee recipient.
SuggestedFeeRecipientFlag = &cli.StringFlag{ SuggestedFeeRecipientFlag = &cli.StringFlag{
Name: "suggested-fee-recipient", Name: "suggested-fee-recipient",
Usage: "Sets ALL validators' mapping to a suggested eth address to receive gas fees when proposing a block." + Usage: `Sets ALL validators' mapping to a suggested eth address to receive gas fees when proposing a block.
" note that this is only a suggestion when integrating with a Builder API, which may choose to specify a different fee recipient as payment for the blocks it builds." + Note that this is only a suggestion when integrating with a Builder API, which may choose to specify
" For additional setting overrides use the --" + ProposerSettingsFlag.Name + " or --" + ProposerSettingsURLFlag.Name + " flags. ", a different fee recipient as payment for the blocks it builds.For additional setting overrides use the
--` + ProposerSettingsFlag.Name + " or --" + ProposerSettingsURLFlag.Name + " flags.",
Value: params.BeaconConfig().EthBurnAddressHex, Value: params.BeaconConfig().EthBurnAddressHex,
} }
// EnableBuilderFlag enables the periodic validator registration API calls that will update the custom builder with validator settings. // EnableBuilderFlag enables the periodic validator registration API calls that will update the custom builder with validator settings.
EnableBuilderFlag = &cli.BoolFlag{ EnableBuilderFlag = &cli.BoolFlag{
Name: "enable-builder", Name: "enable-builder",
Usage: "Enables Builder validator registration APIs for the validator client to update settings such as fee recipient and gas limit. Note* this flag is not required if using proposer settings config file", Usage: `Enables builder validator registration APIs for the validator client to update settings
such as fee recipient and gas limit. This flag is not required if using proposer
settings config file.`,
Value: false, Value: false,
Aliases: []string{"enable-validator-registration"}, Aliases: []string{"enable-validator-registration"},
} }
@@ -361,7 +367,7 @@ var (
// BuilderGasLimitFlag defines the gas limit for the builder to use for constructing a payload. // BuilderGasLimitFlag defines the gas limit for the builder to use for constructing a payload.
BuilderGasLimitFlag = &cli.StringFlag{ BuilderGasLimitFlag = &cli.StringFlag{
Name: "suggested-gas-limit", Name: "suggested-gas-limit",
Usage: "Sets gas limit for the builder to use for constructing a payload for all the validators", Usage: "Sets gas limit for the builder to use for constructing a payload for all the validators.",
Value: fmt.Sprint(params.BeaconConfig().DefaultBuilderGasLimit), Value: fmt.Sprint(params.BeaconConfig().DefaultBuilderGasLimit),
} }

View File

@@ -8,14 +8,12 @@ import (
var ( var (
InteropStartIndex = &cli.Uint64Flag{ InteropStartIndex = &cli.Uint64Flag{
Name: "interop-start-index", Name: "interop-start-index",
Usage: "The start index to deterministically generate validator keys when used in combination with " + Usage: `Start index to deterministically generate validator keys when used in combination with --interop-num-validators.
"--interop-num-validators. Example: --interop-start-index=5 --interop-num-validators=3 would generate " + Example: --interop-start-index=5 --interop-num-validators=3 would generate keys from index 5 to 7.`,
"keys from index 5 to 7.",
} }
InteropNumValidators = &cli.Uint64Flag{ InteropNumValidators = &cli.Uint64Flag{
Name: "interop-num-validators", Name: "interop-num-validators",
Usage: "The number of validators to deterministically generate. " + Usage: `Number of validators to deterministically generate.
"Example: --interop-start-index=5 --interop-num-validators=3 would generate " + Example: --interop-start-index=5 --interop-num-validators=3 would generate keys from index 5 to 7.`,
"keys from index 5 to 7.",
} }
) )

View File

@@ -117,81 +117,79 @@ func init() {
} }
func main() { func main() {
app := cli.App{} app := cli.App{
app.Name = "validator" Name: "validator",
app.Usage = `launches an Ethereum validator client that interacts with a beacon chain, starts proposer and attester services, p2p connections, and more` Usage: "Launches an Ethereum validator client that interacts with a beacon chain, starts proposer and attester services, p2p connections, and more.",
app.Version = version.Version() Version: version.Version(),
app.Action = func(ctx *cli.Context) error { Action: func(ctx *cli.Context) error {
if err := startNode(ctx); err != nil { if err := startNode(ctx); err != nil {
return cli.Exit(err.Error(), 1) return cli.Exit(err.Error(), 1)
}
return nil
}
app.Commands = []*cli.Command{
walletcommands.Commands,
accountcommands.Commands,
slashingprotectioncommands.Commands,
dbcommands.Commands,
web.Commands,
}
app.Flags = appFlags
app.Before = func(ctx *cli.Context) error {
// Load flags from config file, if specified.
if err := cmd.LoadFlagsFromConfig(ctx, app.Flags); err != nil {
return err
}
format := ctx.String(cmd.LogFormat.Name)
switch format {
case "text":
formatter := new(prefixed.TextFormatter)
formatter.TimestampFormat = "2006-01-02 15:04:05"
formatter.FullTimestamp = true
// If persistent log files are written - we disable the log messages coloring because
// the colors are ANSI codes and seen as Gibberish in the log files.
formatter.DisableColors = ctx.String(cmd.LogFileName.Name) != ""
logrus.SetFormatter(formatter)
case "fluentd":
f := joonix.NewFormatter()
if err := joonix.DisableTimestampFormat(f); err != nil {
panic(err)
} }
logrus.SetFormatter(f) return nil
case "json": },
logrus.SetFormatter(&logrus.JSONFormatter{}) Commands: []*cli.Command{
case "journald": walletcommands.Commands,
if err := journald.Enable(); err != nil { accountcommands.Commands,
slashingprotectioncommands.Commands,
dbcommands.Commands,
web.Commands,
},
Flags: appFlags,
Before: func(ctx *cli.Context) error {
// Load flags from config file, if specified.
if err := cmd.LoadFlagsFromConfig(ctx, appFlags); err != nil {
return err return err
} }
default:
return fmt.Errorf("unknown log format %s", format)
}
logFileName := ctx.String(cmd.LogFileName.Name) format := ctx.String(cmd.LogFormat.Name)
if logFileName != "" { switch format {
if err := logs.ConfigurePersistentLogging(logFileName); err != nil { case "text":
log.WithError(err).Error("Failed to configuring logging to disk.") formatter := new(prefixed.TextFormatter)
formatter.TimestampFormat = "2006-01-02 15:04:05"
formatter.FullTimestamp = true
// If persistent log files are written - we disable the log messages coloring because
// the colors are ANSI codes and seen as Gibberish in the log files.
formatter.DisableColors = ctx.String(cmd.LogFileName.Name) != ""
logrus.SetFormatter(formatter)
case "fluentd":
f := joonix.NewFormatter()
if err := joonix.DisableTimestampFormat(f); err != nil {
panic(err)
}
logrus.SetFormatter(f)
case "json":
logrus.SetFormatter(&logrus.JSONFormatter{})
case "journald":
if err := journald.Enable(); err != nil {
return err
}
default:
return fmt.Errorf("unknown log format %s", format)
} }
}
// Fix data dir for Windows users. logFileName := ctx.String(cmd.LogFileName.Name)
outdatedDataDir := filepath.Join(file.HomeDir(), "AppData", "Roaming", "Eth2Validators") if logFileName != "" {
currentDataDir := flags.DefaultValidatorDir() if err := logs.ConfigurePersistentLogging(logFileName); err != nil {
if err := cmd.FixDefaultDataDir(outdatedDataDir, currentDataDir); err != nil { log.WithError(err).Error("Failed to configuring logging to disk.")
log.WithError(err).Error("Cannot update data directory") }
} }
if err := debug.Setup(ctx); err != nil { // Fix data dir for Windows users.
return err outdatedDataDir := filepath.Join(file.HomeDir(), "AppData", "Roaming", "Eth2Validators")
} currentDataDir := flags.DefaultValidatorDir()
return cmd.ValidateNoArgs(ctx) if err := cmd.FixDefaultDataDir(outdatedDataDir, currentDataDir); err != nil {
} log.WithError(err).Error("Cannot update data directory")
}
app.After = func(ctx *cli.Context) error { if err := debug.Setup(ctx); err != nil {
debug.Exit(ctx) return err
return nil }
return cmd.ValidateNoArgs(ctx)
},
After: func(ctx *cli.Context) error {
debug.Exit(ctx)
return nil
},
} }
defer func() { defer func() {

View File

@@ -13,7 +13,7 @@ import (
var Commands = &cli.Command{ var Commands = &cli.Command{
Name: "slashing-protection-history", Name: "slashing-protection-history",
Category: "slashing-protection-history", Category: "slashing-protection-history",
Usage: "defines commands for interacting your validator's slashing protection history", Usage: "Defines commands for interacting your validator's slashing protection history.",
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
{ {
Name: "export", Name: "export",

View File

@@ -14,25 +14,33 @@ import (
var appHelpTemplate = `NAME: var appHelpTemplate = `NAME:
{{.App.Name}} - {{.App.Usage}} {{.App.Name}} - {{.App.Usage}}
USAGE: USAGE:
{{.App.HelpName}} [options]{{if .App.Commands}} command [command options]{{end}} {{if .App.ArgsUsage}}{{.App.ArgsUsage}}{{else}}[arguments...]{{end}} {{.App.HelpName}} [options]{{if .App.Commands}} command [command options]{{end}} {{if .App.ArgsUsage}}{{.App.ArgsUsage}}{{else}}[arguments...]{{end}}
{{if .App.Version}} {{if .App.Version}}
AUTHOR: VERSION:
{{range .App.Authors}}{{ . }}{{end}} {{.App.Version}}
{{end}}{{if .App.Commands}} {{end -}}
GLOBAL OPTIONS: {{if len .App.Authors}}
AUTHORS:
{{range .App.Authors}}{{ . }}
{{end -}}
{{end -}}
{{if .App.Commands}}
global OPTIONS:
{{range .App.Commands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}} {{range .App.Commands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}}
{{end}}{{end}}{{if .FlagGroups}} {{end -}}
{{end -}}
{{if .FlagGroups}}
{{range .FlagGroups}}{{.Name}} OPTIONS: {{range .FlagGroups}}{{.Name}} OPTIONS:
{{range .Flags}}{{.}} {{range .Flags}}{{.}}
{{end}} {{end}}
{{end}}{{end}}{{if .App.Copyright }} {{end -}}
{{end -}}
{{if .App.Copyright }}
COPYRIGHT: COPYRIGHT:
{{.App.Copyright}} {{.App.Copyright}}
VERSION: {{end -}}
{{.App.Version}}
{{end}}{{if len .App.Authors}}
{{end}}
` `
type flagGroup struct { type flagGroup struct {

View File

@@ -15,7 +15,7 @@ var log = logrus.WithField("prefix", "wallet")
var Commands = &cli.Command{ var Commands = &cli.Command{
Name: "wallet", Name: "wallet",
Category: "wallet", Category: "wallet",
Usage: "defines commands for interacting with Ethereum validator wallets", Usage: "Defines commands for interacting with Ethereum validator wallets.",
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
{ {
Name: "create", Name: "create",

View File

@@ -15,7 +15,7 @@ import (
var Commands = &cli.Command{ var Commands = &cli.Command{
Name: "web", Name: "web",
Category: "web", Category: "web",
Usage: "defines commands for interacting with the Prysm web interface", Usage: "Defines commands for interacting with the Prysm web interface.",
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
{ {
Name: "generate-auth-token", Name: "generate-auth-token",

View File

@@ -10,44 +10,44 @@ var (
// PraterTestnet flag for the multiclient Ethereum consensus testnet. // PraterTestnet flag for the multiclient Ethereum consensus testnet.
PraterTestnet = &cli.BoolFlag{ PraterTestnet = &cli.BoolFlag{
Name: "prater", Name: "prater",
Usage: "Run Prysm configured for the Prater / Goerli test network", Usage: "Runs Prysm configured for the Prater / Goerli test network.",
Aliases: []string{"goerli"}, Aliases: []string{"goerli"},
} }
// SepoliaTestnet flag for the multiclient Ethereum consensus testnet. // SepoliaTestnet flag for the multiclient Ethereum consensus testnet.
SepoliaTestnet = &cli.BoolFlag{ SepoliaTestnet = &cli.BoolFlag{
Name: "sepolia", Name: "sepolia",
Usage: "Run Prysm configured for the Sepolia beacon chain test network", Usage: "Runs Prysm configured for the Sepolia test network.",
} }
// HoleskyTestnet flag for the multiclient Ethereum consensus testnet. // HoleskyTestnet flag for the multiclient Ethereum consensus testnet.
HoleskyTestnet = &cli.BoolFlag{ HoleskyTestnet = &cli.BoolFlag{
Name: "holesky", Name: "holesky",
Usage: "Run Prysm configured for the Holesky beacon chain test network", Usage: "Runs Prysm configured for the Holesky test network.",
} }
// Mainnet flag for easier tooling, no-op // Mainnet flag for easier tooling, no-op
Mainnet = &cli.BoolFlag{ Mainnet = &cli.BoolFlag{
Value: true, Value: true,
Name: "mainnet", Name: "mainnet",
Usage: "Run on Ethereum Beacon Chain Main Net. This is the default and can be omitted.", Usage: "Runs on Ethereum main network. This is the default and can be omitted.",
} }
devModeFlag = &cli.BoolFlag{ devModeFlag = &cli.BoolFlag{
Name: "dev", Name: "dev",
Usage: "Enable experimental features still in development. These features may not be stable.", Usage: "Enables experimental features still in development. These features may not be stable.",
} }
enableExperimentalState = &cli.BoolFlag{ enableExperimentalState = &cli.BoolFlag{
Name: "enable-experimental-state", Name: "enable-experimental-state",
Usage: "Turn on the latest and greatest (but potentially unstable) changes to the beacon state", Usage: "Turns on the latest and greatest (but potentially unstable) changes to the beacon state.",
} }
writeSSZStateTransitionsFlag = &cli.BoolFlag{ writeSSZStateTransitionsFlag = &cli.BoolFlag{
Name: "interop-write-ssz-state-transitions", Name: "interop-write-ssz-state-transitions",
Usage: "Write ssz states to disk after attempted state transition", Usage: "Writes SSZ states to disk after attempted state transitio.",
} }
disableGRPCConnectionLogging = &cli.BoolFlag{ disableGRPCConnectionLogging = &cli.BoolFlag{
Name: "disable-grpc-connection-logging", Name: "disable-grpc-connection-logging",
Usage: "Disables displaying logs for newly connected grpc clients", Usage: "Disables displaying logs for newly connected grpc clients.",
} }
disableReorgLateBlocks = &cli.BoolFlag{ disableReorgLateBlocks = &cli.BoolFlag{
Name: "disable-reorg-late-blocks", Name: "disable-reorg-late-blocks",
Usage: "Disables reorgs of late blocks", Usage: "Disables reorgs of late blocks.",
} }
disablePeerScorer = &cli.BoolFlag{ disablePeerScorer = &cli.BoolFlag{
Name: "disable-peer-scorer", Name: "disable-peer-scorer",
@@ -55,31 +55,31 @@ var (
} }
writeWalletPasswordOnWebOnboarding = &cli.BoolFlag{ writeWalletPasswordOnWebOnboarding = &cli.BoolFlag{
Name: "write-wallet-password-on-web-onboarding", Name: "write-wallet-password-on-web-onboarding",
Usage: "(Danger): Writes the wallet password to the wallet directory on completing Prysm web onboarding. " + Usage: `(Danger): Writes the wallet password to the wallet directory on completing Prysm web onboarding.
"We recommend against this flag unless you are an advanced user.", We recommend against this flag unless you are an advanced user.`,
} }
aggregateFirstInterval = &cli.DurationFlag{ aggregateFirstInterval = &cli.DurationFlag{
Name: "aggregate-first-interval", Name: "aggregate-first-interval",
Usage: "(Advanced): Specifies the first interval in which attestations are aggregated in the slot (typically unnaggregated attestations are aggregated in this interval)", Usage: "(Advanced): Specifies the first interval in which attestations are aggregated in the slot (typically unnaggregated attestations are aggregated in this interval).",
Value: 7000 * time.Millisecond, Value: 7000 * time.Millisecond,
Hidden: true, Hidden: true,
} }
aggregateSecondInterval = &cli.DurationFlag{ aggregateSecondInterval = &cli.DurationFlag{
Name: "aggregate-second-interval", Name: "aggregate-second-interval",
Usage: "(Advanced): Specifies the second interval in which attestations are aggregated in the slot", Usage: "(Advanced): Specifies the second interval in which attestations are aggregated in the slot.",
Value: 9500 * time.Millisecond, Value: 9500 * time.Millisecond,
Hidden: true, Hidden: true,
} }
aggregateThirdInterval = &cli.DurationFlag{ aggregateThirdInterval = &cli.DurationFlag{
Name: "aggregate-third-interval", Name: "aggregate-third-interval",
Usage: "(Advanced): Specifies the third interval in which attestations are aggregated in the slot", Usage: "(Advanced): Specifies the third interval in which attestations are aggregated in the slot.",
Value: 11800 * time.Millisecond, Value: 11800 * time.Millisecond,
Hidden: true, Hidden: true,
} }
dynamicKeyReloadDebounceInterval = &cli.DurationFlag{ dynamicKeyReloadDebounceInterval = &cli.DurationFlag{
Name: "dynamic-key-reload-debounce-interval", Name: "dynamic-key-reload-debounce-interval",
Usage: "(Advanced): Specifies the time duration the validator waits to reload new keys if they have " + Usage: `(Advanced): Specifies the time duration the validator waits to reload new keys if they have changed on disk.
"changed on disk. Default 1s, can be any type of duration such as 1.5s, 1000ms, 1m.", Can be any type of duration such as 1.5s, 1000ms, 1m.`,
Value: time.Second, Value: time.Second,
} }
disableBroadcastSlashingFlag = &cli.BoolFlag{ disableBroadcastSlashingFlag = &cli.BoolFlag{
@@ -88,25 +88,25 @@ var (
} }
attestTimely = &cli.BoolFlag{ attestTimely = &cli.BoolFlag{
Name: "attest-timely", Name: "attest-timely",
Usage: "Fixes validator can attest timely after current block processes. See #8185 for more details", Usage: "Fixes validator can attest timely after current block processes. See #8185 for more details.",
} }
enableSlasherFlag = &cli.BoolFlag{ enableSlasherFlag = &cli.BoolFlag{
Name: "slasher", Name: "slasher",
Usage: "Enables a slasher in the beacon node for detecting slashable offenses", Usage: "Enables a slasher in the beacon node for detecting slashable offenses.",
} }
enableSlashingProtectionPruning = &cli.BoolFlag{ enableSlashingProtectionPruning = &cli.BoolFlag{
Name: "enable-slashing-protection-history-pruning", Name: "enable-slashing-protection-history-pruning",
Usage: "Enables the pruning of the validator client's slashing protection database", Usage: "Enables the pruning of the validator client's slashing protection database.",
} }
enableDoppelGangerProtection = &cli.BoolFlag{ enableDoppelGangerProtection = &cli.BoolFlag{
Name: "enable-doppelganger", Name: "enable-doppelganger",
Usage: "Enables the validator to perform a doppelganger check. (Warning): This is not " + Usage: `Enables the validator to perform a doppelganger check.
"a foolproof method to find duplicate instances in the network. Your validator will still be" + This is not "a foolproof method to find duplicate instances in the network.
" vulnerable if it is being run in unsafe configurations.", Your validator will still be vulnerable if it is being run in unsafe configurations.`,
} }
disableStakinContractCheck = &cli.BoolFlag{ disableStakinContractCheck = &cli.BoolFlag{
Name: "disable-staking-contract-check", Name: "disable-staking-contract-check",
Usage: "Disables checking of staking contract deposits when proposing blocks, useful for devnets", Usage: "Disables checking of staking contract deposits when proposing blocks, useful for devnets.",
} }
enableHistoricalSpaceRepresentation = &cli.BoolFlag{ enableHistoricalSpaceRepresentation = &cli.BoolFlag{
Name: "enable-historical-state-representation", Name: "enable-historical-state-representation",
@@ -116,52 +116,52 @@ var (
} }
enableStartupOptimistic = &cli.BoolFlag{ enableStartupOptimistic = &cli.BoolFlag{
Name: "startup-optimistic", Name: "startup-optimistic",
Usage: "Treats every block as optimistically synced at launch. Use with caution", Usage: "Treats every block as optimistically synced at launch. Use with caution.",
Value: false, Value: false,
Hidden: true, Hidden: true,
} }
enableFullSSZDataLogging = &cli.BoolFlag{ enableFullSSZDataLogging = &cli.BoolFlag{
Name: "enable-full-ssz-data-logging", Name: "enable-full-ssz-data-logging",
Usage: "Enables displaying logs for full ssz data on rejected gossip messages", Usage: "Enables displaying logs for full ssz data on rejected gossip messages.",
} }
SaveFullExecutionPayloads = &cli.BoolFlag{ SaveFullExecutionPayloads = &cli.BoolFlag{
Name: "save-full-execution-payloads", Name: "save-full-execution-payloads",
Usage: "Saves beacon blocks with full execution payloads instead of execution payload headers in the database", Usage: "Saves beacon blocks with full execution payloads instead of execution payload headers in the database.",
} }
EnableBeaconRESTApi = &cli.BoolFlag{ EnableBeaconRESTApi = &cli.BoolFlag{
Name: "enable-beacon-rest-api", Name: "enable-beacon-rest-api",
Usage: "Experimental enable of the beacon REST API when querying a beacon node", Usage: "(Experimental): Enables of the beacon REST API when querying a beacon node.",
} }
enableVerboseSigVerification = &cli.BoolFlag{ enableVerboseSigVerification = &cli.BoolFlag{
Name: "enable-verbose-sig-verification", Name: "enable-verbose-sig-verification",
Usage: "Enables identifying invalid signatures if batch verification fails when processing block", Usage: "Enables identifying invalid signatures if batch verification fails when processing block.",
} }
disableOptionalEngineMethods = &cli.BoolFlag{ disableOptionalEngineMethods = &cli.BoolFlag{
Name: "disable-optional-engine-methods", Name: "disable-optional-engine-methods",
Usage: "Disables the optional engine methods", Usage: "Disables the optional engine methods.",
} }
prepareAllPayloads = &cli.BoolFlag{ prepareAllPayloads = &cli.BoolFlag{
Name: "prepare-all-payloads", Name: "prepare-all-payloads",
Usage: "Informs the engine to prepare all local payloads. Useful for relayers and builders", Usage: "Informs the engine to prepare all local payloads. Useful for relayers and builders.",
} }
EnableEIP4881 = &cli.BoolFlag{ EnableEIP4881 = &cli.BoolFlag{
Name: "enable-eip-4881", Name: "enable-eip-4881",
Usage: "Enables the deposit tree specified in EIP4881", Usage: "Enables the deposit tree specified in EIP-4881.",
} }
disableResourceManager = &cli.BoolFlag{ disableResourceManager = &cli.BoolFlag{
Name: "disable-resource-manager", Name: "disable-resource-manager",
Usage: "Disables running the libp2p resource manager", Usage: "Disables running the libp2p resource manager.",
} }
// DisableRegistrationCache a flag for disabling the validator registration cache and use db instead. // DisableRegistrationCache a flag for disabling the validator registration cache and use db instead.
DisableRegistrationCache = &cli.BoolFlag{ DisableRegistrationCache = &cli.BoolFlag{
Name: "disable-registration-cache", Name: "disable-registration-cache",
Usage: "A temporary flag for disabling the validator registration cache instead of using the db. note: registrations do not clear on restart while using the db", Usage: "Temporary flag for disabling the validator registration cache instead of using the DB. Note: registrations do not clear on restart while using the DB.",
} }
disableAggregateParallel = &cli.BoolFlag{ disableAggregateParallel = &cli.BoolFlag{
Name: "disable-aggregate-parallel", Name: "disable-aggregate-parallel",
Usage: "Disables parallel aggregation of attestations", Usage: "Disables parallel aggregation of attestations.",
} }
) )

View File

@@ -51,45 +51,45 @@ var (
// PProfFlag to enable pprof HTTP server. // PProfFlag to enable pprof HTTP server.
PProfFlag = &cli.BoolFlag{ PProfFlag = &cli.BoolFlag{
Name: "pprof", Name: "pprof",
Usage: "Enable the pprof HTTP server", Usage: "Enables the pprof HTTP server.",
} }
// PProfPortFlag to specify HTTP server listening port. // PProfPortFlag to specify HTTP server listening port.
PProfPortFlag = &cli.IntFlag{ PProfPortFlag = &cli.IntFlag{
Name: "pprofport", Name: "pprofport",
Usage: "pprof HTTP server listening port", Usage: "pprof HTTP server listening port.",
Value: 6060, Value: 6060,
} }
// PProfAddrFlag to specify HTTP server address. // PProfAddrFlag to specify HTTP server address.
PProfAddrFlag = &cli.StringFlag{ PProfAddrFlag = &cli.StringFlag{
Name: "pprofaddr", Name: "pprofaddr",
Usage: "pprof HTTP server listening interface", Usage: "pprof HTTP server listening interface.",
Value: "127.0.0.1", Value: "127.0.0.1",
} }
// MemProfileRateFlag to specify the mem profiling rate. // MemProfileRateFlag to specify the mem profiling rate.
MemProfileRateFlag = &cli.IntFlag{ MemProfileRateFlag = &cli.IntFlag{
Name: "memprofilerate", Name: "memprofilerate",
Usage: "Turn on memory profiling with the given rate", Usage: "Turns on memory profiling with the given rate.",
Value: runtime.MemProfileRate, Value: runtime.MemProfileRate,
} }
// MutexProfileFractionFlag to specify the mutex profiling rate. // MutexProfileFractionFlag to specify the mutex profiling rate.
MutexProfileFractionFlag = &cli.IntFlag{ MutexProfileFractionFlag = &cli.IntFlag{
Name: "mutexprofilefraction", Name: "mutexprofilefraction",
Usage: "Turn on mutex profiling with the given rate", Usage: "Turns on mutex profiling with the given rate.",
} }
// BlockProfileRateFlag to specify the block profiling rate. // BlockProfileRateFlag to specify the block profiling rate.
BlockProfileRateFlag = &cli.IntFlag{ BlockProfileRateFlag = &cli.IntFlag{
Name: "blockprofilerate", Name: "blockprofilerate",
Usage: "Turn on block profiling with the given rate", Usage: "Turns on block profiling with the given rate.",
} }
// CPUProfileFlag to specify where to write the CPU profile. // CPUProfileFlag to specify where to write the CPU profile.
CPUProfileFlag = &cli.StringFlag{ CPUProfileFlag = &cli.StringFlag{
Name: "cpuprofile", Name: "cpuprofile",
Usage: "Write CPU profile to the given file", Usage: "Writes CPU profile to the given file.",
} }
// TraceFlag to specify where to write the trace execution profile. // TraceFlag to specify where to write the trace execution profile.
TraceFlag = &cli.StringFlag{ TraceFlag = &cli.StringFlag{
Name: "trace", Name: "trace",
Usage: "Write execution trace to the given file", Usage: "Writes execution trace to the given file.",
} }
) )