cli

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package cli defines the urfave/cli/v2 application, flag schema, and input validation for eth-deposit-gen. It converts raw CLI flags into a typed Config and invokes the caller-supplied run function only after all validations pass.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewApp

func NewApp(run func(context.Context, Config) error) *ucli.App

NewApp constructs and returns a configured *cli.App. The run callback receives a validated Config; it is only invoked when all flags are present and valid. Validation errors are returned as cli.Exit errors (exit code 1) so that urfave can print them to ErrWriter and exit cleanly.

Types

type Config

type Config struct {
	// KeystoreDir is the filesystem path to the directory containing EIP-2335 JSON keystore files.
	KeystoreDir string

	// Pubkeys is the decoded list of 48-byte BLS12-381 G1 compressed points.
	Pubkeys [][48]byte

	// Network identifies the Ethereum consensus network (mainnet or hoodi).
	Network network.Network

	// OutputDir is the validated, writable directory for deposit_data-<ts>.json.
	OutputDir string

	// PassphraseEnv is the name of the environment variable holding the keystore
	// passphrase. An empty string means the tool will fall back to a TTY prompt.
	PassphraseEnv string

	// MainnetAck is true when the operator passed --i-understand-this-is-mainnet,
	// explicitly acknowledging that mainnet deposit data has irreversible financial
	// consequences. Required when Network == network.Mainnet.
	//
	// NOTE: this field may be true for non-mainnet networks if the flag was supplied.
	// Always evaluate it in conjunction with Network == network.Mainnet. The mainnet
	// safety gate is enforced at the CLI layer (before Config is built) and as a
	// defense-in-depth check inside runWithDeps.
	MainnetAck bool

	// DryRun is true when --dry-run is passed. When set, the tool writes JSON to
	// stdout instead of creating a file on disk. The output-dir is validated but
	// nothing is written there. The summary line and sha256 still print to stderr.
	DryRun bool

	// Verbose enables debug-level log output when true. Default is false (Info level).
	Verbose bool

	// JSONLogs selects the JSON log handler when true. Default is false (text handler).
	JSONLogs bool

	// Parallel is the number of concurrent worker goroutines used to process
	// pubkeys. Valid range: 1 to runtime.NumCPU()*4. Default is 1 (sequential).
	// Values <= 0 or > runtime.NumCPU()*4 are rejected with a usage error (exit code 2).
	Parallel int
	// VerifyWithDepositCLI enables optional post-generation cross-check by shelling
	// out to the user's installed staking-deposit-cli. Off by default; opt-in via
	// --verify-with-deposit-cli. Skipped when DryRun is true (no output file exists).
	VerifyWithDepositCLI bool

	// DepositCLIPath is the name or path of the staking-deposit-cli binary to invoke
	// for post-generation verification. Defaults to "deposit". Only used when
	// VerifyWithDepositCLI is true.
	//
	// Minimum supported staking-deposit-cli version: 2.7.0 (same as CLIVersion in main.go).
	DepositCLIPath string
}

Config holds the validated, parsed inputs from the CLI flags.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL