diff --git a/bus-mapping/src/evm/opcodes.rs b/bus-mapping/src/evm/opcodes.rs index afb9481328..ca538ef163 100644 --- a/bus-mapping/src/evm/opcodes.rs +++ b/bus-mapping/src/evm/opcodes.rs @@ -285,9 +285,6 @@ pub fn gen_associated_ops( state: &mut CircuitInputStateRef, geth_steps: &[GethExecStep], ) -> Result, Error> { - let fn_gen_associated_ops = fn_gen_associated_ops(opcode_id); - - // if no errors, continue as normal let memory_enabled = !geth_steps.iter().all(|s| s.memory.is_empty()); if memory_enabled { let check_level = if *CHECK_MEM_STRICT { 2 } else { 0 }; // 0: no check, 1: check and log error and fix, 2: check and assert_eq @@ -356,6 +353,7 @@ pub fn gen_associated_ops( } } // if no errors, continue as normal + let fn_gen_associated_ops = fn_gen_associated_ops(opcode_id); fn_gen_associated_ops(state, geth_steps) } diff --git a/bus-mapping/src/evm/opcodes/error_invalid_opcode.rs b/bus-mapping/src/evm/opcodes/error_invalid_opcode.rs index d73f6bfae4..5b6cd87ce3 100644 --- a/bus-mapping/src/evm/opcodes/error_invalid_opcode.rs +++ b/bus-mapping/src/evm/opcodes/error_invalid_opcode.rs @@ -1,4 +1,5 @@ use crate::circuit_input_builder::{CircuitInputStateRef, ExecStep}; +use crate::error::ExecError; use crate::evm::Opcode; use crate::Error; use eth_types::GethExecStep; @@ -13,13 +14,7 @@ impl Opcode for InvalidOpcode { ) -> Result, Error> { let geth_step = &geth_steps[0]; let mut exec_step = state.new_step(geth_step)?; - - let next_step = if geth_steps.len() > 1 { - Some(&geth_steps[1]) - } else { - None - }; - exec_step.error = state.get_step_err(geth_step, next_step).unwrap(); + exec_step.error = Some(ExecError::InvalidOpcode); state.gen_restore_context_ops(&mut exec_step, geth_steps)?; state.handle_return(geth_step)?; diff --git a/zkevm-circuits/src/evm_circuit/execution/error_invalid_opcode.rs b/zkevm-circuits/src/evm_circuit/execution/error_invalid_opcode.rs index eb41b6932d..7f2dff2a84 100644 --- a/zkevm-circuits/src/evm_circuit/execution/error_invalid_opcode.rs +++ b/zkevm-circuits/src/evm_circuit/execution/error_invalid_opcode.rs @@ -128,12 +128,9 @@ mod test { use crate::test_util::CircuitTestBuilder; use eth_types::bytecode::Bytecode; use eth_types::{bytecode, ToWord, Word}; - use itertools::Itertools; use lazy_static::lazy_static; use mock::TestContext; - const TESTING_CALL_DATA_PAIRS: [(usize, usize); 2] = [(0x20, 0x00), (0x1010, 0xff)]; - lazy_static! { static ref TESTING_INVALID_CODES: [Vec; 6] = [ // Single invalid opcode @@ -156,11 +153,8 @@ mod test { #[test] fn invalid_opcode_internal() { - for ((call_data_offset, call_data_length), invalid_opcode) in TESTING_CALL_DATA_PAIRS - .iter() - .cartesian_product(TESTING_INVALID_CODES.iter()) - { - test_internal_ok(*call_data_offset, *call_data_length, invalid_opcode); + for invalid_code in TESTING_INVALID_CODES.iter() { + test_internal_ok(0x20, 0x00, invalid_code); } }