Skip to content

Commit

Permalink
core/vm: evm fix panic (ethereum#23047)
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan committed Sep 27, 2024
1 parent a02c942 commit 0ce3211
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/vm/runtime/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func NewEnv(cfg *Config) *vm.EVM {
Time: cfg.Time,
Difficulty: cfg.Difficulty,
GasLimit: cfg.GasLimit,
BaseFee: cfg.BaseFee,
}

return vm.NewEVM(blockContext, txContext, cfg.State, nil, cfg.ChainConfig, cfg.EVMConfig)
Expand Down
5 changes: 5 additions & 0 deletions core/vm/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type Config struct {
Value *big.Int
Debug bool
EVMConfig vm.Config
BaseFee *big.Int

State *state.StateDB
GetHashFn func(n uint64) common.Hash
Expand All @@ -68,6 +69,7 @@ func setDefaults(cfg *Config) {
LondonBlock: new(big.Int),
MergeBlock: new(big.Int),
ShanghaiBlock: new(big.Int),
Eip1559Block: new(big.Int),
}
}

Expand All @@ -94,6 +96,9 @@ func setDefaults(cfg *Config) {
return common.BytesToHash(crypto.Keccak256([]byte(new(big.Int).SetUint64(n).String())))
}
}
if cfg.BaseFee == nil {
cfg.BaseFee = big.NewInt(params.InitialBaseFee)
}
}

// Execute executes the code using the input as call data during the execution.
Expand Down

0 comments on commit 0ce3211

Please sign in to comment.