fix: base fee check logic in state transition (#932)

* fix base fee check logic in state transition

- should check london hardfork first, otherwise it panic if feemarket not registered.

* fix lint

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
yihuang 2022-02-15 19:01:30 +08:00 committed by GitHub
parent aeedef9b4b
commit f7009b0e94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -80,6 +80,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (rpc) [tharsis#878](https://github.com/tharsis/ethermint/pull/878) Workaround to make GetBlock RPC api report correct block gas used. * (rpc) [tharsis#878](https://github.com/tharsis/ethermint/pull/878) Workaround to make GetBlock RPC api report correct block gas used.
* (rpc) [tharsis#900](https://github.com/tharsis/ethermint/pull/900) newPendingTransactions filter return ethereum tx hash. * (rpc) [tharsis#900](https://github.com/tharsis/ethermint/pull/900) newPendingTransactions filter return ethereum tx hash.
* (rpc) [tharsis#933](https://github.com/tharsis/ethermint/pull/933) Fix newPendingTransactions subscription deadlock when a Websocket client exits without unsubscribing and the node errors. * (rpc) [tharsis#933](https://github.com/tharsis/ethermint/pull/933) Fix newPendingTransactions subscription deadlock when a Websocket client exits without unsubscribing and the node errors.
* (evm) [tharsis#932](https://github.com/tharsis/ethermint/pull/932) Fix base fee check logic in state transition.
## [v0.9.0] - 2021-12-01 ## [v0.9.0] - 2021-12-01

View File

@ -92,14 +92,17 @@ func (k *Keeper) NewEVM(
if tracer == nil { if tracer == nil {
tracer = k.Tracer(ctx, msg, cfg.ChainConfig) tracer = k.Tracer(ctx, msg, cfg.ChainConfig)
} }
vmConfig := k.VMConfig(ctx, msg, cfg.Params, tracer) vmConfig := k.VMConfig(ctx, msg, cfg, tracer)
return vm.NewEVM(blockCtx, txCtx, stateDB, cfg.ChainConfig, vmConfig) return vm.NewEVM(blockCtx, txCtx, stateDB, cfg.ChainConfig, vmConfig)
} }
// VMConfig creates an EVM configuration from the debug setting and the extra EIPs enabled on the // VMConfig creates an EVM configuration from the debug setting and the extra EIPs enabled on the
// module parameters. The config generated uses the default JumpTable from the EVM. // module parameters. The config generated uses the default JumpTable from the EVM.
func (k Keeper) VMConfig(ctx sdk.Context, msg core.Message, params types.Params, tracer vm.EVMLogger) vm.Config { func (k Keeper) VMConfig(ctx sdk.Context, msg core.Message, cfg *types.EVMConfig, tracer vm.EVMLogger) vm.Config {
fmParams := k.feeMarketKeeper.GetParams(ctx) noBaseFee := true
if types.IsLondon(cfg.ChainConfig, ctx.BlockHeight()) {
noBaseFee = k.feeMarketKeeper.GetParams(ctx).NoBaseFee
}
var debug bool var debug bool
if _, ok := tracer.(types.NoOpTracer); !ok { if _, ok := tracer.(types.NoOpTracer); !ok {
@ -109,8 +112,8 @@ func (k Keeper) VMConfig(ctx sdk.Context, msg core.Message, params types.Params,
return vm.Config{ return vm.Config{
Debug: debug, Debug: debug,
Tracer: tracer, Tracer: tracer,
NoBaseFee: fmParams.NoBaseFee, NoBaseFee: noBaseFee,
ExtraEips: params.EIPs(), ExtraEips: cfg.Params.EIPs(),
} }
} }