@@ -19,6 +19,7 @@ package vm
1919import (
2020 "errors"
2121 "math/big"
22+ "slices"
2223 "sync/atomic"
2324
2425 "github.com/XinFinOrg/XDPoSChain/XDCx/tradingstate"
@@ -170,20 +171,20 @@ func NewEVM(blockCtx BlockContext, txCtx TxContext, statedb StateDB, tradingStat
170171 default :
171172 evm .table = & frontierInstructionSet
172173 }
174+ var extraEips []int
173175 if len (evm .Config .ExtraEips ) > 0 {
174176 // Deep-copy jumptable to prevent modification of opcodes in other tables
175177 evm .table = copyJumpTable (evm .table )
176- }
177- extraEips := make ([]int , 0 , len (evm .Config .ExtraEips ))
178- for _ , eip := range evm .Config .ExtraEips {
179- if err := EnableEIP (eip , evm .table ); err != nil {
180- // Disable it, so caller can check if it's activated or not
181- log .Error ("EIP activation failed" , "eip" , eip , "error" , err )
182- } else {
183- extraEips = append (extraEips , eip )
178+ for _ , eip := range evm .Config .ExtraEips {
179+ if err := EnableEIP (eip , evm .table ); err != nil {
180+ // Disable it, so caller can check if it's activated or not
181+ log .Error ("EIP activation failed" , "eip" , eip , "error" , err )
182+ } else {
183+ extraEips = append (extraEips , eip )
184+ }
184185 }
185186 }
186- evm .Config .ExtraEips = extraEips [ 0 : len (extraEips ): len ( extraEips )]
187+ evm .Config .ExtraEips = slices . Clip (extraEips )
187188
188189 return evm
189190}
0 commit comments