Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
ante: fix fee check (#597)
Browse files Browse the repository at this point in the history
* ante: fix fee check

* changelog

* comment
  • Loading branch information
fedekunze authored Nov 16, 2020
1 parent 26b3af7 commit 73e5eb5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ corresponding Ethereum API namespace:

### Bug Fixes

* (ante) [\#597](https://github.com/cosmos/ethermint/pull/597) Fix incorrect fee check on `AnteHandler`.
* (evm) [\#583](https://github.com/cosmos/ethermint/pull/583) Fixes incorrect resetting of tx count and block bloom during `BeginBlock`, as well as gas consumption.
* (crypto) [\#577](https://github.com/cosmos/ethermint/pull/577) Fix `BIP44HDPath` that did not prepend `m/` to the path. This now uses the `DefaultBaseDerivationPath` variable from go-ethereum to ensure addresses are consistent.

Expand Down
11 changes: 6 additions & 5 deletions app/ante/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,21 @@ func (emfd EthMempoolFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula

evmDenom := emfd.evmKeeper.GetParams(ctx).EvmDenom

// fee = GP * GL
// fee = gas price * gas limit
fee := sdk.NewInt64DecCoin(evmDenom, msgEthTx.Fee().Int64())

minGasPrices := ctx.MinGasPrices()
minFees := minGasPrices.AmountOf(evmDenom).MulInt64(int64(msgEthTx.Data.GasLimit))

// check that fee provided is greater than the minimum
// NOTE: we only check if aphotons are present in min gas prices. It is up to the
// check that fee provided is greater than the minimum defined by the validator node
// NOTE: we only check if the evm denom tokens are present in min gas prices. It is up to the
// sender if they want to send additional fees in other denominations.
var hasEnoughFees bool
if fee.Amount.GTE(minGasPrices.AmountOf(evmDenom)) {
if fee.Amount.GTE(minFees) {
hasEnoughFees = true
}

// reject transaction if minimum gas price is positive and the transaction does not
// reject transaction if minimum gas price is not zero and the transaction does not
// meet the minimum fee
if !ctx.MinGasPrices().IsZero() && !hasEnoughFees {
return ctx, sdkerrors.Wrap(
Expand Down

0 comments on commit 73e5eb5

Please sign in to comment.