From 452263b5ea54bde84bfeb30ca3aa80411980edfe Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Fri, 13 Nov 2020 15:20:50 +0100 Subject: [PATCH 1/3] ante: fix fee check --- app/ante/eth.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/ante/eth.go b/app/ante/eth.go index bad8243fa..55bb59fa4 100644 --- a/app/ante/eth.go +++ b/app/ante/eth.go @@ -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 positive and the transaction does not // meet the minimum fee if !ctx.MinGasPrices().IsZero() && !hasEnoughFees { return ctx, sdkerrors.Wrap( From 6cb53bb126ca382c0e8c2d8a381b314ef7c3b0a4 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Fri, 13 Nov 2020 15:22:17 +0100 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcd70e29c..2373a015a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. From 981aff6f9831346319abe42537f93e2423239fd2 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Fri, 13 Nov 2020 15:23:09 +0100 Subject: [PATCH 3/3] comment --- app/ante/eth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ante/eth.go b/app/ante/eth.go index 55bb59fa4..2075235db 100644 --- a/app/ante/eth.go +++ b/app/ante/eth.go @@ -114,7 +114,7 @@ func (emfd EthMempoolFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula hasEnoughFees = true } - // reject transaction if minimum gas price is not 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(