laconicd/x/evm/keeper
Loredana Cirstea 77d9e29923
fix: GasMeter reset in AnteHandler EthGasConsumeDecorator (#964)
* Fix GasMeter reset in AnteHandler - EthGasConsumeDecorator

Conforming to the spec:
e7066c4271/docs/basics/gas-fees.md
> Set newCtx.GasMeter to 0, with a limit of GasWanted.
> This step is extremely important, as it not only makes sure the transaction cannot consume infinite gas,
> but also that ctx.GasMeter is reset in-between each DeliverTx
> (ctx is set to newCtx after anteHandler is run, and the anteHandler is run each time DeliverTx is called).

* Compute gasWanted in ante handler based on msg gas

* Tests - check gas meter limit after EthGasConsumeDecorator ante handler runs

* Update CHANGELOG.md

* EthGasConsumeDecorator ante handler resets the gas meter only for CheckTx

* Reset the gas meter in Keeper.EthereumTx to an infinite gas meter

* Fix TestOutOfGasWhenDeployContract error check

* Move gas meter reset to the innermost EthAnteHandle

* add NewInfiniteGasMeterWithLimit for setting the user provided gas limit

Fixes block's consumed gas calculation in the block creation phase.

* Fix lint

* Fix lint

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-03-06 15:09:28 +01:00
..
abci.go evm: refactor statedb implementation (#729) 2022-01-05 08:28:27 +01:00
benchmark_test.go evm: refactor statedb implementation (#729) 2022-01-05 08:28:27 +01:00
grpc_query_test.go evm: add returnValue message on tracing (#962) 2022-03-02 02:14:21 +00:00
grpc_query.go evm: add returnValue message on tracing (#962) 2022-03-02 02:14:21 +00:00
hooks_test.go evm: refactor statedb implementation (#729) 2022-01-05 08:28:27 +01:00
hooks.go evm: change Hook to use tx Receipt (#849) 2022-01-03 17:18:13 +01:00
keeper_test.go feemarket: change basefee to be a module param (#943) 2022-02-23 19:48:44 +01:00
keeper.go deps: upgrade geth to v1.10.15 (#935) 2022-02-14 23:08:41 +00:00
migrations.go feat: store migration setup (#794) 2021-11-29 16:46:20 +01:00
msg_server.go impr: support batch eth txs (#901) 2022-01-14 10:37:33 +01:00
params_test.go chore: un-fork from cosmos (#166) 2021-06-22 06:49:18 -04:00
params.go evm: move ChainConfig to Params (#266) 2021-07-14 05:13:55 -04:00
state_transition_benchmark_test.go evm: refactor statedb implementation (#729) 2022-01-05 08:28:27 +01:00
state_transition_test.go fix: default base fee state in genesis (#919) 2022-01-26 11:36:07 +01:00
state_transition.go fix: GasMeter reset in AnteHandler EthGasConsumeDecorator (#964) 2022-03-06 15:09:28 +01:00
statedb_benchmark_test.go evm: refactor statedb implementation (#729) 2022-01-05 08:28:27 +01:00
statedb_test.go types, evm: refactor accounts (#884) 2022-01-05 19:18:02 +01:00
statedb.go types, evm: refactor accounts (#884) 2022-01-05 19:18:02 +01:00
utils_test.go types, evm: refactor accounts (#884) 2022-01-05 19:18:02 +01:00
utils.go fix: minimal-gas-prices and baseFeePerGas conflicts (#916) 2022-01-26 10:44:41 +00:00