fix: skip fee check on tx simulation (#1364)
* fix: skip fee check on tx simulation * fix: update fees_tests to account for sim. change
This commit is contained in:
parent
491c3da7eb
commit
07202c1295
@ -32,8 +32,8 @@ func (mpd MinGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate
|
|||||||
|
|
||||||
minGasPrice := mpd.feesKeeper.GetParams(ctx).MinGasPrice
|
minGasPrice := mpd.feesKeeper.GetParams(ctx).MinGasPrice
|
||||||
|
|
||||||
// short-circuit if min gas price is 0
|
// Short-circuit if min gas price is 0 or if simulating
|
||||||
if minGasPrice.IsZero() {
|
if minGasPrice.IsZero() || simulate {
|
||||||
return next(ctx, tx, simulate)
|
return next(ctx, tx, simulate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() {
|
|||||||
malleate func() sdk.Tx
|
malleate func() sdk.Tx
|
||||||
expPass bool
|
expPass bool
|
||||||
errMsg string
|
errMsg string
|
||||||
|
allowPassOnSimulate bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"invalid cosmos tx type",
|
"invalid cosmos tx type",
|
||||||
@ -42,6 +43,7 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() {
|
|||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
"must be a FeeTx",
|
"must be a FeeTx",
|
||||||
|
false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"valid cosmos tx with MinGasPrices = 0, gasPrice = 0",
|
"valid cosmos tx with MinGasPrices = 0, gasPrice = 0",
|
||||||
@ -55,6 +57,7 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() {
|
|||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
"",
|
"",
|
||||||
|
false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"valid cosmos tx with MinGasPrices = 0, gasPrice > 0",
|
"valid cosmos tx with MinGasPrices = 0, gasPrice > 0",
|
||||||
@ -68,6 +71,7 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() {
|
|||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
"",
|
"",
|
||||||
|
false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"valid cosmos tx with MinGasPrices = 10, gasPrice = 10",
|
"valid cosmos tx with MinGasPrices = 10, gasPrice = 10",
|
||||||
@ -81,6 +85,7 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() {
|
|||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
"",
|
"",
|
||||||
|
false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"invalid cosmos tx with MinGasPrices = 10, gasPrice = 0",
|
"invalid cosmos tx with MinGasPrices = 10, gasPrice = 0",
|
||||||
@ -94,6 +99,7 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() {
|
|||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
"provided fee < minimum global fee",
|
"provided fee < minimum global fee",
|
||||||
|
true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"invalid cosmos tx with wrong denom",
|
"invalid cosmos tx with wrong denom",
|
||||||
@ -107,6 +113,7 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() {
|
|||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
"provided fee < minimum global fee",
|
"provided fee < minimum global fee",
|
||||||
|
true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +125,7 @@ func (s AnteTestSuite) TestMinGasPriceDecorator() {
|
|||||||
dec := ante.NewMinGasPriceDecorator(s.app.FeeMarketKeeper, s.app.EvmKeeper)
|
dec := ante.NewMinGasPriceDecorator(s.app.FeeMarketKeeper, s.app.EvmKeeper)
|
||||||
_, err := dec.AnteHandle(ctx, tc.malleate(), et.simulate, NextFn)
|
_, 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)
|
s.Require().NoError(err, tc.name)
|
||||||
} else {
|
} else {
|
||||||
s.Require().Error(err, tc.name)
|
s.Require().Error(err, tc.name)
|
||||||
|
Loading…
Reference in New Issue
Block a user