prysm-pulse/cmd/validator/accounts/accounts.go

187 lines
5.5 KiB
Go
Raw Normal View History

package accounts
import (
"os"
"github.com/prysmaticlabs/prysm/v5/cmd"
"github.com/prysmaticlabs/prysm/v5/cmd/validator/flags"
"github.com/prysmaticlabs/prysm/v5/config/features"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
)
var log = logrus.WithField("prefix", "accounts")
// Commands for managing Prysm validator accounts.
var Commands = &cli.Command{
Name: "accounts",
Category: "accounts",
Usage: "Defines commands for interacting with Ethereum validator accounts.",
Subcommands: []*cli.Command{
{
Name: "delete",
Description: `deletes the selected accounts from a users wallet.`,
Flags: cmd.WrapFlags([]cli.Flag{
flags.WalletDirFlag,
flags.WalletPasswordFileFlag,
flags.DeletePublicKeysFlag,
features.Mainnet,
2023-01-31 01:09:40 +00:00
features.PulseChain,
features.PraterTestnet,
2023-04-19 18:36:39 +00:00
features.PulseChainTestnetV4,
features.SepoliaTestnet,
features.HoleskyTestnet,
}),
Before: func(cliCtx *cli.Context) error {
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
return err
}
return features.ConfigureValidator(cliCtx)
},
Action: func(cliCtx *cli.Context) error {
if err := accountsDelete(cliCtx); err != nil {
log.WithError(err).Fatal("Could not delete account")
}
return nil
},
},
{
Name: "list",
Description: "Lists all validator accounts in a user's wallet directory",
Flags: cmd.WrapFlags([]cli.Flag{
flags.WalletDirFlag,
flags.WalletPasswordFileFlag,
flags.ShowPrivateKeysFlag,
flags.ListValidatorIndices,
flags.BeaconRPCProviderFlag,
cmd.GrpcMaxCallRecvMsgSizeFlag,
flags.CertFlag,
flags.GrpcHeadersFlag,
flags.GrpcRetriesFlag,
flags.GrpcRetryDelayFlag,
features.Mainnet,
2023-01-31 01:09:40 +00:00
features.PulseChain,
features.PraterTestnet,
2023-04-19 18:36:39 +00:00
features.PulseChainTestnetV4,
features.SepoliaTestnet,
features.HoleskyTestnet,
}),
Before: func(cliCtx *cli.Context) error {
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
return err
}
return features.ConfigureValidator(cliCtx)
},
Action: func(cliCtx *cli.Context) error {
if err := accountsList(cliCtx); err != nil {
log.WithError(err).Fatal("Could not list accounts")
}
return nil
},
},
{
Name: "backup",
Description: "backup accounts into EIP-2335 compliant keystore.json files zipped into a backup.zip file " +
"at a desired output directory. Accounts to backup can also " +
"be specified programmatically via a --backup-for-public-keys flag which specifies a comma-separated " +
"list of hex string public keys",
Flags: cmd.WrapFlags([]cli.Flag{
flags.WalletDirFlag,
Begin Dynamic Rescan of Validating Keys (#6963) * begin on dynamic key rescan * Merge branch 'master' into dynamic-rescan * begin dynamic rescan * fsnotify to listen for rescan dir changes * recheck for slashing protection * lint * Merge branch 'master' into dynamic-rescan * less aggressive recheck interval * imports * Merge branch 'dynamic-rescan' of github.com:prysmaticlabs/prysm into dynamic-rescan * resolve confs * listen for file changes for accounts file * reload accounts from keystore * begin fixing rescan test * add event feed * fix confs * fix conf * fix broken tests * Merge branch 'master' into dynamic-rescan * simplify lines * do nothing if no subscribers * Merge branch 'dynamic-rescan' of github.com:prysmaticlabs/prysm into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * fix tests * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * gaz * Merge branch 'dynamic-rescan' of github.com:prysmaticlabs/prysm into dynamic-rescan * ident * Update WORKSPACE * gaz * Merge branch 'dynamic-rescan' of github.com:prysmaticlabs/prysm into dynamic-rescan * add keys on service start * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * ensure debounce util works * Merge branch 'dynamic-rescan' of github.com:prysmaticlabs/prysm into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * complete refresh, debounce test, and ensure works at runtime * Merge branch 'dynamic-rescan' of github.com:prysmaticlabs/prysm into dynamic-rescan * imports and remove log * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * Merge refs/heads/master into dynamic-rescan * resolve confs * fix up e2e tests * Merge branch 'dynamic-rescan' of github.com:prysmaticlabs/prysm into dynamic-rescan * fix up e2e * Merge refs/heads/master into dynamic-rescan
2020-08-31 23:38:20 +00:00
flags.WalletPasswordFileFlag,
Accounts V2: Refactor prompts, deduplicate into directory and password (#6674) * Refactor input code, deduplicate into directory and password * Change to filepath * Rename * Make consts visible to whole validator package * Fix * Try commands and fix * Fix defaults * Fixes * Merge branch 'master' into refactor-input-prompts * Merge refs/heads/master into refactor-input-prompts * Merge refs/heads/master into refactor-input-prompts * Merge refs/heads/master into refactor-input-prompts * Merge refs/heads/master into refactor-input-prompts * Remove consts and add comment * Merge branch 'refactor-input-prompts' of github.com:prysmaticlabs/prysm into refactor-input-prompts * Undo * Fixes * Update validator/accounts/v2/prompt.go * Merge refs/heads/master into refactor-input-prompts * gofmt * Merge refs/heads/master into refactor-input-prompts * Merge refs/heads/master into refactor-input-prompts * Merge refs/heads/master into refactor-input-prompts * Merge refs/heads/master into refactor-input-prompts * Merge branch 'master' into refactor-input-prompts * Merge refs/heads/master into refactor-input-prompts * Fix * Merge refs/heads/master into refactor-input-prompts * Merge refs/heads/master into refactor-input-prompts * Accounts V2: Simplify Wallet Save/Read To and From Disk Functions (#6686) * simplify wallet functions * fix build * futher simplify wallet * simplify read/write methods * move direct functions to direct keymanager * further move direct km specific funcs * cleanup * simplify the direct tests * fixed tests * lint * further simplify * tidy * fix config write * fixed test Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> * conflict resolution * trim
2020-07-23 03:10:23 +00:00
flags.BackupDirFlag,
flags.BackupPublicKeysFlag,
flags.BackupPasswordFile,
features.Mainnet,
2023-01-31 01:09:40 +00:00
features.PulseChain,
features.PraterTestnet,
2023-04-19 18:36:39 +00:00
features.PulseChainTestnetV4,
features.SepoliaTestnet,
features.HoleskyTestnet,
}),
Before: func(cliCtx *cli.Context) error {
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
return err
}
return features.ConfigureValidator(cliCtx)
},
Action: func(cliCtx *cli.Context) error {
if err := accountsBackup(cliCtx); err != nil {
log.WithError(err).Fatal("Could not backup accounts")
}
return nil
},
},
{
Name: "import",
Description: `imports Ethereum validator accounts stored in EIP-2335 keystore.json files from an external directory`,
Flags: cmd.WrapFlags([]cli.Flag{
flags.WalletDirFlag,
flags.KeysDirFlag,
flags.WalletPasswordFileFlag,
flags.AccountPasswordFileFlag,
flags.ImportPrivateKeyFileFlag,
features.Mainnet,
2023-01-31 01:09:40 +00:00
features.PulseChain,
features.PraterTestnet,
2023-04-19 18:36:39 +00:00
features.PulseChainTestnetV4,
features.SepoliaTestnet,
features.HoleskyTestnet,
}),
Before: func(cliCtx *cli.Context) error {
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
return err
}
return features.ConfigureValidator(cliCtx)
},
Action: func(cliCtx *cli.Context) error {
if err := accountsImport(cliCtx); err != nil {
log.WithError(err).Fatal("Could not import accounts")
}
return nil
},
},
{
Name: "voluntary-exit",
Description: "Performs a voluntary exit on selected accounts",
Flags: cmd.WrapFlags([]cli.Flag{
flags.WalletDirFlag,
flags.WalletPasswordFileFlag,
flags.AccountPasswordFileFlag,
flags.VoluntaryExitPublicKeysFlag,
flags.BeaconRPCProviderFlag,
flags.Web3SignerURLFlag,
flags.Web3SignerPublicValidatorKeysFlag,
flags.InteropNumValidators,
flags.InteropStartIndex,
cmd.GrpcMaxCallRecvMsgSizeFlag,
flags.CertFlag,
flags.GrpcHeadersFlag,
flags.GrpcRetriesFlag,
flags.GrpcRetryDelayFlag,
flags.ExitAllFlag,
flags.ForceExitFlag,
flags.VoluntaryExitJSONOutputPath,
features.Mainnet,
2023-01-31 01:09:40 +00:00
features.PulseChain,
features.PraterTestnet,
2023-04-19 18:36:39 +00:00
features.PulseChainTestnetV4,
features.SepoliaTestnet,
features.HoleskyTestnet,
}),
Before: func(cliCtx *cli.Context) error {
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
return err
}
return features.ConfigureValidator(cliCtx)
},
Action: func(cliCtx *cli.Context) error {
prysmctl: changeblstoexecutionaddress ( withdrawals) (#11790) * adding unit test for withdrawal * updating to handle api changes * Update cmd/prysmctl/withdrawal/withdrawal.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/withdrawal/cmd.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/withdrawal/withdrawal.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/withdrawal/cmd.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/withdrawal/withdrawal.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/withdrawal/withdrawal.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/withdrawal/withdrawal.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * updating based on feedback * rewording prints * Update cmd/prysmctl/withdrawal/withdrawal.go Co-authored-by: Potuz <potuz@prysmaticlabs.com> * add error handling when status not ok * addressing some of the feedback, adding new tests * adding unit test with error return * adjusting based on review comments * addressing more comments and fixing unit test * updating prompts * migrating some functions to api/client * removing unused function * adding review feedback * removing unused functions * migrating command, old command under accounts still exist * reverting tos.go * fixing bazel lint * fixing build * resolving unused parameter caught by deepsource * fixing unit tests * Update cmd/prysmctl/validator/cmd.go Co-authored-by: Potuz <potuz@prysmaticlabs.com> * Update cmd/prysmctl/validator/cmd.go Co-authored-by: Potuz <potuz@prysmaticlabs.com> * adding in website * addressing review comment * adding new verify only flag * Update cmd/prysmctl/validator/withdraw.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/validator/withdraw.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/validator/withdraw.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/validator/withdraw.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update api/client/beacon/client.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update api/client/beacon/client.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update api/client/beacon/client.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update api/client/beacon/client.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/validator/withdraw.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * addressing comments * fixing unit test * Update cmd/prysmctl/validator/cmd.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/validator/cmd.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/validator/cmd.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/validator/cmd.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * address comments * Update cmd/prysmctl/validator/cmd.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * adjusting object for new provided format * adding omit empty * fixing unit test, and linting * adjusting based on cli changes * fixing test data and metadata property * addressing backwards compatability * reverting based on review comment Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: Potuz <potuz@prysmaticlabs.com> Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2023-01-24 10:05:55 +00:00
log.Info("This command will be deprecated in the future in favor of `prysmctl validator exit`")
if err := Exit(cliCtx, os.Stdin); err != nil {
log.WithError(err).Fatal("Could not perform voluntary exit")
}
return nil
},
},
},
}