mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Clarify No Wallet Found Error Messages (#7609)
* clarify no wallet found error messages * extract error * fix tests Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -41,9 +41,7 @@ const (
|
||||
// keystore.json files, which are compatible with importing in other eth2 clients.
|
||||
func BackupAccountsCli(cliCtx *cli.Context) error {
|
||||
w, err := wallet.OpenWalletOrElseCli(cliCtx, func(cliCtx *cli.Context) (*wallet.Wallet, error) {
|
||||
return nil, errors.New(
|
||||
"no wallet found, nothing to backup. Create a new wallet by running wallet create",
|
||||
)
|
||||
return nil, wallet.ErrNoWalletFound
|
||||
})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not initialize wallet")
|
||||
|
||||
@@ -28,9 +28,7 @@ type DeleteAccountConfig struct {
|
||||
// This function uses the CLI to extract necessary values.
|
||||
func DeleteAccountCli(cliCtx *cli.Context) error {
|
||||
w, err := wallet.OpenWalletOrElseCli(cliCtx, func(cliCtx *cli.Context) (*wallet.Wallet, error) {
|
||||
return nil, errors.New(
|
||||
"no wallet found, nothing to delete",
|
||||
)
|
||||
return nil, wallet.ErrNoWalletFound
|
||||
})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not open wallet")
|
||||
|
||||
@@ -76,9 +76,7 @@ func ExitAccountsCli(cliCtx *cli.Context, r io.Reader) error {
|
||||
|
||||
func prepareWallet(cliCtx *cli.Context) ([][48]byte, keymanager.IKeymanager, error) {
|
||||
w, err := wallet.OpenWalletOrElseCli(cliCtx, func(cliCtx *cli.Context) (*wallet.Wallet, error) {
|
||||
return nil, errors.New(
|
||||
"no wallet found, no accounts to exit",
|
||||
)
|
||||
return nil, wallet.ErrNoWalletFound
|
||||
})
|
||||
if err != nil {
|
||||
return nil, nil, errors.Wrap(err, "could not open wallet")
|
||||
|
||||
@@ -21,9 +21,7 @@ import (
|
||||
// ListAccountsCli displays all available validator accounts in a Prysm wallet.
|
||||
func ListAccountsCli(cliCtx *cli.Context) error {
|
||||
w, err := wallet.OpenWalletOrElseCli(cliCtx, func(cliCtx *cli.Context) (*wallet.Wallet, error) {
|
||||
return nil, errors.New(
|
||||
"no wallet found, no accounts to list",
|
||||
)
|
||||
return nil, wallet.ErrNoWalletFound
|
||||
})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not open wallet")
|
||||
|
||||
@@ -49,7 +49,9 @@ const (
|
||||
var (
|
||||
// ErrNoWalletFound signifies there was no wallet directory found on-disk.
|
||||
ErrNoWalletFound = errors.New(
|
||||
"no wallet found at path, please create a new wallet using `./prysm.sh validator wallet create`",
|
||||
"no wallet found. You can create a new wallet with validator wallet create." +
|
||||
"If you already did, perhaps you created a wallet in a custom directory, which you can specify using " +
|
||||
"--wallet-dir=/path/to/my/wallet",
|
||||
)
|
||||
// KeymanagerKindSelections as friendly text.
|
||||
KeymanagerKindSelections = map[keymanager.Kind]string{
|
||||
|
||||
@@ -140,7 +140,7 @@ func Test_IsValid_RandomFiles(t *testing.T) {
|
||||
require.NoError(t, os.MkdirAll(path, params.BeaconIoConfig().ReadWriteExecutePermissions), "Failed to create directory")
|
||||
|
||||
valid, err = wallet.IsValid(path)
|
||||
require.ErrorContains(t, "no wallet found at path", err)
|
||||
require.ErrorContains(t, "no wallet found", err)
|
||||
require.Equal(t, false, valid)
|
||||
|
||||
walletDir := filepath.Join(path, "direct")
|
||||
|
||||
@@ -16,9 +16,7 @@ import (
|
||||
// for HD wallets, and more.
|
||||
func EditWalletConfigurationCli(cliCtx *cli.Context) error {
|
||||
w, err := wallet.OpenWalletOrElseCli(cliCtx, func(cliCtx *cli.Context) (*wallet.Wallet, error) {
|
||||
return nil, errors.New(
|
||||
"no wallet found, no configuration to edit",
|
||||
)
|
||||
return nil, wallet.ErrNoWalletFound
|
||||
})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not open wallet")
|
||||
|
||||
Reference in New Issue
Block a user