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

[To split] Refactor BaseFold and add some features. #294

Closed
wants to merge 53 commits into from

Conversation

yczhangsjtu
Copy link
Collaborator

@yczhangsjtu yczhangsjtu commented Sep 29, 2024

Massively refactored the code. Eliminate the repetitive codes.

Add features:

  • Add new API that supports opening multiple groups of polynomials at one point.
  • Configurable hash function
  • Update the query complexity according to the new paper
  • Skipping rounds optimization (consider canceling this because it's complex to implement, but the benefit is small since proving time is only 200ms now.)

API change:

  • (Breaking change) To differentiate the three versions of batching protocols, rename the original batch_open/verify into batch_vlmp_* where vlmp stands for "polys of Variable Length opened at Multiple Points".
  • The new API is named batch_vlop_open/verify where vlop stands for "polys of Variable Length opened at One Points".
  • (Breaking change) Remove Rng from the template parameters for Basefold.

@yczhangsjtu
Copy link
Collaborator Author

yczhangsjtu commented Sep 29, 2024

Current benchmark results for simple batch (just after refactoring, no skipping rounds yet):

Polynomials size: 64 polys, 20 num of variables.

  • Commit: 2.233 s
  • Open: 439.46 ms
  • Verify: 37.689 ms

@yczhangsjtu
Copy link
Collaborator Author

Current benchmark results for batch vlop (no skipping rounds yet):

Polynomial size: 8 groups, each group has 8 polynomials, with number of variables 20, 19, 18, ..., 13, respectively.

  • Open: 370.73 ms
  • Verify: 43.569 ms

@yczhangsjtu
Copy link
Collaborator Author

Current benchmark results for simple batch (after refactoring, with new Poseidon hash function, no skipping rounds yet):

Polynomials size: 64 polys, 20 num of variables.

  • Commit: 1.6075 s
  • Open: 232.53 ms
  • Verify: 13.824 ms

@yczhangsjtu
Copy link
Collaborator Author

After changing query number to 200:

  • Commit: 1.5916 s
  • Open: 226.44 ms
  • Verify: 3.8251 ms (Previous 13.824 ms)

Copy link
Collaborator

@matthiasgoergens matthiasgoergens left a comment

Choose a reason for hiding this comment

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

This PR is too large to review. Please break it into smaller chunks, if possible.

yczhangsjtu added a commit that referenced this pull request Nov 4, 2024
yczhangsjtu added a commit that referenced this pull request Nov 5, 2024
Extracting a small PR from #294.

The random generator is used only when the encoding scheme is Basecode,
and not used for RS code. So remove it from the type parameter for
Basefold, i.e., `Basefold<E, Spec, Rng>` is replaced with `Basefold<E,
Spec>` to make the API simpler. Fix it to `ChaCha8Rng` in the
implementation of Basecode.
@yczhangsjtu yczhangsjtu changed the title Refactor BaseFold and add some features. [To split] Refactor BaseFold and add some features. Nov 5, 2024
@yczhangsjtu yczhangsjtu marked this pull request as draft November 6, 2024 08:29
hero78119 added a commit that referenced this pull request Nov 26, 2024
Extract a small independent change from #294

Co-authored-by: Ming <[email protected]>
yczhangsjtu added a commit that referenced this pull request Nov 28, 2024
Extracting small PR from #294 

Refactor the test code in `mpcs/src/lib.rs`. Define some utility
functions to simplify the tests.

Also merged the test functions in `mpcs/src/basefold.rs`.
yczhangsjtu added a commit that referenced this pull request Nov 28, 2024
Extracting small PR from #294.

The two benchmarks `benches_commit_verify_rs` and
`benches_commit_verify_basecode` are similar, differing only in the
choice of parameter. Merge them into one benchmark file.

Also simplify the codes using the test utility functions introduced in
#552

Waiting for #552 to merge.

---------

Co-authored-by: Matthias Görgens <[email protected]>
@yczhangsjtu
Copy link
Collaborator Author

Too big PR. Splitting gradually (but not top priority for now), close first.

yczhangsjtu added a commit that referenced this pull request Nov 28, 2024
Extracting small PRs from #294 

There was an implementation of Iterator for iterating through a
`FieldType`. Turns out that it can be replaced with existing tools in
`iter_tools`. This proposes the new implementation.

Also added some other utility functions for type conversion between
`FieldType` and `Vec<E>`, to avoid `match field_type` everywhere.
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.

2 participants