Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose mod permutation and re-export permutation::keygen::Assembly #147

Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions halo2_proofs/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ impl<F: FieldExt> MockProver<F> {

// Iterate over each column of the permutation
self.permutation
.mapping
.mapping()
.iter()
.enumerate()
.flat_map(move |(column, values)| {
Expand Down Expand Up @@ -1334,7 +1334,7 @@ impl<F: FieldExt> MockProver<F> {

// Iterate over each column of the permutation
self.permutation
.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 @@ -27,7 +27,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, 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 @@ -239,4 +239,14 @@ impl Assembly {
cosets,
}
}

/// 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
}
}