Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ProverPolynomialsBase : public AllEntitiesBase {
ProverPolynomialsBase(ProverPolynomialsBase&& o) noexcept = default;
ProverPolynomialsBase& operator=(ProverPolynomialsBase&& o) noexcept = default;
~ProverPolynomialsBase() = default;
[[nodiscard]] size_t get_polynomial_size() const { return this->q_c.size(); }
[[nodiscard]] size_t get_polynomial_size() const { return this->q_c.virtual_size(); }
[[nodiscard]] AllValuesType get_row(size_t row_idx) const
{
AllValuesType result;
Expand Down
18 changes: 18 additions & 0 deletions barretenberg/cpp/src/barretenberg/hypernova/hypernova_prover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,24 @@ Polynomial<HypernovaFoldingProver::FF> HypernovaFoldingProver::batch_polynomials
BB_ASSERT_EQ(
challenges.size(), N, "The number of challenges provided does not match the number of polynomials to batch.");

// Ensure the first polynomial has enough backing to accumulate all others (they may have different backing sizes
// and/or start indices). add_scaled requires destination start_index <= source start_index.
size_t min_start = polynomials_to_batch[0].start_index();
size_t max_end = polynomials_to_batch[0].end_index();
for (size_t idx = 1; idx < N; idx++) {
min_start = std::min(min_start, polynomials_to_batch[idx].start_index());
max_end = std::max(max_end, polynomials_to_batch[idx].end_index());
}

if (min_start < polynomials_to_batch[0].start_index() || max_end > polynomials_to_batch[0].end_index()) {
Polynomial<FF> result(max_end - min_start, full_batched_size, min_start);
result += polynomials_to_batch[0];
for (size_t idx = 1; idx < N; idx++) {
result.add_scaled(polynomials_to_batch[idx], challenges[idx]);
}
return result;
}

for (size_t idx = 1; idx < N; idx++) {
polynomials_to_batch[0].add_scaled(polynomials_to_batch[idx], challenges[idx]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ template <typename Flavor> void ProverInstance_<Flavor>::allocate_selectors(cons
selector = Polynomial(block.size(), dyadic_size(), block.trace_offset());
}

// Set the other non-gate selector polynomials (e.g. q_l, q_r, q_m etc.) to full size
// Set the other non-gate selector polynomials (e.g. q_l, q_r, q_m etc.) to active trace size
for (auto& selector : polynomials.get_non_gate_selectors()) {
selector = Polynomial(dyadic_size());
selector = Polynomial(trace_active_range_size(), dyadic_size());
}
}

Expand Down
Loading