From 355ce7aee54f3e24bff63d9c3f6e391a57cc1d03 Mon Sep 17 00:00:00 2001 From: wit Date: Mon, 3 Nov 2025 15:45:38 +0800 Subject: [PATCH] core: simplify ExtraEIPs handling --- core/vm/evm.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/core/vm/evm.go b/core/vm/evm.go index 8975c791c8..62f7924c7c 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -181,21 +181,21 @@ func NewEVM(blockCtx BlockContext, statedb StateDB, chainConfig *params.ChainCon default: evm.table = &frontierInstructionSet } - var extraEips []int - if len(evm.Config.ExtraEips) > 0 { - // Deep-copy jumptable to prevent modification of opcodes in other tables - evm.table = copyJumpTable(evm.table) - } - for _, eip := range evm.Config.ExtraEips { - if err := EnableEIP(eip, evm.table); err != nil { - // Disable it, so caller can check if it's activated or not - log.Error("EIP activation failed", "eip", eip, "error", err) - } else { - extraEips = append(extraEips, eip) - } - } - evm.Config.ExtraEips = extraEips - return evm +if len(evm.Config.ExtraEips) > 0 { + // Deep-copy jumptable to prevent modification of opcodes in other tables + evm.table = copyJumpTable(evm.table) + extraEips := make([]int, 0, len(evm.Config.ExtraEips)) + for _, eip := range evm.Config.ExtraEips { + if err := EnableEIP(eip, evm.table); err != nil { + // Disable it, so caller can check if it's activated or not + log.Error("EIP activation failed", "eip", eip, "error", err) + } else { + extraEips = append(extraEips, eip) + } + } + evm.Config.ExtraEips = extraEips +} +return evm } // SetPrecompiles sets the precompiled contracts for the EVM.