@@ -28,19 +28,15 @@ func (gd GaslessDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool,
28
28
// eagerly set infinite gas meter so that queries performed by isTxGasless will not incur gas cost
29
29
ctx = ctx .WithGasMeter (storetypes .NewNoConsumptionInfiniteGasMeter ())
30
30
31
- feeTx , ok := tx .(sdk.FeeTx )
32
- if ! ok {
33
- return ctx , sdkerrors .Wrap (sdkerrors .ErrTxDecode , "Tx must be a FeeTx" )
34
- }
35
- gas := feeTx .GetGas ()
36
- // If non-zero gas limit is provided by the TX, we then consider it exempt from the gasless TX, and then prioritize it accordingly
37
31
isGasless , err := isTxGasless (tx , ctx , gd .oracleKeeper )
38
32
if err != nil {
39
33
return ctx , err
40
34
}
35
+ if ! isGasless {
36
+ ctx = ctx .WithGasMeter (originalGasMeter )
37
+ }
41
38
isDeliverTx := ! ctx .IsCheckTx () && ! ctx .IsReCheckTx () && ! simulate
42
- shouldCheckTxSkipFeeDeduct := gas == 0 && isGasless // whether the tx should be subject to min fee check AND priority assignment. Applicable to CheckTx only.
43
- if isDeliverTx || ! shouldCheckTxSkipFeeDeduct {
39
+ if isDeliverTx || ! isGasless {
44
40
// In the case of deliverTx, we want to deduct fees regardless of whether the tx is considered gasless or not, since
45
41
// gasless txs will be subject to application-specific fee requirements in later stage of ante, for which the payment
46
42
// of those app-specific fees happens here. Note that the minimum fee check in the wrapped deduct fee handler is only
@@ -49,13 +45,9 @@ func (gd GaslessDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool,
49
45
// Otherwise (i.e. in the case of checkTx), we only want to perform fee checks and fee deduction if the tx is not considered
50
46
// gasless, or if it specifies a non-zero gas limit even if it is considered gasless, so that the wrapped deduct fee
51
47
// handler will assign an appropriate priority to it.
52
- if ! isGasless {
53
- ctx = ctx .WithGasMeter (originalGasMeter )
54
- }
55
48
return gd .handleWrapped (ctx , tx , simulate , next )
56
49
}
57
50
58
- // must be gasless if this part is reached, so no need to overwrite gas meter back
59
51
return next (ctx , tx , simulate )
60
52
}
61
53
0 commit comments