From 89b3ab9e515c8992a210a7462930905d80465ed1 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Tue, 4 Sep 2018 17:29:33 +0200 Subject: [PATCH] Don't skip basic validation --- x/gov/client/cli/tx.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index b0fa4d6beb..e9a55c5577 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -99,15 +99,15 @@ $ gaiacli gov submit-proposal --title="Test Proposal" --description="My awesome } msg := gov.NewMsgSubmitProposal(proposal.Title, proposal.Description, proposalType, fromAddr, amount) - if cliCtx.GenerateOnly { - return utils.PrintUnsignedStdTx(txCtx, cliCtx, []sdk.Msg{msg}) - } - err = msg.ValidateBasic() if err != nil { return err } + if cliCtx.GenerateOnly { + return utils.PrintUnsignedStdTx(txCtx, cliCtx, []sdk.Msg{msg}) + } + // Build and sign the transaction, then broadcast to Tendermint // proposalID must be returned, and it is a part of response. cliCtx.PrintResponse = true @@ -180,14 +180,15 @@ func GetCmdDeposit(cdc *wire.Codec) *cobra.Command { } msg := gov.NewMsgDeposit(depositerAddr, proposalID, amount) - if cliCtx.GenerateOnly { - return utils.PrintUnsignedStdTx(txCtx, cliCtx, []sdk.Msg{msg}) - } err = msg.ValidateBasic() if err != nil { return err } + if cliCtx.GenerateOnly { + return utils.PrintUnsignedStdTx(txCtx, cliCtx, []sdk.Msg{msg}) + } + // Build and sign the transaction, then broadcast to a Tendermint // node. return utils.SendTx(txCtx, cliCtx, []sdk.Msg{msg}) @@ -226,14 +227,15 @@ func GetCmdVote(cdc *wire.Codec) *cobra.Command { } msg := gov.NewMsgVote(voterAddr, proposalID, byteVoteOption) - if cliCtx.GenerateOnly { - return utils.PrintUnsignedStdTx(txCtx, cliCtx, []sdk.Msg{msg}) - } err = msg.ValidateBasic() if err != nil { return err } + if cliCtx.GenerateOnly { + return utils.PrintUnsignedStdTx(txCtx, cliCtx, []sdk.Msg{msg}) + } + fmt.Printf("Vote[Voter:%s,ProposalID:%d,Option:%s]", voterAddr.String(), msg.ProposalID, msg.Option.String(), )