Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

min-gas-multiplier parameter should accept zero value #1120

Merged
merged 4 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions x/feemarket/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ func validateMinGasMultiplier(i interface{}) error {
return fmt.Errorf("invalid parameter: nil")
}

if v.IsZero() || v.IsNegative() {
fedekunze marked this conversation as resolved.
Show resolved Hide resolved
return fmt.Errorf("value cannot be zero or negative: %T", i)
if v.IsNegative() {
return fmt.Errorf("value cannot be negative: %s", v)
}

if v.GT(sdk.OneDec()) {
return fmt.Errorf("value cannot be greater than 1: %T", i)
return fmt.Errorf("value cannot be greater than 1: %s", v)
}
return nil
}
9 changes: 7 additions & 2 deletions x/feemarket/types/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@ func (suite *ParamsTestSuite) TestParamsValidate() {
true,
},
{
"invalid: min gas multiplier zero",
"valid: min gas multiplier zero",
NewParams(true, 7, 3, 2000000000, int64(544435345345435345), DefaultMinGasPrice, sdk.ZeroDec()),
false,
},
{
"invalid: min gas multiplier is negative",
NewParams(true, 7, 3, 2000000000, int64(544435345345435345), DefaultMinGasPrice, sdk.NewDecWithPrec(-5, 1)),
true,
},
{
"invalid: min gas multiplier",
"invalid: min gas multiplier bigger than 1",
NewParams(true, 7, 3, 2000000000, int64(544435345345435345), sdk.NewDecWithPrec(20, 4), sdk.NewDec(2)),
true,
},
Expand Down