Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
13f508c
No STANDARD_HONK composer type
codygunton Jun 21, 2023
cc2bb28
WIP on HasPlookup concept
codygunton Jun 21, 2023
b6f29d6
Fix bad constexpr condition.
codygunton Jun 22, 2023
da1d523
Move of IsAnyOf; get rid of some ComposerType's.
codygunton Jun 22, 2023
a71cb54
Introduce CIRCUIT_TYPE
codygunton Jun 26, 2023
b5abff6
Move CircuitType out of pk (honk tests build).
codygunton Jun 26, 2023
7cbf926
ComposerType ~> CircuitType; move to honk flavor
codygunton Jun 26, 2023
9aced62
Update comment.
codygunton Jun 26, 2023
ceb6ba0
Move composer helper files.
codygunton Jun 26, 2023
4c06633
Rename helper files
codygunton Jun 26, 2023
503086d
FIx j-s test.
codygunton Jun 26, 2023
1e22d9f
Fix includes post-move and rename.
codygunton Jun 26, 2023
bde0d63
Rename composer helper classes
codygunton Jun 26, 2023
63f46ed
Replace CircuitConstructor by CircuitBuilder
codygunton Jun 26, 2023
9db5fcb
Move and rename circuit_constructor dirs and files
codygunton Jun 26, 2023
6cdf7f7
Update packages commit
codygunton Jun 26, 2023
733fe27
Remove constructred added as hack.
codygunton Jun 26, 2023
9e757a9
Aztec packages commit set to master.
codygunton Jun 28, 2023
85ff1db
That didn't work?
codygunton Jun 28, 2023
13244f0
Fix compilation after removing hack ctors.
codygunton Jun 28, 2023
0aa4f8b
Move comment to issue #562.
codygunton Jun 28, 2023
b608391
Move note to issue #563.
codygunton Jun 28, 2023
57fa2d5
Leave note on unused function.
codygunton Jun 28, 2023
4465cf2
Point to aztec-packages master
codygunton Jun 28, 2023
0e8be82
Merge branch 'master' into cg/post-split-cleanup
codygunton Jun 28, 2023
fdda38c
Circuit type fix in bigfield.
suyash67 Jun 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions barretenberg.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,6 @@
"-g"
],
"cmake.useCMakePresets": "auto",
"editor.inlayHints.enabled": "offUnlessPressed"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an annoying default probably most people don't want.

},
}
2 changes: 1 addition & 1 deletion cpp/.aztec-packages-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
64c8ba700b75df07a8452a6f2eae3d23cf7625a6
master
6 changes: 3 additions & 3 deletions cpp/src/barretenberg/barretenberg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
#include "ecc/curves/grumpkin/grumpkin.hpp"
#include "numeric/random/engine.hpp"
#include "numeric/uint256/uint256.hpp"
#include "proof_system/circuit_constructors/turbo_circuit_constructor.hpp"
#include "proof_system/circuit_constructors/ultra_circuit_constructor.hpp"
#include "proof_system/circuit_builder/turbo_circuit_builder.hpp"
#include "proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "plonk/proof_system/types/proof.hpp"
#include "plonk/proof_system/verification_key/verification_key.hpp"
#include "proof_system/types/composer_type.hpp"
#include "proof_system/types/circuit_type.hpp"
// TODO(https://github.com/AztecProtocol/barretenberg/issues/491):
// consider helper header(s) for serialization and other non-stdlib includes
// - possibly: common, serialize, srs, transcript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@ template <typename Builder> void generate_merkle_membership_test_circuit(Builder
*/
template <typename Composer>
void construct_proof_with_specified_num_gates(State& state,
void (*test_circuit_function)(typename Composer::CircuitConstructor&,
void (*test_circuit_function)(typename Composer::CircuitBuilder&,
size_t)) noexcept
{
barretenberg::srs::init_crs_factory("../srs_db/ignition");
auto num_gates = static_cast<size_t>(1 << (size_t)state.range(0));
for (auto _ : state) {
// Constuct circuit and prover; don't include this part in measurement
state.PauseTiming();
auto builder = typename Composer::CircuitConstructor();
auto builder = typename Composer::CircuitBuilder();
test_circuit_function(builder, num_gates);

auto composer = Composer();
Expand All @@ -212,15 +212,15 @@ void construct_proof_with_specified_num_gates(State& state,
*/
template <typename Composer>
void construct_proof_with_specified_num_iterations(State& state,
void (*test_circuit_function)(typename Composer::CircuitConstructor&,
void (*test_circuit_function)(typename Composer::CircuitBuilder&,
size_t)) noexcept
{
barretenberg::srs::init_crs_factory("../srs_db/ignition");
auto num_iterations = static_cast<size_t>(state.range(0));
for (auto _ : state) {
// Constuct circuit and prover; don't include this part in measurement
state.PauseTiming();
auto builder = typename Composer::CircuitConstructor();
auto builder = typename Composer::CircuitBuilder();
test_circuit_function(builder, num_iterations);

auto composer = Composer();
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/barretenberg/benchmark/honk_bench/honk.bench.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <benchmark/benchmark.h>
#include <cstddef>
#include "barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.hpp"
#include "barretenberg/honk/composer/standard_composer.hpp"
#include "barretenberg/stdlib/primitives/field/field.hpp"
#include "barretenberg/stdlib/primitives/witness/witness.hpp"

Expand All @@ -9,8 +9,8 @@ using namespace proof_system::plonk::stdlib;

namespace standard_honk_bench {

using Builder = proof_system::StandardCircuitConstructor;
using Composer = proof_system::honk::StandardHonkComposerHelper;
using Builder = proof_system::StandardCircuitBuilder;
using Composer = proof_system::honk::StandardComposer;

constexpr size_t MIN_LOG_NUM_GATES = 16;
constexpr size_t MAX_LOG_NUM_GATES = 16;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp"
#include "barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.hpp"
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"
#include "barretenberg/honk/composer/standard_composer.hpp"

using namespace benchmark;

namespace standard_honk_bench {

using StandardBuilder = proof_system::StandardCircuitConstructor;
using StandardHonk = proof_system::honk::StandardHonkComposerHelper;
using StandardBuilder = proof_system::StandardCircuitBuilder;
using StandardHonk = proof_system::honk::StandardComposer;

// Log number of gates for test circuit
constexpr size_t MIN_LOG_NUM_GATES = bench_utils::BenchParams::MIN_LOG_NUM_GATES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp"
#include "barretenberg/plonk/composer/composer_helper/standard_plonk_composer_helper.hpp"
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"
#include "barretenberg/plonk/composer/standard_composer.hpp"

using namespace benchmark;

namespace standard_plonk_bench {

using StandardBuilder = proof_system::StandardCircuitConstructor;
using StandardPlonk = proof_system::plonk::StandardPlonkComposerHelper;
using StandardBuilder = proof_system::StandardCircuitBuilder;
using StandardPlonk = proof_system::plonk::StandardComposer;

// Log number of gates for test circuit
constexpr size_t MIN_LOG_NUM_GATES = bench_utils::BenchParams::MIN_LOG_NUM_GATES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#include <benchmark/benchmark.h>

#include "barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.hpp"
#include "barretenberg/honk/composer/composer_helper/ultra_honk_composer_helper.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/honk/composer/ultra_composer.hpp"
#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"

using namespace benchmark;
using namespace proof_system::plonk;

namespace ultra_honk_bench {

using UltraBuilder = proof_system::UltraCircuitConstructor;
using UltraHonk = proof_system::honk::UltraHonkComposerHelper;
using UltraBuilder = proof_system::UltraCircuitBuilder;
using UltraHonk = proof_system::honk::UltraComposer;

// Number of times to perform operation of interest in the benchmark circuits, e.g. # of hashes to perform
constexpr size_t MIN_NUM_ITERATIONS = bench_utils::BenchParams::MIN_NUM_ITERATIONS;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.hpp"
#include "barretenberg/plonk/composer/composer_helper/ultra_plonk_composer_helper.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/plonk/composer/ultra_composer.hpp"

using namespace benchmark;

namespace ultra_plonk_bench {

using UltraBuilder = proof_system::UltraCircuitConstructor;
using UltraPlonk = proof_system::plonk::UltraPlonkComposerHelper;
using UltraBuilder = proof_system::UltraCircuitBuilder;
using UltraPlonk = proof_system::plonk::UltraComposer;

// Number of times to perform operation of interest in the benchmark circuits, e.g. # of hashes to perform
constexpr size_t MIN_NUM_ITERATIONS = bench_utils::BenchParams::MIN_NUM_ITERATIONS;
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/barretenberg/benchmark/plonk_bench/plonk.bench.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <benchmark/benchmark.h>
#include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp"
#include "barretenberg/plonk/composer/composer_helper/standard_plonk_composer_helper.hpp"
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"
#include "barretenberg/plonk/composer/standard_composer.hpp"
#include "barretenberg/stdlib/primitives/field/field.hpp"

using namespace benchmark;
Expand All @@ -12,8 +12,8 @@ constexpr size_t START = (MAX_GATES) >> (NUM_CIRCUITS - 1);
// constexpr size_t MAX_HASH_ROUNDS = 8192;
// constexpr size_t START_HASH_ROUNDS = 64;

using Builder = proof_system::StandardCircuitConstructor;
using Composer = proof_system::plonk::StandardPlonkComposerHelper;
using Builder = proof_system::StandardCircuitBuilder;
using Composer = proof_system::plonk::StandardComposer;

void generate_test_plonk_circuit(Builder& builder, size_t num_gates)
{
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/barretenberg/common/fuzzer.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include "barretenberg/plonk/composer/standard_plonk_composer.hpp"
#include "barretenberg/plonk/composer/turbo_plonk_composer.hpp"
#include "barretenberg/plonk/composer/standard_composer.hpp"
#include "barretenberg/plonk/composer/turbo_composer.hpp"
#include <concepts>

#define PARENS ()
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/common/fuzzer_constants.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include <cstdint>

enum ComposerType : uint64_t {
enum CircuitType : uint64_t {
Standard = 1 << 0,
Turbo = 1 << 1,
};
6 changes: 3 additions & 3 deletions cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ void create_recursion_constraints(Builder& builder,
// on-curve errors and inverting-zero errors
{
// get a fake key/proof that satisfies on-curve + inversion-zero checks
const std::vector<fr> dummy_key = export_dummy_key_in_recursion_format(PolynomialManifest(Builder::type),
inner_proof_contains_recursive_proof);
const std::vector<fr> dummy_key = export_dummy_key_in_recursion_format(
PolynomialManifest(Builder::CIRCUIT_TYPE), inner_proof_contains_recursive_proof);
const auto manifest = Composer::create_manifest(input.public_inputs.size());
const std::vector<barretenberg::fr> dummy_proof =
export_dummy_transcript_in_recursion_format(manifest, inner_proof_contains_recursive_proof);
Expand Down Expand Up @@ -180,7 +180,7 @@ std::vector<barretenberg::fr> export_key_in_recursion_format(std::shared_ptr<ver
}

verification_key_data vkey_data{
.composer_type = vkey->composer_type,
.circuit_type = static_cast<uint32_t>(vkey->circuit_type),
.circuit_size = static_cast<uint32_t>(vkey->circuit_size),
.num_public_inputs = static_cast<uint32_t>(vkey->num_public_inputs),
.commitments = vkey->commitments,
Expand Down
18 changes: 9 additions & 9 deletions cpp/src/barretenberg/dsl/types.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once
#include "barretenberg/plonk/composer/composer_helper/turbo_plonk_composer_helper.hpp"
#include "barretenberg/plonk/composer/composer_helper/ultra_plonk_composer_helper.hpp"
#include "barretenberg/plonk/composer/turbo_composer.hpp"
#include "barretenberg/plonk/composer/ultra_composer.hpp"

#include "barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.hpp"
#include "barretenberg/proof_system/circuit_builder/turbo_circuit_builder.hpp"
#include "barretenberg/plonk/proof_system/prover/prover.hpp"
#include "barretenberg/stdlib/primitives/bigfield/bigfield.hpp"
#include "barretenberg/stdlib/primitives/biggroup/biggroup.hpp"
Expand All @@ -28,18 +28,18 @@

namespace acir_format {

using Builder = proof_system::UltraCircuitConstructor;
using Composer = plonk::UltraPlonkComposerHelper;
using Builder = proof_system::UltraCircuitBuilder;
using Composer = plonk::UltraComposer;

using Prover = std::conditional_t<
std::same_as<Composer, plonk::UltraPlonkComposerHelper>,
std::same_as<Composer, plonk::UltraComposer>,
plonk::UltraWithKeccakProver,
std::conditional_t<std::same_as<Composer, plonk::TurboPlonkComposerHelper>, plonk::TurboProver, plonk::Prover>>;
std::conditional_t<std::same_as<Composer, plonk::TurboComposer>, plonk::TurboProver, plonk::Prover>>;

using Verifier = std::conditional_t<
std::same_as<Composer, plonk::UltraPlonkComposerHelper>,
std::same_as<Composer, plonk::UltraComposer>,
plonk::UltraWithKeccakVerifier,
std::conditional_t<std::same_as<Composer, plonk::TurboPlonkComposerHelper>, plonk::TurboVerifier, plonk::Verifier>>;
std::conditional_t<std::same_as<Composer, plonk::TurboComposer>, plonk::TurboVerifier, plonk::Verifier>>;

using RecursiveProver = plonk::UltraProver;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "standard_honk_composer_helper.hpp"
#include "standard_composer.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/honk/pcs/commitment_key.hpp"
#include "barretenberg/numeric/bitop/get_msb.hpp"
Expand All @@ -23,13 +23,13 @@ namespace proof_system::honk {
* @return Pointer to the initialized proving key updated with selector polynomials.
* */
template <StandardFlavor Flavor>
std::shared_ptr<typename Flavor::ProvingKey> StandardHonkComposerHelper_<Flavor>::compute_proving_key_base(
const CircuitConstructor& constructor, const size_t minimum_circuit_size, const size_t num_randomized_gates)
std::shared_ptr<typename Flavor::ProvingKey> StandardComposer_<Flavor>::compute_proving_key_base(
const CircuitBuilder& constructor, const size_t minimum_circuit_size, const size_t num_randomized_gates)
{
// Initialize proving_key
// TODO(#392)(Kesha): replace composer types.
proving_key = initialize_proving_key<Flavor>(
constructor, crs_factory_.get(), minimum_circuit_size, num_randomized_gates, ComposerType::STANDARD_HONK);
proving_key =
initialize_proving_key<Flavor>(constructor, crs_factory_.get(), minimum_circuit_size, num_randomized_gates);
// Compute lagrange selectors
construct_selector_polynomials<Flavor>(constructor, proving_key.get());

Expand All @@ -46,8 +46,8 @@ std::shared_ptr<typename Flavor::ProvingKey> StandardHonkComposerHelper_<Flavor>
* @tparam Program settings needed to establish if w_4 is being used.
* */
template <StandardFlavor Flavor>
void StandardHonkComposerHelper_<Flavor>::compute_witness(const CircuitConstructor& circuit_constructor,
const size_t minimum_circuit_size)
void StandardComposer_<Flavor>::compute_witness(const CircuitBuilder& circuit_constructor,
const size_t minimum_circuit_size)
{
if (computed_witness) {
return;
Expand All @@ -70,15 +70,14 @@ void StandardHonkComposerHelper_<Flavor>::compute_witness(const CircuitConstruct
* */

template <StandardFlavor Flavor>
std::shared_ptr<typename Flavor::ProvingKey> StandardHonkComposerHelper_<Flavor>::compute_proving_key(
const CircuitConstructor& circuit_constructor)
std::shared_ptr<typename Flavor::ProvingKey> StandardComposer_<Flavor>::compute_proving_key(
const CircuitBuilder& circuit_constructor)
{
if (proving_key) {
return proving_key;
}
// Compute q_l, q_r, q_o, etc polynomials
StandardHonkComposerHelper_::compute_proving_key_base(
circuit_constructor, /*minimum_circuit_size=*/0, NUM_RESERVED_GATES);
StandardComposer_::compute_proving_key_base(circuit_constructor, /*minimum_circuit_size=*/0, NUM_RESERVED_GATES);

// Compute sigma polynomials (we should update that late)
compute_standard_honk_sigma_permutations<Flavor>(circuit_constructor, proving_key.get());
Expand All @@ -95,15 +94,15 @@ std::shared_ptr<typename Flavor::ProvingKey> StandardHonkComposerHelper_<Flavor>
* @return Pointer to created circuit verification key.
* */
template <StandardFlavor Flavor>
std::shared_ptr<typename Flavor::VerificationKey> StandardHonkComposerHelper_<Flavor>::compute_verification_key(
const CircuitConstructor& circuit_constructor)
std::shared_ptr<typename Flavor::VerificationKey> StandardComposer_<Flavor>::compute_verification_key(
const CircuitBuilder& circuit_constructor)
{
if (verification_key) {
return verification_key;
}

verification_key = std::make_shared<typename Flavor::VerificationKey>(
proving_key->circuit_size, proving_key->num_public_inputs, proving_key->composer_type);
verification_key =
std::make_shared<typename Flavor::VerificationKey>(proving_key->circuit_size, proving_key->num_public_inputs);

// Compute and store commitments to all precomputed polynomials
verification_key->q_m = commitment_key->commit(proving_key->q_m);
Expand All @@ -120,14 +119,11 @@ std::shared_ptr<typename Flavor::VerificationKey> StandardHonkComposerHelper_<Fl
verification_key->lagrange_first = commitment_key->commit(proving_key->lagrange_first);
verification_key->lagrange_last = commitment_key->commit(proving_key->lagrange_last);

verification_key->composer_type = proving_key->composer_type;

return verification_key;
}

template <StandardFlavor Flavor>
StandardVerifier_<Flavor> StandardHonkComposerHelper_<Flavor>::create_verifier(
const CircuitConstructor& circuit_constructor)
StandardVerifier_<Flavor> StandardComposer_<Flavor>::create_verifier(const CircuitBuilder& circuit_constructor)
{
compute_verification_key(circuit_constructor);
StandardVerifier_<Flavor> output_state(verification_key);
Expand All @@ -141,8 +137,7 @@ StandardVerifier_<Flavor> StandardHonkComposerHelper_<Flavor>::create_verifier(
}

template <StandardFlavor Flavor>
StandardProver_<Flavor> StandardHonkComposerHelper_<Flavor>::create_prover(
const CircuitConstructor& circuit_constructor)
StandardProver_<Flavor> StandardComposer_<Flavor>::create_prover(const CircuitBuilder& circuit_constructor)
{
compute_proving_key(circuit_constructor);
compute_witness(circuit_constructor);
Expand All @@ -154,6 +149,6 @@ StandardProver_<Flavor> StandardHonkComposerHelper_<Flavor>::create_prover(
return output_state;
}

template class StandardHonkComposerHelper_<honk::flavor::Standard>;
template class StandardHonkComposerHelper_<honk::flavor::StandardGrumpkin>;
template class StandardComposer_<honk::flavor::Standard>;
template class StandardComposer_<honk::flavor::StandardGrumpkin>;
} // namespace proof_system::honk
Loading