core/vm: better handle error on eip activation check (#25131)

* core/vm: correct logic for eip check of NewEVMInterpreter

* refactor
pull/25844/head
Leon 2 years ago committed by GitHub
parent b32d20324e
commit c55c56cf0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      core/vm/interpreter.go

@ -90,15 +90,18 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter {
default: default:
cfg.JumpTable = &frontierInstructionSet cfg.JumpTable = &frontierInstructionSet
} }
for i, eip := range cfg.ExtraEips { var extraEips []int
for _, eip := range cfg.ExtraEips {
copy := *cfg.JumpTable copy := *cfg.JumpTable
if err := EnableEIP(eip, &copy); err != nil { if err := EnableEIP(eip, &copy); err != nil {
// Disable it, so caller can check if it's activated or not // Disable it, so caller can check if it's activated or not
cfg.ExtraEips = append(cfg.ExtraEips[:i], cfg.ExtraEips[i+1:]...)
log.Error("EIP activation failed", "eip", eip, "error", err) log.Error("EIP activation failed", "eip", eip, "error", err)
} else {
extraEips = append(extraEips, eip)
} }
cfg.JumpTable = &copy cfg.JumpTable = &copy
} }
cfg.ExtraEips = extraEips
} }
return &EVMInterpreter{ return &EVMInterpreter{

Loading…
Cancel
Save