Skip to content

Commit

Permalink
Plonk polynomial class => legacy polynomial
Browse files Browse the repository at this point in the history
  • Loading branch information
ludamad committed Aug 13, 2024
1 parent c2c7073 commit d641a13
Show file tree
Hide file tree
Showing 64 changed files with 185 additions and 179 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ void pippenger(State& state)
for (auto _ : state) {
state.PauseTiming();
size_t num_cycles = 1 << static_cast<size_t>(state.range(0));
Polynomial<Fr> pol(num_cycles);
LegacyPolynomial<Fr> pol(num_cycles);
for (size_t i = 0; i < num_cycles; i++) {
*(uint256_t*)&pol[i] = engine.get_random_uint256();
pol[i].self_reduce_once();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ template <typename Curve> class OpeningClaim {
* @param polynomial the claimed witness polynomial p(X)
* @return C = Commit(p(X)) && p(r) = v
*/
bool verify(std::shared_ptr<CK> ck, const bb::Polynomial<Fr>& polynomial) const
bool verify(std::shared_ptr<CK> ck, const bb::LegacyPolynomial<Fr>& polynomial) const
{
Fr real_eval = polynomial.evaluate(opening_pair.challenge);
if (real_eval != opening_pair.evaluation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ template <typename Curve> std::shared_ptr<CommitmentKey<Curve>> create_commitmen
}

// Generate a polynomial with a specified number of nonzero random coefficients
template <typename FF> Polynomial<FF> sparse_random_poly(const size_t size, const size_t num_nonzero)
template <typename FF> LegacyPolynomial<FF> sparse_random_poly(const size_t size, const size_t num_nonzero)
{
auto& engine = numeric::get_debug_randomness();
auto polynomial = Polynomial<FF>(size);
auto polynomial = LegacyPolynomial<FF>(size);

for (size_t i = 0; i < num_nonzero; i++) {
size_t idx = engine.get_random_uint32() % size;
Expand All @@ -37,7 +37,7 @@ template <typename Curve> void bench_commit_zero(::benchmark::State& state)
auto key = create_commitment_key<Curve>(MAX_NUM_POINTS);

const size_t num_points = 1 << state.range(0);
const auto polynomial = Polynomial<typename Curve::ScalarField>(num_points);
const auto polynomial = LegacyPolynomial<typename Curve::ScalarField>(num_points);
for (auto _ : state) {
key->commit(polynomial);
}
Expand All @@ -52,7 +52,7 @@ template <typename Curve> void bench_commit_sparse(::benchmark::State& state)
const size_t num_points = 1 << state.range(0);
const size_t num_nonzero = SPARSE_NUM_NONZERO;

auto polynomial = Polynomial<Fr>(num_points);
auto polynomial = LegacyPolynomial<Fr>(num_points);
for (size_t i = 0; i < num_nonzero; i++) {
polynomial[i] = 1;
}
Expand All @@ -71,7 +71,7 @@ template <typename Curve> void bench_commit_sparse_preprocessed(::benchmark::Sta
const size_t num_points = 1 << state.range(0);
const size_t num_nonzero = SPARSE_NUM_NONZERO;

auto polynomial = Polynomial<Fr>(num_points);
auto polynomial = LegacyPolynomial<Fr>(num_points);
for (size_t i = 0; i < num_nonzero; i++) {
polynomial[i] = 1;
}
Expand Down Expand Up @@ -120,7 +120,7 @@ template <typename Curve> void bench_commit_random(::benchmark::State& state)
auto key = create_commitment_key<Curve>(MAX_NUM_POINTS);

const size_t num_points = 1 << state.range(0);
auto polynomial = Polynomial<Fr>(num_points);
auto polynomial = LegacyPolynomial<Fr>(num_points);
for (auto& coeff : polynomial) {
coeff = Fr::random_element();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "barretenberg/common/op_count.hpp"
#include "barretenberg/ecc/scalar_multiplication/scalar_multiplication.hpp"
#include "barretenberg/numeric/bitop/pow.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/polynomials/polynomial_arithmetic.hpp"
#include "barretenberg/srs/factories/crs_factory.hpp"
#include "barretenberg/srs/factories/file_crs_factory.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "barretenberg/commitment_schemes/commitment_key.hpp"
#include "barretenberg/commitment_schemes/verification_key.hpp"
#include "barretenberg/ecc/curves/bn254/g1.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/srs/factories/file_crs_factory.hpp"
#include "claim.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "./mock_transcript.hpp"
#include "barretenberg/commitment_schemes/commitment_key.hpp"
#include "barretenberg/commitment_schemes/verification_key.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/srs/factories/file_crs_factory.hpp"

namespace bb {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "barretenberg/common/mem.hpp"
#include "barretenberg/ecc/curves/bn254/fq12.hpp"
#include "barretenberg/ecc/curves/types.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/polynomials/polynomial_arithmetic.hpp"
#include <gtest/gtest.h>
#include <utility>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "../claim.hpp"
#include "barretenberg/commitment_schemes/commitment_key.hpp"
#include "barretenberg/commitment_schemes/verification_key.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/transcript/transcript.hpp"

#include <memory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "../commitment_key.test.hpp"
#include "barretenberg/commitment_schemes/claim.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"

#include "barretenberg/ecc/curves/bn254/g1.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "../commitment_key.test.hpp"
#include "barretenberg/commitment_schemes/claim.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
namespace bb {
template <class Params> class ShplonkTest : public CommitmentTest<Params> {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp"
#include "barretenberg/ecc/scalar_multiplication/scalar_multiplication.hpp"
#include "barretenberg/numeric/bitop/pow.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/polynomials/polynomial_arithmetic.hpp"
#include "barretenberg/srs/global_crs.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "barretenberg/eccvm/eccvm_verifier.hpp"
#include "barretenberg/numeric/uint256/uint256.hpp"
#include "barretenberg/plonk_honk_shared/library/grand_product_delta.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/relations/permutation_relation.hpp"
#include "barretenberg/relations/relation_parameters.hpp"
#include "barretenberg/sumcheck/sumcheck_round.hpp"
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "barretenberg/honk/proof_system/logderivative_library.hpp"
#include "barretenberg/honk/proof_system/permutation_library.hpp"
#include "barretenberg/plonk_honk_shared/library/grand_product_library.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/relations/permutation_relation.hpp"
#include "barretenberg/sumcheck/sumcheck.hpp"

Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/flavor/flavor.test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/srs/factories/crs_factory.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp"
#include <cstddef>
Expand Down
4 changes: 2 additions & 2 deletions barretenberg/cpp/src/barretenberg/flavor/plonk_flavors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Standard {
using ProvingKey = plonk::proving_key;
using Curve = curve::BN254;
using FF = Curve::ScalarField;
using Polynomial = bb::Polynomial<FF>;
using Polynomial = bb::LegacyPolynomial<FF>;
static constexpr size_t NUM_WIRES = CircuitBuilder::NUM_WIRES;
// Whether or not the first row of the execution trace is reserved for 0s to enable shifts
static constexpr bool has_zero_row = false;
Expand All @@ -24,7 +24,7 @@ class Ultra {
using ProvingKey = plonk::proving_key;
using Curve = curve::BN254;
using FF = Curve::ScalarField;
using Polynomial = bb::Polynomial<FF>;
using Polynomial = bb::LegacyPolynomial<FF>;
static constexpr size_t NUM_WIRES = CircuitBuilder::NUM_WIRES;
// Whether or not the first row of the execution trace is reserved for 0s to enable shifts
static constexpr bool has_zero_row = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "barretenberg/common/ref_vector.hpp"
#include "barretenberg/common/zip_view.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/relations/relation_parameters.hpp"
#include <typeinfo>

Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/honk/utils/testing.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include "barretenberg/common/zip_view.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"

namespace bb {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "barretenberg/plonk/proof_system/widgets/transition_widgets/arithmetic_widget.hpp"
#include "barretenberg/plonk_honk_shared/composer/composer_lib.hpp"
#include "barretenberg/plonk_honk_shared/composer/permutation_lib.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"

#include <cstddef>
#include <cstdint>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "../../../polynomials/polynomial.hpp"
#include "../../../polynomials/legacy_polynomial.hpp"
#include "../../../polynomials/polynomial_arithmetic.hpp"
#include "../types/commitment_open_proof.hpp"
#include "../types/program_settings.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "../types/program_settings.hpp"
#include "barretenberg/common/mem.hpp"
#include "barretenberg/plonk/work_queue/work_queue.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/polynomials/polynomial_arithmetic.hpp"
#include "barretenberg/srs/factories/file_crs_factory.hpp"
#include <gtest/gtest.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "barretenberg/ecc/scalar_multiplication/scalar_multiplication.hpp"
#include "barretenberg/plonk/proof_system/types/prover_settings.hpp"
#include "barretenberg/polynomials/iterate_over_domain.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/polynomials/polynomial_arithmetic.hpp"
#include <chrono>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "barretenberg/plonk/proof_system/types/polynomial_manifest.hpp"
#include "barretenberg/plonk_honk_shared/types/aggregation_object_type.hpp"
#include "barretenberg/polynomials/evaluation_domain.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/srs/factories/crs_factory.hpp"

#ifdef __wasm__
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "barretenberg/numeric/bitop/get_msb.hpp"
#include "barretenberg/polynomials/iterate_over_domain.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"

namespace bb::plonk {
template <typename program_settings>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "barretenberg/common/throw_or_abort.hpp"
#include "barretenberg/numeric/bitop/get_msb.hpp"
#include "barretenberg/polynomials/iterate_over_domain.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"

namespace bb::plonk {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp"
#include "barretenberg/plonk/proof_system/public_inputs/public_inputs.hpp"
#include "barretenberg/polynomials/iterate_over_domain.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/polynomials/polynomial_arithmetic.hpp"
#include "barretenberg/transcript/transcript.hpp"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "work_queue.hpp"
#include "barretenberg/ecc/scalar_multiplication/scalar_multiplication.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/polynomials/polynomial_arithmetic.hpp"

namespace bb::plonk {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "barretenberg/flavor/flavor.hpp"
#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp"
#include "barretenberg/polynomials/iterate_over_domain.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"

#include <algorithm>
#include <cstddef>
Expand Down Expand Up @@ -347,10 +347,11 @@ void compute_monomial_and_coset_fft_polynomials_from_lagrange(std::string label,
* @brief Compute Lagrange Polynomials L_0 and L_{n-1} and put them in the polynomial cache
*/
template <typename FF>
inline std::tuple<Polynomial<FF>, Polynomial<FF>> compute_first_and_last_lagrange_polynomials(const size_t circuit_size)
inline std::tuple<LegacyPolynomial<FF>, LegacyPolynomial<FF>> compute_first_and_last_lagrange_polynomials(
const size_t circuit_size)
{
Polynomial<FF> lagrange_polynomial_0(circuit_size);
Polynomial<FF> lagrange_polynomial_n_min_1(circuit_size);
LegacyPolynomial<FF> lagrange_polynomial_0(circuit_size);
LegacyPolynomial<FF> lagrange_polynomial_n_min_1(circuit_size);
lagrange_polynomial_0[0] = 1;

lagrange_polynomial_n_min_1[circuit_size - 1] = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "barretenberg/common/thread.hpp"
#include "barretenberg/common/zip_view.hpp"
#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/legacy_polynomial.hpp"
#include "barretenberg/relations/relation_parameters.hpp"
#include <typeinfo>

Expand Down
Loading

0 comments on commit d641a13

Please sign in to comment.