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

feat: extend functionality of SmallSubgroupIPA #12244

Merged
merged 17 commits into from
Feb 28, 2025

Conversation

iakovenkos
Copy link
Contributor

@iakovenkos iakovenkos commented Feb 24, 2025

To fix the issue with translation evaluations when the masking is enabled in ECCVM, we need to prove the batched evaluation of the masking term, where by masking term we mean a small table (5 columns, 4 rows) added at the end of the Transcript polynomials.

Fortunately, we could use the SmallSubgroupIPA protocol to do this efficiently and faciliatate the integration of this fix into Goblin.

This is the first batch of changes:

  • Introduction of a class TranslationData designed to process the masked wires and commit to the masking term
  • Extension of SmallSubgroupIPA functionality - now it could accept Translation data and produce a proof of the batch opening of the masking term
  • Added corresponding tests to SmallSubgroupIPATests
  • Moved implementations to .cpp

barretenberg_module(eccvm sumcheck commitment_schemes)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

needed to add this after moving SmallSubgroupIPA stuff to .cpp + in two other CMake files below

@iakovenkos iakovenkos marked this pull request as ready for review February 24, 2025 23:41
@iakovenkos iakovenkos self-assigned this Feb 24, 2025
@@ -31,7 +31,7 @@ template <typename Curve> class ShpleminiProver_ {
std::span<FF> multilinear_challenge,
const std::shared_ptr<CommitmentKey<Curve>>& commitment_key,
const std::shared_ptr<Transcript>& transcript,
const std::array<Polynomial, NUM_LIBRA_EVALUATIONS>& libra_polynomials = {},
const std::array<Polynomial, NUM_SMALL_IPA_EVALUATIONS>& libra_polynomials = {},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this global const is rather a SmallSubgroupIPA constant. I haven't thought the argument would be used elsewehere, so initially called it NUM_LIBRA_EVALUATIONS

@@ -1,7 +1,9 @@
#pragma once

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved impls and some docs to cpp

// Simulate the interaction between the prover and the verifier leading to the consistency check performed by the
// verifier.
TYPED_TEST(SmallSubgroupIPATest, TranslationMaskingTermConsistency)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

don't know how to name it better

}
/**
* @brief Let m_0, ..., m_4 be the vectors of last 4 coeffs in each transcript poly, we compute the concatenation
* \f$ (0 || m_0 || ... || m_4)\f$ in Lagrange and monomial basis and mask the latter.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

here constant term is 0 because we don't need extra masking as opposed to the ZKSumcheckData-usecase (there is redundant randomness in the masking entries of the ECCVM transcript wires)

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you codify your PR comment here into a comment in the code?

Copy link
Contributor

@ledwards2225 ledwards2225 left a comment

Choose a reason for hiding this comment

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

Over this looks good to me. As I mentioned, it would have been a lot easier to review if the hpp/cpp separation had happened in a separate PR - something to keep in mind for next time. I wound up just skimming through everything rather than trying to figure out what was new so my review may not have the depth it otherwise would have. I left some comments around things that I think could be clarified a bit either in code or comments. I think there is sufficient code sharing here so as not to warrant something like separate classes for the different use cases here but we should monitor things to ensure that the single class remains readable if any more complexity is introduced.

template <typename Flavor>
SmallSubgroupIPAProver<Flavor>::SmallSubgroupIPAProver(std::shared_ptr<typename Flavor::Transcript>& transcript)
: interpolation_domain{}
, concatenated_polynomial(Polynomial<FF>(SUBGROUP_SIZE + 2))
Copy link
Contributor

Choose a reason for hiding this comment

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

Not terribly important but it seems a little funny to me to initialize some of these members in the constructor given that SUBGROUP_SIZE is static. Maybe this is just a matter of preference? Curious if @ludamad has an opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I remember trying to not initialize them in the constructor and hitting memory errors

commitment_key->commit(batched_quotient));
}
}
std::array<Polynomial<FF>, 2> static compute_lagrange_polynomials(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess, this constant is fine, cause it's clear that we're computing 2 Lagranges

@iakovenkos
Copy link
Contributor Author

  • Changed big_sum to grand_sum everywhere
  • Gave names to magic constants 2 and 3
  • Removed confusing zero coefficient in front of (m_0 || m_1 || ... || m_4)
  • Isolated Lagrange to monomial transformation
  • Expanded docs + fixed doxygen markdown issues

Copy link
Contributor

@ledwards2225 ledwards2225 left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for the thorough docs and for making those updates

{
// Reallocate the commitment key if necessary. This is an edge case with SmallSubgroupIPA since it has
// polynomials that may exceed the circuit size.
if (commitment_key->dyadic_size < MASKED_GRAND_SUM_LENGTH) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is fine but just thinking out loud, maybe the right thing to do is to have each flavor define how to compute the required srs size..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, I'll do a small separate PR to move it to the ck allocation step in oink and Translator/ECCVM provers

@iakovenkos iakovenkos merged commit 050ce57 into master Feb 28, 2025
6 checks passed
@iakovenkos iakovenkos deleted the si/small-subgroup-ipa-supports-translation branch February 28, 2025 14:58
iakovenkos added a commit that referenced this pull request Mar 6, 2025
After [extending SmallSubgroupIPA
functionality](#12244),
we integrated the changes into the ECCVM logic. Specifically, the Prover
and Verifier methods `compute_translation_opening_claim` were modified
to establish the correctness of the value
`translation_masking_term_eval`= $\sum_i m_i(x) v^i $, where $m_i$ are
univariate polynomials of degree `MASKING_OFFSET` used to mask the wires
`op`, `Px`, `Py`, `z1`, and `z2`.

Detailed documentation has been included in the `ECCVMProver`'s method
`compute_translation_opening_claims`.

The integration into Goblin/ClientIVC required minimal changes - namely,
the TranslatorVerifier accepts `translation_masking_term_eval` and
subtracts it from the `eccvm_opening`.

Note that currently the masking is not turned on in ECCVM, so
`translation_masking_term_eval`= 0.
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