Skip to content

Commit c257fa0

Browse files
committed
core/vm: evm fix panic (ethereum#23047)
1 parent 8b6e6f7 commit c257fa0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
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, nil, cfg.ChainConfig, cfg.EVMConfig)

core/vm/runtime/runtime.go

Lines changed: 5 additions & 0 deletions
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
@@ -68,6 +69,7 @@ func setDefaults(cfg *Config) {
6869
LondonBlock: new(big.Int),
6970
MergeBlock: new(big.Int),
7071
ShanghaiBlock: new(big.Int),
72+
Eip1559Block: new(big.Int),
7173
}
7274
}
7375

@@ -94,6 +96,9 @@ func setDefaults(cfg *Config) {
9496
return common.BytesToHash(crypto.Keccak256([]byte(new(big.Int).SetUint64(n).String())))
9597
}
9698
}
99+
if cfg.BaseFee == nil {
100+
cfg.BaseFee = big.NewInt(params.InitialBaseFee)
101+
}
97102
}
98103

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

0 commit comments

Comments
 (0)