Don't skip basic validation

This commit is contained in:
Alessio Treglia 2018-09-04 17:29:33 +02:00
parent 8c32a8f229
commit 89b3ab9e51
No known key found for this signature in database
GPG Key ID: E8A48AE5311D765A

View File

@ -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(),
)