diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp index 9d703a3bb07a..308fc8eec452 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp @@ -345,8 +345,6 @@ template class ProtoGalaxyProver_ { * univariate (i.e., sum them against an appropriate univariate Lagrange basis) and then extended as needed during * the constuction of the combiner. */ - - // THIS SHOULD BE CALLED ACCUMULATED static void fold_relation_parameters(ProverInstances& instances) { // array of parameters to be computed @@ -355,7 +353,6 @@ template class ProtoGalaxyProver_ { for (auto& folded_parameter : folded_parameters) { Univariate tmp(0); size_t instance_idx = 0; - // it's not wrong i'm just dumb for (auto& instance : instances) { tmp.value_at(instance_idx) = instance->relation_parameters.to_fold[param_idx]; instance_idx++; @@ -369,8 +366,10 @@ template class ProtoGalaxyProver_ { * @brief Create folded univariate for the relation batching parameter (alpha). * */ - - // THIS SHOULD BE CALLED ACCUMULATED + // TODO(https://github.com/AztecProtocol/barretenberg/issues/772): At the moment we have a single α per Instance, we + // fold them and then we use the unique folded_α for each folded subrelation that is batched in the combiner. This + // is obviously insecure. We need to generate α_i for each subrelation_i, fold them and then use folded_α_i when + // batching the i-th folded subrelation in the combiner. static void fold_alpha(ProverInstances& instances) { Univariate accumulated_alpha; diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.cpp b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.cpp index f26b59028ebf..ed6441dae39b 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.cpp @@ -52,13 +52,13 @@ VerifierFoldingResult ProtoGalaxyVerifier_< auto perturbator_at_challenge = perturbator.evaluate(perturbator_challenge); // Thed degree of K(X) is dk - k - 1 = k(d - 1) - 1. Hence we need k(d - 1) evaluations to represent it. - std::array combiner_quotient_evals = {}; - for (size_t idx = 0; idx < (Flavor::MAX_TOTAL_RELATION_LENGTH - 2) * (VerifierInstances::NUM - 1); idx++) { + std::array combiner_quotient_evals = {}; + for (size_t idx = 0; idx < VerifierInstances::BATCHED_EXTENDED_LENGTH - VerifierInstances::NUM; idx++) { combiner_quotient_evals[idx] = transcript.template receive_from_prover( "combiner_quotient_" + std::to_string(idx + VerifierInstances::NUM)); } - Univariate - combiner_quotient(combiner_quotient_evals); + Univariate combiner_quotient( + combiner_quotient_evals); auto combiner_challenge = transcript.get_challenge("combiner_quotient_challenge"); auto combiner_quotient_at_challenge = combiner_quotient.evaluate(combiner_challenge); diff --git a/barretenberg/cpp/src/barretenberg/relations/utils.hpp b/barretenberg/cpp/src/barretenberg/relations/utils.hpp index e20213f62872..6b52f317db77 100644 --- a/barretenberg/cpp/src/barretenberg/relations/utils.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/utils.hpp @@ -86,7 +86,8 @@ template class RelationUtils { template static constexpr void add_tuples(std::tuple& tuple_1, const std::tuple& tuple_2) { - auto add_tuples_helper = [&](std::index_sequence) { + auto add_tuples_helper = [&](std::index_sequence) + { ((std::get(tuple_1) += std::get(tuple_2)), ...); }; diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/instance/instances.hpp b/barretenberg/cpp/src/barretenberg/sumcheck/instance/instances.hpp index af3df6989fc7..ab67af98d4a9 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/instance/instances.hpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/instance/instances.hpp @@ -93,6 +93,7 @@ template struct VerifierInstances_ { public: static constexpr size_t NUM = NUM_; + static constexpr size_t BATCHED_EXTENDED_LENGTH = (Flavor::MAX_TOTAL_RELATION_LENGTH - 1 + NUM - 1) * (NUM - 1) + 1; ArrayType _data; std::shared_ptr const& operator[](size_t idx) const { return _data[idx]; } typename ArrayType::iterator begin() { return _data.begin(); };