-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UltraHonk Composer (Split) (AztecProtocol/barretenberg#339)
* add split UltraHonk composer and checks for consistency with UltraPlonk * adding issue number to some TODOs
- Loading branch information
1 parent
52ae1a5
commit 5979fd4
Showing
9 changed files
with
2,060 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
352 changes: 352 additions & 0 deletions
352
...tenberg/cpp/src/barretenberg/honk/composer/composer_helper/ultra_honk_composer_helper.cpp
Large diffs are not rendered by default.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
...tenberg/cpp/src/barretenberg/honk/composer/composer_helper/ultra_honk_composer_helper.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#pragma once | ||
|
||
#include "barretenberg/proof_system/composer/composer_helper_lib.hpp" | ||
#include "barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp" | ||
#include "barretenberg/srs/reference_string/file_reference_string.hpp" | ||
#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" | ||
#include "barretenberg/honk/proof_system/ultra_prover.hpp" | ||
// #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" | ||
|
||
#include <cstddef> | ||
#include <memory> | ||
#include <utility> | ||
#include <vector> | ||
|
||
namespace proof_system::honk { | ||
// TODO(Kesha): change initializations to specify this parameter | ||
// Cody: What does this mean? | ||
template <typename CircuitConstructor> class UltraHonkComposerHelper { | ||
public: | ||
// TODO(#340)(luke): In the split composers, NUM_RANDOMIZED_GATES has replaced NUM_RESERVED_GATES (in some places) | ||
// to determine the next-power-of-2 circuit size. (There are some places in this composer that still use | ||
// NUM_RESERVED_GATES). Therefore for consistency within this composer itself, and consistency with the original | ||
// Ultra Composer, this value must match that of NUM_RESERVED_GATES. This issue needs to be reconciled | ||
// simultaneously here and in the other split composers. | ||
static constexpr size_t NUM_RANDOMIZED_GATES = 4; // equal to the number of multilinear evaluations leaked | ||
static constexpr size_t program_width = CircuitConstructor::program_width; | ||
std::vector<barretenberg::polynomial> wire_polynomials; | ||
std::shared_ptr<proof_system::plonk::proving_key> circuit_proving_key; | ||
std::shared_ptr<proof_system::plonk::verification_key> circuit_verification_key; | ||
// TODO(#218)(kesha): we need to put this into the commitment key, so that the composer doesn't have to handle srs | ||
// at all | ||
std::shared_ptr<ReferenceStringFactory> crs_factory_; | ||
|
||
std::vector<uint32_t> recursive_proof_public_input_indices; | ||
bool contains_recursive_proof = false; | ||
bool computed_witness = false; | ||
|
||
// This variable controls the amount with which the lookup table and witness values need to be shifted | ||
// above to make room for adding randomness into the permutation and witness polynomials in the plookup widget. | ||
// This must be (num_roots_cut_out_of_the_vanishing_polynomial - 1), since the variable num_roots_cut_out_of_ | ||
// vanishing_polynomial cannot be trivially fetched here, I am directly setting this to 4 - 1 = 3. | ||
static constexpr size_t s_randomness = 3; | ||
|
||
explicit UltraHonkComposerHelper(std::shared_ptr<ReferenceStringFactory> crs_factory) | ||
: crs_factory_(std::move(crs_factory)) | ||
{} | ||
|
||
UltraHonkComposerHelper(std::shared_ptr<plonk::proving_key> p_key, std::shared_ptr<plonk::verification_key> v_key) | ||
: circuit_proving_key(std::move(p_key)) | ||
, circuit_verification_key(std::move(v_key)) | ||
{} | ||
|
||
UltraHonkComposerHelper(UltraHonkComposerHelper&& other) noexcept = default; | ||
UltraHonkComposerHelper(UltraHonkComposerHelper const& other) noexcept = default; | ||
UltraHonkComposerHelper& operator=(UltraHonkComposerHelper&& other) noexcept = default; | ||
UltraHonkComposerHelper& operator=(UltraHonkComposerHelper const& other) noexcept = default; | ||
~UltraHonkComposerHelper() = default; | ||
|
||
void finalize_circuit(CircuitConstructor& circuit_constructor) { circuit_constructor.finalize_circuit(); }; | ||
|
||
std::shared_ptr<plonk::proving_key> compute_proving_key(const CircuitConstructor& circuit_constructor); | ||
// std::shared_ptr<plonk::verification_key> compute_verification_key(const CircuitConstructor& circuit_constructor); | ||
|
||
void compute_witness(CircuitConstructor& circuit_constructor); | ||
|
||
UltraProver create_prover(CircuitConstructor& circuit_constructor); | ||
// UltraVerifier create_verifier(const CircuitConstructor& circuit_constructor); | ||
|
||
void add_table_column_selector_poly_to_proving_key(polynomial& small, const std::string& tag); | ||
}; | ||
|
||
} // namespace proof_system::honk |
Oops, something went wrong.