Skip to content

Commit

Permalink
ADD: constraints for filter_looking_rc in memory.
Browse files Browse the repository at this point in the history
  • Loading branch information
web3Softcloud committed Jan 13, 2023
1 parent f69161a commit b7e31c3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions circuits/src/memory/memory_stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ impl<F: RichField + Extendable<D>, const D: usize> Stark<F, D> for MemoryStark<F
let nv_value = lv[COL_MEM_VALUE];
let diff_clk = lv[COL_MEM_DIFF_CLK];
let rc_value = lv[COL_MEM_RC_VALUE];
let filter_looking_rc = lv[COL_MEM_FILTER_LOOKING_RC];

let op_mload = P::Scalar::from_canonical_u64(2_u64.pow(25));
let op_mstore = P::Scalar::from_canonical_u64(2_u64.pow(24));
Expand Down Expand Up @@ -172,6 +173,12 @@ impl<F: RichField + Extendable<D>, const D: usize> Stark<F, D> for MemoryStark<F
// rc_value constraint:
yield_constr.constraint(is_rw * (diff_addr + diff_clk - rc_value));
yield_constr.constraint((P::ONES - is_rw) * (diff_addr_cond - rc_value));
// filter_looking_rc constraints:
// 1. read write segment filter_looking_rc must be 1.
// 2. in write once segment, when reading filter_looking_rc must be 1.
yield_constr.constraint(is_rw * (P::ONES - filter_looking_rc));
yield_constr
.constraint((P::ONES - is_rw) * (P::ONES - is_write) * (P::ONES - filter_looking_rc));
}

fn eval_ext_circuit(
Expand Down

0 comments on commit b7e31c3

Please sign in to comment.