Skip to content

Commit d3d9532

Browse files
authored
Update: make structs and fields related to proof generation public (#73)
* Update: make all the fields in `ProvingKey` public * Update: make more necessary structs/fields public * Fix: format doc
1 parent 08f24d4 commit d3d9532

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

plonk/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub mod testing_apis;
3131
pub mod prelude {
3232
pub use crate::{
3333
circuit::{Arithmetization, Circuit, PlonkCircuit},
34-
errors::PlonkError,
34+
errors::{PlonkError, SnarkError},
3535
proof_system::{structs::*, PlonkKzgSnark, Snark},
3636
transcript::{PlonkTranscript, StandardTranscript},
3737
};

plonk/src/proof_system/structs.rs

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ impl<E: PairingEngine> UniversalSrs<E> {
3737
}
3838
}
3939

40-
pub(crate) type CommitKey<'a, E> = Powers<'a, E>;
40+
/// Key for committing to and creating evaluation proofs
41+
/// (alias to kzg10::Powers).
42+
pub type CommitKey<'a, E> = Powers<'a, E>;
4143

4244
/// Key for verifying PCS opening proof (alias to kzg10::VerifierKey).
4345
pub type OpenKey<E> = VerifierKey<E>;
@@ -48,23 +50,23 @@ pub type OpenKey<E> = VerifierKey<E>;
4850
#[derivative(Hash(bound = "E:PairingEngine"))]
4951
pub struct Proof<E: PairingEngine> {
5052
/// Wire witness polynomials commitments.
51-
pub(crate) wires_poly_comms: Vec<Commitment<E>>,
53+
pub wires_poly_comms: Vec<Commitment<E>>,
5254

5355
/// The polynomial commitment for the wire permutation argument.
54-
pub(crate) prod_perm_poly_comm: Commitment<E>,
56+
pub prod_perm_poly_comm: Commitment<E>,
5557

5658
/// Splitted quotient polynomial commitments.
57-
pub(crate) split_quot_poly_comms: Vec<Commitment<E>>,
59+
pub split_quot_poly_comms: Vec<Commitment<E>>,
5860

5961
/// (Aggregated) proof of evaluations at challenge point `zeta`.
60-
pub(crate) opening_proof: Commitment<E>,
62+
pub opening_proof: Commitment<E>,
6163

6264
/// (Aggregated) proof of evaluation at challenge point `zeta * g` where `g`
6365
/// is the root of unity.
64-
pub(crate) shifted_opening_proof: Commitment<E>,
66+
pub shifted_opening_proof: Commitment<E>,
6567

6668
/// Polynomial evaluations.
67-
pub(crate) poly_evals: ProofEvaluations<E::Fr>,
69+
pub poly_evals: ProofEvaluations<E::Fr>,
6870
}
6971

7072
impl<E, P> TryFrom<Vec<E::Fq>> for Proof<E>
@@ -260,14 +262,14 @@ impl<E: PairingEngine> From<Proof<E>> for BatchProof<E> {
260262
#[derive(Debug, Clone, PartialEq, Eq, Hash, CanonicalSerialize, CanonicalDeserialize)]
261263
pub struct ProofEvaluations<F: Field> {
262264
/// Wire witness polynomials evaluations at point `zeta`.
263-
pub(crate) wires_evals: Vec<F>,
265+
pub wires_evals: Vec<F>,
264266

265267
/// Extended permutation (sigma) polynomials evaluations at point `zeta`.
266268
/// We do not include the last sigma polynomial evaluation.
267-
pub(crate) wire_sigma_evals: Vec<F>,
269+
pub wire_sigma_evals: Vec<F>,
268270

269271
/// Permutation product polynomial evaluation at point `zeta * g`.
270-
pub(crate) perm_next_eval: F,
272+
pub perm_next_eval: F,
271273
}
272274

273275
impl<F: Field> TryFrom<Vec<F>> for ProofEvaluations<F> {
@@ -328,30 +330,30 @@ where
328330
#[derive(Debug, Clone, PartialEq, CanonicalSerialize, CanonicalDeserialize)]
329331
pub struct ProvingKey<'a, E: PairingEngine> {
330332
/// Extended permutation (sigma) polynomials.
331-
pub(crate) sigmas: Vec<DensePolynomial<E::Fr>>,
333+
pub sigmas: Vec<DensePolynomial<E::Fr>>,
332334

333335
/// Selector polynomials.
334-
pub(crate) selectors: Vec<DensePolynomial<E::Fr>>,
336+
pub selectors: Vec<DensePolynomial<E::Fr>>,
335337

336-
// KZG PCS committing key.
337-
pub(crate) commit_key: CommitKey<'a, E>,
338+
/// KZG PCS committing key.
339+
pub commit_key: CommitKey<'a, E>,
338340

339341
/// The verifying key. It is used by prover to initialize transcripts.
340342
pub vk: VerifyingKey<E>,
341343
}
342344

343345
impl<'a, E: PairingEngine> ProvingKey<'a, E> {
344346
/// The size of the evaluation domain. Should be a power of two.
345-
pub(crate) fn domain_size(&self) -> usize {
347+
pub fn domain_size(&self) -> usize {
346348
self.vk.domain_size
347349
}
348350
/// The number of public inputs.
349351
#[allow(dead_code)]
350-
pub(crate) fn num_inputs(&self) -> usize {
352+
pub fn num_inputs(&self) -> usize {
351353
self.vk.num_inputs
352354
}
353355
/// The constants K0, ..., K4 that ensure wire subsets are disjoint.
354-
pub(crate) fn k(&self) -> &[E::Fr] {
356+
pub fn k(&self) -> &[E::Fr] {
355357
&self.vk.k
356358
}
357359
}
@@ -361,20 +363,20 @@ impl<'a, E: PairingEngine> ProvingKey<'a, E> {
361363
#[derive(Debug, Clone, PartialEq, CanonicalSerialize, CanonicalDeserialize)]
362364
pub struct VerifyingKey<E: PairingEngine> {
363365
/// The size of the evaluation domain. Should be a power of two.
364-
pub(crate) domain_size: usize,
366+
pub domain_size: usize,
365367

366368
/// The number of public inputs.
367-
pub(crate) num_inputs: usize,
369+
pub num_inputs: usize,
368370

369371
/// The permutation polynomial commitments. The commitments are not hiding.
370-
pub(crate) sigma_comms: Vec<Commitment<E>>,
372+
pub sigma_comms: Vec<Commitment<E>>,
371373

372374
/// The selector polynomial commitments. The commitments are not hiding.
373-
pub(crate) selector_comms: Vec<Commitment<E>>,
375+
pub selector_comms: Vec<Commitment<E>>,
374376

375377
/// The constants K0, ..., K_num_wire_types that ensure wire subsets are
376378
/// disjoint.
377-
pub(crate) k: Vec<E::Fr>,
379+
pub k: Vec<E::Fr>,
378380

379381
/// KZG PCS opening key.
380382
pub open_key: OpenKey<E>,

0 commit comments

Comments
 (0)