From ab36fba36d1ccb83f01f11336b9fe490f5f4824d Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Tue, 23 Oct 2018 11:53:47 -0700 Subject: [PATCH] s/--print-sigs/--validate-signatures/ --- cmd/gaia/cli_test/cli_test.go | 12 +++++++----- x/auth/client/cli/sign.go | 14 ++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/cmd/gaia/cli_test/cli_test.go b/cmd/gaia/cli_test/cli_test.go index a9bdcd2c6583..139e13ed14ad 100644 --- a/cmd/gaia/cli_test/cli_test.go +++ b/cmd/gaia/cli_test/cli_test.go @@ -439,7 +439,8 @@ func TestGaiaCLISendGenerateSignAndBroadcast(t *testing.T) { flags := fmt.Sprintf("--home=%s --node=%v --chain-id=%v", gaiacliHome, servAddr, chainID) // start gaiad server - proc := tests.GoExecuteTWithStdout(t, fmt.Sprintf("gaiad start --home=%s --rpc.laddr=%v", gaiadHome, servAddr)) + proc := tests.GoExecuteTWithStdout(t, fmt.Sprintf( + "gaiad start --home=%s --rpc.laddr=%v", gaiadHome, servAddr)) defer proc.Stop(false) tests.WaitForTMStart(port) @@ -484,9 +485,9 @@ func TestGaiaCLISendGenerateSignAndBroadcast(t *testing.T) { unsignedTxFile := writeToNewTempFile(t, stdout) defer os.Remove(unsignedTxFile.Name()) - // Test sign --print-sigs + // Test sign --validate-signatures success, stdout, _ = executeWriteRetStdStreams(t, fmt.Sprintf( - "gaiacli tx sign %v --print-sigs %v", flags, unsignedTxFile.Name())) + "gaiacli tx sign %v --validate-signatures %v", flags, unsignedTxFile.Name())) require.False(t, success) require.Equal(t, fmt.Sprintf("Signers:\n 0: %v\n\nSignatures:\n\n", fooAddr.String()), stdout) @@ -505,7 +506,7 @@ func TestGaiaCLISendGenerateSignAndBroadcast(t *testing.T) { // Test sign --print-signatures success, stdout, _ = executeWriteRetStdStreams(t, fmt.Sprintf( - "gaiacli tx sign %v --print-sigs %v", flags, signedTxFile.Name())) + "gaiacli tx sign %v --validate-signatures %v", flags, signedTxFile.Name())) require.True(t, success) require.Equal(t, fmt.Sprintf("Signers:\n 0: %v\n\nSignatures:\n 0: %v\t[OK]\n\n", fooAddr.String(), fooAddr.String()), stdout) @@ -514,7 +515,8 @@ func TestGaiaCLISendGenerateSignAndBroadcast(t *testing.T) { fooAcc := executeGetAccount(t, fmt.Sprintf("gaiacli query account %s %v", fooAddr, flags)) require.Equal(t, int64(50), fooAcc.GetCoins().AmountOf("steak").Int64()) - success, stdout, _ = executeWriteRetStdStreams(t, fmt.Sprintf("gaiacli tx broadcast %v --json %v", flags, signedTxFile.Name())) + success, stdout, _ = executeWriteRetStdStreams(t, fmt.Sprintf( + "gaiacli tx broadcast %v --json %v", flags, signedTxFile.Name())) require.True(t, success) var result struct { Response abci.ResponseDeliverTx diff --git a/x/auth/client/cli/sign.go b/x/auth/client/cli/sign.go index 7009bd9689e0..bc4ad59ab37c 100644 --- a/x/auth/client/cli/sign.go +++ b/x/auth/client/cli/sign.go @@ -18,9 +18,9 @@ import ( const ( flagAppend = "append" - flagPrintSigs = "print-sigs" + flagPrintSigs = "validate-signatures" flagOffline = "offline" - flagRawSignature = "raw-signature" + flagRawSignature = "sig-only" ) // GetSignCommand returns the sign command @@ -31,7 +31,7 @@ func GetSignCommand(codec *amino.Codec, decoder auth.AccountDecoder) *cobra.Comm Long: `Sign transactions created with the --generate-only flag. Read a transaction from , sign it, and print its JSON encoding. -If the flag --raw-signature flag is on, it outputs a JSON representation +If the flag --sig-only flag is on, it outputs a JSON representation of the generated signature only. The --offline flag makes sure that the client will not reach out to the local cache. @@ -41,9 +41,11 @@ recommended to set such parameters manually.`, Args: cobra.ExactArgs(1), } cmd.Flags().String(client.FlagName, "", "Name of private key with which to sign") - cmd.Flags().Bool(flagAppend, true, "Append the signature to the existing ones. If disabled, old signatures would be overwritten") + cmd.Flags().Bool(flagAppend, true, + "Append the signature to the existing ones. If disabled, old signatures would be overwritten") cmd.Flags().Bool(flagRawSignature, false, "Print only the generated signature, then exit.") - cmd.Flags().Bool(flagPrintSigs, false, "Print the addresses that must sign the transaction and those who have already signed it, then exit") + cmd.Flags().Bool(flagPrintSigs, false, "Print the addresses that must sign the transaction, "+ + "those who have already signed it, and make sure that signatures are in the correct order.") cmd.Flags().Bool(flagOffline, false, "Offline mode. Do not query local cache.") return cmd } @@ -69,7 +71,7 @@ func makeSignCmd(cdc *amino.Codec, decoder auth.AccountDecoder) func(cmd *cobra. cliCtx := context.NewCLIContext().WithCodec(cdc).WithAccountDecoder(decoder) txBldr := authtxb.NewTxBuilderFromCLI() - // if --print-signature-only is on, then override --append + // if --sig-only is on, then override --append generateSignatureOnly := viper.GetBool(flagRawSignature) append := viper.GetBool(flagAppend) && !generateSignatureOnly newTx, err := utils.SignStdTx(txBldr, cliCtx, name, stdTx, append, viper.GetBool(flagOffline))