Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit f33b7ff

Browse files
committed
Merge branch 'scroll-dev-1115' of github.com:scroll-tech/zkevm-circuits into scroll-dev-1115
2 parents bf78f5b + e72ade2 commit f33b7ff

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

bus-mapping/src/evm/opcodes.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,14 @@ fn fn_gen_associated_ops(opcode_id: &OpcodeId) -> FnGenAssociatedOps {
255255
}
256256
}
257257

258-
fn fn_gen_error_state_associated_ops(error: &ExecError) -> FnGenAssociatedOps {
258+
fn fn_gen_error_state_associated_ops(error: &ExecError) -> Option<FnGenAssociatedOps> {
259259
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),
262262
// more future errors place here
263263
_ => {
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
266266
}
267267
}
268268
}
@@ -327,16 +327,22 @@ pub fn gen_associated_ops(
327327
if exec_step.oog_or_stack_error() && !geth_step.op.is_call_or_create() {
328328
state.gen_restore_context_ops(&mut exec_step, geth_steps)?;
329329
} 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
330340
if geth_step.op.is_call_or_create() && !exec_step.oog_or_stack_error() {
331341
let call = state.parse_call(geth_step)?;
332342
// Switch to callee's call context
333343
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);
337344
}
338345
}
339-
340346
state.handle_return(geth_step)?;
341347
return Ok(vec![exec_step]);
342348
}

zkevm-circuits/src/evm_circuit/execution/memory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<F: Field> ExecutionGadget<F> for MemoryGadget<F> {
4949
let is_mstore8 = IsEqualGadget::construct(cb, opcode.expr(), OpcodeId::MSTORE8.expr());
5050
// This is an MSTORE/MSTORE8
5151
let is_store = not::expr(is_mload.expr());
52-
// This in an MSTORE/MLOAD
52+
// This is an MSTORE/MLOAD
5353
let is_not_mstore8 = not::expr(is_mstore8.expr());
5454

5555
// Calculate the next memory size and the gas cost for this memory

0 commit comments

Comments
 (0)