Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add comments to permutation prover structs #355

Merged
merged 6 commits into from
Sep 26, 2024

Conversation

guorong009
Copy link

Description

Document the permutation prover types, in halo2_backend

Related issues

Resolve #264

Changes

  • add comments to CommittedSet, Committed and Evaluated structs in halo2_backend/plonk/permutation/prover.rs

@guorong009 guorong009 self-assigned this Jun 19, 2024
Copy link
Member

@ed255 ed255 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I'm not familiar enough with this to approve. Specially I'm not very familiar with the names for the different domains; I think @davidnevadoc can review the naming better :)

halo2_backend/src/plonk/permutation/prover.rs Outdated Show resolved Hide resolved
Co-authored-by: Eduard S. <[email protected]>
@guorong009
Copy link
Author

@davidnevadoc
Can you take a look at the PR?
It's a tiny PR for documentation.
So, I think we can merge this before new release.

@guorong009 guorong009 marked this pull request as draft June 25, 2024 09:04
@guorong009
Copy link
Author

Mark as draft until new release.

pub(crate) struct CommittedSet<C: CurveAffine> {
pub(crate) permutation_product_poly: Polynomial<C::Scalar, Coeff>,
permutation_product_blind: Blind<C::Scalar>,
}

/// Set of permutation product polynomials, which have been **committed**.
///
/// This struct is to contain all the permutation product commitments, from a single circuit.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This structs only contains a vector of CommittedSet, which in turn, just holds polynomials that have been committed to, plus their blinders. So, the actual commitments are not store here, right? 🤔

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly. @davidnevadoc
The real commitments are computed & stored into transcript in this part.
The CommittedSet just holds the polynomial which has been committed, and its blinder.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This struct is to contain all the permutation product commitments
Then I think we should change or remove this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I change the doc, as recommended, here. 23ada39

@codecov-commenter
Copy link

codecov-commenter commented Jun 28, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.99%. Comparing base (7c368af) to head (e817f27).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #355   +/-   ##
=======================================
  Coverage   84.99%   84.99%           
=======================================
  Files          85       85           
  Lines       18684    18684           
=======================================
  Hits        15880    15880           
  Misses       2804     2804           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@guorong009 guorong009 marked this pull request as ready for review September 16, 2024 02:45
Copy link

@davidnevadoc davidnevadoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc looks good but I find the struct names somewhat confusing (not changed in this PR).
In particular, Committed being a Vec of CommittedSet and not the other way around seems very counter intuitive. Thoughts on this @adria0 @guorong009 ?
Other than that, LGTM 👍

@guorong009
Copy link
Author

Doc looks good but I find the struct names somewhat confusing (not changed in this PR). In particular, Committed being a Vec of CommittedSet and not the other way around seems very counter intuitive. Thoughts on this @adria0 @guorong009 ? Other than that, LGTM 👍

Yes, they are very counter intuitive.
How about renaming the CommittedSet?
eg. PermPolyCommitted, SinglePolyCommitted, CommittedSingle

/// - `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).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding a link the the halo2 specification!

///
/// 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 **opened** (see [`Evaluated::open`]).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// It also indicates that the permuted product polynomials([`Evaluated`]) can be **opened** (see [`Evaluated::open`]).
/// It also indicates that the permuted product polynomials([`Evaluated`]) can be **opened** (see [`Evaluated::open`]).

Good point!

Copy link
Member

@adria0 adria0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@CPerezz CPerezz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@adria0 adria0 merged commit 486770c into main Sep 26, 2024
6 checks passed
@guorong009 guorong009 deleted the gr@doc-permutation-prover-structs branch September 26, 2024 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document permutation prover types
6 participants