From 523aa231acd22228fa6414fc8241cebdfa21eafa Mon Sep 17 00:00:00 2001 From: Jean M <132435771+jeanmon@users.noreply.github.com> Date: Mon, 21 Oct 2024 20:14:50 +0200 Subject: [PATCH] chore(avm): some cleaning in avm prover (#9311) The AvmProver constructor body can be replaced by calling the constructor for prover_polynomials. Furthermore, in execute_log_derivative_inverse_round() some temporary prover_polynomials are superfluous. --- .../barretenberg/vm/avm/generated/prover.cpp | 19 ++++-------------- .../bb-pil-backend/templates/prover.cpp.hbs | 20 ++++--------------- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.cpp index 4cd03f684a1..e5541e0238c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.cpp @@ -28,18 +28,9 @@ using FF = Flavor::FF; */ AvmProver::AvmProver(std::shared_ptr input_key, std::shared_ptr commitment_key) : key(std::move(input_key)) + , prover_polynomials(*key) , commitment_key(std::move(commitment_key)) -{ - for (auto [prover_poly, key_poly] : zip_view(prover_polynomials.get_unshifted(), key->get_all())) { - ASSERT(bb::flavor_get_label(prover_polynomials, prover_poly) == bb::flavor_get_label(*key, key_poly)); - prover_poly = key_poly.share(); - } - for (auto [prover_poly, key_poly] : zip_view(prover_polynomials.get_shifted(), key->get_to_be_shifted())) { - ASSERT(bb::flavor_get_label(prover_polynomials, prover_poly) == - bb::flavor_get_label(*key, key_poly) + "_shift"); - prover_poly = key_poly.shifted(); - } -} +{} /** * @brief Add circuit size, public input size, and public inputs to transcript @@ -69,11 +60,9 @@ void AvmProver::execute_wire_commitments_round() void AvmProver::execute_log_derivative_inverse_round() { - auto [beta, gamm] = transcript->template get_challenges("beta", "gamma"); + auto [beta, gamma] = transcript->template get_challenges("beta", "gamma"); relation_parameters.beta = beta; - relation_parameters.gamma = gamm; - - auto prover_polynomials = ProverPolynomials(*key); + relation_parameters.gamma = gamma; std::vector> tasks; bb::constexpr_for<0, std::tuple_size_v, 1>([&]() { diff --git a/bb-pilcom/bb-pil-backend/templates/prover.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/prover.cpp.hbs index 66ca5eaba04..28a5276c648 100644 --- a/bb-pilcom/bb-pil-backend/templates/prover.cpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/prover.cpp.hbs @@ -29,19 +29,9 @@ using FF = Flavor::FF; {{name}}Prover::{{name}}Prover(std::shared_ptr input_key, std::shared_ptr commitment_key) : key(std::move(input_key)) + , prover_polynomials(*key) , commitment_key(std::move(commitment_key)) -{ - for (auto [prover_poly, key_poly] : zip_view(prover_polynomials.get_unshifted(), key->get_all())) { - ASSERT(bb::flavor_get_label(prover_polynomials, prover_poly) == - bb::flavor_get_label(*key, key_poly)); - prover_poly = key_poly.share(); - } - for (auto [prover_poly, key_poly] : zip_view(prover_polynomials.get_shifted(), key->get_to_be_shifted())) { - ASSERT(bb::flavor_get_label(prover_polynomials, prover_poly) == - bb::flavor_get_label(*key, key_poly) + "_shift"); - prover_poly = key_poly.shifted(); - } -} +{} /** * @brief Add circuit size, public input size, and public inputs to transcript @@ -70,11 +60,9 @@ void {{name}}Prover::execute_wire_commitments_round() void {{name}}Prover::execute_log_derivative_inverse_round() { - auto [beta, gamm] = transcript->template get_challenges("beta", "gamma"); + auto [beta, gamma] = transcript->template get_challenges("beta", "gamma"); relation_parameters.beta = beta; - relation_parameters.gamma = gamm; - - auto prover_polynomials = ProverPolynomials(*key); + relation_parameters.gamma = gamma; std::vector> tasks; bb::constexpr_for<0, std::tuple_size_v, 1>([&]() {