@@ -255,14 +255,14 @@ fn fn_gen_associated_ops(opcode_id: &OpcodeId) -> FnGenAssociatedOps {
255
255
}
256
256
}
257
257
258
- fn fn_gen_error_state_associated_ops ( error : & ExecError ) -> FnGenAssociatedOps {
258
+ fn fn_gen_error_state_associated_ops ( error : & ExecError ) -> Option < FnGenAssociatedOps > {
259
259
match error {
260
- ExecError :: InvalidJump => ErrorInvalidJump :: gen_associated_ops,
261
- ExecError :: OutOfGas ( OogError :: Call ) => OOGCall :: gen_associated_ops,
260
+ ExecError :: InvalidJump => Some ( ErrorInvalidJump :: gen_associated_ops) ,
261
+ ExecError :: OutOfGas ( OogError :: Call ) => Some ( OOGCall :: gen_associated_ops) ,
262
262
// more future errors place here
263
263
_ => {
264
- warn ! ( "Using dummy gen_associated_ops for error state {:?}" , error) ;
265
- Dummy :: gen_associated_ops
264
+ warn ! ( "TODO: error state {:?} not implemented " , error) ;
265
+ None
266
266
}
267
267
}
268
268
}
@@ -327,16 +327,22 @@ pub fn gen_associated_ops(
327
327
if exec_step. oog_or_stack_error ( ) && !geth_step. op . is_call_or_create ( ) {
328
328
state. gen_restore_context_ops ( & mut exec_step, geth_steps) ?;
329
329
} else {
330
+ let fn_gen_error_associated_ops = fn_gen_error_state_associated_ops ( & exec_error) ;
331
+ // if fn_gen_error_associated_ops handles the target error, return the handled
332
+ // result
333
+ if let Some ( fn_gen_error_ops) = fn_gen_error_associated_ops {
334
+ return fn_gen_error_ops ( state, geth_steps) ;
335
+ }
336
+
337
+ // here for some errors which fn_gen_error_associated_ops don't handle now,
338
+ // continue to use dummy handling until all errors implemented in
339
+ // fn_gen_error_associated_ops
330
340
if geth_step. op . is_call_or_create ( ) && !exec_step. oog_or_stack_error ( ) {
331
341
let call = state. parse_call ( geth_step) ?;
332
342
// Switch to callee's call context
333
343
state. push_call ( call) ;
334
- } else {
335
- let fn_gen_error_associated_ops = fn_gen_error_state_associated_ops ( & exec_error) ;
336
- return fn_gen_error_associated_ops ( state, geth_steps) ;
337
344
}
338
345
}
339
-
340
346
state. handle_return ( geth_step) ?;
341
347
return Ok ( vec ! [ exec_step] ) ;
342
348
}
0 commit comments