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
21
22#include <gtest/gtest.h>
23
24namespace bb {
25
27
28template <typename Flavor> class UltraHonkTests : public ::testing::Test {
29 public:
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
52
53 void prove_and_verify(typename Flavor::CircuitBuilder& circuit_builder, bool expected_result)
54 {
55 auto prover_instance = std::make_shared<ProverInstance>(circuit_builder);
56 prove_and_verify(prover_instance, expected_result);
57 };
58
60 {
61 auto verification_key = std::make_shared<VerificationKey>(prover_instance->get_precomputed());
62 Prover prover(prover_instance, verification_key);
63 auto proof = prover.construct_proof();
64 if constexpr (HasIPAAccumulator<Flavor>) {
65 VerifierCommitmentKey<curve::Grumpkin> ipa_verification_key(1 << CONST_ECCVM_LOG_N);
66 Verifier verifier(verification_key, ipa_verification_key);
67 bool result = verifier.template verify_proof<RollupIO>(proof, prover_instance->ipa_proof).result;
68 EXPECT_EQ(result, expected_result);
69 } else {
70 Verifier verifier(verification_key);
71 bool result = verifier.template verify_proof<DefaultIO>(proof).result;
72 EXPECT_EQ(result, expected_result);
73 }
74 };
75
76 protected:
78};
79
80} // namespace bb
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
A ProverInstance is normally constructed from a finalized circuit and it contains all the information...
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 set_default_pairing_points_and_ipa_claim_and_proof(UltraCircuitBuilder &builder)
void prove_and_verify(typename Flavor::CircuitBuilder &circuit_builder, bool expected_result)
static void SetUpTestSuite()
Representation of the Grumpkin Verifier Commitment Key inside a bn254 circuit.
static void add_default(Builder &builder)
Add default public inputs when they are not present.
static void add_default(Builder &builder)
Add default public inputs when they are not present.
AluTraceBuilder builder
Definition alu.test.cpp:124
bool expected_result
Base class templates for structures that contain data parameterized by the fundamental polynomials of...
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.