prysm-pulse/validator/accounts/v2/cmd_accounts.go
Raul Jordan ecbab20bad
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

168 lines
5.2 KiB
Go

package v2
import (
"os"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/validator/flags"
"github.com/urfave/cli/v2"
)
// AccountCommands for accounts-v2 for Prysm validators.
var AccountCommands = &cli.Command{
Name: "accounts-v2",
Category: "accounts",
Usage: "defines commands for interacting with eth2 validator accounts (work in progress)",
Subcommands: []*cli.Command{
// AccountCommands for accounts-v2 for Prysm validators.
{
Name: "create",
Description: `creates a new validator account for eth2. If no wallet exists at the given wallet path, creates a new wallet for a user based on
specified input, capable of creating a direct, derived, or remote wallet.
this command outputs a deposit data string which is required to become a validator in eth2.`,
Flags: []cli.Flag{
flags.WalletDirFlag,
flags.WalletPasswordFileFlag,
flags.AccountPasswordFileFlag,
flags.NumAccountsFlag,
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
flags.DeprecatedPasswordsDirFlag,
},
Action: func(cliCtx *cli.Context) error {
featureconfig.ConfigureValidator(cliCtx)
if err := CreateAccountCli(cliCtx); err != nil {
log.Fatalf("Could not create new account: %v", err)
}
return nil
},
},
{
Name: "delete",
Description: `deletes the selected accounts from a users wallet.`,
Flags: []cli.Flag{
flags.WalletDirFlag,
flags.WalletPasswordFileFlag,
flags.AccountPasswordFileFlag,
flags.DeletePublicKeysFlag,
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
},
Action: func(cliCtx *cli.Context) error {
featureconfig.ConfigureValidator(cliCtx)
if err := DeleteAccountCli(cliCtx); err != nil {
log.Fatalf("Could not delete account: %v", err)
}
return nil
},
},
{
Name: "list",
Description: "Lists all validator accounts in a user's wallet directory",
Flags: []cli.Flag{
flags.WalletDirFlag,
flags.WalletPasswordFileFlag,
flags.ShowDepositDataFlag,
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
flags.DeprecatedPasswordsDirFlag,
},
Action: func(cliCtx *cli.Context) error {
featureconfig.ConfigureValidator(cliCtx)
if err := ListAccountsCli(cliCtx); err != nil {
log.Fatalf("Could not list accounts: %v", err)
}
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: []cli.Flag{
flags.WalletDirFlag,
flags.WalletPasswordFileFlag,
flags.BackupDirFlag,
flags.BackupPublicKeysFlag,
flags.BackupPasswordFile,
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
},
Action: func(cliCtx *cli.Context) error {
featureconfig.ConfigureValidator(cliCtx)
if err := BackupAccountsCli(cliCtx); err != nil {
log.Fatalf("Could not backup accounts: %v", err)
}
return nil
},
},
{
Name: "import",
Description: `imports eth2 validator accounts stored in EIP-2335 keystore.json files from an external directory`,
Flags: []cli.Flag{
flags.WalletDirFlag,
flags.KeysDirFlag,
flags.WalletPasswordFileFlag,
flags.AccountPasswordFileFlag,
flags.ImportPrivateKeyFileFlag,
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
flags.DeprecatedPasswordsDirFlag,
},
Action: func(cliCtx *cli.Context) error {
featureconfig.ConfigureValidator(cliCtx)
if err := ImportAccountsCli(cliCtx); err != nil {
log.Fatalf("Could not import accounts: %v", err)
}
return nil
},
},
{
Name: "voluntary-exit",
Description: "Performs a voluntary exit on selected accounts",
Flags: []cli.Flag{
flags.WalletDirFlag,
flags.WalletPasswordFileFlag,
flags.AccountPasswordFileFlag,
flags.VoluntaryExitPublicKeysFlag,
featureconfig.AltonaTestnet,
featureconfig.OnyxTestnet,
},
Action: func(cliCtx *cli.Context) error {
featureconfig.ConfigureValidator(cliCtx)
if err := ExitAccountsUnimplemented(cliCtx, os.Stdin); err != nil {
log.Fatalf("Could not perform voluntary exit: %v", err)
}
return nil
},
},
{
Name: "deposit",
Description: "Submits a deposit to the eth2 deposit contract for a validator key by connecting " +
"to an eth1 endpoint to submit a transaction. Requires signing the transaction with an eth1 private key",
Flags: []cli.Flag{
flags.WalletDirFlag,
flags.WalletPasswordFileFlag,
flags.HTTPWeb3ProviderFlag,
flags.Eth1KeystoreUTCPathFlag,
flags.Eth1KeystorePasswordFileFlag,
flags.Eth1PrivateKeyFileFlag,
flags.DepositDelaySecondsFlag,
flags.DepositContractAddressFlag,
flags.DepositPublicKeysFlag,
flags.SkipDepositConfirmationFlag,
flags.DepositAllAccountsFlag,
},
Action: func(cliCtx *cli.Context) error {
featureconfig.ConfigureValidator(cliCtx)
if err := SendDepositCli(cliCtx); err != nil {
log.Fatalf("Could not send validator deposit(s): %v", err)
}
return nil
},
},
},
}