Skip to content

Commit

Permalink
Expose mod permutation and re-export permutation::keygen::Assembly (
Browse files Browse the repository at this point in the history
privacy-scaling-explorations#149)

* feat: expose mod ule `permutation` and re-export `permutation::keygen::Assembly`

* feat: derive `lone` for `permutation::keygen::Assembly`

* feat: bump MSRV for `inferno`
  • Loading branch information
han0110 authored and Velaciela committed Oct 8, 2023
1 parent 4c12249 commit 323f403
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
4 changes: 2 additions & 2 deletions halo2_proofs/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ impl<'a, F: FieldExt> MockProver<'a, F> {
self.permutation
.as_ref()
.expect("root cs permutation must be Some")
.mapping
.mapping()
.iter()
.enumerate()
.flat_map(move |(column, values)| {
Expand Down Expand Up @@ -1817,7 +1817,7 @@ impl<'a, F: FieldExt> MockProver<'a, F> {
self.permutation
.as_ref()
.expect("root cs permutation must be Some")
.mapping
.mapping()
.iter()
.enumerate()
.flat_map(move |(column, values)| {
Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/src/plonk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ mod error;
mod evaluation;
mod keygen;
mod lookup;
pub(crate) mod permutation;
pub mod permutation;
mod vanishing;

mod prover;
Expand Down
5 changes: 5 additions & 0 deletions halo2_proofs/src/plonk/permutation.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Implementation of permutation argument.
use super::circuit::{Any, Column};
use crate::{
arithmetic::CurveAffine,
Expand All @@ -14,6 +16,8 @@ pub(crate) mod keygen;
pub(crate) mod prover;
pub(crate) mod verifier;

pub use keygen::Assembly;

use std::io;

/// A permutation argument.
Expand Down Expand Up @@ -72,6 +76,7 @@ impl Argument {
}
}

/// Returns columns that participate on the permutation argument.
pub fn get_columns(&self) -> Vec<Column<Any>> {
self.columns.clone()
}
Expand Down
20 changes: 15 additions & 5 deletions halo2_proofs/src/plonk/permutation/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ use crate::{
};

/// Struct that accumulates all the necessary data in order to construct the permutation argument.
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Assembly {
/// Columns that participate on the copy permutation argument.
pub columns: Vec<Column<Any>>,
columns: Vec<Column<Any>>,
/// Mapping of the actual copies done.
pub mapping: Vec<Vec<(usize, usize)>>,
mapping: Vec<Vec<(usize, usize)>>,
/// Some aux data used to swap positions directly when sorting.
pub aux: Vec<Vec<(usize, usize)>>,
aux: Vec<Vec<(usize, usize)>>,
/// More aux data
pub sizes: Vec<Vec<usize>>,
sizes: Vec<Vec<usize>>,
}

impl Assembly {
Expand Down Expand Up @@ -238,4 +238,14 @@ impl Assembly {
polys,
}
}

/// Returns columns that participate on the permutation argument.
pub fn columns(&self) -> &[Column<Any>] {
&self.columns
}

/// Returns mappings of the copies.
pub fn mapping(&self) -> &[Vec<(usize, usize)>] {
&self.mapping
}
}
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.63.0
1.64.0

0 comments on commit 323f403

Please sign in to comment.