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 {
45 IO::add_default(builder);
46 auto prover_instance = std::make_shared<ProverInstance>(builder);
47 return VerificationKey{ prover_instance->get_precomputed() };
48 }
49
50 protected:
52};
54
60{
61 using Flavor = typename TypeParam::Flavor;
63
64 VerificationKey vk(TestFixture::create_vk());
65
66 // First method of hashing: using hash().
67 fr vk_hash_1 = vk.hash();
68
69 // Second method of hashing: using hash_with_origin_tagging.
70 typename Flavor::Transcript transcript;
71 fr vk_hash_2 = vk.hash_with_origin_tagging(transcript);
72 EXPECT_EQ(vk_hash_1, vk_hash_2);
73}
74
84{
85 using Flavor = typename TypeParam::Flavor;
87
88 VerificationKey vk(TestFixture::create_vk());
89 EXPECT_EQ(vk.to_field_elements().size(), VerificationKey::calc_num_data_types());
90}
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:135
static size_t calc_num_data_types()
Calculate the number of field elements needed for serialization.
Definition flavor.hpp:200
Contains all the information required by a Honk prover to create a proof, constructed from a finalize...
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