Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(reward): enable empty reward coins for MsgSetRewards #540

Merged
merged 10 commits into from
Feb 23, 2022
3 changes: 0 additions & 3 deletions x/reward/types/message_set_reward.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ func (msg *MsgSetRewards) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Provider); err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid provider address (%s)", err)
}
if msg.Coins.Empty() {
return sdkerrors.Wrap(ErrInvalidRewardPoolCoins, "empty reward pool coins")
}
if err := msg.Coins.Validate(); err != nil {
return sdkerrors.Wrapf(ErrInvalidRewardPoolCoins, "invalid reward pool coins (%s)", err)
}
Expand Down
19 changes: 9 additions & 10 deletions x/reward/types/message_set_reward_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ func TestMsgSetRewards_ValidateBasic(t *testing.T) {
},
err: sdkerrors.ErrInvalidAddress,
},
{
name: "empty coins",
msg: types.MsgSetRewards{
LaunchID: 1,
Provider: sample.Address(),
Coins: sdk.NewCoins(),
LastRewardHeight: 50,
},
err: types.ErrInvalidRewardPoolCoins,
},
{
name: "invalid coins",
msg: types.MsgSetRewards{
Expand All @@ -59,6 +49,15 @@ func TestMsgSetRewards_ValidateBasic(t *testing.T) {
LastRewardHeight: 50,
},
},
{
name: "valid reward pool message with empty coins",
msg: types.MsgSetRewards{
LaunchID: 1,
Provider: sample.Address(),
Coins: sdk.NewCoins(),
LastRewardHeight: 50,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down