From ee83524394cdfa359a235421bcc219aa693c7786 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Tue, 8 Mar 2022 07:19:01 -0500 Subject: [PATCH 1/2] Algokey: clarify some error messages. --- cmd/algokey/keyreg.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/algokey/keyreg.go b/cmd/algokey/keyreg.go index 445a07827e..c545b342f9 100644 --- a/cmd/algokey/keyreg.go +++ b/cmd/algokey/keyreg.go @@ -82,7 +82,7 @@ func init() { keyregCmd.Flags().BoolVar(¶ms.offline, "offline", false, "set to bring an account offline") keyregCmd.Flags().StringVarP(¶ms.txFile, "outputFile", "o", "", fmt.Sprintf("write signed transaction to this file, or '%s' to write to stdout", stdoutFilenameValue)) keyregCmd.Flags().StringVar(¶ms.partkeyFile, "keyfile", "", "participation keys to register, file is opened to fetch metadata for the transaction; only specify when bringing an account online to vote in Algorand consensus") - keyregCmd.Flags().StringVar(¶ms.addr, "account", "", "account address to bring offline; only specify when taking an account offline from voting in Algorand consensus") + keyregCmd.Flags().StringVar(¶ms.addr, "account", "", "account to bring offline; only specify when taking an account offline from voting in Algorand consensus") // TODO: move 'bundleGenesisInject' into something that can be imported here instead of using constants. validNetworks = map[string]crypto.Digest{ @@ -144,11 +144,11 @@ func run(params keyregCmdParams) error { return errors.New("must provide --keyfile when registering participation keys") } if params.addr != "" { - return errors.New("do not provide --address when registering participation keys") + return errors.New("do not provide --account when registering participation keys") } } else { if params.addr == "" { - return errors.New("must provide --address when bringing an account offline") + return errors.New("must provide --account when bringing an account offline") } if params.partkeyFile != "" { return errors.New("do not provide --keyfile when bringing an account offline") @@ -160,7 +160,7 @@ func run(params keyregCmdParams) error { var err error accountAddress, err = basics.UnmarshalChecksumAddress(params.addr) if err != nil { - return fmt.Errorf("unable to parse --address: %w", err) + return fmt.Errorf("unable to parse --account: %w", err) } } @@ -173,7 +173,7 @@ func run(params keyregCmdParams) error { } if util.FileExists(params.txFile) || params.txFile == stdoutFilenameValue { - return fmt.Errorf("outputFile '%s' already exists", params.partkeyFile) + return fmt.Errorf("outputFile '%s' already exists", params.txFile) } // Lookup information from partkey file From cb2eef09a12e4e9da4e93e3eeb1a0464e4573a0d Mon Sep 17 00:00:00 2001 From: Will Winder Date: Wed, 9 Mar 2022 08:49:47 -0500 Subject: [PATCH 2/2] PR feedback --- cmd/algokey/keyreg.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/algokey/keyreg.go b/cmd/algokey/keyreg.go index c545b342f9..24ddafdd1e 100644 --- a/cmd/algokey/keyreg.go +++ b/cmd/algokey/keyreg.go @@ -82,7 +82,7 @@ func init() { keyregCmd.Flags().BoolVar(¶ms.offline, "offline", false, "set to bring an account offline") keyregCmd.Flags().StringVarP(¶ms.txFile, "outputFile", "o", "", fmt.Sprintf("write signed transaction to this file, or '%s' to write to stdout", stdoutFilenameValue)) keyregCmd.Flags().StringVar(¶ms.partkeyFile, "keyfile", "", "participation keys to register, file is opened to fetch metadata for the transaction; only specify when bringing an account online to vote in Algorand consensus") - keyregCmd.Flags().StringVar(¶ms.addr, "account", "", "account to bring offline; only specify when taking an account offline from voting in Algorand consensus") + keyregCmd.Flags().StringVar(¶ms.addr, "account", "", "account address to bring offline; only specify when taking an account offline from voting in Algorand consensus") // TODO: move 'bundleGenesisInject' into something that can be imported here instead of using constants. validNetworks = map[string]crypto.Digest{ @@ -172,7 +172,7 @@ func run(params keyregCmdParams) error { params.txFile = fmt.Sprintf("%s.tx", params.partkeyFile) } - if util.FileExists(params.txFile) || params.txFile == stdoutFilenameValue { + if params.txFile != stdoutFilenameValue && util.FileExists(params.txFile) { return fmt.Errorf("outputFile '%s' already exists", params.txFile) }