Skip to content

Commit ac88f30

Browse files
authored
chore(bb): remove poly downsizing, other fast-follow from structured polys (#8475)
1 parent 372f23c commit ac88f30

File tree

8 files changed

+17
-21
lines changed

8 files changed

+17
-21
lines changed

barretenberg/cpp/src/barretenberg/bb/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ void prove(const std::string& bytecodePath, const std::string& witnessPath, cons
643643

644644
acir_proofs::AcirComposer acir_composer{ 0, verbose_logging };
645645
acir_composer.create_circuit(constraint_system, witness);
646-
init_bn254_crs(acir_composer.get_dyadic_circuit_size() * 2);
646+
init_bn254_crs(acir_composer.get_dyadic_circuit_size());
647647
acir_composer.init_proving_key();
648648
auto proof = acir_composer.create_proof();
649649

barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ class ECCVMFlavor {
350350
{
351351
// Storage is only needed after the first partial evaluation, hence polynomials of size (n / 2)
352352
for (auto& poly : this->get_all()) {
353-
poly = Polynomial(circuit_size / 2, circuit_size / 2);
353+
poly = Polynomial(circuit_size / 2);
354354
}
355355
}
356356
};

barretenberg/cpp/src/barretenberg/plonk_honk_shared/composer/composer_lib.hpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ void construct_lookup_read_counts(typename Flavor::Polynomial& read_counts,
5353
{
5454
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1033): construct tables and counts at top of trace
5555
size_t offset = dyadic_circuit_size - circuit.get_tables_size();
56-
read_counts = typename Flavor::Polynomial(circuit.get_tables_size(), dyadic_circuit_size, /*start index*/ offset);
57-
// TODO(AD) we dont need to initialize read_tags
58-
read_tags = typename Flavor::Polynomial(circuit.get_tables_size(), dyadic_circuit_size, /*start index*/ offset);
5956

6057
size_t table_offset = offset; // offset of the present table in the table polynomials
6158
// loop over all tables used in the circuit; each table contains data about the lookups made on it
@@ -71,7 +68,7 @@ void construct_lookup_read_counts(typename Flavor::Polynomial& read_counts,
7168

7269
// increment the read count at the corresponding index in the full polynomial
7370
size_t index_in_poly = table_offset + index_in_table;
74-
read_counts.at(index_in_poly) = read_counts[index_in_poly] + 1;
71+
read_counts.at(index_in_poly)++;
7572
read_tags.at(index_in_poly) = 1; // tag is 1 if entry has been read 1 or more times
7673
}
7774
table_offset += table.size(); // set the offset of the next table within the polynomials

barretenberg/cpp/src/barretenberg/plonk_honk_shared/library/grand_product_library.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void compute_grand_product(typename Flavor::ProverPolynomials& full_polynomials,
7373
// calling get_row which creates full copies. avoid?
7474
for (size_t i = start; i < end; ++i) {
7575
for (auto [eval, full_poly] : zip_view(evaluations.get_all(), full_polynomials.get_all())) {
76-
eval = full_poly.size() > i ? full_poly.get(i) : 0;
76+
eval = full_poly.size() > i ? full_poly[i] : 0;
7777
}
7878
numerator.at(i) = GrandProdRelation::template compute_grand_product_numerator<Accumulator>(
7979
evaluations, relation_parameters);

barretenberg/cpp/src/barretenberg/polynomials/polynomial.hpp

+10-11
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,16 @@ template <typename Fr> class Polynomial {
172172
Fr compute_kate_opening_coefficients(const Fr& z)
173173
requires polynomial_arithmetic::SupportsFFT<Fr>;
174174

175-
// /**
176-
// * @brief Divides p(X) by (X-r₁)⋯(X−rₘ) in-place.
177-
// * Assumes that p(rⱼ)=0 for all j
178-
// *
179-
// * @details we specialize the method when only a single root is given.
180-
// * if one of the roots is 0, then we first factor all other roots.
181-
// * dividing by X requires only a left shift of all coefficient.
182-
// *
183-
// * @param roots list of roots (r₁,…,rₘ)
184-
// */
185-
// void factor_roots(std::span<const Fr> roots) { polynomial_arithmetic::factor_roots(std::span{ *this }, roots); };
175+
/**
176+
* @brief Divides p(X) by (X-r) in-place.
177+
* Assumes that p(rⱼ)=0 for all j
178+
*
179+
* @details we specialize the method when only a single root is given.
180+
* if one of the roots is 0, then we first factor all other roots.
181+
* dividing by X requires only a left shift of all coefficient.
182+
*
183+
* @param root a single root r
184+
*/
186185
void factor_roots(const Fr& root) { polynomial_arithmetic::factor_roots(coeffs(), root); };
187186

188187
Fr evaluate(const Fr& z, size_t target_size) const;

barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ class UltraFlavor {
563563
// Storage is only needed after the first partial evaluation, hence polynomials of
564564
// size (n / 2)
565565
for (auto& poly : this->get_all()) {
566-
poly = Polynomial(circuit_size / 2, circuit_size / 2);
566+
poly = Polynomial(circuit_size / 2);
567567
}
568568
}
569569
};

barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_keccak_flavor.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ class UltraKeccakFlavor {
521521
// Storage is only needed after the first partial evaluation, hence polynomials of
522522
// size (n / 2)
523523
for (auto& poly : this->get_all()) {
524-
poly = Polynomial(circuit_size / 2, circuit_size / 2);
524+
poly = Polynomial(circuit_size / 2);
525525
}
526526
}
527527
};

barretenberg/cpp/src/barretenberg/translator_vm/translator_flavor.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ class TranslatorFlavor {
919919
{
920920
// Storage is only needed after the first partial evaluation, hence polynomials of size (n / 2)
921921
for (auto& poly : this->get_all()) {
922-
poly = Polynomial(circuit_size / 2, circuit_size / 2);
922+
poly = Polynomial(circuit_size / 2);
923923
}
924924
}
925925
};

0 commit comments

Comments
 (0)