From ebbffc685cf1fd2e91dff6f3c2522672bed08f05 Mon Sep 17 00:00:00 2001 From: Freddy Caceres Date: Thu, 28 Jul 2022 15:14:46 -0400 Subject: [PATCH] change default maxGasWanted (#1208) --- CHANGELOG.md | 1 + app/ante/eth.go | 2 +- app/ante/eth_test.go | 2 +- server/config/config.go | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6045d6d3..efebe820 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (feemarket) [\#1165](https://github.com/evmos/ethermint/pull/1165) Add hint in specs about different gas terminology for gas in Cosmos and Ethereum. * (rpc) [\#1169](https://github.com/evmos/ethermint/pull/1169) Remove unnecessary queries from `getBlockNumber` function +* (ante) [1208](https://github.com/evmos/ethermint/pull/1208) Change default `maxGasWanted` value ### Bug Fixes diff --git a/app/ante/eth.go b/app/ante/eth.go index 4534e19c..e14eacc3 100644 --- a/app/ante/eth.go +++ b/app/ante/eth.go @@ -194,7 +194,7 @@ func (egcd EthGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula return ctx, sdkerrors.Wrap(err, "failed to unpack tx data") } - if ctx.IsCheckTx() { + if ctx.IsCheckTx() && egcd.maxGasWanted != 0 { // We can't trust the tx gas limit, because we'll refund the unused gas. if txData.GetGas() > egcd.maxGasWanted { gasWanted += egcd.maxGasWanted diff --git a/app/ante/eth_test.go b/app/ante/eth_test.go index ad733011..e775e8ce 100644 --- a/app/ante/eth_test.go +++ b/app/ante/eth_test.go @@ -280,7 +280,7 @@ func (suite AnteTestSuite) TestEthGasConsumeDecorator() { { "success", tx2, - config.DefaultMaxTxGasWanted, // it's capped + tx2GasLimit, // it's capped func() { vmdb.AddBalance(addr, big.NewInt(1000000)) diff --git a/server/config/config.go b/server/config/config.go index 3b0a7b2f..a4ba48a9 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -28,7 +28,7 @@ const ( // DefaultEVMTracer is the default vm.Tracer type DefaultEVMTracer = "" - DefaultMaxTxGasWanted = 500000 + DefaultMaxTxGasWanted = 0 DefaultGasCap uint64 = 25000000