@@ -138,10 +138,10 @@ func (in *Interpreter) Run(snapshot int, contract *Contract, input []byte) (ret
138138 pc = uint64 (0 ) // program counter
139139 cost uint64
140140 // copies used by tracer
141- stackCopy = newstack () // stackCopy needed for Tracer since stack is mutated by 63/64 gas rule
142- pcCopy uint64 // needed for the deferred Tracer
143- gasCopy uint64 // for Tracer to log gas remaining before execution
144- logged bool // deferred Tracer should ignore already logged steps
141+ stackCopy = newstack () // stackCopy needed for Tracer since stack is mutated by 63/64 gas rule
142+ pcCopy uint64 // needed for the deferred Tracer
143+ gasCopy uint64 // for Tracer to log gas remaining before execution
144+ logged bool // deferred Tracer should ignore already logged steps
145145 )
146146 contract .Input = input
147147
@@ -169,22 +169,19 @@ func (in *Interpreter) Run(snapshot int, contract *Contract, input []byte) (ret
169169 }
170170 }
171171
172- // get the operation from the jump table matching the opcode
172+ // Get the operation from the jump table matching the opcode and validate the
173+ // stack and make sure there enough stack items available to perform the operation
173174 operation := in .cfg .JumpTable [op ]
174- if err := in .enforceRestrictions (op , operation , stack ); err != nil {
175- return nil , err
176- }
177-
178- // if the op is invalid abort the process and return an error
179175 if ! operation .valid {
180176 return nil , fmt .Errorf ("invalid opcode 0x%x" , int (op ))
181177 }
182-
183- // validate the stack and make sure there enough stack items available
184- // to perform the operation
185178 if err := operation .validateStack (stack ); err != nil {
186179 return nil , err
187180 }
181+ // If the operation is valid, enforce and write restrictions
182+ if err := in .enforceRestrictions (op , operation , stack ); err != nil {
183+ return nil , err
184+ }
188185
189186 var memorySize uint64
190187 // calculate the new memory size and expand the memory to fit
0 commit comments