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:
18 using MockCircuitProducer = PrivateFunctionExecutionMockCircuitProducer;
21
23
26 std::shared_ptr<VKAndHash> vk_and_hash;
27 };
28
34 static ChonkProverOutput construct_chonk_prover_output(const size_t num_app_circuits = 1)
35 {
36 // Construct and accumulate a series of mocked private function execution circuits
37 MockCircuitProducer circuit_producer{ num_app_circuits };
38 const size_t NUM_CIRCUITS = circuit_producer.total_num_circuits;
39 Chonk ivc{ NUM_CIRCUITS };
40
41 for (size_t idx = 0; idx < NUM_CIRCUITS; ++idx) {
42 circuit_producer.construct_and_accumulate_next_circuit(ivc);
43 }
44
45 return { ivc.prove(), ivc.get_hiding_kernel_vk_and_hash() };
46 }
47};
48
53TEST_F(ChonkRecursionTests, NativeVerification)
54{
55 auto [proof, vk_and_hash] = construct_chonk_prover_output();
56
57 // Confirm that the IVC proof can be natively verified
58 ChonkNativeVerifier verifier(vk_and_hash);
59 EXPECT_TRUE(verifier.verify(proof));
60}
61
67{
68 using ChonkRecVerifierOutput = ChonkVerifier::Output;
69
70 // Generate a genuine Chonk prover output
71 auto [proof, native_vk_and_hash] = construct_chonk_prover_output();
72
73 // Construct the Chonk recursive verifier
75 auto recursive_vk_and_hash = std::make_shared<ChonkVerifier::VKAndHash>(builder, native_vk_and_hash->vk);
76 ChonkVerifier verifier{ recursive_vk_and_hash };
77
78 // Generate the recursive verification circuit
79 StdlibProof stdlib_proof(builder, proof);
80 ChonkRecVerifierOutput output = verifier.verify(stdlib_proof);
81
82 EXPECT_EQ(builder.failed(), false) << builder.err();
83
84 EXPECT_TRUE(CircuitChecker::check(builder));
85
86 // Print the number of gates post finalization
87 info("Recursive Verifier: finalized num gates = ", builder.num_gates());
88}
89} // 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:547
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.
UltraRollupFlavor extends UltraFlavor with IPA proof support.
The recursive counterpart to the "native" UltraRollupFlavor.
Wrapper holding a verification key and its precomputed hash.
Definition flavor.hpp:521
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.
void info(Args... args)
Definition log.hpp:89
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.