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.
9
10#include <gtest/gtest.h>
11
12using namespace bb;
13
14#ifdef STARKNET_GARAGA_FLAVORS
15using FlavorTypes = testing::Types<UltraFlavor, UltraKeccakFlavor, UltraRollupFlavor, UltraStarknetFlavor, MegaFlavor>;
16#else
17using FlavorTypes = testing::Types<UltraFlavor, UltraKeccakFlavor, UltraRollupFlavor, MegaFlavor>;
18#endif
19
20template <typename Flavor> class NativeVerificationKeyTests : public ::testing::Test {
21 public:
24
26 {
27 if constexpr (IsUltraOrMegaHonk<Flavor>) {
30 if constexpr (HasIPAAccumulator<Flavor>) {
32 } else {
34 }
35 auto prover_instance = std::make_shared<ProverInstance>(builder);
36 return VerificationKey{ prover_instance->get_precomputed() };
37 } else {
38 return VerificationKey();
39 }
40 }
41
42 protected:
44};
46
52{
53 using Flavor = TypeParam;
55
56 VerificationKey vk(TestFixture::create_vk());
57
58 // First method of hashing: using hash().
59 fr vk_hash_1 = vk.hash();
60
61 // Second method of hashing: using hash_with_origin_tagging.
62 typename Flavor::Transcript transcript;
63 fr vk_hash_2 = vk.hash_with_origin_tagging(transcript);
64 EXPECT_EQ(vk_hash_1, vk_hash_2);
65}
66
76{
77 using Flavor = TypeParam;
79
80 VerificationKey vk(TestFixture::create_vk());
81 EXPECT_EQ(vk.to_field_elements().size(), VerificationKey::calc_num_data_types());
82}
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...
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
testing::Types< MegaFlavor, UltraFlavor, UltraZKFlavor, UltraRollupFlavor > FlavorTypes
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