From 43cb637733b01dcb96a73741993200f968843e24 Mon Sep 17 00:00:00 2001 From: guorong009 Date: Wed, 19 Jun 2024 14:27:59 +0800 Subject: [PATCH 1/3] doc: add comments to permutation prover structs --- halo2_backend/src/plonk/permutation/prover.rs | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/halo2_backend/src/plonk/permutation/prover.rs b/halo2_backend/src/plonk/permutation/prover.rs index 585fa3ab4..02c2e6a95 100644 --- a/halo2_backend/src/plonk/permutation/prover.rs +++ b/halo2_backend/src/plonk/permutation/prover.rs @@ -20,18 +20,34 @@ use crate::{ use halo2_middleware::circuit::Any; use halo2_middleware::poly::Rotation; -// TODO: Document a bit these types -// https://github.com/privacy-scaling-explorations/halo2/issues/264 - +/// Single permutation product polynomial, which has been **committed**. +/// +/// This struct contains two fields: +/// - `permutation_product_poly`: A (coefficient-form) polynomial representing the permutation grand product. +/// - `permutation_product_blind`: A scalar value used for blinding, in the commitment of the `permutation_product_poly`. +/// +/// It stores a single `Z_P` in [permutation argument specification](https://zcash.github.io/halo2/design/proving-system/permutation.html#argument-specification). pub(crate) struct CommittedSet { pub(crate) permutation_product_poly: Polynomial, permutation_product_blind: Blind, } +/// Set of permutation product polynomials, which have been **committed**. +/// +/// This struct is to contain all the permutation product commitments, from a single circuit. +/// +/// It stores multiple `Z_P` in [permutation argument specification](https://zcash.github.io/halo2/design/proving-system/permutation.html#spanning-a-large-number-of-columns). pub(crate) struct Committed { pub(crate) sets: Vec>, } +/// Set of permutation product polynomials, which have been **evaluated**. +/// +/// This struct is, in essence, the same as [`Committed`]. +/// +/// It indicates that the permutation product polynomials([`Committed`]) have been evaluated in the evaluation domain, and converted to [`Evaluated`](see [`Committed::evaluate`]). +/// +/// It also indicates that the permuted product polynomials([`Evaluated`]) can be **open** (see [`Evaluated::open`]). pub(crate) struct Evaluated { constructed: Committed, } From d4cb20fc9c9278869cbb0dd184cbe3e5f29d584b Mon Sep 17 00:00:00 2001 From: guorong009 Date: Wed, 19 Jun 2024 18:11:51 +0800 Subject: [PATCH 2/3] chore: fix the comment Co-authored-by: Eduard S. --- halo2_backend/src/plonk/permutation/prover.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/halo2_backend/src/plonk/permutation/prover.rs b/halo2_backend/src/plonk/permutation/prover.rs index 02c2e6a95..00986517b 100644 --- a/halo2_backend/src/plonk/permutation/prover.rs +++ b/halo2_backend/src/plonk/permutation/prover.rs @@ -47,7 +47,7 @@ pub(crate) struct Committed { /// /// It indicates that the permutation product polynomials([`Committed`]) have been evaluated in the evaluation domain, and converted to [`Evaluated`](see [`Committed::evaluate`]). /// -/// It also indicates that the permuted product polynomials([`Evaluated`]) can be **open** (see [`Evaluated::open`]). +/// It also indicates that the permuted product polynomials([`Evaluated`]) can be **opened** (see [`Evaluated::open`]). pub(crate) struct Evaluated { constructed: Committed, } From 23ada3972f534eb6458eba4677b10696fefaa7df Mon Sep 17 00:00:00 2001 From: guorong009 Date: Fri, 28 Jun 2024 09:43:24 +0800 Subject: [PATCH 3/3] doc: fix the doc of "Committed" struct --- halo2_backend/src/plonk/permutation/prover.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/halo2_backend/src/plonk/permutation/prover.rs b/halo2_backend/src/plonk/permutation/prover.rs index 00986517b..486da63b7 100644 --- a/halo2_backend/src/plonk/permutation/prover.rs +++ b/halo2_backend/src/plonk/permutation/prover.rs @@ -34,7 +34,7 @@ pub(crate) struct CommittedSet { /// Set of permutation product polynomials, which have been **committed**. /// -/// This struct is to contain all the permutation product commitments, from a single circuit. +/// This struct is to contain all of the permutation product polynomials([`CommittedSet`]), from a single circuit. /// /// It stores multiple `Z_P` in [permutation argument specification](https://zcash.github.io/halo2/design/proving-system/permutation.html#spanning-a-large-number-of-columns). pub(crate) struct Committed {