all: define Berlin hard fork spec

This commit is contained in:
Péter Szilágyi
2021-02-25 09:10:30 +02:00
parent dc109cce26
commit 0928562670
22 changed files with 132 additions and 93 deletions

View File

@ -65,6 +65,7 @@ func setDefaults(cfg *Config) {
PetersburgBlock: new(big.Int),
IstanbulBlock: new(big.Int),
MuirGlacierBlock: new(big.Int),
BerlinBlock: new(big.Int),
YoloV3Block: nil,
}
}
@ -113,7 +114,7 @@ func Execute(code, input []byte, cfg *Config) ([]byte, *state.StateDB, error) {
vmenv = NewEnv(cfg)
sender = vm.AccountRef(cfg.Origin)
)
if cfg.ChainConfig.IsYoloV3(vmenv.Context.BlockNumber) {
if cfg.ChainConfig.IsBerlin(vmenv.Context.BlockNumber) {
cfg.State.PrepareAccessList(cfg.Origin, &address, vmenv.ActivePrecompiles(), nil)
}
cfg.State.CreateAccount(address)
@ -145,7 +146,7 @@ func Create(input []byte, cfg *Config) ([]byte, common.Address, uint64, error) {
vmenv = NewEnv(cfg)
sender = vm.AccountRef(cfg.Origin)
)
if cfg.ChainConfig.IsYoloV3(vmenv.Context.BlockNumber) {
if cfg.ChainConfig.IsBerlin(vmenv.Context.BlockNumber) {
cfg.State.PrepareAccessList(cfg.Origin, nil, vmenv.ActivePrecompiles(), nil)
}
@ -171,7 +172,7 @@ func Call(address common.Address, input []byte, cfg *Config) ([]byte, uint64, er
sender := cfg.State.GetOrNewStateObject(cfg.Origin)
statedb := cfg.State
if cfg.ChainConfig.IsYoloV3(vmenv.Context.BlockNumber) {
if cfg.ChainConfig.IsBerlin(vmenv.Context.BlockNumber) {
statedb.PrepareAccessList(cfg.Origin, &address, vmenv.ActivePrecompiles(), nil)
}