Skip to content

Commit a348be0

Browse files
committed
fix: tests and logging
1 parent e4e5a23 commit a348be0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

x/tax/keeper/custom_tx_fee_checker.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ func (k Keeper) CustomTxFeeChecker(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64
6666

6767
// price by the gas limit, where fee = ceil(minGasPrice * gasLimit).
6868
gasLimitDec := sdkmath.LegacyNewDec(int64(gas))
69-
minimumFeeRequiredInPaidDenom := gasLimitDec.Mul(minGasPrice)
69+
minimumFeeRequiredInPaidDenom := gasLimitDec.Mul(minGasPrice).RoundInt()
7070
// if the fee provided is greater than the minimum fee required in the paid denom, then it is accepted
71-
if fee.Amount.GT(minimumFeeRequiredInPaidDenom.Ceil().RoundInt()) {
71+
if fee.Amount.GT(minimumFeeRequiredInPaidDenom) {
7272
priority := getTxPriority(feeCoins, int64(gas))
7373
return feeCoins, priority, nil
7474
} else {
75-
return nil, 0, errors.Wrapf(sdkerrors.ErrInsufficientFee, "insufficient fees; got: %f%s required: %f%s", fee.Amount.ToLegacyDec().RoundInt(), fee.Denom, minimumFeeRequiredInPaidDenom, fee.Denom)
75+
return nil, 0, errors.Wrapf(sdkerrors.ErrInsufficientFee, "insufficient fees; got: %d%s required: %d%s", fee.Amount.ToLegacyDec().RoundInt().Int64(), fee.Denom, minimumFeeRequiredInPaidDenom.Int64(), fee.Denom)
7676
}
7777
}
7878
}

x/tax/keeper/custom_tx_fee_checker_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func TestCustomTxFeeCheckerFailDueToHighGasPayingWithUSDC(t *testing.T) {
106106

107107
_, _, err := taxKeeper.CustomTxFeeChecker(ctx, feeTx)
108108
require.Error(t, err)
109-
require.Equal(t, "insufficient fees; got: 1.000000ibc/5DE4FCAF68AE40F81F738C857C0D95F7C1BC47B00FA1026E85C1DD92524D4A11 required: 100029998.779297ibc/5DE4FCAF68AE40F81F738C857C0D95F7C1BC47B00FA1026E85C1DD92524D4A11: insufficient fee", err.Error())
109+
require.Equal(t, "insufficient fees; got: 1ibc/5DE4FCAF68AE40F81F738C857C0D95F7C1BC47B00FA1026E85C1DD92524D4A11 required: 100030000ibc/5DE4FCAF68AE40F81F738C857C0D95F7C1BC47B00FA1026E85C1DD92524D4A11: insufficient fee", err.Error())
110110
}
111111

112112
// Fail to pay fees in ibc/C4C... which represents OSMO. Minimum gas prices set to unls. High gas -> fee amount not enough.
@@ -143,7 +143,7 @@ func TestCustomTxFeeCheckerFailDueToHighGasPayingWithOSMO(t *testing.T) {
143143

144144
_, _, err := taxKeeper.CustomTxFeeChecker(ctx, feeTx)
145145
require.Error(t, err)
146-
require.Equal(t, "insufficient fees; got: 1.000000ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9y required: 100025001.525879ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9y: insufficient fee", err.Error())
146+
require.Equal(t, "insufficient fees; got: 1ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9y required: 100025000ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9y: insufficient fee", err.Error())
147147
}
148148

149149
// Successfully pay fees in unls which represents NLS. Minimum gas prices set to unls.

0 commit comments

Comments
 (0)