-
Notifications
You must be signed in to change notification settings - Fork 265
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
chore: make first iteration of protogalaxy more efficient #4630
Changes from 8 commits
76202c4
7a03e7c
37151e6
18ed4ac
a1e7506
72724fe
00f8217
0bfb753
7bdf9bb
8efa399
46d142e
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 |
---|---|---|
|
@@ -159,17 +159,8 @@ void ProtoGalaxyVerifier_<VerifierInstances>::prepare_for_folding(const std::vec | |
receive_accumulator(inst, domain_separator); | ||
} else { | ||
// This is the first round of folding and we need to generate some gate challenges. | ||
// TODO(https://github.com/AztecProtocol/barretenberg/issues/740): implement option 2 to make this more | ||
// efficient by avoiding the computation of the perturbator | ||
receive_and_finalise_instance(inst, domain_separator); | ||
inst->target_sum = 0; | ||
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. could also maybe get rid of this, but its not that important since its one value 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. That’s the issue you are resolving I belive 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. no, sorry, its referring to the target_sum 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. No you cannot do that, the verifier should initialise the first coefficient of the perturbator with the target sum of the accumulator (i’m gonna make that more explicit in the follow up |
||
auto beta = transcript->template get_challenge<FF>(domain_separator + "_initial_gate_challenge"); | ||
std::vector<FF> gate_challenges(inst->log_instance_size); | ||
gate_challenges[0] = beta; | ||
for (size_t i = 1; i < inst->log_instance_size; i++) { | ||
gate_challenges[i] = gate_challenges[i - 1].sqr(); | ||
} | ||
inst->gate_challenges = gate_challenges; | ||
} | ||
index++; | ||
|
||
|
@@ -189,9 +180,12 @@ bool ProtoGalaxyVerifier_<VerifierInstances>::verify_folding_proof(const std::ve | |
auto accumulator = get_accumulator(); | ||
auto deltas = compute_round_challenge_pows(accumulator->log_instance_size, delta); | ||
|
||
std::vector<FF> perturbator_coeffs(accumulator->log_instance_size + 1); | ||
for (size_t idx = 0; idx <= accumulator->log_instance_size; idx++) { | ||
perturbator_coeffs[idx] = transcript->template receive_from_prover<FF>("perturbator_" + std::to_string(idx)); | ||
std::vector<FF> perturbator_coeffs(accumulator->log_instance_size + 1, 0); | ||
if (accumulator->is_accumulator) { | ||
for (size_t idx = 0; idx <= accumulator->log_instance_size; idx++) { | ||
perturbator_coeffs[idx] = | ||
transcript->template receive_from_prover<FF>("perturbator_" + std::to_string(idx)); | ||
} | ||
} | ||
|
||
if (perturbator_coeffs[0] != accumulator->target_sum) { | ||
|
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.
you could do this first and then if
accumulator->is_accumulator
is true you runcompute_perturbator
which is easier to readThere 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.
isn't that extra computation?
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.
I generally prefer readability in cases like this when it’s basically negligible