diff --git a/app/ante/fees.go b/app/ante/fees.go index 8064ef3a..1d6830ab 100644 --- a/app/ante/fees.go +++ b/app/ante/fees.go @@ -32,8 +32,8 @@ func (mpd MinGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate minGasPrice := mpd.feesKeeper.GetParams(ctx).MinGasPrice - // short-circuit if min gas price is 0 - if minGasPrice.IsZero() { + // Short-circuit if min gas price is 0 or if simulating + if minGasPrice.IsZero() || simulate { return next(ctx, tx, simulate) } diff --git a/app/ante/fees_test.go b/app/ante/fees_test.go index 51093006..15a8cb31 100644 --- a/app/ante/fees_test.go +++ b/app/ante/fees_test.go @@ -30,10 +30,11 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() { } testCases := []struct { - name string - malleate func() sdk.Tx - expPass bool - errMsg string + name string + malleate func() sdk.Tx + expPass bool + errMsg string + allowPassOnSimulate bool }{ { "invalid cosmos tx type", @@ -42,6 +43,7 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() { }, false, "must be a FeeTx", + false, }, { "valid cosmos tx with MinGasPrices = 0, gasPrice = 0", @@ -55,6 +57,7 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() { }, true, "", + false, }, { "valid cosmos tx with MinGasPrices = 0, gasPrice > 0", @@ -68,6 +71,7 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() { }, true, "", + false, }, { "valid cosmos tx with MinGasPrices = 10, gasPrice = 10", @@ -81,6 +85,7 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() { }, true, "", + false, }, { "invalid cosmos tx with MinGasPrices = 10, gasPrice = 0", @@ -94,6 +99,7 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() { }, false, "provided fee < minimum global fee", + true, }, { "invalid cosmos tx with wrong denom", @@ -107,6 +113,7 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() { }, false, "provided fee < minimum global fee", + true, }, } @@ -118,7 +125,7 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() { dec := ante.NewMinGasPriceDecorator(s.app.FeeMarketKeeper, s.app.EvmKeeper) _, err := dec.AnteHandle(ctx, tc.malleate(), et.simulate, NextFn) - if tc.expPass { + if tc.expPass || (et.simulate && tc.allowPassOnSimulate) { s.Require().NoError(err, tc.name) } else { s.Require().Error(err, tc.name)