From 666484a18655b02e35a3d31099ba93dce7d87b53 Mon Sep 17 00:00:00 2001 From: han0110 Date: Fri, 17 Feb 2023 02:02:41 +0000 Subject: [PATCH 1/3] feat: expose mod ule `permutation` and re-export `permutation::keygen::Assembly` --- halo2_proofs/src/dev.rs | 4 ++-- halo2_proofs/src/plonk.rs | 2 +- halo2_proofs/src/plonk/permutation.rs | 5 +++++ halo2_proofs/src/plonk/permutation/keygen.rs | 18 ++++++++++++++---- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/halo2_proofs/src/dev.rs b/halo2_proofs/src/dev.rs index 8989fe1309..511bc91293 100644 --- a/halo2_proofs/src/dev.rs +++ b/halo2_proofs/src/dev.rs @@ -973,7 +973,7 @@ impl MockProver { // Iterate over each column of the permutation self.permutation - .mapping + .mapping() .iter() .enumerate() .flat_map(move |(column, values)| { @@ -1334,7 +1334,7 @@ impl MockProver { // Iterate over each column of the permutation self.permutation - .mapping + .mapping() .iter() .enumerate() .flat_map(move |(column, values)| { diff --git a/halo2_proofs/src/plonk.rs b/halo2_proofs/src/plonk.rs index 00f2c51586..8d9d347546 100644 --- a/halo2_proofs/src/plonk.rs +++ b/halo2_proofs/src/plonk.rs @@ -27,7 +27,7 @@ mod error; mod evaluation; mod keygen; mod lookup; -pub(crate) mod permutation; +pub mod permutation; mod vanishing; mod prover; diff --git a/halo2_proofs/src/plonk/permutation.rs b/halo2_proofs/src/plonk/permutation.rs index 05cae2d373..0e92ccc705 100644 --- a/halo2_proofs/src/plonk/permutation.rs +++ b/halo2_proofs/src/plonk/permutation.rs @@ -1,3 +1,5 @@ +//! Implementation of permutation argument. + use super::circuit::{Any, Column}; use crate::{ arithmetic::CurveAffine, @@ -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. @@ -72,6 +76,7 @@ impl Argument { } } + /// Returns columns that participate on the permutation argument. pub fn get_columns(&self) -> Vec> { self.columns.clone() } diff --git a/halo2_proofs/src/plonk/permutation/keygen.rs b/halo2_proofs/src/plonk/permutation/keygen.rs index 9cb226a94e..a1f4ee33f1 100644 --- a/halo2_proofs/src/plonk/permutation/keygen.rs +++ b/halo2_proofs/src/plonk/permutation/keygen.rs @@ -15,13 +15,13 @@ use crate::{ #[derive(Debug, PartialEq, Eq)] pub struct Assembly { /// Columns that participate on the copy permutation argument. - pub columns: Vec>, + columns: Vec>, /// Mapping of the actual copies done. - pub mapping: Vec>, + mapping: Vec>, /// Some aux data used to swap positions directly when sorting. - pub aux: Vec>, + aux: Vec>, /// More aux data - pub sizes: Vec>, + sizes: Vec>, } impl Assembly { @@ -239,4 +239,14 @@ impl Assembly { cosets, } } + + /// Returns columns that participate on the permutation argument. + pub fn columns(&self) -> &[Column] { + &self.columns + } + + /// Returns mappings of the copies. + pub fn mapping(&self) -> &[Vec<(usize, usize)>] { + &self.mapping + } } From 3d3856bd9c9ffcdbe36ec6c69a0163081d1af6bd Mon Sep 17 00:00:00 2001 From: han0110 Date: Fri, 17 Feb 2023 12:36:19 +0000 Subject: [PATCH 2/3] feat: derive `lone` for `permutation::keygen::Assembly` --- halo2_proofs/src/plonk/permutation/keygen.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/halo2_proofs/src/plonk/permutation/keygen.rs b/halo2_proofs/src/plonk/permutation/keygen.rs index a1f4ee33f1..277c1b92e9 100644 --- a/halo2_proofs/src/plonk/permutation/keygen.rs +++ b/halo2_proofs/src/plonk/permutation/keygen.rs @@ -12,7 +12,7 @@ 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. columns: Vec>, From eeb903718c665e4d26178c3ec161dfad74f787f3 Mon Sep 17 00:00:00 2001 From: han0110 Date: Wed, 22 Feb 2023 05:06:25 +0000 Subject: [PATCH 3/3] feat: bump MSRV for `inferno` --- rust-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain b/rust-toolchain index af92bdd9f5..9405730420 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.63.0 +1.64.0