From 2e358fa02181e62dbc599eb127aee57839ee3f0e Mon Sep 17 00:00:00 2001 From: HuangYi Date: Thu, 9 Jun 2022 13:53:00 +0800 Subject: [PATCH 1/3] min-gas-multiplier parameter should accept zero value update min-gas-multiplier validation logic --- x/feemarket/types/params.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/feemarket/types/params.go b/x/feemarket/types/params.go index ad998caea8..55af8b7715 100644 --- a/x/feemarket/types/params.go +++ b/x/feemarket/types/params.go @@ -189,12 +189,12 @@ func validateMinGasMultiplier(i interface{}) error { return fmt.Errorf("invalid parameter: nil") } - if v.IsZero() || v.IsNegative() { - 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 } From 7350492fa654eaa409a25eb5200eab74f0e46a23 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Thu, 9 Jun 2022 14:06:36 +0800 Subject: [PATCH 2/3] fix unit test --- x/feemarket/types/params_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/x/feemarket/types/params_test.go b/x/feemarket/types/params_test.go index 8664cd4c5e..835558f06d 100644 --- a/x/feemarket/types/params_test.go +++ b/x/feemarket/types/params_test.go @@ -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, }, From 4a515ae17c8db2243b73098dd4642d99eddc5b30 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Thu, 9 Jun 2022 15:59:23 +0800 Subject: [PATCH 3/3] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55f3a3bfff..f372bec2cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (evm) [tharsis#1118](https://github.com/tharsis/ethermint/pull/1118) Fix `Type()` `Account` method `EmptyCodeHash` comparison +### Improvements + +- (feemarket) [tharsis#1120](https://github.com/tharsis/ethermint/pull/1120) Make `min-gas-multiplier` parameter accept zero value + ## [v0.16.0] - 2022-06-06 ### State Machine Breaking