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

refactor all copy bytes using rlc_acc equality check #604

Merged
merged 2 commits into from
Jul 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions zkevm-circuits/src/copy_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,11 @@ impl<F: Field> SubCircuitConfig<F> for CopyCircuitConfig<F> {
cb.gate(and::expr([
meta.query_fixed(q_enable, Rotation::cur()),
meta.query_advice(is_last, Rotation::next()),
and::expr([
meta.query_advice(is_memory, Rotation::cur()),
meta.query_advice(is_memory, Rotation::next())
+ meta.query_advice(is_tx_log, Rotation::next()),
]),
// and::expr([
// meta.query_advice(is_memory, Rotation::cur()),
// meta.query_advice(is_memory, Rotation::next())
// + meta.query_advice(is_tx_log, Rotation::next()),
// ]),
]))
},
);
Expand Down Expand Up @@ -569,20 +569,20 @@ impl<F: Field> SubCircuitConfig<F> for CopyCircuitConfig<F> {
);
// we use rlc to constraint the write == read specially for memory to memory case
// here only handle non memory to memory nor to log cases
cb.condition(
not::expr(and::expr([
meta.query_advice(is_memory, Rotation::cur()),
meta.query_advice(is_memory, Rotation::next())
+ meta.query_advice(is_tx_log, Rotation::next()),
])),
|cb| {
cb.require_equal(
"write value == read value",
meta.query_advice(value, Rotation::cur()),
meta.query_advice(value, Rotation::next()),
);
},
);
// cb.condition(
// not::expr(and::expr([
// meta.query_advice(is_memory, Rotation::cur()),
// meta.query_advice(is_memory, Rotation::next())
// + meta.query_advice(is_tx_log, Rotation::next()),
// ])),
// |cb| {
// cb.require_equal(
// "write value == read value",
// meta.query_advice(value, Rotation::cur()),
// meta.query_advice(value, Rotation::next()),
// );
// },
// );

cb.require_equal(
"value_acc is same for read-write rows",
Expand Down