-
Notifications
You must be signed in to change notification settings - Fork 322
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
refactor: Move remaining data out of Honk UltraComposer #4848
Changes from 19 commits
0944a30
d4f49c9
a673bd2
dc8f5ea
5404cac
8eeea85
0d90615
1b50996
654411b
92d9107
8393fa2
c4810d2
aefafae
4def8a0
5541381
696a6af
21c98c1
657c971
561e28f
2984b27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
set -eu | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Simple script that's useful for running tests locally. Will delete in a future PR. |
||
|
||
# Move above script dir. | ||
cd $(dirname $0)/.. | ||
|
||
cmake --preset clang16 | ||
cmake --build --preset clang16 | ||
|
||
cd build/ | ||
|
||
./bin/flavor_tests | ||
./bin/relations_tests | ||
./bin/transcript_tests | ||
./bin/commitment_schemes_tests | ||
./bin/sumcheck_tests | ||
./bin/eccvm_tests | ||
./bin/translator_vm_tests | ||
./bin/protogalaxy_tests | ||
./bin/ultra_honk_tests | ||
./bin/goblin_tests | ||
./bin/client_ivc_tests | ||
./bin/stdlib_recursion_tests |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,10 +39,9 @@ template <> | |
inline std::shared_ptr<VerifierCommitmentKey<curve::BN254>> CreateVerifierCommitmentKey< | ||
VerifierCommitmentKey<curve::BN254>>() | ||
{ | ||
constexpr size_t n = 4096; | ||
std::shared_ptr<bb::srs::factories::CrsFactory<curve::BN254>> crs_factory( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a point to this line anymore? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, idk why the compiler didn't complain. |
||
new bb::srs::factories::FileCrsFactory<curve::BN254>("../srs_db/ignition", 4096)); | ||
return std::make_shared<VerifierCommitmentKey<curve::BN254>>(n, crs_factory); | ||
return std::make_shared<VerifierCommitmentKey<curve::BN254>>(); | ||
} | ||
// For IPA | ||
template <> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,7 @@ | |
#include "barretenberg/numeric/bitop/pow.hpp" | ||
#include "barretenberg/polynomials/polynomial.hpp" | ||
#include "barretenberg/polynomials/polynomial_arithmetic.hpp" | ||
#include "barretenberg/srs/factories/crs_factory.hpp" | ||
#include "barretenberg/srs/factories/file_crs_factory.hpp" | ||
#include "barretenberg/srs/global_crs.hpp" | ||
|
||
#include <cstddef> | ||
#include <memory> | ||
|
@@ -35,19 +34,13 @@ template <> class VerifierCommitmentKey<curve::BN254> { | |
using Commitment = typename Curve::AffineElement; | ||
|
||
public: | ||
VerifierCommitmentKey() = delete; | ||
std::shared_ptr<bb::srs::factories::VerifierCrs<Curve>> srs; | ||
|
||
/** | ||
* @brief Construct a new Kate Verification Key object from existing SRS | ||
* | ||
* @param num_points | ||
* @param srs verifier G2 point | ||
*/ | ||
VerifierCommitmentKey( | ||
[[maybe_unused]] size_t num_points, // TODO(https://github.com/AztecProtocol/barretenberg/issues/874) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR doesn't resolve all of 874. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. leave it as a TODO then? |
||
std::shared_ptr<bb::srs::factories::CrsFactory<Curve>> crs_factory) | ||
: srs(crs_factory->get_verifier_crs()) | ||
{} | ||
VerifierCommitmentKey() | ||
{ | ||
srs::init_crs_factory("../srs_db/ignition"); | ||
srs = srs::get_crs_factory<Curve>()->get_verifier_crs(); | ||
}; | ||
|
||
/** | ||
* @brief verifies a pairing equation over 2 points using the verifier SRS | ||
|
@@ -65,8 +58,6 @@ template <> class VerifierCommitmentKey<curve::BN254> { | |
|
||
return (result == Curve::TargetField::one()); | ||
} | ||
|
||
std::shared_ptr<bb::srs::factories::VerifierCrs<Curve>> srs; | ||
}; | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,7 @@ | |
#include "barretenberg/polynomials/univariate.hpp" | ||
#include "barretenberg/proof_system/types/circuit_type.hpp" | ||
#include <array> | ||
#include <barretenberg/srs/global_crs.hpp> | ||
#include <concepts> | ||
#include <vector> | ||
|
||
|
@@ -142,20 +143,25 @@ class ProvingKey_ : public PrecomputedPolynomials, public WitnessPolynomials { | |
* | ||
* @tparam PrecomputedEntities An instance of PrecomputedEntities_ with affine_element data type and handle type. | ||
*/ | ||
template <typename PrecomputedCommitments> class VerificationKey_ : public PrecomputedCommitments { | ||
template <typename PrecomputedCommitments, typename VerifierCommitmentKey> | ||
class VerificationKey_ : public PrecomputedCommitments { | ||
public: | ||
std::shared_ptr<VerifierCommitmentKey> pcs_verification_key; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Core change |
||
|
||
VerificationKey_() = default; | ||
VerificationKey_(const size_t circuit_size, const size_t num_public_inputs) | ||
{ | ||
this->circuit_size = circuit_size; | ||
this->log_circuit_size = numeric::get_msb(circuit_size); | ||
this->num_public_inputs = num_public_inputs; | ||
}; | ||
|
||
template <typename ProvingKeyPtr> VerificationKey_(const ProvingKeyPtr& proving_key) | ||
{ | ||
this->circuit_size = proving_key->circuit_size; | ||
this->log_circuit_size = numeric::get_msb(this->circuit_size); | ||
this->num_public_inputs = proving_key->num_public_inputs; | ||
this->pcs_verification_key = std::make_shared<VerifierCommitmentKey>(); | ||
|
||
for (auto [polynomial, commitment] : zip_view(proving_key->get_precomputed_polynomials(), this->get_all())) { | ||
commitment = proving_key->commitment_key->commit(polynomial); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ namespace bb { | |
template <typename Flavor> class DeciderVerifier_ { | ||
using FF = typename Flavor::FF; | ||
using Commitment = typename Flavor::Commitment; | ||
using CommitmentKey = typename Flavor::CommitmentKey; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems useless? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed |
||
using VerificationKey = typename Flavor::VerificationKey; | ||
using VerifierCommitmentKey = typename Flavor::VerifierCommitmentKey; | ||
using Transcript = typename Flavor::Transcript; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,8 @@ | |
namespace bb { | ||
template <class ProverInstances_> struct ProtogalaxyProofConstructionState { | ||
using FF = typename ProverInstances_::FF; | ||
using Instance = typename ProverInstances_::Instance; | ||
using ProverInstance = typename ProverInstances_::Instance; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why keep both ProverInstance and Instance? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trying to keep foot print small esp since all of this is going to get updated, but changed, it was easy. |
||
using Instance = ProverInstance; | ||
|
||
std::shared_ptr<Instance> accumulator; | ||
Polynomial<FF> perturbator; | ||
|
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.
Did this so that when we run CI first we run the less complex tests first, so if we segfault or fail an assertion we can see the failure farther upstream.