@@ -138,10 +138,10 @@ func (in *Interpreter) Run(snapshot int, contract *Contract, input []byte) (ret
138
138
pc = uint64 (0 ) // program counter
139
139
cost uint64
140
140
// 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
145
145
)
146
146
contract .Input = input
147
147
@@ -169,22 +169,19 @@ func (in *Interpreter) Run(snapshot int, contract *Contract, input []byte) (ret
169
169
}
170
170
}
171
171
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
173
174
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
179
175
if ! operation .valid {
180
176
return nil , fmt .Errorf ("invalid opcode 0x%x" , int (op ))
181
177
}
182
-
183
- // validate the stack and make sure there enough stack items available
184
- // to perform the operation
185
178
if err := operation .validateStack (stack ); err != nil {
186
179
return nil , err
187
180
}
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
+ }
188
185
189
186
var memorySize uint64
190
187
// calculate the new memory size and expand the memory to fit
0 commit comments