diff --git a/halo2_proofs/src/plonk.rs b/halo2_proofs/src/plonk.rs index 9be2fdbc79..2e99a7c119 100644 --- a/halo2_proofs/src/plonk.rs +++ b/halo2_proofs/src/plonk.rs @@ -110,6 +110,21 @@ impl VerifyingKey { cs: self.cs.pinned(), } } + + /// Doc + pub fn fixed_commitments(&self) -> &Vec { + &self.fixed_commitments + } + + /// Doc + pub fn permutation(&self) -> &permutation::VerifyingKey { + &self.permutation + } + + /// Doc + pub fn cs(&self) -> &ConstraintSystem { + &self.cs + } } /// Minimal representation of a verification key that can be used to identify diff --git a/halo2_proofs/src/plonk/circuit.rs b/halo2_proofs/src/plonk/circuit.rs index a0dce53110..369560eba8 100644 --- a/halo2_proofs/src/plonk/circuit.rs +++ b/halo2_proofs/src/plonk/circuit.rs @@ -33,7 +33,8 @@ impl Column { Column { index, column_type } } - pub(crate) fn index(&self) -> usize { + /// Doc + pub fn index(&self) -> usize { self.index } @@ -930,7 +931,7 @@ pub(crate) struct PointIndex(pub usize); /// A "virtual cell" is a PLONK cell that has been queried at a particular relative offset /// within a custom gate. #[derive(Clone, Debug)] -pub(crate) struct VirtualCell { +pub struct VirtualCell { pub(crate) column: Column, pub(crate) rotation: Rotation, } @@ -1054,8 +1055,9 @@ impl>, Iter: IntoIterator> IntoIterato } } +/// Doc #[derive(Clone, Debug)] -pub(crate) struct Gate { +pub struct Gate { name: &'static str, constraint_names: Vec<&'static str>, polys: Vec>, @@ -1074,7 +1076,8 @@ impl Gate { self.constraint_names[constraint_index] } - pub(crate) fn polynomials(&self) -> &[Expression] { + /// Doc + pub fn polynomials(&self) -> &[Expression] { &self.polys } @@ -1648,6 +1651,51 @@ impl ConstraintSystem { // and the interstitial values.) + 1 // for at least one row } + + /// Doc + pub fn num_fixed_columns(&self) -> usize { + self.num_fixed_columns + } + + /// Doc + pub fn num_advice_columns(&self) -> usize { + self.num_advice_columns + } + + /// Doc + pub fn num_instance_columns(&self) -> usize { + self.num_instance_columns + } + + /// Doc + pub fn gates(&self) -> &Vec> { + &self.gates + } + + /// Doc + pub fn advice_queries(&self) -> &Vec<(Column, Rotation)> { + &self.advice_queries + } + + /// Doc + pub fn instance_queries(&self) -> &Vec<(Column, Rotation)> { + &self.instance_queries + } + + /// Doc + pub fn fixed_queries(&self) -> &Vec<(Column, Rotation)> { + &self.fixed_queries + } + + /// Doc + pub fn permutation(&self) -> &permutation::Argument { + &self.permutation + } + + /// Doc + pub fn lookups(&self) -> &Vec> { + &self.lookups + } } /// Exposes the "virtual cells" that can be queried while creating a custom gate or lookup diff --git a/halo2_proofs/src/plonk/lookup.rs b/halo2_proofs/src/plonk/lookup.rs index 8b4e8258d3..9898e7276e 100644 --- a/halo2_proofs/src/plonk/lookup.rs +++ b/halo2_proofs/src/plonk/lookup.rs @@ -6,10 +6,10 @@ pub(crate) mod prover; pub(crate) mod verifier; #[derive(Clone)] -pub(crate) struct Argument { - pub name: &'static str, - pub input_expressions: Vec>, - pub table_expressions: Vec>, +pub struct Argument { + pub(crate) name: &'static str, + pub(crate) input_expressions: Vec>, + pub(crate) table_expressions: Vec>, } impl Debug for Argument { @@ -81,4 +81,14 @@ impl Argument { 2 + input_degree + table_degree, ) } + + /// Doc + pub fn input_expressions(&self) -> &Vec> { + &self.input_expressions + } + + /// Doc + pub fn table_expressions(&self) -> &Vec> { + &self.table_expressions + } } diff --git a/halo2_proofs/src/plonk/permutation.rs b/halo2_proofs/src/plonk/permutation.rs index 23ade0d3aa..71b685a488 100644 --- a/halo2_proofs/src/plonk/permutation.rs +++ b/halo2_proofs/src/plonk/permutation.rs @@ -13,7 +13,7 @@ use std::io; /// A permutation argument. #[derive(Debug, Clone)] -pub(crate) struct Argument { +pub struct Argument { /// A sequence of columns involved in the argument. pub(super) columns: Vec>, } @@ -67,17 +67,24 @@ impl Argument { } } - pub(crate) fn get_columns(&self) -> Vec> { + pub fn get_columns(&self) -> Vec> { self.columns.clone() } } /// The verifying key for a single permutation argument. #[derive(Clone, Debug)] -pub(crate) struct VerifyingKey { +pub struct VerifyingKey { commitments: Vec, } +impl VerifyingKey { + /// Doc + pub fn commitments(&self) -> &Vec { + &self.commitments + } +} + /// The proving key for a single permutation argument. #[derive(Clone, Debug)] pub(crate) struct ProvingKey {