Skip to content

Commit

Permalink
fix(cliff): improve verification on cliff msg tx
Browse files Browse the repository at this point in the history
  • Loading branch information
bdeneux committed Oct 5, 2022
1 parent ea3e2c5 commit 4dfaa5b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion x/vesting/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}

Expand Down

0 comments on commit 4dfaa5b

Please sign in to comment.