Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bbapi_client_ivc.test.cpp
Go to the documentation of this file.
8#include <gtest/gtest.h>
9
10namespace bb::bbapi {
11
12class BBApiClientIvcTest : public ::testing::Test {
13 protected:
15};
16
17TEST_F(BBApiClientIvcTest, StandaloneVerificationKeySerialization)
18{
19 auto [bytecode, witness] = acir_bincode_mocks::create_simple_circuit_bytecode();
20
22 .oracle_hash_type = "poseidon2",
23 .disable_zk = true };
24
25 // Compute standalone VK using ClientIvcComputeStandaloneVk
26 auto vk_response =
27 ClientIvcComputeStandaloneVk{ .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(BBApiClientIvcTest, ClientIvcVkSerialization)
37{
38 auto [bytecode, _witness] = acir_bincode_mocks::create_simple_circuit_bytecode();
39 auto vk_response = ClientIvcComputeIvcVk{ .circuit = { .name = "test_circuit", .bytecode = bytecode } }.execute();
40
41 // Create a VK from the field elements
42 ClientIVC::VerificationKey vk = from_buffer<ClientIVC::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
ClientIVC-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(BBApiClientIvcTest, 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)
std::string name
Human-readable name for the circuit.
Compute IVC verification key for the complete proof.
Compute standalone verification key for a circuit.
bool ipa_accumulation
Optional flag to indicate if the proof should be generated with IPA accumulation (i....