barretenberg
Loading...
Searching...
No Matches
eccvm_composer.hpp
1#pragma once
2
3#include "barretenberg/eccvm/eccvm_prover.hpp"
4#include "barretenberg/eccvm/eccvm_verifier.hpp"
5#include "barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp"
6#include "barretenberg/proof_system/composer/composer_lib.hpp"
7#include "barretenberg/srs/factories/file_crs_factory.hpp"
8#include "barretenberg/srs/global_crs.hpp"
9
10namespace proof_system::honk {
11template <ECCVMFlavor Flavor> class ECCVMComposer_ {
12 public:
13 using FF = typename Flavor::FF;
15 using ProvingKey = typename Flavor::ProvingKey;
16 using VerificationKey = typename Flavor::VerificationKey;
17 using PCS = typename Flavor::PCS;
18 using CommitmentKey = typename Flavor::CommitmentKey;
19 using VerifierCommitmentKey = typename Flavor::VerifierCommitmentKey;
20 using Transcript = typename Flavor::Transcript;
21
22 static constexpr std::string_view NAME_STRING = "ECCVM";
23 static constexpr size_t NUM_RESERVED_GATES = 0; // equal to the number of multilinear evaluations leaked
24 static constexpr size_t NUM_WIRES = CircuitConstructor::NUM_WIRES;
25 std::shared_ptr<ProvingKey> proving_key;
26 std::shared_ptr<VerificationKey> verification_key;
27
28 // The crs_factory holds the path to the srs and exposes methods to extract the srs elements
29 std::shared_ptr<barretenberg::srs::factories::CrsFactory<typename Flavor::Curve>> crs_factory_;
30
31 // The commitment key is passed to the prover but also used herein to compute the verfication key commitments
32 std::shared_ptr<CommitmentKey> commitment_key;
33
34 std::vector<uint32_t> recursive_proof_public_input_indices;
35 bool contains_recursive_proof = false;
36 bool computed_witness = false;
38 requires(std::same_as<Flavor, honk::flavor::ECCVM>)
39 {
40 crs_factory_ = barretenberg::srs::get_grumpkin_crs_factory();
41 };
42
43 explicit ECCVMComposer_(
45 : crs_factory_(std::move(crs_factory))
46 {}
47
48 ECCVMComposer_(std::shared_ptr<ProvingKey> p_key, std::shared_ptr<VerificationKey> v_key)
49 : proving_key(std::move(p_key))
50 , verification_key(std::move(v_key))
51 {}
52
53 ECCVMComposer_(ECCVMComposer_&& other) noexcept = default;
54 ECCVMComposer_(ECCVMComposer_ const& other) noexcept = default;
55 ECCVMComposer_& operator=(ECCVMComposer_&& other) noexcept = default;
56 ECCVMComposer_& operator=(ECCVMComposer_ const& other) noexcept = default;
57 ~ECCVMComposer_() = default;
58
59 std::shared_ptr<ProvingKey> compute_proving_key(CircuitConstructor& circuit_constructor);
60 std::shared_ptr<VerificationKey> compute_verification_key(CircuitConstructor& circuit_constructor);
61
62 void compute_witness(CircuitConstructor& circuit_constructor);
63
64 ECCVMProver_<Flavor> create_prover(CircuitConstructor& circuit_constructor,
65 const std::shared_ptr<Transcript>& transcript = std::make_shared<Transcript>());
67 CircuitConstructor& circuit_constructor,
68 const std::shared_ptr<Transcript>& transcript = std::make_shared<Transcript>());
69
70 void add_table_column_selector_poly_to_proving_key(barretenberg::polynomial& small, const std::string& tag);
71
72 void compute_commitment_key(size_t circuit_size)
73 {
74 commitment_key = std::make_shared<CommitmentKey>(circuit_size, crs_factory_);
75 };
76};
77extern template class ECCVMComposer_<honk::flavor::ECCVM>;
78
79// TODO(#532): this pattern is weird; is this not instantiating the templates?
81
82} // namespace proof_system::honk
Definition: crs_factory.hpp:72
Definition: eccvm_circuit_builder.hpp:17
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
Definition: transcript.hpp:62
Definition: eccvm_composer.hpp:11
std::shared_ptr< VerificationKey > compute_verification_key(CircuitConstructor &circuit_constructor)
Definition: eccvm_composer.cpp:101
ECCVMVerifier_< Flavor > create_verifier(CircuitConstructor &circuit_constructor, const std::shared_ptr< Transcript > &transcript=std::make_shared< Transcript >())
Definition: eccvm_composer.cpp:49
void compute_witness(CircuitConstructor &circuit_constructor)
Compute witness polynomials.
Definition: eccvm_composer.cpp:11
Definition: eccvm_prover.hpp:15
Definition: eccvm_verifier.hpp:7
The proving key is responsible for storing the polynomials used by the prover.
Definition: goblin_translator.hpp:902
VerificationKey_< PrecomputedEntities< Commitment > > VerificationKey
The verification key is responsible for storing the the commitments to the precomputed (non-witnessk)...
Definition: goblin_translator.hpp:941
CommitmentKey object over a pairing group 𝔾₁.
Definition: commitment_key.hpp:35
Definition: verification_key.hpp:25
Definition: kzg.hpp:14
Defines particular circuit builder types expected to be used for circuit construction in stdlib and c...
Definition: claim.hpp:6