Skip to content

Commit

Permalink
feat: Split plonk and honk tests (AztecProtocol/barretenberg#529)
Browse files Browse the repository at this point in the history
Co-authored-by: Rumata888 <isennovskiy@gmail.com>
  • Loading branch information
codygunton and Rumata888 authored Jun 20, 2023
1 parent 41042f1 commit c7dd751
Show file tree
Hide file tree
Showing 25 changed files with 1,780 additions and 1,606 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
#include "barretenberg/common/net.hpp"

const std::string protocol_name = "BARRETENBERG_GRUMPKIN_IPA_CRS";
/* Generates a monomial basis Grumpkin SRS for testing purposes.
We only provide functionality create a single transcript file.
The SRS has the form [1]_1, [x]_1, [x^2]_1, ... where x = 2. */
/**
* @brief Generates a monomial basis Grumpkin SRS.
*
* @details We only provide functionality create a single transcript file.
*
*/
int main(int argc, char** argv)
{
std::vector<std::string> args(argv, argv + argc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ StandardProver_<Flavor> StandardHonkComposerHelper_<Flavor>::create_prover(

return output_state;
}

template class StandardHonkComposerHelper_<honk::flavor::Standard>;
template class StandardHonkComposerHelper_<honk::flavor::StandardGrumpkin>;

} // namespace proof_system::honk
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ template <StandardFlavor Flavor> class StandardHonkComposerHelper_ {
commitment_key = std::make_shared<typename PCSParams::CommitmentKey>(circuit_size, crs_factory_);
};
};

extern template class StandardHonkComposerHelper_<honk::flavor::Standard>;
extern template class StandardHonkComposerHelper_<honk::flavor::StandardGrumpkin>;
// TODO(#532): this pattern is weird; is this not instantiating the templates?
using StandardHonkComposerHelper = StandardHonkComposerHelper_<honk::flavor::Standard>;

using StandardGrumpkinHonkComposerHelper = StandardHonkComposerHelper_<honk::flavor::StandardGrumpkin>;
} // namespace proof_system::honk
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ void UltraHonkComposerHelper_<Flavor>::compute_witness(CircuitConstructor& circu
template <UltraFlavor Flavor>
UltraProver_<Flavor> UltraHonkComposerHelper_<Flavor>::create_prover(CircuitConstructor& circuit_constructor)
{
finalize_circuit(circuit_constructor);
circuit_constructor.add_gates_to_ensure_all_polys_are_non_zero();
circuit_constructor.finalize_circuit();

compute_proving_key(circuit_constructor);
compute_witness(circuit_constructor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ template <UltraFlavor Flavor> class UltraHonkComposerHelper_ {
bool contains_recursive_proof = false;
bool computed_witness = false;

UltraHonkComposerHelper_()
: crs_factory_(barretenberg::srs::get_crs_factory()){};

explicit UltraHonkComposerHelper_(std::shared_ptr<srs::factories::CrsFactory> crs_factory)
: crs_factory_(std::move(crs_factory))
{}
Expand All @@ -51,8 +54,6 @@ template <UltraFlavor Flavor> class UltraHonkComposerHelper_ {
UltraHonkComposerHelper_& operator=(UltraHonkComposerHelper_ const& other) noexcept = default;
~UltraHonkComposerHelper_() = default;

void finalize_circuit(CircuitConstructor& circuit_constructor) { circuit_constructor.finalize_circuit(); };

std::shared_ptr<ProvingKey> compute_proving_key(const CircuitConstructor& circuit_constructor);
std::shared_ptr<VerificationKey> compute_verification_key(const CircuitConstructor& circuit_constructor);

Expand All @@ -70,5 +71,7 @@ template <UltraFlavor Flavor> class UltraHonkComposerHelper_ {
};
extern template class UltraHonkComposerHelper_<honk::flavor::Ultra>;
extern template class UltraHonkComposerHelper_<honk::flavor::UltraGrumpkin>;
// TODO(#532): this pattern is weird; is this not instantiating the templates?
using UltraHonkComposerHelper = UltraHonkComposerHelper_<honk::flavor::Ultra>;
using UltraGrumpkinHonkComposerHelper = UltraHonkComposerHelper_<honk::flavor::UltraGrumpkin>;
} // namespace proof_system::honk
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ template <class Flavor> class StandardHonkComposer_ {
const std::string& err() const { return circuit_constructor.err(); };
void failure(std::string msg) { circuit_constructor.failure(msg); }
};

// TODO(#532): These using declarations instantiate the templates?
using StandardHonkComposer = StandardHonkComposer_<flavor::Standard>;
using StandardGrumpkinHonkComposer = StandardHonkComposer_<flavor::StandardGrumpkin>;
} // namespace proof_system::honk

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ template <class Flavor> class UltraHonkComposer_ {

barretenberg::fr get_variable(const uint32_t index) const { return circuit_constructor.get_variable(index); }

void finalize_circuit() { circuit_constructor.finalize_circuit(); };

UltraProver_<Flavor> create_prover() { return composer_helper.create_prover(circuit_constructor); };
UltraVerifier_<Flavor> create_verifier() { return composer_helper.create_verifier(circuit_constructor); };

Expand Down
Loading

0 comments on commit c7dd751

Please sign in to comment.