-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UltraHonk Composer (Split) #339
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, yes, but it is very weird that his is not raising a warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll just remove this, I think it was added by Cody by mistake