Skip to content

Commit

Permalink
support max snark up to 15 (privacy-scaling-explorations#803)
Browse files Browse the repository at this point in the history
* support max snark upto 16

* more tests

* fix bug in data input len

* merge required features from max_snark=29

* clean up
  • Loading branch information
zhenfeizhang authored Sep 6, 2023
1 parent 86491c2 commit 48d9298
Show file tree
Hide file tree
Showing 7 changed files with 188 additions and 132 deletions.
1 change: 1 addition & 0 deletions aggregator/src/aggregation/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ impl AggregationConfig {
);

let columns = keccak_circuit_config.cell_manager.columns();
log::info!("keccak uses {} columns", columns.len(),);

// enabling equality for preimage column
meta.enable_equality(columns[keccak_circuit_config.preimage_column_index].advice);
Expand Down
24 changes: 17 additions & 7 deletions aggregator/src/aggregation/rlc/gates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ impl RlcConfig {
region.assign_fixed(|| "const two", self.fixed, 2, || Value::known(Fr::from(2)))?;
region.assign_fixed(|| "const five", self.fixed, 3, || Value::known(Fr::from(5)))?;
region.assign_fixed(|| "const nine", self.fixed, 4, || Value::known(Fr::from(9)))?;
region.assign_fixed(|| "const 32", self.fixed, 5, || Value::known(Fr::from(32)))?;
region.assign_fixed(|| "const 13", self.fixed, 5, || Value::known(Fr::from(13)))?;
region.assign_fixed(|| "const 32", self.fixed, 6, || Value::known(Fr::from(32)))?;
region.assign_fixed(
|| "const 136",
self.fixed,
6,
7,
|| Value::known(Fr::from(136)),
)?;
region.assign_fixed(
|| "const 2^32",
self.fixed,
7,
8,
|| Value::known(Fr::from(1 << 32)),
)?;
Ok(())
Expand Down Expand Up @@ -80,27 +81,36 @@ impl RlcConfig {
}

#[inline]
pub(crate) fn thirty_two_cell(&self, region_index: RegionIndex) -> Cell {
pub(crate) fn thirteen_cell(&self, region_index: RegionIndex) -> Cell {
Cell {
region_index,
row_offset: 5,
column: self.fixed.into(),
}
}

#[inline]
pub(crate) fn one_hundred_and_thirty_six_cell(&self, region_index: RegionIndex) -> Cell {
pub(crate) fn thirty_two_cell(&self, region_index: RegionIndex) -> Cell {
Cell {
region_index,
row_offset: 6,
column: self.fixed.into(),
}
}
#[inline]
pub(crate) fn one_hundred_and_thirty_six_cell(&self, region_index: RegionIndex) -> Cell {
Cell {
region_index,
row_offset: 7,
column: self.fixed.into(),
}
}

#[inline]
pub(crate) fn two_to_thirty_two_cell(&self, region_index: RegionIndex) -> Cell {
Cell {
region_index,
row_offset: 7,
row_offset: 8,
column: self.fixed.into(),
}
}
Expand Down Expand Up @@ -439,7 +449,7 @@ impl RlcConfig {
&input.value(),
)
.as_str(),
);
)?;

region.constrain_equal(acc.cell(), input.cell())?;

Expand Down
2 changes: 1 addition & 1 deletion aggregator/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ pub(crate) const BITS: usize = 88;
/// If the input size is less than this, dummy snarks
/// will be padded.
// TODO: update me(?)
pub const MAX_AGG_SNARKS: usize = 10;
pub const MAX_AGG_SNARKS: usize = 15;
Loading

0 comments on commit 48d9298

Please sign in to comment.