barretenberg
Loading...
Searching...
No Matches
acir_composer.hpp
1#pragma once
2#include <barretenberg/dsl/acir_format/acir_format.hpp>
3#include <barretenberg/goblin/goblin.hpp>
4#include <barretenberg/proof_system/op_queue/ecc_op_queue.hpp>
5
6namespace acir_proofs {
7
15 public:
16 AcirComposer(size_t size_hint = 0, bool verbose = true);
17
18 template <typename Builder = UltraCircuitBuilder> void create_circuit(acir_format::acir_format& constraint_system);
19
20 std::shared_ptr<proof_system::plonk::proving_key> init_proving_key(acir_format::acir_format& constraint_system);
21
22 std::vector<uint8_t> create_proof(acir_format::acir_format& constraint_system,
23 acir_format::WitnessVector& witness,
24 bool is_recursive);
25
26 void load_verification_key(proof_system::plonk::verification_key_data&& data);
27
28 std::shared_ptr<proof_system::plonk::verification_key> init_verification_key();
29
30 bool verify_proof(std::vector<uint8_t> const& proof, bool is_recursive);
31
32 std::string get_solidity_verifier();
33 size_t get_exact_circuit_size() { return exact_circuit_size_; };
34 size_t get_total_circuit_size() { return total_circuit_size_; };
35 size_t get_circuit_subgroup_size() { return circuit_subgroup_size_; };
36
37 std::vector<barretenberg::fr> serialize_proof_into_fields(std::vector<uint8_t> const& proof,
38 size_t num_inner_public_inputs);
39
40 std::vector<barretenberg::fr> serialize_verification_key_into_fields();
41
42 // Goblin specific methods
43 void create_goblin_circuit(acir_format::acir_format& constraint_system, acir_format::WitnessVector& witness);
44 std::vector<uint8_t> create_goblin_proof();
45 bool verify_goblin_proof(std::vector<uint8_t> const& proof);
46
47 private:
48 acir_format::Builder builder_;
49 acir_format::GoblinBuilder goblin_builder_;
50 Goblin goblin;
51 size_t size_hint_;
52 size_t exact_circuit_size_;
53 size_t total_circuit_size_;
54 size_t circuit_subgroup_size_;
55 std::shared_ptr<proof_system::plonk::proving_key> proving_key_;
56 std::shared_ptr<proof_system::plonk::verification_key> verification_key_;
57 bool verbose_ = true;
58
59 template <typename... Args> inline void vinfo(Args... args)
60 {
61 if (verbose_) {
62 info(args...);
63 }
64 }
65};
66
67} // namespace acir_proofs
A class responsible for marshalling construction of keys and prover and verifier instances used to pr...
Definition: acir_composer.hpp:14
std::vector< barretenberg::fr > serialize_proof_into_fields(std::vector< uint8_t > const &proof, size_t num_inner_public_inputs)
Takes in a proof buffer and converts into a vector of field elements. The Recursion opcode requires t...
Definition: acir_composer.cpp:175
std::vector< barretenberg::fr > serialize_verification_key_into_fields()
Takes in a verification key buffer and converts into a vector of field elements. The Recursion opcode...
Definition: acir_composer.cpp:192
Definition: goblin.hpp:15
Definition: goblin_ultra_circuit_builder.hpp:16
Definition: ultra_circuit_builder.hpp:31
Definition: acir_format.hpp:21
Definition: verification_key.hpp:14