From 7e727e88c79f58cf00a9314a515f89cd902c92c8 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 30 Jun 2022 07:22:08 -0400 Subject: [PATCH] fix: update x/mint parameter validation (backport #12384) (#12396) --- CHANGELOG.md | 4 ++++ x/mint/types/params.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3b5f366dd52..7352c385c01e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Bug Fixes + +* (x/mint) [#12384](https://github.com/cosmos/cosmos-sdk/pull/12384) Ensure `GoalBonded` must be positive when performing `x/mint` parameter validation. + ## [v0.45.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.6) - 2022-06-28 ### Improvements diff --git a/x/mint/types/params.go b/x/mint/types/params.go index f0f9ef494bb9..be3d189c4e3b 100644 --- a/x/mint/types/params.go +++ b/x/mint/types/params.go @@ -171,8 +171,8 @@ func validateGoalBonded(i interface{}) error { return fmt.Errorf("invalid parameter type: %T", i) } - if v.IsNegative() { - return fmt.Errorf("goal bonded cannot be negative: %s", v) + if v.IsNegative() || v.IsZero() { + return fmt.Errorf("goal bonded must be positive: %s", v) } if v.GT(sdk.OneDec()) { return fmt.Errorf("goal bonded too large: %s", v)