Skip to content

Commit

Permalink
fix: cleanup of include statements and dependencies (AztecProtocol/ba…
Browse files Browse the repository at this point in the history
…rretenberg#527)

Ensure honk does not depend on plonk anymore. Remove use of the stdlib composer headers used for forward declaration outside stdlib.
Co-authored-by: maramihali <[email protected]>, codygunton <[email protected]>
  • Loading branch information
codygunton authored Jun 16, 2023
1 parent 4928aa4 commit 0c7b5e2
Show file tree
Hide file tree
Showing 19 changed files with 13 additions and 305 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#include "barretenberg/ecc/curves/bn254/fr.hpp"
#include <benchmark/benchmark.h>
#include <cstddef>
#include "barretenberg/honk/composer/standard_honk_composer.hpp"
#include "barretenberg/stdlib/primitives/field/field.hpp"
#include "barretenberg/stdlib/primitives/composers/composers.hpp"
#include "barretenberg/stdlib/primitives/composers/composers_fwd.hpp"
#include "barretenberg/stdlib/primitives/witness/witness.hpp"

using namespace benchmark;
using namespace proof_system::plonk::stdlib;

namespace standard_honk_bench {

Expand All @@ -18,9 +19,9 @@ constexpr size_t NUM_REPETITIONS = 5;

void generate_test_circuit(auto& composer, size_t num_gates)
{
plonk::stdlib::field_t a(plonk::stdlib::witness_t(&composer, barretenberg::fr::random_element()));
plonk::stdlib::field_t b(plonk::stdlib::witness_t(&composer, barretenberg::fr::random_element()));
plonk::stdlib::field_t c(&composer);
field_t a(witness_t(&composer, barretenberg::fr::random_element()));
field_t b(witness_t(&composer, barretenberg::fr::random_element()));
field_t c(&composer);
for (size_t i = 0; i < (num_gates / 4) - 4; ++i) {
c = a + b;
c = a * c;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "acir_format.hpp"
#include "barretenberg/common/log.hpp"
#include "barretenberg/stdlib/primitives/composers/composers.hpp"

namespace acir_format {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "pedersen.hpp"
#include "hash_to_field.hpp"
#include "barretenberg/dsl/types.hpp"
#include "barretenberg/stdlib/primitives/composers/composers_fwd.hpp"

namespace acir_format {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "barretenberg/common/streams.hpp"
#include "barretenberg/serialize/test_helper.hpp"
#include "ecdsa_secp256k1.hpp"
#include "barretenberg/stdlib/primitives/composers/composers.hpp"

TEST(acir_format, test_a_single_constraint_no_pub_inputs)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# TODO(Cody): Remove plonk dependency
barretenberg_module(honk numeric ecc srs proof_system transcript plonk)
barretenberg_module(honk numeric ecc srs proof_system transcript)

if(TESTING)
# TODO: Re-enable all these warnings once PoC is finished
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "standard_honk_composer_helper.hpp"
#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/honk/pcs/commitment_key.hpp"
#include "barretenberg/numeric/bitop/get_msb.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "barretenberg/honk/proof_system/prover.hpp"
#include "barretenberg/honk/proof_system/verifier.hpp"
#include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp"
#include "barretenberg/plonk/proof_system/verifier/verifier.hpp"
#include "barretenberg/proof_system/composer/composer_helper_lib.hpp"
#include "barretenberg/proof_system/composer/permutation_helper.hpp"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#pragma once

#include "barretenberg/proof_system/composer/composer_helper_lib.hpp"
#include "barretenberg/plonk/composer/composer_helper/composer_helper_lib.hpp"
#include "barretenberg/srs/factories/file_crs_factory.hpp"
#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp"
#include "barretenberg/honk/proof_system/ultra_prover.hpp"
#include "barretenberg/honk/proof_system/ultra_verifier.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,6 @@ template <class Flavor> class StandardHonkComposer_ {
const std::string& err() const { return circuit_constructor.err(); };
void failure(std::string msg) { circuit_constructor.failure(msg); }
};
template class StandardHonkComposer_<flavor::Standard>;
template class StandardHonkComposer_<flavor::StandardGrumpkin>;
using StandardHonkComposer = StandardHonkComposer_<flavor::Standard>;
using StandardGrumpkinHonkComposer = StandardHonkComposer_<flavor::StandardGrumpkin>;
} // namespace proof_system::honk
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ TEST_F(StandardHonkComposerTests, BaseCase)
composer.circuit_constructor.add_variable(a);

auto prover = composer.create_prover();
plonk::proof proof = prover.construct_proof();
auto proof = prover.construct_proof();
auto verifier = composer.create_verifier();
bool verified = verifier.verify_proof(proof);
ASSERT_TRUE(verified);
Expand Down Expand Up @@ -350,7 +350,7 @@ TEST_F(StandardHonkComposerTests, TwoGates)

auto prover = composer.create_prover();

plonk::proof proof = prover.construct_proof();
auto proof = prover.construct_proof();
auto verifier = composer.create_verifier();
bool verified = verifier.verify_proof(proof);
EXPECT_EQ(verified, expect_verified);
Expand Down Expand Up @@ -383,7 +383,7 @@ TEST_F(StandardHonkComposerTests, SumcheckEvaluations)
composer.create_add_gate({ d_idx, c_idx, a_idx, fr::one(), fr::neg_one(), fr::neg_one(), fr::zero() });
}
auto prover = composer.create_prover();
plonk::proof proof = prover.construct_proof();
auto proof = prover.construct_proof();

auto verifier = composer.create_verifier();
bool verified = verifier.verify_proof(proof);
Expand All @@ -399,7 +399,7 @@ TEST(StandardGrumpkinHonkComposer, BaseCase)
composer.circuit_constructor.add_variable(a);

auto prover = composer.create_prover();
plonk::proof proof = prover.construct_proof();
auto proof = prover.construct_proof();
auto verifier = composer.create_verifier();
bool verified = verifier.verify_proof(proof);
ASSERT_TRUE(verified);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,6 @@ template <class Flavor> class UltraHonkComposer_ {
const std::string& err() const { return circuit_constructor.err(); };
void failure(std::string msg) { circuit_constructor.failure(msg); }
};
template class UltraHonkComposer_<honk::flavor::Ultra>;
template class UltraHonkComposer_<honk::flavor::UltraGrumpkin>;
using UltraHonkComposer = UltraHonkComposer_<honk::flavor::Ultra>;
using UltraGrumpkinHonkComposer = UltraHonkComposer_<honk::flavor::UltraGrumpkin>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "barretenberg/honk/sumcheck/relations/arithmetic_relation.hpp"
#include "barretenberg/honk/sumcheck/relations/permutation_relation.hpp"
#include "barretenberg/honk/transcript/transcript.hpp"
#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp"
#include "barretenberg/polynomials/evaluation_domain.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "barretenberg/honk/sumcheck/relations/arithmetic_relation.hpp"
#include "barretenberg/honk/sumcheck/relations/permutation_relation.hpp"
#include "barretenberg/honk/transcript/transcript.hpp"
#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp"
#include "barretenberg/polynomials/evaluation_domain.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "barretenberg/honk/sumcheck/polynomials/univariate.hpp"
#include "barretenberg/ecc/curves/bn254/g1.hpp"
#include "barretenberg/honk/transcript/transcript.hpp"
#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp"
#include "barretenberg/polynomials/evaluation_domain.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "barretenberg/honk/sumcheck/polynomials/univariate.hpp"
#include "barretenberg/ecc/curves/bn254/g1.hpp"
#include "barretenberg/honk/transcript/transcript.hpp"
#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp"
#include "barretenberg/polynomials/evaluation_domain.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.hpp"
Expand Down
Loading

0 comments on commit 0c7b5e2

Please sign in to comment.