Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
fix base fee check logic in state transition
Browse files Browse the repository at this point in the history
- should check london hardfork first, otherwise it panic if feemarket not registered.
  • Loading branch information
yihuang committed Feb 10, 2022
1 parent 7b22a53 commit 31d3075
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (evm) [tharsis#871](https://github.com/tharsis/ethermint/pull/871) Set correct nonce in `EthCall` and `EstimateGas` grpc query.
* (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.
* (evm) [tharsis#932](https://github.com/tharsis/ethermint/pull/932) Fix base fee check logic in state transition.

## [v0.9.0] - 2021-12-01

Expand Down
13 changes: 8 additions & 5 deletions x/evm/keeper/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,17 @@ func (k *Keeper) NewEVM(
if tracer == nil {
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)
}

// 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.
func (k Keeper) VMConfig(ctx sdk.Context, msg core.Message, params types.Params, tracer vm.Tracer) vm.Config {
fmParams := k.feeMarketKeeper.GetParams(ctx)
func (k Keeper) VMConfig(ctx sdk.Context, msg core.Message, cfg *types.EVMConfig, tracer vm.Tracer) vm.Config {
noBaseFee := true
if types.IsLondon(cfg.ChainConfig, ctx.BlockHeight()) {
noBaseFee = k.feeMarketKeeper.GetParams(ctx).NoBaseFee
}

var debug bool
if _, ok := tracer.(types.NoOpTracer); !ok {
Expand All @@ -110,8 +113,8 @@ func (k Keeper) VMConfig(ctx sdk.Context, msg core.Message, params types.Params,
Debug: debug,
Tracer: tracer,
NoRecursion: false, // TODO: consider disabling recursion though params
NoBaseFee: fmParams.NoBaseFee,
ExtraEips: params.EIPs(),
NoBaseFee: noBaseFee,
ExtraEips: cfg.Params.EIPs(),
}
}

Expand Down

0 comments on commit 31d3075

Please sign in to comment.