Skip to content

Commit b28f525

Browse files
committed
remove max-tx-gas-wanted related config
1 parent 3fdb18b commit b28f525

File tree

10 files changed

+30
-35
lines changed

10 files changed

+30
-35
lines changed

app/ante/eth.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import (
2121
ethtypes "github.com/ethereum/go-ethereum/core/types"
2222
)
2323

24+
const MaxTxGasWanted uint64 = 500000
25+
2426
// EthSigVerificationDecorator validates an ethereum signatures
2527
type EthSigVerificationDecorator struct {
2628
evmKeeper EVMKeeper
@@ -146,18 +148,15 @@ func (avd EthAccountVerificationDecorator) AnteHandle(
146148
// EthGasConsumeDecorator validates enough intrinsic gas for the transaction and
147149
// gas consumption.
148150
type EthGasConsumeDecorator struct {
149-
evmKeeper EVMKeeper
150-
maxGasWanted uint64
151+
evmKeeper EVMKeeper
151152
}
152153

153154
// NewEthGasConsumeDecorator creates a new EthGasConsumeDecorator
154155
func NewEthGasConsumeDecorator(
155156
evmKeeper EVMKeeper,
156-
maxGasWanted uint64,
157157
) EthGasConsumeDecorator {
158158
return EthGasConsumeDecorator{
159159
evmKeeper,
160-
maxGasWanted,
161160
}
162161
}
163162

@@ -202,10 +201,10 @@ func (egcd EthGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula
202201
return ctx, sdkerrors.Wrap(err, "failed to unpack tx data")
203202
}
204203

205-
if ctx.IsCheckTx() && egcd.maxGasWanted != 0 {
204+
if ctx.IsCheckTx() {
206205
// We can't trust the tx gas limit, because we'll refund the unused gas.
207-
if txData.GetGas() > egcd.maxGasWanted {
208-
gasWanted += egcd.maxGasWanted
206+
if txData.GetGas() > MaxTxGasWanted {
207+
gasWanted += MaxTxGasWanted
209208
} else {
210209
gasWanted += txData.GetGas()
211210
}

app/ante/eth_test.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
sdk "github.com/cosmos/cosmos-sdk/types"
88

99
"github.com/evmos/ethermint/app/ante"
10-
"github.com/evmos/ethermint/server/config"
1110
"github.com/evmos/ethermint/tests"
1211
"github.com/evmos/ethermint/x/evm/statedb"
1312
evmtypes "github.com/evmos/ethermint/x/evm/types"
@@ -213,7 +212,7 @@ func (suite AnteTestSuite) TestEthNonceVerificationDecorator() {
213212
}
214213

215214
func (suite AnteTestSuite) TestEthGasConsumeDecorator() {
216-
dec := ante.NewEthGasConsumeDecorator(suite.app.EvmKeeper, config.DefaultMaxTxGasWanted)
215+
dec := ante.NewEthGasConsumeDecorator(suite.app.EvmKeeper)
217216

218217
addr := tests.GenerateAddress()
219218

@@ -298,6 +297,17 @@ func (suite AnteTestSuite) TestEthGasConsumeDecorator() {
298297
false, true,
299298
0,
300299
},
300+
{
301+
"success",
302+
tx2,
303+
ante.MaxTxGasWanted, // it's capped
304+
func() {
305+
vmdb.AddBalance(addr, big.NewInt(1000000))
306+
suite.ctx = suite.ctx.WithBlockGasMeter(sdk.NewGasMeter(10000000000000000000))
307+
},
308+
true, false,
309+
0,
310+
},
301311
{
302312
"success - legacy tx",
303313
tx2,

app/ante/handler_options.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ type HandlerOptions struct {
2525
FeegrantKeeper ante.FeegrantKeeper
2626
SignModeHandler authsigning.SignModeHandler
2727
SigGasConsumer func(meter sdk.GasMeter, sig signing.SignatureV2, params authtypes.Params) error
28-
MaxTxGasWanted uint64
2928
ExtensionOptionChecker ante.ExtensionOptionChecker
3029
TxFeeChecker ante.TxFeeChecker
3130
Blacklist []string
@@ -60,7 +59,7 @@ func newEthAnteHandler(options HandlerOptions, extra sdk.AnteDecorator) sdk.Ante
6059
NewEthSigVerificationDecorator(options.EvmKeeper),
6160
NewEthAccountVerificationDecorator(options.AccountKeeper, options.EvmKeeper),
6261
NewCanTransferDecorator(options.EvmKeeper),
63-
NewEthGasConsumeDecorator(options.EvmKeeper, options.MaxTxGasWanted),
62+
NewEthGasConsumeDecorator(options.EvmKeeper),
6463
NewEthIncrementSenderSequenceDecorator(options.AccountKeeper), // innermost AnteDecorator.
6564
NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),
6665
NewEthEmitEventDecorator(options.EvmKeeper), // emit eth tx hash and index at the very last ante handler.

app/app.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ func NewEthermintApp(
611611
app.SetInitChainer(app.InitChainer)
612612
app.SetBeginBlocker(app.BeginBlocker)
613613
app.SetEndBlocker(app.EndBlocker)
614-
app.setAnteHandler(encodingConfig.TxConfig, cast.ToUint64(appOpts.Get(srvflags.EVMMaxTxGasWanted)))
614+
app.setAnteHandler(encodingConfig.TxConfig)
615615
// In v0.46, the SDK introduces _postHandlers_. PostHandlers are like
616616
// antehandlers, but are run _after_ the `runMsgs` execution. They are also
617617
// defined as a chain, and have the same signature as antehandlers.
@@ -640,7 +640,7 @@ func NewEthermintApp(
640640
}
641641

642642
// use Ethermint's custom AnteHandler
643-
func (app *EthermintApp) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64) {
643+
func (app *EthermintApp) setAnteHandler(txConfig client.TxConfig) {
644644
anteHandler, err := ante.NewAnteHandler(ante.HandlerOptions{
645645
AccountKeeper: app.AccountKeeper,
646646
BankKeeper: app.BankKeeper,
@@ -650,7 +650,6 @@ func (app *EthermintApp) setAnteHandler(txConfig client.TxConfig, maxGasWanted u
650650
IBCKeeper: app.IBCKeeper,
651651
EvmKeeper: app.EvmKeeper,
652652
FeeMarketKeeper: app.FeeMarketKeeper,
653-
MaxTxGasWanted: maxGasWanted,
654653
ExtensionOptionChecker: ethermint.HasDynamicFeeExtensionOption,
655654
TxFeeChecker: ante.NewDynamicFeeChecker(app.EvmKeeper),
656655
})

app/simulation_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ func NewSimApp(logger log.Logger, db dbm.DB) (*EthermintApp, error) {
7777
IBCKeeper: app.IBCKeeper,
7878
EvmKeeper: app.EvmKeeper,
7979
FeeMarketKeeper: app.FeeMarketKeeper,
80-
MaxTxGasWanted: 0,
8180
})
8281
if err != nil {
8382
return nil, err

server/config/config.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ const (
3434
// DefaultFixRevertGasRefundHeight is the default height at which to overwrite gas refund
3535
DefaultFixRevertGasRefundHeight = 0
3636

37-
DefaultMaxTxGasWanted = 0
38-
3937
DefaultGasCap uint64 = 25000000
4038

4139
DefaultFilterCap int32 = 200
@@ -82,8 +80,6 @@ type EVMConfig struct {
8280
// Tracer defines vm.Tracer type that the EVM will use if the node is run in
8381
// trace mode. Default: 'json'.
8482
Tracer string `mapstructure:"tracer"`
85-
// MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode.
86-
MaxTxGasWanted uint64 `mapstructure:"max-tx-gas-wanted"`
8783
}
8884

8985
// JSONRPCConfig defines configuration for the EVM RPC server.
@@ -186,8 +182,7 @@ func DefaultConfig() *Config {
186182
// DefaultEVMConfig returns the default EVM configuration
187183
func DefaultEVMConfig() *EVMConfig {
188184
return &EVMConfig{
189-
Tracer: DefaultEVMTracer,
190-
MaxTxGasWanted: DefaultMaxTxGasWanted,
185+
Tracer: DefaultEVMTracer,
191186
}
192187
}
193188

@@ -321,8 +316,7 @@ func GetConfig(v *viper.Viper) (Config, error) {
321316
return Config{
322317
Config: cfg,
323318
EVM: EVMConfig{
324-
Tracer: v.GetString("evm.tracer"),
325-
MaxTxGasWanted: v.GetUint64("evm.max-tx-gas-wanted"),
319+
Tracer: v.GetString("evm.tracer"),
326320
},
327321
JSONRPC: JSONRPCConfig{
328322
Enable: v.GetBool("json-rpc.enable"),

server/config/toml.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ const DefaultConfigTemplate = `
1313
# Valid types are: json|struct|access_list|markdown
1414
tracer = "{{ .EVM.Tracer }}"
1515
16-
# MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode.
17-
max-tx-gas-wanted = {{ .EVM.MaxTxGasWanted }}
18-
1916
###############################################################################
2017
### JSON RPC Configuration ###
2118
###############################################################################

server/flags/flags.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ const (
6060

6161
// EVM flags
6262
const (
63-
EVMTracer = "evm.tracer"
64-
EVMMaxTxGasWanted = "evm.max-tx-gas-wanted"
63+
EVMTracer = "evm.tracer"
6564
)
6665

6766
// TLS flags

server/start.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ which accepts a path for the resulting pprof file.
200200
cmd.Flags().Bool(srvflags.JSONRPCEnableMetrics, false, "Define if EVM rpc metrics server should be enabled")
201201

202202
cmd.Flags().String(srvflags.EVMTracer, config.DefaultEVMTracer, "the EVM tracer type to collect execution traces from the EVM transaction execution (json|struct|access_list|markdown)") //nolint:lll
203-
cmd.Flags().Uint64(srvflags.EVMMaxTxGasWanted, config.DefaultMaxTxGasWanted, "the gas wanted for each eth tx returned in ante handler in check tx mode") //nolint:lll
204203

205204
cmd.Flags().String(srvflags.TLSCertPath, "", "the cert.pem file path for the server TLS configuration")
206205
cmd.Flags().String(srvflags.TLSKeyPath, "", "the key.pem file path for the server TLS configuration")

tests/integration_tests/test_websockets.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
CONTRACTS,
1414
build_batch_tx,
1515
deploy_contract,
16-
modify_command_in_supervisor_config,
16+
# modify_command_in_supervisor_config,
1717
wait_for_new_blocks,
1818
wait_for_port,
1919
)
@@ -83,11 +83,11 @@ def test_subscribe_basic(ethermint: Ethermint):
8383
"""
8484
test basic subscribe and unsubscribe
8585
"""
86-
modify_command_in_supervisor_config(
87-
ethermint.base_dir / "tasks.ini",
88-
lambda cmd: f"{cmd} --evm.max-tx-gas-wanted {0}",
89-
)
90-
ethermint.supervisorctl("update")
86+
# modify_command_in_supervisor_config(
87+
# ethermint.base_dir / "tasks.ini",
88+
# lambda cmd: f"{cmd} --evm.max-tx-gas-wanted {0}",
89+
# )
90+
# ethermint.supervisorctl("update")
9191
wait_for_port(ports.evmrpc_ws_port(ethermint.base_port(0)))
9292
cli = ethermint.cosmos_cli()
9393
loop = asyncio.get_event_loop()

0 commit comments

Comments
 (0)