diff --git a/app/upgrades/v9/upgrades.go b/app/upgrades/v9/upgrades.go index 3538adfb..fb67fa7d 100644 --- a/app/upgrades/v9/upgrades.go +++ b/app/upgrades/v9/upgrades.go @@ -18,7 +18,14 @@ func CreateV9UpgradeHandler( return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { // set default oracle split keepers.TreasuryKeeper.SetTaxRate(ctx, sdk.ZeroDec()) - keepers.Tax2gasKeeper.SetParams(ctx, tax2gastypes.DefaultParams()) + + tax2gasParams := tax2gastypes.DefaultParams() + tax2gasParams.GasPrices = sdk.NewDecCoins( + sdk.NewDecCoinFromDec("uluna", sdk.NewDecWithPrec(28325, 3)), + sdk.NewDecCoinFromDec("uusd", sdk.NewDecWithPrec(75, 2)), + ) + tax2gasParams.MaxTotalBypassMinFeeMsgGasUsage = 200000 + keepers.Tax2gasKeeper.SetParams(ctx, tax2gasParams) return mm.RunMigrations(ctx, cfg, fromVM) } } diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index 6c8ecb62..3a619954 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -245,8 +245,8 @@ func (s *IntegrationTestSuite) TestFeeTaxGrant() { s.Require().Equal(balanceTest1, transferCoin1) s.Require().Equal(newValidatorBalance, validatorBalance.Add(transferCoin1)) - // addr2 lost 10uluna to pay for grant msg's gas, 100000000 * TaxRate + 1uluna to pay for bank send msg's tx fees, - s.Require().Equal(balanceTest2.Amount, transferAmount1.Sub(initialization.TaxRate.MulInt(transferAmount1).TruncateInt()).SubRaw(4)) + // addr2 lost 2uluna to pay for grant msg's gas, 100000000 * TaxRate + 2uluna to pay for bank send msg's tx fees, + s.Require().Equal(balanceTest2.Amount, transferAmount1.Sub(initialization.TaxRate.MulInt(transferAmount1).TruncateInt()).SubRaw(12)) // Test 3: try bank send with no grant transferAmount2 := sdkmath.NewInt(200000000) @@ -292,7 +292,7 @@ func (s *IntegrationTestSuite) TestFeeTaxGrant() { initialization.TaxRate.MulInt(transferAmount2). // tax amount in the form of terra denom Mul(initialization.UsdGasPrice.Quo(initialization.TerraGasPrice)). // convert terra denom to usd denom base on gas price TruncateInt(), - ).SubRaw(5), // addr2 lost 2uusd to pay for revoke msg's gas, 2uusd to pay for grant msg's gas, 1uusd to pay for band send msg's gas + ).SubRaw(21), // addr2 lost 10uusd to pay for revoke msg's gas, 10uusd to pay for grant msg's gas, 1uusd to pay for band send msg's gas ) } @@ -352,7 +352,7 @@ func (s *IntegrationTestSuite) TestFeeTaxNotSupport() { transferAmount3 := sdkmath.NewInt(10000000) transferCoin3 := sdk.NewCoin(initialization.TerraIBCDenom, transferAmount3) - nodeB.BankSend(transferCoin3.String(), test1AddrChainB, test2AddrChainB, []string{}, sdk.NewCoin(initialization.TerraDenom, sdkmath.NewInt(10))) + nodeB.BankSend(transferCoin3.String(), test1AddrChainB, test2AddrChainB, []string{}, sdk.NewCoin(initialization.TerraDenom, sdkmath.NewInt(2))) newTerraIBCBalance, err := nodeB.QuerySpecificBalance(test1AddrChainB, initialization.TerraIBCDenom) s.Require().NoError(err) diff --git a/x/tax2gas/post/post.go b/x/tax2gas/post/post.go index 7feccddc..8435ecfe 100644 --- a/x/tax2gas/post/post.go +++ b/x/tax2gas/post/post.go @@ -155,6 +155,10 @@ func (tgd Tax2gasPostDecorator) PostHandle(ctx sdk.Context, tx sdk.Tx, simulate return ctx, errorsmod.Wrapf(sdkerrors.ErrInsufficientFee, "fees are not enough to pay for gas, need to cover %s gas more, which equal to %q ", gasRemaining.String(), gasRemainingFees) } feePayerAccount := tgd.accountKeeper.GetAccount(ctx, feePayer) + + if !simulate && taxes.IsZero() { + payableFees = feeCoins + } err := tgd.bankKeeper.SendCoinsFromAccountToModule(ctx, feePayerAccount.GetAddress(), authtypes.FeeCollectorName, payableFees) if err != nil { return ctx, errorsmod.Wrapf(sdkerrors.ErrInsufficientFunds, err.Error())