Skip to content

Commit 080b6eb

Browse files
authored
core/vm: evm fix panic (#23047)
* core/vm: evm fix panic * core/vm/runtime: default to params.initialbasefee
1 parent ae315ef commit 080b6eb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

core/vm/runtime/env.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func NewEnv(cfg *Config) *vm.EVM {
3535
Time: cfg.Time,
3636
Difficulty: cfg.Difficulty,
3737
GasLimit: cfg.GasLimit,
38+
BaseFee: cfg.BaseFee,
3839
}
3940

4041
return vm.NewEVM(blockContext, txContext, cfg.State, cfg.ChainConfig, cfg.EVMConfig)

core/vm/runtime/runtime.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type Config struct {
4343
Value *big.Int
4444
Debug bool
4545
EVMConfig vm.Config
46+
BaseFee *big.Int
4647

4748
State *state.StateDB
4849
GetHashFn func(n uint64) common.Hash
@@ -66,7 +67,7 @@ func setDefaults(cfg *Config) {
6667
IstanbulBlock: new(big.Int),
6768
MuirGlacierBlock: new(big.Int),
6869
BerlinBlock: new(big.Int),
69-
LondonBlock: nil,
70+
LondonBlock: new(big.Int),
7071
}
7172
}
7273

@@ -93,6 +94,9 @@ func setDefaults(cfg *Config) {
9394
return common.BytesToHash(crypto.Keccak256([]byte(new(big.Int).SetUint64(n).String())))
9495
}
9596
}
97+
if cfg.BaseFee == nil {
98+
cfg.BaseFee = big.NewInt(params.InitialBaseFee)
99+
}
96100
}
97101

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

0 commit comments

Comments
 (0)