Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
flavor_serialization.test.cpp
Go to the documentation of this file.
15
16#include <gtest/gtest.h>
17
18using namespace bb;
19
20template <typename Flavor> class FlavorSerializationTests : public ::testing::Test {
21 public:
25
26 protected:
28};
29
30#ifdef STARKNET_GARAGA_FLAVORS
31using FlavorTypes = testing::Types<UltraFlavor, UltraKeccakFlavor, UltraStarknetFlavor, MegaFlavor>;
32#else
33using FlavorTypes = testing::Types<UltraFlavor, UltraKeccakFlavor, MegaFlavor>;
34#endif
36
37// Test msgpack serialization/deserialization of verification keys
38TYPED_TEST(FlavorSerializationTests, VerificationKeySerialization)
39{
40 using Builder = typename TestFixture::Builder;
41 using DeciderProvingKey = typename TestFixture::DeciderProvingKey;
42 using VerificationKey = typename TestFixture::VerificationKey;
43
45
46 // Add some arbitrary arithmetic gates that utilize public inputs
48
51 VerificationKey original_vkey{ proving_key->get_precomputed() };
52
53 // Serialize and deserialize the verification key
54 std::vector<uint8_t> vkey_buffer = to_buffer(original_vkey);
55 VerificationKey deserialized_vkey = from_buffer<VerificationKey>(vkey_buffer);
56
57 // Ensure the original is equal to the reconstructed
58 EXPECT_EQ(original_vkey, deserialized_vkey);
59}
typename Flavor::CircuitBuilder Builder
typename Flavor::VerificationKey VerificationKey
A DeciderProvingKey is normally constructed from a finalized circuit and it contains all the informat...
The verification key is responsible for storing the commitments to the precomputed (non-witness) poly...
MegaCircuitBuilder CircuitBuilder
static void add_arithmetic_gates_with_public_inputs(Builder &builder, const size_t num_gates=4)
Add a specified number of arithmetic gates (with public inputs) to the provided circuit.
AluTraceBuilder builder
Definition alu.test.cpp:123
UltraKeccakFlavor::VerificationKey VerificationKey
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.
TYPED_TEST_SUITE(ShpleminiTest, TestSettings)
TYPED_TEST(ShpleminiTest, CorrectnessOfMultivariateClaimBatching)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::vector< uint8_t > to_buffer(T const &value)
static void add_default_to_public_inputs(Builder &builder)
Adds default public inputs to the builder.