Skip to content

Commit

Permalink
fix failures
Browse files Browse the repository at this point in the history
  • Loading branch information
DreamWuGit committed Aug 19, 2024
1 parent 169e6c7 commit 09c16c2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 0 additions & 2 deletions zkevm-circuits/src/evm_circuit/execution/extcodecopy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,6 @@ impl<F: Field> ExecutionGadget<F> for ExtcodecopyGadget<F> {
.code_len_gadget
.assign(region, offset, block, &code_hash)?;

self.code_len_gadget
.assign(region, offset, block, &code_hash)?;
self.code_offset
.assign(region, offset, code_offset, F::from(code_size))?;

Expand Down
21 changes: 19 additions & 2 deletions zkevm-circuits/src/evm_circuit/util/constraint_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ pub(crate) struct EVMConstraintBuilder<'a, F> {
execution_state: ExecutionState,
constraints: Constraints<F>,
rw_counter_offset: Expression<F>,
program_counter_offset: Expression<F>,
stack_pointer_offset: Expression<F>,
log_id_offset: usize,
in_next_step: bool,
Expand Down Expand Up @@ -350,6 +351,7 @@ impl<'a, F: Field> EVMConstraintBuilder<'a, F> {
not_step_last: Vec::new(),
},
rw_counter_offset: 0.expr(),
program_counter_offset: 0.expr(),
stack_pointer_offset: 0.expr(),
log_id_offset: 0,
in_next_step: false,
Expand Down Expand Up @@ -693,17 +695,32 @@ impl<'a, F: Field> EVMConstraintBuilder<'a, F> {
}

pub(crate) fn opcode_lookup_rlc(&mut self, opcode: Expression<F>, push_rlc: Expression<F>) {
self.opcode_lookup_at_rlc(self.curr.state.program_counter.expr(), opcode, push_rlc);
//self.opcode_lookup_at_rlc(self.curr.state.program_counter.expr(), opcode, push_rlc);
self.opcode_lookup_at_rlc(
self.curr.state.program_counter.expr() + self.program_counter_offset.clone(),
opcode,
push_rlc,
);

self.program_counter_offset = self.program_counter_offset.clone() * self.condition_expr();
}

#[cfg(feature = "dual_bytecode")]
// helper to lookup second bytecode table.
pub(crate) fn opcode_lookup_rlc2(&mut self, opcode: Expression<F>, push_rlc: Expression<F>) {
// self.opcode_lookup_at_rlc2(
// self.curr.state.program_counter.expr() + self.condition_expr(),
// opcode,
// push_rlc,
// );
self.opcode_lookup_at_rlc2(
self.curr.state.program_counter.expr() + self.condition_expr(),
self.curr.state.program_counter.expr()
+ self.program_counter_offset.expr() * self.condition_expr(),
opcode,
push_rlc,
);

self.program_counter_offset = self.program_counter_offset.clone() * self.condition_expr();
}

// lookup bytecode_table.
Expand Down

0 comments on commit 09c16c2

Please sign in to comment.