Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
chonk_verifier.test.cpp
Go to the documentation of this file.
7
9class ChonkRecursionTests : public testing::Test {
10 public:
15 using MockCircuitProducer = PrivateFunctionExecutionMockCircuitProducer;
18
20
23 std::shared_ptr<VKAndHash> vk_and_hash;
24 };
25
31 static ChonkProverOutput construct_chonk_prover_output(const size_t num_app_circuits = 1)
32 {
33 // Construct and accumulate a series of mocked private function execution circuits
34 MockCircuitProducer circuit_producer{ num_app_circuits };
35 const size_t NUM_CIRCUITS = circuit_producer.total_num_circuits;
36 Chonk ivc{ NUM_CIRCUITS };
37
38 for (size_t idx = 0; idx < NUM_CIRCUITS; ++idx) {
39 circuit_producer.construct_and_accumulate_next_circuit(ivc);
40 }
41
42 return { ivc.prove(), ivc.get_hiding_kernel_vk_and_hash() };
43 }
44};
45
50TEST_F(ChonkRecursionTests, NativeVerification)
51{
52 auto [proof, vk_and_hash] = construct_chonk_prover_output();
53
54 // Confirm that the IVC proof can be natively verified
55 ChonkNativeVerifier verifier(vk_and_hash);
56 EXPECT_TRUE(verifier.verify(proof));
57}
58
64{
65 using ChonkRecVerifierOutput = ChonkVerifier::Output;
66
67 // Generate a genuine Chonk prover output
68 auto [proof, native_vk_and_hash] = construct_chonk_prover_output();
69
70 // Construct the Chonk recursive verifier
72 auto recursive_vk_and_hash = std::make_shared<ChonkVerifier::VKAndHash>(builder, native_vk_and_hash->vk);
73 ChonkVerifier verifier{ recursive_vk_and_hash };
74
75 // Generate the recursive verification circuit
76 StdlibProof stdlib_proof(builder, proof);
77 ChonkRecVerifierOutput output = verifier.verify(stdlib_proof);
78
79 EXPECT_EQ(builder.failed(), false) << builder.err();
80
81 EXPECT_TRUE(CircuitChecker::check(builder));
82
83 // Print the number of gates post finalization
84 info("Recursive Verifier: finalized num gates = ", builder.num_gates());
85}
86} // namespace bb::stdlib::recursion::honk
The IVC scheme used by the aztec client for private function execution.
Definition chonk.hpp:38
ChonkProof prove()
Construct Chonk proof, which, if verified, fully establishes the correctness of RCG.
Definition chonk.cpp:554
Verifier for Chonk IVC proofs (both native and recursive).
std::conditional_t< IsRecursive, ReductionResult, bool > Output
Output verify(const Proof &proof)
Verify a Chonk proof.
MegaFlavor::VKAndHash VKAndHash
static bool check(const Builder &circuit)
Check the witness satisifies the circuit.
Wrapper holding a verification key and its precomputed hash.
Definition flavor.hpp:541
PrivateFunctionExecutionMockCircuitProducer MockCircuitProducer
static ChonkProverOutput construct_chonk_prover_output(const size_t num_app_circuits=1)
Construct a genuine Chonk prover output based on accumulation of an arbitrary set of mock circuits.
#define info(...)
Definition log.hpp:93
AluTraceBuilder builder
Definition alu.test.cpp:124
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
TEST_F(BoomerangGoblinRecursiveVerifierTests, graph_description_basic)
Construct and check a goblin recursive verification circuit.
ChonkProof_< true > ChonkStdlibProof
ChonkProof_< false > ChonkProof
ChonkVerifier< true > ChonkRecursiveVerifier
UltraCircuitBuilder_< UltraExecutionTraceBlocks > UltraCircuitBuilder
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
An object storing two EC points that represent the inputs to a pairing check.