Skip to content

Commit

Permalink
txBuilder override existing tx fee amount
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Nov 7, 2023
1 parent b50bd7a commit 876cd53
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions x/move/ante/fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ func (suite *AnteTestSuite) TestEnsureMempoolFees() {
tx, err := suite.CreateTestTx(privs, accNums, accSeqs, suite.ctx.ChainID())
suite.Require().NoError(err)

suite.txBuilder.SetFeeAmount(atomFeeAmount)
tx2, err := suite.CreateTestTx(privs, accNums, accSeqs, suite.ctx.ChainID())
suite.Require().NoError(err)

// Set high gas price so standard test fee fails
basePrice := sdk.NewDecCoinFromDec(baseDenom, sdk.NewDec(200).Quo(sdk.NewDec(100000)))
highGasPrice := []sdk.DecCoin{basePrice}
Expand Down Expand Up @@ -134,7 +130,9 @@ func (suite *AnteTestSuite) TestEnsureMempoolFees() {
_, _, err = fc.CheckTxFeeWithMinGasPrices(suite.ctx, tx)
suite.Require().Nil(err, "Decorator should not have errored on fee higher than local gasPrice")

_, _, err = fc.CheckTxFeeWithMinGasPrices(suite.ctx, tx2)
suite.txBuilder.SetFeeAmount(atomFeeAmount)
suite.Require().Equal(atomFeeAmount, tx.GetFee())
_, _, err = fc.CheckTxFeeWithMinGasPrices(suite.ctx, tx)
suite.Require().Nil(err, "Decorator should not have errored on fee higher than local gasPrice")

// set high base_min_gas_price to test should be failed
Expand All @@ -145,6 +143,8 @@ func (suite *AnteTestSuite) TestEnsureMempoolFees() {
baseMinGasPrice: sdk.NewDec(200).Quo(sdk.NewDec(100000)),
})

suite.txBuilder.SetFeeAmount(feeAmount)
suite.Require().Equal(feeAmount, tx.GetFee())
_, _, err = fc.CheckTxFeeWithMinGasPrices(suite.ctx, tx)
suite.Require().NotNil(err, "Decorator should have errored on too low fee for local gasPrice")
}

0 comments on commit 876cd53

Please sign in to comment.