Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
test_bench_shared.hpp
Go to the documentation of this file.
7
8namespace bb {
9
11 PrivateFunctionExecutionMockCircuitProducer& circuit_producer, auto& precomputed_vks)
12{
13 const size_t NUM_CIRCUITS = circuit_producer.total_num_circuits;
14 Chonk ivc{ NUM_CIRCUITS };
15
16 BB_ASSERT_EQ(precomputed_vks.size(), NUM_CIRCUITS, "There should be a precomputed VK for each circuit");
17
18 for (size_t circuit_idx = 0; circuit_idx < NUM_CIRCUITS; ++circuit_idx) {
19 MegaCircuitBuilder circuit;
20 {
21 BB_BENCH_NAME("construct_circuits");
22 circuit = circuit_producer.create_next_circuit(ivc);
23 }
24
25 ivc.accumulate(circuit, precomputed_vks[circuit_idx]);
26 }
27 return { ivc.prove(), ivc.get_hiding_kernel_vk_and_hash() };
28}
29
36 size_t num_app_circuits, auto& precomputed_vks, const bool large_first_app = true)
37{
38 PrivateFunctionExecutionMockCircuitProducer circuit_producer(num_app_circuits, large_first_app);
39 return accumulate_and_prove_with_precomputed_vks(circuit_producer, precomputed_vks);
40}
41
43 std::vector<bool> leading_is_kernel_flags, auto& precomputed_vks, const bool large_first_app = false)
44{
45 PrivateFunctionExecutionMockCircuitProducer circuit_producer(std::move(leading_is_kernel_flags), large_first_app);
46 return accumulate_and_prove_with_precomputed_vks(circuit_producer, precomputed_vks);
47}
48
50 PrivateFunctionExecutionMockCircuitProducer& circuit_producer)
51{
52 const size_t NUM_CIRCUITS = circuit_producer.total_num_circuits;
53 Chonk ivc{ NUM_CIRCUITS };
54
56 for (size_t j = 0; j < NUM_CIRCUITS; ++j) {
57
58 auto circuit = circuit_producer.create_next_circuit(ivc);
59 const bool is_hiding_kernel = (j == NUM_CIRCUITS - 1);
60 auto vk = PrivateFunctionExecutionMockCircuitProducer::get_verification_key(circuit, is_hiding_kernel);
61 vkeys.push_back(vk);
62 ivc.accumulate(circuit, vk);
63 }
64
65 return vkeys;
66}
67
69 const bool large_first_app = true)
70{
71 PrivateFunctionExecutionMockCircuitProducer circuit_producer(num_app_circuits, large_first_app);
72 return precompute_vks(circuit_producer);
73}
74
76 std::vector<bool> leading_is_kernel_flags, const bool large_first_app = false)
77{
78 PrivateFunctionExecutionMockCircuitProducer circuit_producer(std::move(leading_is_kernel_flags), large_first_app);
79 return precompute_vks(circuit_producer);
80}
81
82} // namespace bb
#define BB_ASSERT_EQ(actual, expected,...)
Definition assert.hpp:83
#define BB_BENCH_NAME(name)
Definition bb_bench.hpp:264
The IVC scheme used by the aztec client for private function execution.
Definition chonk.hpp:39
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
std::pair< ChonkProof, std::shared_ptr< MegaZKFlavor::VKAndHash > > accumulate_and_prove_with_precomputed_vks(PrivateFunctionExecutionMockCircuitProducer &circuit_producer, auto &precomputed_vks)
std::vector< std::shared_ptr< typename MegaFlavor::VerificationKey > > precompute_vks(PrivateFunctionExecutionMockCircuitProducer &circuit_producer)
VerifierCommitmentKey< Curve > vk
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13