-
Notifications
You must be signed in to change notification settings - Fork 296
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: zk shplemini #9830
feat: zk shplemini #9830
Changes from 9 commits
7265e39
ca3a8d6
bb22c4a
17212cc
764b7fe
1ff36da
6e42950
eda158e
93dbf18
3c3f4b1
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 |
---|---|---|
|
@@ -49,19 +49,37 @@ std::vector<typename GeminiProver_<Curve>::Claim> GeminiProver_<Curve>::prove( | |
const std::shared_ptr<CommitmentKey<Curve>>& commitment_key, | ||
const std::shared_ptr<Transcript>& transcript, | ||
RefSpan<Polynomial> concatenated_polynomials, | ||
const std::vector<RefVector<Polynomial>>& groups_to_be_concatenated) | ||
const std::vector<RefVector<Polynomial>>& groups_to_be_concatenated, | ||
bool HasZK) | ||
|
||
{ | ||
size_t log_n = numeric::get_msb(static_cast<uint32_t>(circuit_size)); | ||
size_t n = 1 << log_n; | ||
|
||
Fr rho = transcript->template get_challenge<Fr>("rho"); | ||
|
||
// Compute batched polynomials | ||
Polynomial batched_unshifted(n); | ||
Polynomial batched_to_be_shifted = Polynomial::shiftable(1 << log_n); | ||
Polynomial batched_to_be_shifted = Polynomial::shiftable(n); | ||
|
||
// To achieve ZK, we mask the batched polynomial by a random polynomial of the same size | ||
if (HasZK) { | ||
batched_unshifted = Polynomial::random(n); | ||
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. Before: initialize poly to zero then start to accumulate f_polynomials[0]: After: initialize poly to zero then start to accumulate f_polynomials[0] OR overwrite with random.
But then you have to similarly define a conditional starting point for the loop. Anyway, you're not making things worse so don't worry about it, just remarking. 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. thanks for the suggestion! it breaks some edge case tests in Gemini though, namely when we open shifts without unshifted (quite unrealistic). adding another check (f_polynomials.size()>0) would be somewhat ugly |
||
transcript->send_to_verifier("Gemini:masking_poly_comm", commitment_key->commit(batched_unshifted)); | ||
// In the provers, the size of multilinear_challenge is CONST_PROOF_SIZE_LOG_N, but we need to evaluate the | ||
// hiding polynomial as multilinear in log_n variables | ||
std::vector<Fr> multilinear_challenge_resized(multilinear_challenge.begin(), multilinear_challenge.end()); | ||
multilinear_challenge_resized.resize(log_n); | ||
transcript->send_to_verifier("Gemini:masking_poly_eval", | ||
batched_unshifted.evaluate_mle(multilinear_challenge_resized)); | ||
} | ||
|
||
// Get the batching challenge | ||
const Fr rho = transcript->template get_challenge<Fr>("rho"); | ||
|
||
Fr rho_challenge{ 1 }; | ||
if (HasZK) { | ||
// ρ⁰ is used to batch the hiding polynomial | ||
rho_challenge *= rho; | ||
} | ||
for (size_t i = 0; i < f_polynomials.size(); i++) { | ||
batched_unshifted.add_scaled(f_polynomials[i], rho_challenge); | ||
rho_challenge *= rho; | ||
|
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.
Please rename to
has_zk
for style--this case is for classes and concepts.