Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

- (test) [#51](https://github.com/EscanBE/evermint/pull/51) Set chain-id into client.toml during init testnet

### Bug Fixes

- (ante) [#60](https://github.com/EscanBE/evermint/pull/60) Prevent panic when building error message of fee which overflow int64 (backport #59)

# Evermint changelog

#### Note: Evermint was born for development and research purpose so maintainers do not support migration for new upgrade/breaking changes.
Expand Down
4 changes: 2 additions & 2 deletions app/ante/evm/fees.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ func (empd EthMinGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simul
if fee.LT(requiredFee) {
return ctx, errorsmod.Wrapf(
errortypes.ErrInsufficientFee,
"provided fee < minimum global fee (%d < %d). Please increase the priority tip (for EIP-1559 txs) or the gas prices (for access list or legacy txs)", //nolint:lll
fee.TruncateInt().Int64(), requiredFee.TruncateInt().Int64(),
"provided fee < minimum global fee (%s < %s). Please increase the priority tip (for EIP-1559 txs) or the gas prices (for access list or legacy txs)", //nolint:lll
fee.TruncateInt().String(), requiredFee.TruncateInt().String(),
)
}
}
Expand Down
48 changes: 48 additions & 0 deletions app/ante/evm/fees_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package evm_test

import (
"github.com/EscanBE/evermint/v12/rename_chain/marker"
"math"
"math/big"

sdkmath "cosmossdk.io/math"
Expand Down Expand Up @@ -228,6 +229,53 @@ func (suite *AnteTestSuite) TestEthMinGasPriceDecorator() {
true,
"",
},
{
name: "do not panic when tx fee overflow of int64",
malleate: func() sdk.Tx {
params := suite.app.FeeMarketKeeper.GetParams(suite.ctx)
params.MinGasPrice = sdk.NewDec(math.MaxInt64).MulInt64(2)
err := suite.app.FeeMarketKeeper.SetParams(suite.ctx, params)
suite.Require().NoError(err)

gasFeeOverflowInt64 := new(big.Int).Add(big.NewInt(math.MaxInt64), big.NewInt(1))
msg := suite.BuildTestEthTx(
from, // from
to, // to
nil, // amount
make([]byte, 0), // input
nil, // gas price
gasFeeOverflowInt64, // gas fee cap
gasFeeOverflowInt64, // gas tip cap
&emptyAccessList, // access list
)
return suite.CreateTestTx(msg, privKey, 1, false)
},
expPass: false,
errMsg: "provided fee < minimum global fee",
},
{
name: "do not panic when required fee (minimum global fee) overflow of int64",
malleate: func() sdk.Tx {
params := suite.app.FeeMarketKeeper.GetParams(suite.ctx)
params.MinGasPrice = sdk.NewDec(math.MaxInt64).MulInt64(2)
err := suite.app.FeeMarketKeeper.SetParams(suite.ctx, params)
suite.Require().NoError(err)

msg := suite.BuildTestEthTx(
from, // from
to, // to
nil, // amount
make([]byte, 0), // input
nil, // gas price
big.NewInt(100_000), // gas fee cap
big.NewInt(100), // gas tip cap
&emptyAccessList, // access list
)
return suite.CreateTestTx(msg, privKey, 1, false)
},
expPass: false,
errMsg: "provided fee < minimum global fee",
},
}

for _, et := range execTypes {
Expand Down