laconicd/app/ante
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
..
ante_test.go ante: EIP712 support (#950) 2022-02-26 16:34:43 +00:00
ante.go ante: EIP712 support (#950) 2022-02-26 16:34:43 +00:00
doc.go ante: switch ethAnteHandler to use AnteDecorators (#252) 2020-04-17 18:32:01 -04:00
eip712.go ante: EIP712 support (#950) 2022-02-26 16:34:43 +00:00
eth_test.go fix: GasMeter reset in AnteHandler EthGasConsumeDecorator (#964) 2022-03-06 15:09:28 +01:00
eth.go fix: GasMeter reset in AnteHandler EthGasConsumeDecorator (#964) 2022-03-06 15:09:28 +01:00
handler_options.go ante: EIP712 support (#950) 2022-02-26 16:34:43 +00:00
interfaces.go deps: upgrade geth to v1.10.15 (#935) 2022-02-14 23:08:41 +00:00
reject_msgs.go ante: update ante handler internals (#866) 2022-01-02 23:44:46 +01:00
sigs_test.go evm: refactor statedb implementation (#729) 2022-01-05 08:28:27 +01:00
utils_test.go ante: EIP712 support (#950) 2022-02-26 16:34:43 +00:00