From a3fa2339a735f036224dbb0c2003488faedb4320 Mon Sep 17 00:00:00 2001 From: iakovenkos Date: Mon, 14 Jul 2025 11:17:39 +0000 Subject: [PATCH 1/4] fix --- .../src/barretenberg/sumcheck/sumcheck.hpp | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp index fdc028a7ea8c..cae4553d5999 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp @@ -158,7 +158,7 @@ template // separate linearly independent subrelation. SubrelationSeparators alphas; // pow_β(X₀, ..., X_{d−1}) = ∏ₖ₌₀^{d−1} (1 − Xₖ + Xₖ ⋅ βₖ) - bb::GateSeparatorPolynomial gate_separators; + std::vector gate_challenges; // Contains various challenges, such as `beta` and `gamma` used in the Grand Product argument. bb::RelationParameters relation_parameters; @@ -196,7 +196,7 @@ template , transcript(std::move(transcript)) , round(multivariate_n) , alphas(relation_separator) - , gate_separators(gate_challenges, multivariate_d) + , gate_challenges(gate_challenges) , relation_parameters(relation_parameters){}; // SumcheckProver constructor for the Flavors that generate a single challeng `alpha` and use its powers as @@ -213,7 +213,7 @@ template , transcript(std::move(transcript)) , round(multivariate_n) , alphas(initialize_relation_separator(alpha)) - , gate_separators(gate_challenges, multivariate_d) + , gate_challenges(gate_challenges) , relation_parameters(relation_parameters){}; /** * @brief Non-ZK version: Compute round univariate, place it in transcript, compute challenge, partially evaluate. @@ -223,6 +223,11 @@ template */ SumcheckOutput prove() { + // Given gate challenges β = (β₀, ..., β_{d−1}) and d = `multivariate_d`, compute the evaluations of + // GateSeparator_β (X₀, ..., X_{d−1}) = ∏ₖ₌₀^{d−1} (1 − Xₖ + Xₖ · βₖ) + // on the boolean hypercube. + GateSeparatorPolynomial gate_separators(gate_challenges, multivariate_d); + multivariate_challenge.reserve(virtual_log_n); // In the first round, we compute the first univariate polynomial and populate the book-keeping table of // #partially_evaluated_polynomials, which has \f$ n/2 \f$ rows and \f$ N \f$ columns. When the Flavor has ZK, @@ -306,6 +311,10 @@ template } vinfo("starting sumcheck rounds..."); + // Given gate challenges β = (β₀, ..., β_{d−1}) and d = `multivariate_d`, compute the evaluations of + // GateSeparator_β (X₀, ..., X_{d−1}) = ∏ₖ₌₀^{d−1} (1 − Xₖ + Xₖ · βₖ) + // on the boolean hypercube. + GateSeparatorPolynomial gate_separators(gate_challenges, multivariate_d); multivariate_challenge.reserve(multivariate_d); size_t round_idx = 0; @@ -403,14 +412,8 @@ template // Zero univariates are used to pad the proof to the fixed size virtual_log_n. auto zero_univariate = bb::Univariate::zero(); for (size_t idx = multivariate_d; idx < virtual_log_n; idx++) { - if constexpr (!IsGrumpkinFlavor) { - transcript->send_to_verifier("Sumcheck:univariate_" + std::to_string(idx), zero_univariate); - } else { - transcript->send_to_verifier("Sumcheck:univariate_comm_" + std::to_string(idx), - ck.commit(Polynomial(std::span(zero_univariate)))); - transcript->send_to_verifier("Sumcheck:univariate_" + std::to_string(idx) + "_eval_0", FF(0)); - transcript->send_to_verifier("Sumcheck:univariate_" + std::to_string(idx) + "_eval_1", FF(0)); - } + transcript->send_to_verifier("Sumcheck:univariate_" + std::to_string(idx), zero_univariate); + FF round_challenge = transcript->template get_challenge("Sumcheck:u_" + std::to_string(idx)); multivariate_challenge.emplace_back(round_challenge); } From dab120ec8a6e9df36b3cd5650988542fae6c9332 Mon Sep 17 00:00:00 2001 From: iakovenkos Date: Tue, 15 Jul 2025 08:36:29 +0000 Subject: [PATCH 2/4] Merge branch 'next' into si/mem-reg-bench From ee2d6d70011cc3997b376a929d979896ab291688 Mon Sep 17 00:00:00 2001 From: iakovenkos Date: Tue, 15 Jul 2025 09:57:23 +0000 Subject: [PATCH 3/4] fix a comment --- barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.hpp b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.hpp index 9adc2ac0daad..63fa0d2454d5 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.hpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.hpp @@ -322,7 +322,7 @@ template class SumcheckProverRound { ExtendedEdges extended_edges; SumcheckRoundUnivariate result; - // In Round 0, we have to compute the contribution from 2 edges: n - 1 = (1,1,...,1) and n-4 = (0,1,...,1). + // In Round 0, we have to compute the contribution from 2 edges: n - 1 = (1,1,...,1) and n - 3 = (0,1,...,1). size_t start_edge_idx = (round_idx == 0) ? round_size - 4 : round_size - 2; for (size_t edge_idx = start_edge_idx; edge_idx < round_size; edge_idx += 2) { From bdc3c04e56884618dc0fa0455baf7d3ea6ba2db4 Mon Sep 17 00:00:00 2001 From: iakovenkos Date: Tue, 15 Jul 2025 10:13:49 +0000 Subject: [PATCH 4/4] fix comment again --- barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.hpp b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.hpp index 63fa0d2454d5..6ed8f14e8701 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.hpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.hpp @@ -322,7 +322,8 @@ template class SumcheckProverRound { ExtendedEdges extended_edges; SumcheckRoundUnivariate result; - // In Round 0, we have to compute the contribution from 2 edges: n - 1 = (1,1,...,1) and n - 3 = (0,1,...,1). + // In Round 0, we have to compute the contribution from 2 edges: (1, 1,..., 1) and (0, 1, ..., 1) (as points on + // (d-1) - dimensional Boolean hypercube). size_t start_edge_idx = (round_idx == 0) ? round_size - 4 : round_size - 2; for (size_t edge_idx = start_edge_idx; edge_idx < round_size; edge_idx += 2) {