From d07176863011382c34af5d5c80c596f737369703 Mon Sep 17 00:00:00 2001 From: Jean M <132435771+jeanmon@users.noreply.github.com> Date: Tue, 13 Feb 2024 18:25:42 +0100 Subject: [PATCH] chore: toy avm snake case (#4584) --- .../flavor/generated/{Toy_flavor.hpp => toy_flavor.hpp} | 4 ++-- .../{Toy_circuit_builder.hpp => toy_circuit_builder.hpp} | 8 ++++---- .../toy_avm/toy_avm_circuit_builder.test.cpp | 6 +++--- .../relations/generated/{Toy => toy}/declare_views.hpp | 0 .../relations/generated/{Toy => toy}/lookup_xor.hpp | 0 .../relations/generated/{Toy => toy}/toy_avm.hpp | 2 +- .../relations/generated/{Toy => toy}/two_column_perm.hpp | 0 .../vm/generated/{Toy_composer.cpp => toy_composer.cpp} | 6 +++--- .../vm/generated/{Toy_composer.hpp => toy_composer.hpp} | 6 +++--- .../vm/generated/{Toy_prover.cpp => toy_prover.cpp} | 6 +++++- .../vm/generated/{Toy_prover.hpp => toy_prover.hpp} | 2 +- .../vm/generated/{Toy_verifier.cpp => toy_verifier.cpp} | 5 ++++- .../vm/generated/{Toy_verifier.hpp => toy_verifier.hpp} | 4 ++-- 13 files changed, 28 insertions(+), 21 deletions(-) rename barretenberg/cpp/src/barretenberg/flavor/generated/{Toy_flavor.hpp => toy_flavor.hpp} (99%) rename barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/{Toy_circuit_builder.hpp => toy_circuit_builder.hpp} (96%) rename barretenberg/cpp/src/barretenberg/relations/generated/{Toy => toy}/declare_views.hpp (100%) rename barretenberg/cpp/src/barretenberg/relations/generated/{Toy => toy}/lookup_xor.hpp (100%) rename barretenberg/cpp/src/barretenberg/relations/generated/{Toy => toy}/toy_avm.hpp (100%) rename barretenberg/cpp/src/barretenberg/relations/generated/{Toy => toy}/two_column_perm.hpp (100%) rename barretenberg/cpp/src/barretenberg/vm/generated/{Toy_composer.cpp => toy_composer.cpp} (94%) rename barretenberg/cpp/src/barretenberg/vm/generated/{Toy_composer.hpp => toy_composer.hpp} (93%) rename barretenberg/cpp/src/barretenberg/vm/generated/{Toy_prover.cpp => toy_prover.cpp} (98%) rename barretenberg/cpp/src/barretenberg/vm/generated/{Toy_prover.hpp => toy_prover.hpp} (96%) rename barretenberg/cpp/src/barretenberg/vm/generated/{Toy_verifier.cpp => toy_verifier.cpp} (99%) rename barretenberg/cpp/src/barretenberg/vm/generated/{Toy_verifier.hpp => toy_verifier.hpp} (89%) diff --git a/barretenberg/cpp/src/barretenberg/flavor/generated/Toy_flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/generated/toy_flavor.hpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/flavor/generated/Toy_flavor.hpp rename to barretenberg/cpp/src/barretenberg/flavor/generated/toy_flavor.hpp index 1d88605d122..c13b13f50a2 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/generated/Toy_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/generated/toy_flavor.hpp @@ -13,8 +13,8 @@ #include "barretenberg/flavor/flavor_macros.hpp" #include "barretenberg/polynomials/evaluation_domain.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/relations/generated/Toy/toy_avm.hpp" -#include "barretenberg/relations/generated/Toy/two_column_perm.hpp" +#include "barretenberg/relations/generated/toy/toy_avm.hpp" +#include "barretenberg/relations/generated/toy/two_column_perm.hpp" #include "barretenberg/transcript/transcript.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/Toy_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/toy_circuit_builder.hpp similarity index 96% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/Toy_circuit_builder.hpp rename to barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/toy_circuit_builder.hpp index 207b5a9e21e..ca930d1b51e 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/Toy_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/toy_circuit_builder.hpp @@ -11,10 +11,10 @@ #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" -#include "barretenberg/flavor/generated/Toy_flavor.hpp" -#include "barretenberg/relations/generated/Toy/lookup_xor.hpp" -#include "barretenberg/relations/generated/Toy/toy_avm.hpp" -#include "barretenberg/relations/generated/Toy/two_column_perm.hpp" +#include "barretenberg/flavor/generated/toy_flavor.hpp" +#include "barretenberg/relations/generated/toy/lookup_xor.hpp" +#include "barretenberg/relations/generated/toy/toy_avm.hpp" +#include "barretenberg/relations/generated/toy/two_column_perm.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/toy_avm/toy_avm_circuit_builder.test.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/toy_avm/toy_avm_circuit_builder.test.cpp index 7c395269104..e20bbaf3a2f 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/toy_avm/toy_avm_circuit_builder.test.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/toy_avm/toy_avm_circuit_builder.test.cpp @@ -1,7 +1,7 @@ -#include "../generated/Toy_circuit_builder.hpp" +#include "../generated/toy_circuit_builder.hpp" #include "barretenberg/crypto/generators/generator_data.hpp" -#include "barretenberg/flavor/generated/Toy_flavor.hpp" -#include "barretenberg/proof_system/circuit_builder/generated/Toy_circuit_builder.hpp" +#include "barretenberg/flavor/generated/toy_flavor.hpp" +#include "barretenberg/proof_system/circuit_builder/generated/toy_circuit_builder.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/Toy/declare_views.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/toy/declare_views.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/relations/generated/Toy/declare_views.hpp rename to barretenberg/cpp/src/barretenberg/relations/generated/toy/declare_views.hpp diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/Toy/lookup_xor.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/toy/lookup_xor.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/relations/generated/Toy/lookup_xor.hpp rename to barretenberg/cpp/src/barretenberg/relations/generated/toy/lookup_xor.hpp diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/Toy/toy_avm.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/toy/toy_avm.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/relations/generated/Toy/toy_avm.hpp rename to barretenberg/cpp/src/barretenberg/relations/generated/toy/toy_avm.hpp index 02b736fc92c..010fad5c2c5 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/Toy/toy_avm.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/toy/toy_avm.hpp @@ -7,9 +7,9 @@ namespace bb::Toy_vm { template struct Toy_avmRow { - FF toy_q_xor_table{}; FF toy_q_tuple_set{}; FF toy_q_xor{}; + FF toy_q_xor_table{}; }; inline std::string get_relation_label_toy_avm(int index) diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/Toy/two_column_perm.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/toy/two_column_perm.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/relations/generated/Toy/two_column_perm.hpp rename to barretenberg/cpp/src/barretenberg/relations/generated/toy/two_column_perm.hpp diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_composer.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/toy_composer.cpp similarity index 94% rename from barretenberg/cpp/src/barretenberg/vm/generated/Toy_composer.cpp rename to barretenberg/cpp/src/barretenberg/vm/generated/toy_composer.cpp index b5c36724fd6..379a7949bf7 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/toy_composer.cpp @@ -1,10 +1,10 @@ -#include "./Toy_composer.hpp" -#include "barretenberg/proof_system/circuit_builder/generated/Toy_circuit_builder.hpp" +#include "./toy_composer.hpp" +#include "barretenberg/proof_system/circuit_builder/generated/toy_circuit_builder.hpp" #include "barretenberg/proof_system/composer/composer_lib.hpp" #include "barretenberg/proof_system/composer/permutation_lib.hpp" -#include "barretenberg/vm/generated/Toy_verifier.hpp" +#include "barretenberg/vm/generated/toy_verifier.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_composer.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/toy_composer.hpp similarity index 93% rename from barretenberg/cpp/src/barretenberg/vm/generated/Toy_composer.hpp rename to barretenberg/cpp/src/barretenberg/vm/generated/toy_composer.hpp index 1e6a7292413..b65f0b5e5f7 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/toy_composer.hpp @@ -2,11 +2,11 @@ #pragma once -#include "barretenberg/proof_system/circuit_builder/generated/Toy_circuit_builder.hpp" +#include "barretenberg/proof_system/circuit_builder/generated/toy_circuit_builder.hpp" #include "barretenberg/proof_system/composer/composer_lib.hpp" #include "barretenberg/srs/global_crs.hpp" -#include "barretenberg/vm/generated/Toy_prover.hpp" -#include "barretenberg/vm/generated/Toy_verifier.hpp" +#include "barretenberg/vm/generated/toy_prover.hpp" +#include "barretenberg/vm/generated/toy_verifier.hpp" namespace bb { class ToyComposer { diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_prover.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/toy_prover.cpp similarity index 98% rename from barretenberg/cpp/src/barretenberg/vm/generated/Toy_prover.cpp rename to barretenberg/cpp/src/barretenberg/vm/generated/toy_prover.cpp index 525726c645a..d02ef357daf 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/toy_prover.cpp @@ -1,6 +1,6 @@ -#include "Toy_prover.hpp" +#include "toy_prover.hpp" #include "barretenberg/commitment_schemes/claim.hpp" #include "barretenberg/commitment_schemes/commitment_key.hpp" #include "barretenberg/honk/proof_system/logderivative_library.hpp" @@ -14,6 +14,7 @@ namespace bb { using Flavor = ToyFlavor; +using FF = Flavor::FF; /** * Create ToyProver from proving key, witness and manifest. @@ -69,9 +70,12 @@ void ToyProver::execute_wire_commitments_round() void ToyProver::execute_relation_check_rounds() { using Sumcheck = SumcheckProver; + auto sumcheck = Sumcheck(key->circuit_size, transcript); + FF alpha = transcript->template get_challenge("Sumcheck:alpha"); std::vector gate_challenges(numeric::get_msb(key->circuit_size)); + for (size_t idx = 0; idx < gate_challenges.size(); idx++) { gate_challenges[idx] = transcript->template get_challenge("Sumcheck:gate_challenge_" + std::to_string(idx)); } diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_prover.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/toy_prover.hpp similarity index 96% rename from barretenberg/cpp/src/barretenberg/vm/generated/Toy_prover.hpp rename to barretenberg/cpp/src/barretenberg/vm/generated/toy_prover.hpp index 8a807b7729a..9c451ad8a6a 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/toy_prover.hpp @@ -2,7 +2,7 @@ #pragma once #include "barretenberg/commitment_schemes/zeromorph/zeromorph.hpp" -#include "barretenberg/flavor/generated/Toy_flavor.hpp" +#include "barretenberg/flavor/generated/toy_flavor.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/relations/relation_parameters.hpp" #include "barretenberg/sumcheck/sumcheck_output.hpp" diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_verifier.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/toy_verifier.cpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/vm/generated/Toy_verifier.cpp rename to barretenberg/cpp/src/barretenberg/vm/generated/toy_verifier.cpp index 327822cfdd9..43ae568ea6d 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/toy_verifier.cpp @@ -1,6 +1,6 @@ -#include "./Toy_verifier.hpp" +#include "./toy_verifier.hpp" #include "barretenberg/commitment_schemes/zeromorph/zeromorph.hpp" #include "barretenberg/numeric/bitop/get_msb.hpp" #include "barretenberg/transcript/transcript.hpp" @@ -82,11 +82,14 @@ bool ToyVerifier::verify_proof(const HonkProof& proof) // Execute Sumcheck Verifier const size_t log_circuit_size = numeric::get_msb(circuit_size); auto sumcheck = SumcheckVerifier(log_circuit_size, transcript); + FF alpha = transcript->template get_challenge("Sumcheck:alpha"); + auto gate_challenges = std::vector(log_circuit_size); for (size_t idx = 0; idx < log_circuit_size; idx++) { gate_challenges[idx] = transcript->template get_challenge("Sumcheck:gate_challenge_" + std::to_string(idx)); } + auto [multivariate_challenge, claimed_evaluations, sumcheck_verified] = sumcheck.verify(relation_parameters, alpha, gate_challenges); diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_verifier.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/toy_verifier.hpp similarity index 89% rename from barretenberg/cpp/src/barretenberg/vm/generated/Toy_verifier.hpp rename to barretenberg/cpp/src/barretenberg/vm/generated/toy_verifier.hpp index d4bbdd2a998..4adad57f6ba 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/toy_verifier.hpp @@ -1,8 +1,8 @@ #pragma once -#include "barretenberg/flavor/generated/Toy_flavor.hpp" -#include "barretenberg/honk/proof_system/types/proof.hpp" +#include "barretenberg/flavor/generated/toy_flavor.hpp" +#include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" namespace bb {