Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bbapi_ultra_honk.test.cpp
Go to the documentation of this file.
7#include <gtest/gtest.h>
8
9namespace bb::bbapi {
10
11class BBApiUltraHonkTest : public ::testing::Test {
12 protected:
14};
16{
17 auto [bytecode, witness] = acir_bincode_mocks::create_simple_circuit_bytecode();
18
19 // Test different combinations of settings
20 const std::vector<bbapi::ProofSystemSettings> test_settings = {
21 // ipa_accumulation = true (other values don't matter)
22 { .ipa_accumulation = true, .oracle_hash_type = "poseidon2", .disable_zk = false },
23 // ipa_accumulation = false cases (test both disable_zk values)
24 { .ipa_accumulation = false, .oracle_hash_type = "poseidon2", .disable_zk = false },
25 { .ipa_accumulation = false, .oracle_hash_type = "poseidon2", .disable_zk = true },
26 { .ipa_accumulation = false, .oracle_hash_type = "keccak", .disable_zk = false },
27 { .ipa_accumulation = false, .oracle_hash_type = "keccak", .disable_zk = true }
28 };
29
30 for (const bbapi::ProofSystemSettings& settings : test_settings) {
31 // Compute VK
32 auto vk_response =
33 CircuitComputeVk{ .circuit = { .name = "test_circuit", .bytecode = bytecode }, .settings = settings }
34 .execute();
35
36 // First prove
37 auto prove_response = CircuitProve{ .circuit = { .name = "test_circuit",
38 .bytecode = bytecode,
39 .verification_key = vk_response.bytes },
40 .witness = witness,
41 .settings = settings }
42 .execute();
43
44 // Verify the proof
45 auto verify_response = CircuitVerify{ .verification_key = vk_response.bytes,
46 .public_inputs = prove_response.public_inputs,
47 .proof = prove_response.proof,
48 .settings = settings }
49 .execute();
50
51 EXPECT_TRUE(verify_response.verified)
52 << "Failed with ipa_accumulation=" << settings.ipa_accumulation
53 << ", oracle_hash_type=" << settings.oracle_hash_type << ", disable_zk=" << settings.disable_zk;
54 }
55}
56
57} // namespace bb::bbapi
UltraHonk-specific command definitions for the Barretenberg RPC API.
std::pair< std::vector< uint8_t >, std::vector< uint8_t > > create_simple_circuit_bytecode()
Helper function to create a minimal circuit bytecode and witness for testing.
TEST_F(BBApiUltraHonkTest, CircuitProve)
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::string name
Human-readable name for the circuit.
std::string name
Human-readable name for the circuit.
Represents a request to generate a proof. Currently, UltraHonk is the only proving system supported b...
Verify a proof against a verification key and public inputs.
std::vector< uint8_t > verification_key