From c55c56cf0a1fc4b217628c3e776849ad7d6cc632 Mon Sep 17 00:00:00 2001 From: Leon <316032931@qq.com> Date: Mon, 26 Sep 2022 19:20:38 +0800 Subject: [PATCH] core/vm: better handle error on eip activation check (#25131) * core/vm: correct logic for eip check of NewEVMInterpreter * refactor --- core/vm/interpreter.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 40fe23dc51..04256bb4bd 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -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, ©); 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 = © } + cfg.ExtraEips = extraEips } return &EVMInterpreter{