diff --git a/x/incentive/types/msg.go b/x/incentive/types/msg.go index 446389d5..dc5707a4 100644 --- a/x/incentive/types/msg.go +++ b/x/incentive/types/msg.go @@ -1,9 +1,6 @@ package types import ( - "errors" - "strings" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -36,10 +33,7 @@ func (msg MsgClaimReward) ValidateBasic() error { if msg.Sender.Empty() { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address cannot be empty") } - if strings.TrimSpace(msg.Denom) == "" { - return errors.New("invalid (empty) denom") - } - return nil + return sdk.ValidateDenom(msg.Denom) } // GetSignBytes gets the canonical byte representation of the Msg. diff --git a/x/validator-vesting/types/genesis.go b/x/validator-vesting/types/genesis.go index aef83708..8a4daf8f 100644 --- a/x/validator-vesting/types/genesis.go +++ b/x/validator-vesting/types/genesis.go @@ -2,7 +2,7 @@ package types import ( "bytes" - "fmt" + "errors" "time" tmtime "github.com/tendermint/tendermint/types/time" @@ -39,8 +39,8 @@ func (data GenesisState) IsEmpty() bool { // ValidateGenesis returns nil because accounts are validated by auth func ValidateGenesis(data GenesisState) error { - if data.PreviousBlockTime.Unix() < 0 { - return fmt.Errorf("Previous block time should be positive, is set to %v", data.PreviousBlockTime.Unix()) + if data.PreviousBlockTime.IsZero() { + return errors.New("previous block time cannot be zero") } return nil }