Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bbapi_chonk.test.cpp
Go to the documentation of this file.
8#include <gtest/gtest.h>
9
10namespace bb::bbapi {
11
12class BBApiChonkTest : public ::testing::Test {
13 protected:
15};
16
17TEST_F(BBApiChonkTest, StandaloneVerificationKeySerialization)
18{
20
22 .oracle_hash_type = "poseidon2",
23 .disable_zk = true };
24
25 // Compute standalone VK using ChonkComputeStandaloneVk
26 auto vk_response =
27 ChonkComputeStandaloneVk{ .circuit = { .name = "test_circuit", .bytecode = bytecode } }.execute();
28
29 // Create a VK from the field elements
30 auto vk =
31 std::make_shared<MegaFlavor::VerificationKey>(from_buffer<MegaFlavor::VerificationKey>(vk_response.bytes));
32 EXPECT_EQ(vk->to_field_elements(), vk_response.fields)
33 << "Serialized field elements should match original field elements";
34}
35
36TEST_F(BBApiChonkTest, ChonkVkSerialization)
37{
39 auto vk_response = ChonkComputeIvcVk{ .circuit = { .name = "test_circuit", .bytecode = bytecode } }.execute();
40
41 // Create a VK from the field elements
42 Chonk::VerificationKey vk = from_buffer<Chonk::VerificationKey>(vk_response.bytes);
43 EXPECT_EQ(to_buffer(vk.to_field_elements()), vk_response.bytes)
44 << "Serialized field elements should match original field elements";
45}
46
47} // namespace bb::bbapi
std::shared_ptr< Napi::ThreadSafeFunction > bytecode
Chonk-specific command definitions for the Barretenberg RPC API.
std::pair< std::vector< uint8_t >, std::vector< uint8_t > > create_simple_circuit_bytecode(size_t num_constraints=1)
Helper function to create a minimal circuit bytecode and witness for testing.
TEST_F(BBApiChonkTest, StandaloneVerificationKeySerialization)
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
VerifierCommitmentKey< Curve > vk
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::vector< uint8_t > to_buffer(T const &value)
Compute IVC verification key for the complete proof.
Compute standalone verification key for a circuit.
std::string name
Human-readable name for the circuit.
bool ipa_accumulation
Optional flag to indicate if the proof should be generated with IPA accumulation (i....