From 2b74d8f771a566a828fd0e27c0195c4dfbd71dd2 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Thu, 1 Feb 2024 20:02:38 +0000 Subject: [PATCH] chore: update ontop of namespace changes --- bberg/src/circuit_builder.rs | 6 +++--- bberg/src/composer_builder.rs | 10 +++++----- bberg/src/flavor_builder.rs | 30 +++++++++++++++--------------- bberg/src/lookup_builder.rs | 4 ++-- bberg/src/permutation_builder.rs | 2 +- bberg/src/prover_builder.rs | 31 ++++++++++++++++--------------- bberg/src/verifier_builder.rs | 23 ++++++++++------------- 7 files changed, 52 insertions(+), 54 deletions(-) diff --git a/bberg/src/circuit_builder.rs b/bberg/src/circuit_builder.rs index a307a5746a..994c07fe3c 100644 --- a/bberg/src/circuit_builder.rs +++ b/bberg/src/circuit_builder.rs @@ -89,7 +89,7 @@ impl CircuitBuilder for BBFiles { }; let check_lookup_transformation = |lookup_name: &String| { format!( - "if (!evaluate_logderivative.template operator()>(\"{lookup_name}\")) {{ + "if (!evaluate_logderivative.template operator()>(\"{lookup_name}\")) {{ return false; }}" ) @@ -125,7 +125,7 @@ namespace bb {{ class {name}CircuitBuilder {{ public: - using Flavor = bb::honk::flavor::{name}Flavor; + using Flavor = bb::{name}Flavor; using FF = Flavor::FF; using Row = {name}FullRow; @@ -204,7 +204,7 @@ fn get_lookup_check_closure() -> String { const auto evaluate_logderivative = [&](const std::string& lookup_name) { // Check the logderivative relation - bb::honk::logderivative_library::compute_logderivative_inverse< + bb::logderivative_library::compute_logderivative_inverse< Flavor, LogDerivativeSettings>( polys, params, num_rows); diff --git a/bberg/src/composer_builder.rs b/bberg/src/composer_builder.rs index 2cad55278f..f6e3616590 100644 --- a/bberg/src/composer_builder.rs +++ b/bberg/src/composer_builder.rs @@ -14,9 +14,9 @@ impl ComposerBuilder for BBFiles { " {include_str} -namespace bb::honk {{ +namespace bb {{ -using Flavor = honk::flavor::{name}Flavor; +using Flavor = {name}Flavor; void {name}Composer::compute_witness(CircuitConstructor& circuit) {{ if (computed_witness) {{ @@ -109,10 +109,10 @@ std::shared_ptr {name}Composer::compute_verification_ke " {include_str} -namespace bb::honk {{ +namespace bb {{ class {name}Composer {{ public: - using Flavor = honk::flavor::{name}Flavor; + using Flavor = {name}Flavor; using CircuitConstructor = {name}CircuitBuilder; using ProvingKey = Flavor::ProvingKey; using VerificationKey = Flavor::VerificationKey; @@ -170,7 +170,7 @@ class {name}Composer {{ }}; }}; -}} // namespace bb::honk +}} // namespace bb " ); diff --git a/bberg/src/flavor_builder.rs b/bberg/src/flavor_builder.rs index 4c847ff098..e83704c1d0 100644 --- a/bberg/src/flavor_builder.rs +++ b/bberg/src/flavor_builder.rs @@ -69,7 +69,7 @@ impl FlavorBuilder for BBFiles { " {includes} -namespace bb::honk::flavor {{ +namespace bb {{ class {name}Flavor {{ public: @@ -101,7 +101,7 @@ class {name}Flavor {{ {transcript} }}; -}} // namespace bb::honk +}} // namespace bb " @@ -150,7 +150,7 @@ fn create_relations_tuple(master_name: &str, relation_file_names: &[String]) -> fn create_permutations_tuple(permutations: &[Permutation]) -> String { permutations .iter() - .map(|perm| format!("sumcheck::{}_relation", perm.attribute.clone().unwrap())) + .map(|perm| format!("{}_relation", perm.attribute.clone().unwrap())) .collect::>() .join(", ") } @@ -162,7 +162,7 @@ fn create_class_aliases() -> &'static str { r#" using Curve = curve::BN254; using G1 = Curve::Group; - using PCS = pcs::kzg::KZG; + using PCS = KZG; using FF = G1::subgroup_field; using Polynomial = bb::Polynomial; @@ -170,8 +170,8 @@ fn create_class_aliases() -> &'static str { using GroupElement = G1::element; using Commitment = G1::affine_element; using CommitmentHandle = G1::affine_element; - using CommitmentKey = pcs::CommitmentKey; - using VerifierCommitmentKey = pcs::VerifierCommitmentKey; + using CommitmentKey = bb::CommitmentKey; + using VerifierCommitmentKey = bb::VerifierCommitmentKey; using RelationSeparator = FF; "# } @@ -489,7 +489,7 @@ fn generate_transcript(witness: &[String]) -> String { let declaration_transform = |c: &_| format!("Commitment {c};"); let deserialize_transform = |name: &_| { format!( - "{name} = deserialize_from_buffer(Transcript::proof_data, num_bytes_read);", + "{name} = deserialize_from_buffer(Transcript::proof_data, num_frs_read);", ) }; let serialize_transform = @@ -515,14 +515,14 @@ fn generate_transcript(witness: &[String]) -> String { Transcript() = default; - Transcript(const std::vector& proof) + Transcript(const std::vector& proof) : BaseTranscript(proof) {{}} void deserialize_full_transcript() {{ - size_t num_bytes_read = 0; - circuit_size = deserialize_from_buffer(proof_data, num_bytes_read); + size_t num_frs_read = 0; + circuit_size = deserialize_from_buffer(proof_data, num_frs_read); size_t log_n = numeric::get_msb(circuit_size); {deserialize_wires} @@ -530,15 +530,15 @@ fn generate_transcript(witness: &[String]) -> String { for (size_t i = 0; i < log_n; ++i) {{ sumcheck_univariates.emplace_back( deserialize_from_buffer>( - Transcript::proof_data, num_bytes_read)); + Transcript::proof_data, num_frs_read)); }} sumcheck_evaluations = deserialize_from_buffer>( - Transcript::proof_data, num_bytes_read); + Transcript::proof_data, num_frs_read); for (size_t i = 0; i < log_n; ++i) {{ - zm_cq_comms.push_back(deserialize_from_buffer(proof_data, num_bytes_read)); + zm_cq_comms.push_back(deserialize_from_buffer(proof_data, num_frs_read)); }} - zm_cq_comm = deserialize_from_buffer(proof_data, num_bytes_read); - zm_pi_comm = deserialize_from_buffer(proof_data, num_bytes_read); + zm_cq_comm = deserialize_from_buffer(proof_data, num_frs_read); + zm_pi_comm = deserialize_from_buffer(proof_data, num_frs_read); }} void serialize_full_transcript() diff --git a/bberg/src/lookup_builder.rs b/bberg/src/lookup_builder.rs index 279695f971..a6752211b6 100644 --- a/bberg/src/lookup_builder.rs +++ b/bberg/src/lookup_builder.rs @@ -203,7 +203,7 @@ fn create_lookup_settings_file(lookup: &Lookup) -> String { " {lookup_settings_includes} - namespace bb::honk::sumcheck {{ + namespace bb::sumcheck {{ /** * @brief This class contains an example of how to set LookupSettings classes used by the @@ -215,7 +215,7 @@ fn create_lookup_settings_file(lookup: &Lookup) -> String { * 3) Update \"DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS\" and \"DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS\" to * include the new settings * 4) Add the relation with the chosen settings to Relations in the flavor (for example,\"` - * using Relations = std::tuple>;)` * */ diff --git a/bberg/src/permutation_builder.rs b/bberg/src/permutation_builder.rs index 78bf0b5dd4..8d32a9902d 100644 --- a/bberg/src/permutation_builder.rs +++ b/bberg/src/permutation_builder.rs @@ -163,7 +163,7 @@ fn create_permutation_settings_file(permutation: &Permutation) -> String { " {permutation_settings_includes} - namespace bb::honk::sumcheck {{ + namespace bb::sumcheck {{ class {permutation_name}_permutation_settings {{ public: diff --git a/bberg/src/prover_builder.rs b/bberg/src/prover_builder.rs index 81280652fb..9fcaafa05c 100644 --- a/bberg/src/prover_builder.rs +++ b/bberg/src/prover_builder.rs @@ -11,11 +11,11 @@ impl ProverBuilder for BBFiles { let include_str = includes_hpp(name); let prover_hpp = format!(" {include_str} - namespace bb::honk {{ + namespace bb {{ class {name}Prover {{ - using Flavor = honk::flavor::{name}Flavor; + using Flavor = {name}Flavor; using FF = Flavor::FF; using PCS = Flavor::PCS; using PCSCommitmentKey = Flavor::CommitmentKey; @@ -34,8 +34,8 @@ impl ProverBuilder for BBFiles { void execute_relation_check_rounds(); void execute_zeromorph_rounds(); - plonk::proof& export_proof(); - plonk::proof& construct_proof(); + HonkProof& export_proof(); + HonkProof& construct_proof(); std::shared_ptr transcript = std::make_shared(); @@ -52,17 +52,17 @@ impl ProverBuilder for BBFiles { Polynomial quotient_W; - sumcheck::SumcheckOutput sumcheck_output; + SumcheckOutput sumcheck_output; std::shared_ptr commitment_key; - using ZeroMorph = pcs::zeromorph::ZeroMorphProver_; + using ZeroMorph = ZeroMorphProver_; private: - plonk::proof proof; + HonkProof proof; }}; - }} // namespace bb::honk + }} // namespace bb "); self.write_file(&self.prover, &format!("{}_prover.hpp", name), &prover_hpp); @@ -74,9 +74,10 @@ impl ProverBuilder for BBFiles { let prover_cpp = format!(" {include_str} - namespace bb::honk {{ + namespace bb {{ - using Flavor = honk::flavor::{name}Flavor; + using Flavor = {name}Flavor; + using FF = Flavor::FF; /** * Create {name}Prover from proving key, witness and manifest. @@ -136,7 +137,7 @@ impl ProverBuilder for BBFiles { */ void {name}Prover::execute_relation_check_rounds() {{ - using Sumcheck = sumcheck::SumcheckProver; + using Sumcheck = SumcheckProver; auto sumcheck = Sumcheck(key->circuit_size, transcript); @@ -168,13 +169,13 @@ impl ProverBuilder for BBFiles { }} - plonk::proof& {name}Prover::export_proof() + HonkProof& {name}Prover::export_proof() {{ - proof.proof_data = transcript->proof_data; + proof = transcript->proof_data; return proof; }} - plonk::proof& {name}Prover::construct_proof() + HonkProof& {name}Prover::construct_proof() {{ // Add circuit size public input size and public inputs to transcript. execute_preamble_round(); @@ -201,7 +202,7 @@ impl ProverBuilder for BBFiles { return export_proof(); }} - }} // namespace bb::honk + }} // namespace bb "); diff --git a/bberg/src/verifier_builder.rs b/bberg/src/verifier_builder.rs index 9c2c199e4c..3d076ad5a8 100644 --- a/bberg/src/verifier_builder.rs +++ b/bberg/src/verifier_builder.rs @@ -20,10 +20,7 @@ impl VerifierBuilder for BBFiles { let ver_cpp = format!(" {include_str} - using namespace bb; - using namespace bb::honk::sumcheck; - - namespace bb::honk {{ + namespace bb {{ {name}Verifier::{name}Verifier(std::shared_ptr verifier_key) : key(verifier_key) {{}} @@ -45,19 +42,19 @@ impl VerifierBuilder for BBFiles { * @brief This function verifies an {name} Honk proof for given program settings. * */ - bool {name}Verifier::verify_proof(const plonk::proof& proof) + bool {name}Verifier::verify_proof(const HonkProof& proof) {{ - using Flavor = honk::flavor::{name}Flavor; + using Flavor = {name}Flavor; using FF = Flavor::FF; using Commitment = Flavor::Commitment; // using Curve = Flavor::Curve; - // using ZeroMorph = pcs::zeromorph::ZeroMorphVerifier_; + // using ZeroMorph = ZeroMorphVerifier_; using VerifierCommitments = Flavor::VerifierCommitments; using CommitmentLabels = Flavor::CommitmentLabels; RelationParameters relation_parameters; - transcript = std::make_shared(proof.proof_data); + transcript = std::make_shared(proof); VerifierCommitments commitments {{ key }}; CommitmentLabels commitment_labels; @@ -106,7 +103,7 @@ impl VerifierBuilder for BBFiles { }} - }} // namespace bb::honk + }} // namespace bb "); @@ -120,9 +117,9 @@ impl VerifierBuilder for BBFiles { " {include_str} - namespace bb::honk {{ + namespace bb {{ class {name}Verifier {{ - using Flavor = honk::flavor::{name}Flavor; + using Flavor = {name}Flavor; using FF = Flavor::FF; using Commitment = Flavor::Commitment; using VerificationKey = Flavor::VerificationKey; @@ -137,7 +134,7 @@ impl VerifierBuilder for BBFiles { {name}Verifier& operator=(const {name}Verifier& other) = delete; {name}Verifier& operator=({name}Verifier&& other) noexcept; - bool verify_proof(const plonk::proof& proof); + bool verify_proof(const HonkProof& proof); std::shared_ptr key; std::map commitments; @@ -145,7 +142,7 @@ impl VerifierBuilder for BBFiles { std::shared_ptr transcript; }}; - }} // namespace bb::honk + }} // namespace bb "