Skip to content

Commit

Permalink
Merge pull request #306 from irisnet/feature/gov
Browse files Browse the repository at this point in the history
R4R: Merge Feature/gov to evelop
  • Loading branch information
wukongcheng authored Sep 27, 2018
2 parents 70c732c + b1cb489 commit 2b034d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/gov/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const (
CodeInvalidGenesis sdk.CodeType = 10
CodeInvalidProposalStatus sdk.CodeType = 11
CodeInvalidParam sdk.CodeType = 12
CodeInvalidParamOp sdk.CodeType = 13
)

//----------------------------------------
Expand Down Expand Up @@ -68,5 +69,9 @@ func ErrInvalidGenesis(codespace sdk.CodespaceType, msg string) sdk.Error {
}

func ErrInvalidParam(codespace sdk.CodespaceType) sdk.Error {
return sdk.NewError(codespace, CodeInvalidParam, fmt.Sprintf("Param '%s' is not valid"))
return sdk.NewError(codespace, CodeInvalidParam, fmt.Sprintf("Param is not valid"))
}

func ErrInvalidParamOp(codespace sdk.CodespaceType, opStr string) sdk.Error {
return sdk.NewError(codespace, CodeInvalidParamOp, fmt.Sprintf("Op '%s' is not valid", opStr))
}
5 changes: 5 additions & 0 deletions modules/gov/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ func (msg MsgSubmitProposal) ValidateBasic() sdk.Error {
}

}

if msg.Param.Op != Update && msg.Param.Op != Insert {
return ErrInvalidParamOp(DefaultCodespace, msg.Param.Op)
}

return nil
}

Expand Down

0 comments on commit 2b034d8

Please sign in to comment.