Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
native_verification_key.test.cpp
Go to the documentation of this file.
8
9#include <gtest/gtest.h>
10
11using namespace bb;
12
13// Test parameters: <Flavor, IO>
14template <typename Flavor_, typename IO_> struct VKTestParams {
15 using Flavor = Flavor_;
16 using IO = IO_;
17};
18
19#ifdef STARKNET_GARAGA_FLAVORS
20using TestTypes =
21 testing::Types<VKTestParams<UltraFlavor, stdlib::recursion::honk::DefaultIO<UltraCircuitBuilder>>,
26#else
27using TestTypes =
28 testing::Types<VKTestParams<UltraFlavor, stdlib::recursion::honk::DefaultIO<UltraCircuitBuilder>>,
32#endif
33
34template <typename Params> class NativeVerificationKeyTests : public ::testing::Test {
35 public:
36 using Flavor = typename Params::Flavor;
37 using IO = typename Params::IO;
40
42 {
43 if constexpr (IsUltraOrMegaHonk<Flavor>) {
46 IO::add_default(builder);
47 auto prover_instance = std::make_shared<ProverInstance>(builder);
48 return VerificationKey{ prover_instance->get_precomputed() };
49 } else {
50 return VerificationKey();
51 }
52 }
53
54 protected:
56};
58
64{
65 using Flavor = typename TypeParam::Flavor;
67
68 VerificationKey vk(TestFixture::create_vk());
69
70 // First method of hashing: using hash().
71 fr vk_hash_1 = vk.hash();
72
73 // Second method of hashing: using hash_with_origin_tagging.
74 typename Flavor::Transcript transcript;
75 fr vk_hash_2 = vk.hash_with_origin_tagging(transcript);
76 EXPECT_EQ(vk_hash_1, vk_hash_2);
77}
78
88{
89 using Flavor = typename TypeParam::Flavor;
91
92 VerificationKey vk(TestFixture::create_vk());
93 EXPECT_EQ(vk.to_field_elements().size(), VerificationKey::calc_num_data_types());
94}
typename Flavor::CircuitBuilder Builder
typename Flavor::VerificationKey VerificationKey
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
ECCVMCircuitBuilder CircuitBuilder
FixedVKAndHash_< PrecomputedEntities< Commitment >, BF, ECCVMHardcodedVKAndHash > VerificationKey
The verification key stores commitments to the precomputed polynomials used by the verifier.
Base Native verification key class.
Definition flavor.hpp:172
static size_t calc_num_data_types()
Calculate the number of field elements needed for serialization.
Definition flavor.hpp:240
A ProverInstance is normally constructed from a finalized circuit and it contains all the information...
AluTraceBuilder builder
Definition alu.test.cpp:124
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
TYPED_TEST_SUITE(CommitmentKeyTest, Curves)
TYPED_TEST(CommitmentKeyTest, CommitToZeroPoly)
VerifierCommitmentKey< Curve > vk
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
testing::Types< VKTestParams< UltraFlavor, stdlib::recursion::honk::DefaultIO< UltraCircuitBuilder > >, VKTestParams< UltraFlavor, stdlib::recursion::honk::RollupIO >, VKTestParams< UltraKeccakFlavor, stdlib::recursion::honk::DefaultIO< UltraCircuitBuilder > >, VKTestParams< MegaFlavor, stdlib::recursion::honk::DefaultIO< MegaCircuitBuilder > > > TestTypes