Skip to content

Commit

Permalink
core/vm: better handle error on eip activation check (ethereum#25131)
Browse files Browse the repository at this point in the history
* core/vm: correct logic for eip check of NewEVMInterpreter

* refactor
  • Loading branch information
qinglin89 authored and shekhirin committed Jun 6, 2023
1 parent 029f4ed commit 11f8343
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/vm/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,18 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter {
default:
cfg.JumpTable = &frontierInstructionSet
}
for i, eip := range cfg.ExtraEips {
var extraEips []int
for _, eip := range cfg.ExtraEips {
copy := *cfg.JumpTable
if err := EnableEIP(eip, &copy); err != nil {
// 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)
} else {
extraEips = append(extraEips, eip)
}
cfg.JumpTable = &copy
}
cfg.ExtraEips = extraEips
}

return &EVMInterpreter{
Expand Down

0 comments on commit 11f8343

Please sign in to comment.