Skip to content

Commit

Permalink
feat: update pg changes (#39)
Browse files Browse the repository at this point in the history
* feat: update pg changes

* fix: remove duplicated verifier
  • Loading branch information
Maddiaa0 authored Jan 12, 2024
1 parent ea8c518 commit 04fd1af
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
7 changes: 3 additions & 4 deletions bberg/src/flavor_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ impl FlavorBuilder for BBFiles {
"
{includes}
namespace proof_system::honk {{
namespace flavor {{
namespace proof_system::honk::flavor {{
class {name}Flavor {{
public:
Expand Down Expand Up @@ -102,7 +101,6 @@ class {name}Flavor {{
{transcript}
}};
}} // namespace proof_system::honk::flavor
}} // namespace proof_system::honk
Expand All @@ -120,7 +118,7 @@ fn flavor_includes(name: &str, relation_file_names: &[String], permutations: &[S
format!(
"
#pragma once
#include \"../relation_definitions_fwd.hpp\"
#include \"../relation_definitions.hpp\"
#include \"barretenberg/ecc/curves/bn254/g1.hpp\"
#include \"barretenberg/commitment_schemes/kzg/kzg.hpp\"
#include \"barretenberg/polynomials/barycentric.hpp\"
Expand Down Expand Up @@ -174,6 +172,7 @@ fn create_class_aliases() -> &'static str {
using CommitmentHandle = G1::affine_element;
using CommitmentKey = pcs::CommitmentKey<Curve>;
using VerifierCommitmentKey = pcs::VerifierCommitmentKey<Curve>;
using RelationSeparator = FF;
"#
}

Expand Down
12 changes: 8 additions & 4 deletions bberg/src/prover_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,14 @@ impl ProverBuilder for BBFiles {
using Sumcheck = sumcheck::SumcheckProver<Flavor>;
auto sumcheck = Sumcheck(key->circuit_size, transcript);
auto alpha = transcript->get_challenge(\"alpha\");
sumcheck_output = sumcheck.prove(prover_polynomials, relation_parameters, alpha);
FF alpha = transcript->get_challenge(\"Sumcheck:alpha\");
std::vector<FF> gate_challenges(numeric::get_msb(key->circuit_size));
for (size_t idx = 0; idx < gate_challenges.size(); idx++) {{
gate_challenges[idx] = transcript->get_challenge(\"Sumcheck:gate_challenge_\" + std::to_string(idx));
}}
sumcheck_output = sumcheck.prove(prover_polynomials, relation_parameters, alpha, gate_challenges);
}}
Expand Down Expand Up @@ -229,7 +234,6 @@ fn includes_cpp(name: &str) -> String {
#include \"barretenberg/commitment_schemes/commitment_key.hpp\"
#include \"barretenberg/honk/proof_system/logderivative_library.hpp\"
#include \"barretenberg/honk/proof_system/permutation_library.hpp\"
#include \"barretenberg/honk/proof_system/power_polynomial.hpp\"
#include \"barretenberg/polynomials/polynomial.hpp\"
#include \"barretenberg/proof_system/library/grand_product_library.hpp\"
#include \"barretenberg/relations/lookup_relation.hpp\"
Expand Down
17 changes: 11 additions & 6 deletions bberg/src/verifier_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,18 @@ impl VerifierBuilder for BBFiles {
{wire_commitments}
// Execute Sumcheck Verifier
auto sumcheck = SumcheckVerifier<Flavor>(circuit_size);
auto alpha = transcript->get_challenge(\"alpha\");
const size_t log_circuit_size = numeric::get_msb(circuit_size);
auto sumcheck = SumcheckVerifier<Flavor>(log_circuit_size, transcript);
FF alpha = transcript->get_challenge(\"Sumcheck:alpha\");
auto gate_challenges = std::vector<FF>(log_circuit_size);
for (size_t idx = 0; idx < log_circuit_size; idx++) {{
gate_challenges[idx] = transcript->get_challenge(\"Sumcheck:gate_challenge_\" + std::to_string(idx));
}}
auto [multivariate_challenge, claimed_evaluations, sumcheck_verified] =
sumcheck.verify(relation_parameters, alpha, transcript);
sumcheck.verify(relation_parameters, alpha, gate_challenges);
// If Sumcheck did not verify, return false
if (sumcheck_verified.has_value() && !sumcheck_verified.value()) {{
Expand Down Expand Up @@ -163,9 +170,7 @@ fn includes_cpp(name: &str) -> String {
format!(
"
#include \"./{name}_verifier.hpp\"
#include \"./{name}_verifier.hpp\"
#include \"barretenberg/commitment_schemes/zeromorph/zeromorph.hpp\"
#include \"barretenberg/honk/proof_system/power_polynomial.hpp\"
#include \"barretenberg/numeric/bitop/get_msb.hpp\"
#include \"barretenberg/transcript/transcript.hpp\"
"
Expand Down

0 comments on commit 04fd1af

Please sign in to comment.