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.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
13
14namespace bb {
15
22 size_t num_app_circuits, auto& precomputed_vks, const bool large_first_app = true)
23{
24 PrivateFunctionExecutionMockCircuitProducer circuit_producer(num_app_circuits, large_first_app);
25 const size_t NUM_CIRCUITS = circuit_producer.total_num_circuits;
26 TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
27 ClientIVC ivc{ NUM_CIRCUITS, trace_settings };
28
29 BB_ASSERT_EQ(precomputed_vks.size(), NUM_CIRCUITS, "There should be a precomputed VK for each circuit");
30
31 for (size_t circuit_idx = 0; circuit_idx < NUM_CIRCUITS; ++circuit_idx) {
32 MegaCircuitBuilder circuit;
33 {
34 BB_BENCH_NAME("construct_circuits");
35 circuit = circuit_producer.create_next_circuit(ivc);
36 }
37
38 ivc.accumulate(circuit, precomputed_vks[circuit_idx]);
39 }
40 return { ivc.prove(), ivc.get_vk() };
41}
42
44 const bool large_first_app = true)
45{
46 using CircuitProducer = PrivateFunctionExecutionMockCircuitProducer;
47 CircuitProducer circuit_producer(num_app_circuits, large_first_app);
48 const size_t NUM_CIRCUITS = circuit_producer.total_num_circuits;
49 TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
50 ClientIVC ivc{ NUM_CIRCUITS, trace_settings };
51
53 for (size_t j = 0; j < NUM_CIRCUITS; ++j) {
54
55 auto circuit = circuit_producer.create_next_circuit(ivc);
56
57 // Hiding kernel does not use structured trace
58 if (j == NUM_CIRCUITS - 1) {
59 trace_settings = TraceSettings{};
60 }
61 auto vk = CircuitProducer::get_verification_key(circuit, trace_settings);
62 vkeys.push_back(vk);
63 ivc.accumulate(circuit, vk);
64 }
65
66 return vkeys;
67}
68
69} // namespace bb
#define BB_ASSERT_EQ(actual, expected,...)
Definition assert.hpp:88
#define BB_BENCH_NAME(name)
Definition bb_bench.hpp:218
The IVC scheme used by the aztec client for private function execution.
Entry point for Barretenberg command-line interface.
std::pair< SumcheckClientIVC::Proof, SumcheckClientIVC::VerificationKey > accumulate_and_prove_ivc_with_precomputed_vks(size_t num_app_circuits, auto &precomputed_vks, const bool large_first_app=true)
Perform a specified number of circuit accumulation rounds.
std::vector< std::shared_ptr< typename MegaFlavor::VerificationKey > > precompute_vks(const size_t num_app_circuits, const bool large_first_app=true)
VerifierCommitmentKey< Curve > vk
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13