Skip to content

Commit

Permalink
fix: patch the fee check refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaru Wang committed May 4, 2023
1 parent 15406d3 commit cd497a5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion x/globalfee/ante/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ func (mfd FeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, ne
return ctx, err
}

// reject the transaction early if the feeCoins have more denoms than the fee requirement
if feeCoins.Len() > requiredGlobalFees.Len() {
return ctx, sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "fee is not a subset of required fees; got %s, required: %s", feeCoins, requiredGlobalFees)
}

// Get local minimum-gas-prices
localFees := GetMinGasPrice(ctx, int64(feeTx.GetGas()))

Expand All @@ -95,7 +100,7 @@ func (mfd FeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, ne
// if feeCoinsNoZeroDenom=[], DenomsSubsetOf returns true
// if feeCoinsNoZeroDenom is not empty, but nonZeroCoinFeesReq empty, return false
if !feeCoinsNonZeroDenom.DenomsSubsetOf(nonZeroCoinFeesReq) {
return ctx, sdkerrors.Wrapf(sdkerrors.ErrInsufficientFee, "fee is not a subset of required fees; got %s, required: %s", feeCoins, combinedFeeRequirement)
return ctx, sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "fee is not a subset of required fees; got %s, required: %s", feeCoins, combinedFeeRequirement)
}

// Accept zero fee transactions only if both of the following statements are true:
Expand Down

0 comments on commit cd497a5

Please sign in to comment.