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: constify eccvm and translator #9661

Merged
merged 14 commits into from
Nov 7, 2024
Merged

feat: constify eccvm and translator #9661

merged 14 commits into from
Nov 7, 2024

Conversation

lucasxia01
Copy link
Contributor

@lucasxia01 lucasxia01 commented Nov 1, 2024

Makes the proof size of ECCVM constant by making the sumcheck gate challenges and IPA constant.
Fixes the ECCVM recursive verifier size (besides the MSM in the IPA Recursive verifier) as a result.

Closes AztecProtocol/barretenberg#1009.

@lucasxia01 lucasxia01 self-assigned this Nov 1, 2024
@lucasxia01
Copy link
Contributor Author

This PR could add a test for showing that the tube circuit is fixed, but it isn't true as of now because the linear component of IPA verification was not constifying as it will be removed in a followup PR.

challenge_poly_eval *= (Fr(1) + u_challenges_inv[len - 1 - i] * r_pow);
r_pow *= r_pow;
for (size_t i = 0; i < CONST_ECCVM_LOG_N; i++) {
stdlib::bool_t<typename Curve::Builder> dummy_round = stdlib::witness_t(builder, i < CONST_ECCVM_LOG_N - uint32_t(log_poly_length.get_value()));
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 sort of stuff is not secure. Will need to figure out a way to fix it, like the rest of the dummy_round stuff in sumcheck

// Step 7
// Send a_0 to the verifier
transcript->send_to_verifier("IPA:a_0", a_vec[0]);

info("prove G_zero: ", G_vec_local[0]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

will delete all the infos

@@ -346,11 +358,13 @@ template <typename Curve_> class IPA {
}
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1140): Use batch_invert.
round_challenges_inv[i] = round_challenges[i].invert();
if (i < log_poly_length) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

for native verifier, we only need to look at the log_poly_length elements that matter

auto element_L = transcript->template receive_from_prover<Commitment>("IPA:L_" + index);
auto element_R = transcript->template receive_from_prover<Commitment>("IPA:R_" + index);
round_challenges[i] = transcript->template get_challenge<Fr>("IPA:round_challenge_" + index);
round_challenges_inv[i] = round_challenges[i].invert();

msm_elements[2 * i] = element_L;
msm_elements[2 * i + 1] = element_R;
msm_scalars[2 * i] = round_challenges_inv[i];
msm_scalars[2 * i + 1] = round_challenges[i];
msm_scalars[2 * i] = Fr::conditional_assign(dummy_round, Fr(0), round_challenges_inv[i]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

for the dummy rounds, put 0s as the scalars.

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 good, just some minor comments/questions

Fr monomial = Fr::conditional_assign(dummy_round, Fr(0), round_challenges_inv[CONST_ECCVM_LOG_N - 1 - i] * challenge);
b_zero *= Fr(1) + monomial;
info("rec verify b_zero after i: ", i, " is ", b_zero.get_value());
if (i != CONST_ECCVM_LOG_N - 1) // this if is fine because the number of iterations is constant
Copy link
Contributor

Choose a reason for hiding this comment

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

typo in comment?

Copy link
Contributor Author

@lucasxia01 lucasxia01 Nov 6, 2024

Choose a reason for hiding this comment

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

I meant this if statement is fine (as opposed to using a constexpr if)

@lucasxia01 lucasxia01 enabled auto-merge (squash) November 6, 2024 21:23
@lucasxia01 lucasxia01 merged commit c95e5fd into master Nov 7, 2024
46 of 47 checks passed
@lucasxia01 lucasxia01 deleted the lx/constify-eccvm branch November 7, 2024 00:38
ludamad pushed a commit that referenced this pull request Nov 11, 2024
Makes the proof size of ECCVM constant by making the sumcheck gate
challenges and IPA constant.
Fixes the ECCVM recursive verifier size (besides the MSM in the IPA
Recursive verifier) as a result.

Closes AztecProtocol/barretenberg#1009.
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.

Fix circuit_size in ECCVM recursive verifier to maximum possible
2 participants