-
Notifications
You must be signed in to change notification settings - Fork 326
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: translation evaluations: refactor + soundness fix #12051
Changes from 24 commits
ead1afc
d9d9a1f
5504006
acc8a51
4d4349e
3aa169b
6628ec7
a51d492
bfaab51
b4eaa6b
b21a2b2
bcc3284
ae74a81
7d8e932
a18fc20
98f29b0
9eec4c3
692619f
a1c3ebe
2eb4c43
3f95d0d
1d41026
a6c729d
b77aa9e
ae994d3
0da6dc1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,50 +157,8 @@ void ECCVMProver::execute_pcs_rounds() | |
sumcheck_output.round_univariates, | ||
sumcheck_output.round_univariate_evaluations); | ||
|
||
// Get the challenge at which we evaluate all transcript polynomials as univariates | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isolated into a separate method |
||
evaluation_challenge_x = transcript->template get_challenge<FF>("Translation:evaluation_challenge_x"); | ||
|
||
// Evaluate the transcript polynomials at the challenge | ||
translation_evaluations.op = key->polynomials.transcript_op.evaluate(evaluation_challenge_x); | ||
translation_evaluations.Px = key->polynomials.transcript_Px.evaluate(evaluation_challenge_x); | ||
translation_evaluations.Py = key->polynomials.transcript_Py.evaluate(evaluation_challenge_x); | ||
translation_evaluations.z1 = key->polynomials.transcript_z1.evaluate(evaluation_challenge_x); | ||
translation_evaluations.z2 = key->polynomials.transcript_z2.evaluate(evaluation_challenge_x); | ||
|
||
// Add the univariate evaluations to the transcript so the verifier can reconstruct the batched evaluation | ||
transcript->send_to_verifier("Translation:op", translation_evaluations.op); | ||
transcript->send_to_verifier("Translation:Px", translation_evaluations.Px); | ||
transcript->send_to_verifier("Translation:Py", translation_evaluations.Py); | ||
transcript->send_to_verifier("Translation:z1", translation_evaluations.z1); | ||
transcript->send_to_verifier("Translation:z2", translation_evaluations.z2); | ||
const OpeningClaim translation_opening_claim = ECCVMProver::reduce_translation_evaluations(); | ||
|
||
// Get another challenge for batching the univariates and evaluations | ||
FF ipa_batching_challenge = transcript->template get_challenge<FF>("Translation:ipa_batching_challenge"); | ||
|
||
// Collect the polynomials and evaluations to be batched | ||
RefArray univariate_polynomials{ key->polynomials.transcript_op, | ||
key->polynomials.transcript_Px, | ||
key->polynomials.transcript_Py, | ||
key->polynomials.transcript_z1, | ||
key->polynomials.transcript_z2 }; | ||
std::array<FF, univariate_polynomials.size()> univariate_evaluations{ translation_evaluations.op, | ||
translation_evaluations.Px, | ||
translation_evaluations.Py, | ||
translation_evaluations.z1, | ||
translation_evaluations.z2 }; | ||
|
||
// Construct the batched polynomial and batched evaluation to produce the batched opening claim | ||
Polynomial batched_univariate{ key->circuit_size }; | ||
FF batched_evaluation{ 0 }; | ||
FF batching_scalar = FF(1); | ||
for (auto [polynomial, eval] : zip_view(univariate_polynomials, univariate_evaluations)) { | ||
batched_univariate.add_scaled(polynomial, batching_scalar); | ||
batched_evaluation += eval * batching_scalar; | ||
batching_scalar *= ipa_batching_challenge; | ||
} | ||
|
||
const OpeningClaim translation_opening_claim = { .polynomial = batched_univariate, | ||
.opening_pair = { evaluation_challenge_x, batched_evaluation } }; | ||
const std::array<OpeningClaim, 2> opening_claims = { multivariate_to_univariate_opening_claim, | ||
translation_opening_claim }; | ||
|
||
|
@@ -209,9 +167,6 @@ void ECCVMProver::execute_pcs_rounds() | |
|
||
// Compute the opening proof for the batched opening claim with the univariate PCS | ||
PCS::compute_opening_proof(key->commitment_key, batch_opening_claim, ipa_transcript); | ||
|
||
// Produce another challenge passed as input to the translator verifier | ||
translation_batching_challenge_v = transcript->template get_challenge<FF>("Translation:batching_challenge"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was a very strange step, the challenge that has to be propagated is the |
||
} | ||
|
||
ECCVMProof ECCVMProver::export_proof() | ||
|
@@ -237,4 +192,47 @@ ECCVMProof ECCVMProver::construct_proof() | |
|
||
return export_proof(); | ||
} | ||
|
||
/** | ||
* @brief The evaluations of the wires `op`, `Px`, `Py`, `z_1`, and `z_2` as univariate polynomials have to proved as | ||
iakovenkos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* they are used in the 'TranslatorVerifier::verify_translation' sub-protocol and its recursive counterpart. To increase | ||
* the efficiency, we produce an OpeningClaim that is fed to Shplonk along with the OpeningClaim produced by Shplemini. | ||
* | ||
* @return ProverOpeningClaim<typename ECCVMFlavor::Curve> | ||
*/ | ||
ProverOpeningClaim<typename ECCVMFlavor::Curve> ECCVMProver::reduce_translation_evaluations() | ||
iakovenkos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
// Collect the polynomials and evaluations to be batched | ||
RefArray translation_polynomials{ key->polynomials.transcript_op, | ||
key->polynomials.transcript_Px, | ||
key->polynomials.transcript_Py, | ||
key->polynomials.transcript_z1, | ||
key->polynomials.transcript_z2 }; | ||
|
||
// Get the challenge at which we evaluate all transcript polynomials as univariates | ||
evaluation_challenge_x = transcript->template get_challenge<FF>("Translation:evaluation_challenge_x"); | ||
|
||
// Evaluate the transcript polynomials as univariates and add their evaluations at x to the transcript | ||
for (auto [eval, poly, label] : | ||
zip_view(translation_evaluations.get_all(), translation_polynomials, translation_labels)) { | ||
*eval = poly.evaluate(evaluation_challenge_x); | ||
transcript->template send_to_verifier(label, *eval); | ||
} | ||
|
||
// Get another challenge to batch the evaluations of the transcript polynomials | ||
translation_batching_challenge_v = transcript->template get_challenge<FF>("Translation:batching_challenge_v"); | ||
|
||
// Construct the batched polynomial and batched evaluation to produce the batched opening claim | ||
Polynomial batched_translation_univariate{ key->circuit_size }; | ||
FF batched_translation_evaluation{ 0 }; | ||
FF batching_scalar = FF(1); | ||
for (auto [polynomial, eval] : zip_view(translation_polynomials, translation_evaluations.get_all())) { | ||
batched_translation_univariate.add_scaled(polynomial, batching_scalar); | ||
batched_translation_evaluation += *eval * batching_scalar; | ||
batching_scalar *= translation_batching_challenge_v; | ||
} | ||
|
||
return { .polynomial = batched_translation_univariate, | ||
.opening_pair = { evaluation_challenge_x, batched_translation_evaluation } }; | ||
} | ||
} // namespace bb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the eccvm flavor might be a better place for this constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was also implicitly used in
TranslationEvaluations
struct that is propagated to Translator, I just modified it to use this constant explicitly. It is also used by the SmallSubgroupIPA in #12244, so I'd keep it here. But probably we'll need to revise these constants at some point.