From c8c04d900f0b93c263723bfe7257598f0460316a Mon Sep 17 00:00:00 2001 From: StrathCole <7449529+StrathCole@users.noreply.github.com> Date: Tue, 30 Jul 2024 21:47:55 +0200 Subject: [PATCH] Improve simulation handling for tax transactions (#504) --- custom/auth/ante/fee.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/custom/auth/ante/fee.go b/custom/auth/ante/fee.go index cf530991..8e8cf402 100644 --- a/custom/auth/ante/fee.go +++ b/custom/auth/ante/fee.go @@ -99,19 +99,24 @@ func (fd FeeDecorator) checkDeductFee(ctx sdk.Context, feeTx sdk.FeeTx, taxes sd return sdkerrors.ErrUnknownAddress.Wrapf("fee payer address: %s does not exist", deductFeesFrom) } + feesOrTax := fee + // deduct the fees - if !fee.IsZero() { - err := DeductFees(fd.bankKeeper, ctx, deductFeesFromAcc, fee) + if fee.IsZero() && simulate { + feesOrTax = taxes + } + + if !feesOrTax.IsZero() { + err := DeductFees(fd.bankKeeper, ctx, deductFeesFromAcc, feesOrTax) if err != nil { return err } - if !taxes.IsZero() && !simulate { + if !taxes.IsZero() { err := fd.BurnTaxSplit(ctx, taxes) if err != nil { return err } - // Record tax proceeds fd.treasuryKeeper.RecordEpochTaxProceeds(ctx, taxes) }