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

Let Radix2Domain::offset to be FpVar instead of F #65

Merged
merged 9 commits into from Jun 6, 2021

Conversation

tsunrise
Copy link
Member

@tsunrise tsunrise commented May 31, 2021

Description

Current Radix2Domain does not support non-constant offset. This PR adds that functionality.

Highlighted Changes:

  • Radix2Domain will be renamed to Radix2DomainVar
  • Radix2DomainVar will offset that is FpVar instead of F
  • Radix2DomainVar::interpolate_and_evaluate will specialize according to whether self.offset is constant or not.

closes: #64


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (main)
  • Linked to Github issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

@weikengchen
Copy link
Member

weikengchen commented May 31, 2021

The change looks good. Although this is a breaking change, the Radix2Domain in r1cs_std is not used very often downstream (most are using the Radix2Domain in ark-ff), and I think renaming makes sense.

@tsunrise tsunrise marked this pull request as ready for review June 4, 2021 04:38
src/poly/domain/mod.rs Outdated Show resolved Hide resolved
src/poly/domain/mod.rs Outdated Show resolved Hide resolved
@Pratyush Pratyush requested a review from ValarDragon June 5, 2021 05:03
Copy link
Member Author

@tsunrise tsunrise left a comment

Choose a reason for hiding this comment

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

Thanks for review! fixed 2 of 3

src/poly/domain/mod.rs Outdated Show resolved Hide resolved
src/poly/evaluations/univariate/mod.rs Outdated Show resolved Hide resolved
@weikengchen
Copy link
Member

will wait for @ValarDragon for a final review

/// Defines an evaluation domain over a prime field. The domain is a coset of size `1<<dim`.
///
/// Native code corresponds to `ark-poly::univariate::domain::radix2`, but `ark-poly` only supports
/// subgroup for now.
///
/// TODO: support cosets in `ark-poly`.
pub struct Radix2Domain<F: PrimeField> {
pub struct Radix2DomainVar<F: PrimeField> {
/// generator of subgroup g
pub gen: F,
Copy link
Member

Choose a reason for hiding this comment

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

Should we plan to make this FpVar in a future release as well?

Copy link
Member

Choose a reason for hiding this comment

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

I did some preliminary attempts. It is possible but would require a lot of changes. I guess we would leave it to the next release.

There are some potential use cases. For example, a Marlin gadget verifies proofs of varying domain sizes, e.g., if used as layer-2 of ZEXE.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good. I will put this on my stack, and will probably do so after I finish up FRI protocol

Copy link
Member

@ValarDragon ValarDragon left a comment

Choose a reason for hiding this comment

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

LGTM, just a suggestion for one minor function rename

@weikengchen weikengchen merged commit c3a99ac into arkworks-rs:master Jun 6, 2021
@tsunrise tsunrise deleted the domain2 branch June 25, 2021 04:44
Pratyush pushed a commit that referenced this pull request Aug 8, 2021
* restructure code

* done

* add changelog

* add the changelog to mark this as a breaking change

* add the CHANGELOG

* tweak

* add `EqGadget`

* rename generate_interpolate_cache to generate_interpolation_cache

* address the comment

Co-authored-by: weikeng <w.k@berkeley.edu>
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.

Add Radix2Domain where offset is not constant
4 participants