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

Commit e9e845d

Browse files
Gate docs
1 parent 65a174a commit e9e845d

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

crates/shielder-circuits/src/gates/membership.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ impl<F: Field, const N: usize> Gate<F> for MembershipGate<N> {
3131
type Values = MembershipGateValues<F, N>;
3232
type Advices = (Column<Advice>, [Column<Advice>; N]);
3333

34+
/// The gate operates on a single advice column `needle` and `N` advice columns `haystack`. It
35+
/// enforces that:
36+
///
37+
/// `(needle[x] - haystack_1[x]) · … · (needle[x] - haystack_N[x]) = 0`, where `x` is the row
38+
/// where the gate is enabled.
3439
fn create_gate(
3540
cs: &mut ConstraintSystem<F>,
3641
(needle_advice, haystack_advice): Self::Advices,

crates/shielder-circuits/src/gates/range_check.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ impl<const CHUNK_SIZE: usize, F: FieldExt> Gate<F> for RangeCheckGate<CHUNK_SIZE
2626
type Values = RangeCheckGateValues<F>;
2727
type Advices = Column<Advice>;
2828

29+
/// The gate operates on a single advice column `A` and a table `T`. It enforces that:
30+
///
31+
/// `A[x] - A[x+1] * 2^CHUNK_SIZE` belongs to `T`
32+
///
33+
/// where:
34+
/// - `x` is the row where the gate is enabled
35+
/// - `T` represents set `[0, 2^CHUNK_SIZE)`
2936
fn create_gate(cs: &mut ConstraintSystem<F>, running_sum: Self::Advices) -> Self {
3037
let selector = cs.complex_selector();
3138
let table = RangeTable::new(cs);

crates/shielder-circuits/src/gates/sum.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ impl<F: Field> Gate<F> for SumGate {
3131
type Values = SumGateValues<F>;
3232
type Advices = [Column<Advice>; 3];
3333

34+
/// The gate operates on three advice columns `A`, `B`, and `C`. It enforces that:
35+
/// `A[x] + B[x] = C[x]`, where `x` is the row where the gate is enabled.
3436
fn create_gate(cs: &mut ConstraintSystem<F>, advice: Self::Advices) -> Self {
3537
Self::ensure_unique_columns(&advice);
3638
let selector = cs.selector();

0 commit comments

Comments
 (0)