-
Notifications
You must be signed in to change notification settings - Fork 234
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(bb): pointer_view to reference-based get_all #3495
Merged
Merged
Changes from all commits
Commits
Show all changes
3 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
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
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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#include "eccvm_prover.hpp" | ||
#include "barretenberg/commitment_schemes/claim.hpp" | ||
#include "barretenberg/commitment_schemes/commitment_key.hpp" | ||
#include "barretenberg/common/ref_array.hpp" | ||
#include "barretenberg/honk/proof_system/lookup_library.hpp" | ||
#include "barretenberg/honk/proof_system/permutation_library.hpp" | ||
#include "barretenberg/honk/proof_system/power_polynomial.hpp" | ||
|
@@ -345,18 +346,16 @@ template <ECCVMFlavor Flavor> void ECCVMProver_<Flavor>::execute_transcript_cons | |
FF batching_challenge = transcript.get_challenge("Translation:batching_challenge"); | ||
|
||
// Collect the polynomials and evaluations to be batched | ||
const size_t NUM_UNIVARIATES = 6; // 5 transcript polynomials plus the constant hack poly | ||
std::array<Polynomial*, NUM_UNIVARIATES> univariate_polynomials = { &key->transcript_op, &key->transcript_Px, | ||
&key->transcript_Py, &key->transcript_z1, | ||
&key->transcript_z2, &hack }; | ||
std::array<FF, NUM_UNIVARIATES> univariate_evaluations; | ||
RefArray univariate_polynomials{ key->transcript_op, key->transcript_Px, key->transcript_Py, | ||
key->transcript_z1, key->transcript_z2, hack }; | ||
std::array<FF, univariate_polynomials.size()> univariate_evaluations; | ||
|
||
// Constuct the batched polynomial and batched evaluation | ||
Polynomial batched_univariate{ key->circuit_size }; | ||
FF batched_evaluation{ 0 }; | ||
auto batching_scalar = FF(1); | ||
for (auto [eval, polynomial] : zip_view(univariate_evaluations, univariate_polynomials)) { | ||
batched_univariate.add_scaled(*polynomial, batching_scalar); | ||
for (auto [polynomial, eval] : zip_view(univariate_polynomials, univariate_evaluations)) { | ||
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. just convention: LHS the assignable variable |
||
batched_univariate.add_scaled(polynomial, batching_scalar); | ||
batched_evaluation += eval * batching_scalar; | ||
batching_scalar *= batching_challenge; | ||
} | ||
|
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
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
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
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
// Macros for defining the flavor classes. | ||
// These are used to derive iterator methods along with the body of a 'flavor' class. | ||
// DEFINE_FLAVOR_MEMBERS lets you define a flavor entity as a collection of individual members, and derive an iterator. | ||
// while DEFINE_COMPOUND_GET_ALL and DEFINE_COMPOUND_POINTER_VIEW let you combine the iterators of substructures or base | ||
// while DEFINE_COMPOUND_GET_ALL lets you combine the iterators of substructures or base | ||
// classes. | ||
|
||
#include "barretenberg/common/ref_vector.hpp" | ||
|
@@ -17,17 +17,6 @@ template <typename... Refs> auto _refs_to_pointer_array(Refs&... refs) | |
return std::array{ &refs... }; | ||
} | ||
|
||
// @deprecated this was less natural than the ref view | ||
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. It's nice that this change is so localized ✅ |
||
#define DEFINE_POINTER_VIEW(...) \ | ||
[[nodiscard]] auto pointer_view() \ | ||
{ \ | ||
return _refs_to_pointer_array(__VA_ARGS__); \ | ||
} \ | ||
[[nodiscard]] auto pointer_view() const \ | ||
{ \ | ||
return _refs_to_pointer_array(__VA_ARGS__); \ | ||
} | ||
|
||
#define DEFINE_REF_VIEW(...) \ | ||
[[nodiscard]] auto get_all() \ | ||
{ \ | ||
|
@@ -47,19 +36,8 @@ template <typename... Refs> auto _refs_to_pointer_array(Refs&... refs) | |
*/ | ||
#define DEFINE_FLAVOR_MEMBERS(DataType, ...) \ | ||
DataType __VA_ARGS__; \ | ||
DEFINE_POINTER_VIEW(__VA_ARGS__) \ | ||
DEFINE_REF_VIEW(__VA_ARGS__) | ||
|
||
#define DEFINE_COMPOUND_POINTER_VIEW(...) \ | ||
[[nodiscard]] auto pointer_view() \ | ||
{ \ | ||
return concatenate(__VA_ARGS__); \ | ||
} \ | ||
[[nodiscard]] auto pointer_view() const \ | ||
{ \ | ||
return concatenate(__VA_ARGS__); \ | ||
} | ||
|
||
#define DEFINE_COMPOUND_GET_ALL(...) \ | ||
[[nodiscard]] auto get_all() \ | ||
{ \ | ||
|
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
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
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
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
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
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
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.
This wasn't actually working before, can't have an initializer list of references for the same reason you can't have a vector of references