Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
ultra_honk.test.hpp
Go to the documentation of this file.
1#pragma once
2
20
21#include <gtest/gtest.h>
22
23namespace bb {
24
26
27template <typename Flavor> class UltraHonkTests : public ::testing::Test {
28 public:
29 using IO = DefaultIO;
34
35 std::vector<uint32_t> add_variables(auto& circuit_builder, std::vector<bb::fr> variables)
36 {
37 std::vector<uint32_t> res;
38 for (auto& variable : variables) {
39 res.emplace_back(circuit_builder.add_variable(variable));
40 }
41 return res;
42 }
43
48
49 void prove_and_verify(typename Flavor::CircuitBuilder& circuit_builder, bool expected_result)
50 {
51 auto prover_instance = std::make_shared<ProverInstance>(circuit_builder);
52 prove_and_verify(prover_instance, expected_result);
53 };
54
56 {
57 auto verification_key = std::make_shared<VerificationKey>(prover_instance->get_precomputed());
58 auto vk_and_hash = std::make_shared<typename Flavor::VKAndHash>(verification_key);
59 Prover prover(prover_instance, verification_key);
60 auto proof = prover.construct_proof();
61 Verifier verifier(vk_and_hash);
62 bool result = verifier.verify_proof(proof).result;
63 EXPECT_EQ(result, expected_result);
64 };
65
66 protected:
68};
69
70} // namespace bb
Manages the data that is propagated on the public inputs of an application/function circuit.
static void add_default(Builder &builder)
Add default IO values to a circuit builder (for native tests)
FixedVKAndHash_< PrecomputedEntities< Commitment >, BF, ECCVMHardcodedVKAndHash > VerificationKey
The verification key stores commitments to the precomputed polynomials used by the verifier.
Contains all the information required by a Honk prover to create a proof, constructed from a finalize...
void set_default_pairing_points_and_ipa_claim_and_proof(typename Flavor::CircuitBuilder &builder)
std::vector< uint32_t > add_variables(auto &circuit_builder, std::vector< bb::fr > variables)
void prove_and_verify(const std::shared_ptr< ProverInstance > &prover_instance, bool expected_result)
typename Flavor::VerificationKey VerificationKey
void prove_and_verify(typename Flavor::CircuitBuilder &circuit_builder, bool expected_result)
static void SetUpTestSuite()
Output verify_proof(const Proof &proof)
Perform ultra verification.
AluTraceBuilder builder
Definition alu.test.cpp:124
bool expected_result
Base class templates shared across Honk flavors.
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
An object storing two EC points that represent the inputs to a pairing check.