Skip to content

Commit

Permalink
more naming
Browse files Browse the repository at this point in the history
  • Loading branch information
maramihali committed Nov 17, 2023
1 parent e9079f3 commit 1636d9b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,6 @@ template <class ProverInstances_> 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
Expand All @@ -355,7 +353,6 @@ template <class ProverInstances_> class ProtoGalaxyProver_ {
for (auto& folded_parameter : folded_parameters) {
Univariate<FF, ProverInstances::NUM> 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++;
Expand All @@ -369,8 +366,10 @@ template <class ProverInstances_> 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<FF, ProverInstances::NUM> accumulated_alpha;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ VerifierFoldingResult<typename VerifierInstances::Flavor> 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<FF, (Flavor::MAX_TOTAL_RELATION_LENGTH - 2) * (VerifierInstances::NUM - 1)> combiner_quotient_evals = {};
for (size_t idx = 0; idx < (Flavor::MAX_TOTAL_RELATION_LENGTH - 2) * (VerifierInstances::NUM - 1); idx++) {
std::array<FF, VerifierInstances::BATCHED_EXTENDED_LENGTH - VerifierInstances::NUM> 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<FF>(
"combiner_quotient_" + std::to_string(idx + VerifierInstances::NUM));
}
Univariate<FF, (Flavor::MAX_TOTAL_RELATION_LENGTH - 1) * (VerifierInstances::NUM - 1) + 1, VerifierInstances::NUM>
combiner_quotient(combiner_quotient_evals);
Univariate<FF, VerifierInstances::BATCHED_EXTENDED_LENGTH, VerifierInstances::NUM> combiner_quotient(
combiner_quotient_evals);
auto combiner_challenge = transcript.get_challenge("combiner_quotient_challenge");
auto combiner_quotient_at_challenge = combiner_quotient.evaluate(combiner_challenge);

Expand Down
3 changes: 2 additions & 1 deletion barretenberg/cpp/src/barretenberg/relations/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ template <typename Flavor> class RelationUtils {
template <typename... T>
static constexpr void add_tuples(std::tuple<T...>& tuple_1, const std::tuple<T...>& tuple_2)
{
auto add_tuples_helper = [&]<std::size_t... I>(std::index_sequence<I...>) {
auto add_tuples_helper = [&]<std::size_t... I>(std::index_sequence<I...>)
{
((std::get<I>(tuple_1) += std::get<I>(tuple_2)), ...);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ template <typename Flavor_, size_t NUM_> 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<Instance> const& operator[](size_t idx) const { return _data[idx]; }
typename ArrayType::iterator begin() { return _data.begin(); };
Expand Down

0 comments on commit 1636d9b

Please sign in to comment.