Skip to content

Commit

Permalink
feat: expose mod ule permutation and re-export `permutation::keygen…
Browse files Browse the repository at this point in the history
…::Assembly`
  • Loading branch information
han0110 committed Feb 17, 2023
1 parent c85ab01 commit 666484a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
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
18 changes: 14 additions & 4 deletions halo2_proofs/src/plonk/permutation/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ use crate::{
#[derive(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
}
}

0 comments on commit 666484a

Please sign in to comment.