Skip to content

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 9, 2022
1 parent 1bd9ad9 commit caa29c2
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 @@ -67,6 +67,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (evm) [tharsis#901](https://github.com/tharsis/ethermint/pull/901) Support multiple MsgEthereumTx in single tx.
* (config) [tharsis#908](https://github.com/tharsis/ethermint/pull/908) Add api.enable flag for Cosmos SDK Rest server
* (feemarket) [tharsis#919](https://github.com/tharsis/ethermint/pull/919) Initialize baseFee in default genesis state.
* (evm) [tharsis#932](https://github.com/tharsis/ethermint/pull/932) Fix base fee check logic in state transition.

### Bug Fixes

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 caa29c2

Please sign in to comment.