From 4dfaa5b2624fcd39b12459d83275027f8d09507d Mon Sep 17 00:00:00 2001 From: Benjamin DENEUX Date: Wed, 5 Oct 2022 08:13:28 +0200 Subject: [PATCH] fix(cliff): improve verification on cliff msg tx --- x/vesting/types/msgs.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/x/vesting/types/msgs.go b/x/vesting/types/msgs.go index 339375d0..d62846cb 100644 --- a/x/vesting/types/msgs.go +++ b/x/vesting/types/msgs.go @@ -222,7 +222,7 @@ func NewMsgCreateCliffVestingAccount(fromAddr, func (msg MsgCreateCliffVestingAccount) Route() string { return RouterKey } // Type returns the message type for a MsgCreateVestingAccount. -func (msg MsgCreateCliffVestingAccount) Type() string { return TypeMsgCreateVestingAccount } +func (msg MsgCreateCliffVestingAccount) Type() string { return TypeMsgCreateCliffVestingAccount } // ValidateBasic Implements Msg. func (msg MsgCreateCliffVestingAccount) ValidateBasic() error { @@ -245,6 +245,14 @@ func (msg MsgCreateCliffVestingAccount) ValidateBasic() error { return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid end time") } + if msg.CliffTime <= 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid cliff time") + } + + if msg.CliffTime > msg.EndTime { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "cliff time should be before end time") + } + return nil }