Repository navigation
fix: deprecate witness circuit size from ECCVM and Translator #13133
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
Changes from all commits
6ff41b8
25c2e87
9b326b5
d0443aa
d9b8ebe
7db86f8
5abfc56
802ef24
acd65b4
b980d74
06c81d1
dd37060
490b01d
3db0793
fc71919
c4add4c
11e9aca
96cbc7a
0fe86e6
a204c86
1793920
a0f2680
aa5013a
af87667
9e6a4f7
7cc720e
22a6382
4e5aca7
42c0a72
df84f40
871ede4
3f9bd79
f12fb6c
3d1875b
a9c087e
cab4caf
fb8f9aa
99ef9fa
9540a98
7c65f6d
5910962
d48a7ed
5bb7edb
a456656
8f66df7
419ee09
95b63bb
14de7c9
da39e15
16addf3
936a368
282278b
65a8031
610c8a7
0c63fac
ab33d8c
e65b01c
eee29cb
c920c38
bf92ab6
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 |
|---|---|---|
|
|
@@ -180,7 +180,7 @@ template <typename Curve> class ShpleminiProver_ { | |
| * | ||
| */ | ||
|
|
||
| template <typename Curve> class ShpleminiVerifier_ { | ||
| template <typename Curve, bool use_padding> class ShpleminiVerifier_ { | ||
|
Contributor
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. Maybe reconsider if this needs to be template. If it does, just FYI you can also default it
Contributor
Author
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. thanks! yeah, I'm leaning towards separating verifier methods into the one that uses padding and the one which does not, cause the inputs are going to be of different types + no need to mix the logic |
||
| using Fr = typename Curve::ScalarField; | ||
| using GroupElement = typename Curve::Element; | ||
| using Commitment = typename Curve::AffineElement; | ||
|
|
@@ -192,7 +192,7 @@ template <typename Curve> class ShpleminiVerifier_ { | |
| public: | ||
| template <typename Transcript> | ||
| static BatchOpeningClaim<Curve> compute_batch_opening_claim( | ||
| const Fr N, | ||
| const size_t log_n, | ||
|
Contributor
Author
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.
|
||
| ClaimBatcher& claim_batcher, | ||
| const std::vector<Fr>& multivariate_challenge, | ||
| const Commitment& g1_identity, | ||
|
|
@@ -209,14 +209,6 @@ template <typename Curve> class ShpleminiVerifier_ { | |
| { | ||
| const bool committed_sumcheck = !sumcheck_round_evaluations.empty(); | ||
|
|
||
| // Extract log_n | ||
| size_t log_n{ 0 }; | ||
| if constexpr (Curve::is_stdlib_type) { | ||
| log_n = numeric::get_msb(static_cast<uint32_t>(N.get_value())); | ||
| } else { | ||
| log_n = numeric::get_msb(static_cast<uint32_t>(N)); | ||
| } | ||
|
|
||
| // When padding is enabled, the size of the multilinear challenge may be bigger than the log of `circuit_size`. | ||
| const size_t virtual_log_n = multivariate_challenge.size(); | ||
|
|
||
|
|
@@ -345,12 +337,12 @@ template <typename Curve> class ShpleminiVerifier_ { | |
| // Reconstruct Aᵢ(r²ⁱ) for i=0, ..., d - 1 from the batched evaluation of the multilinear polynomials and | ||
| // Aᵢ(−r²ⁱ) for i = 0, ..., d - 1. In the case of interleaving, we compute A₀(r) as A₀₊(r) + P₊(r^s). | ||
| const std::vector<Fr> gemini_fold_pos_evaluations = | ||
| GeminiVerifier_<Curve>::compute_fold_pos_evaluations(log_n, | ||
| batched_evaluation, | ||
| multivariate_challenge, | ||
| gemini_eval_challenge_powers, | ||
| gemini_fold_neg_evaluations, | ||
| p_neg); | ||
| GeminiVerifier_<Curve>::template compute_fold_pos_evaluations<use_padding>(log_n, | ||
| batched_evaluation, | ||
| multivariate_challenge, | ||
| gemini_eval_challenge_powers, | ||
| gemini_fold_neg_evaluations, | ||
| p_neg); | ||
|
|
||
| // Place the commitments to Gemini fold polynomials Aᵢ in the vector of batch_mul commitments, compute the | ||
| // contributions from Aᵢ(−r²ⁱ) for i=1, … , d − 1 to the constant term accumulator, add corresponding scalars | ||
|
|
@@ -464,7 +456,7 @@ template <typename Curve> class ShpleminiVerifier_ { | |
| std::vector<Fr>& scalars, | ||
| Fr& constant_term_accumulator) | ||
| { | ||
| const size_t virtual_log_n = gemini_neg_evaluations.size(); | ||
| const size_t virtual_log_n = use_padding ? gemini_neg_evaluations.size() : log_n; | ||
|
Contributor
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. By the use in this function it doesn't look like use_padding needs to be a constexpr. it could be a defaulted param of this function. |
||
| // TODO(https://github.com/AztecProtocol/barretenberg/issues/1159): Decouple constants from primitives. | ||
| // Start from 1, because the commitment to A_0 is reconstructed from the commitments to the multilinear | ||
| // polynomials. The corresponding evaluations are also handled separately. | ||
|
|
@@ -484,17 +476,19 @@ template <typename Curve> class ShpleminiVerifier_ { | |
| constant_term_accumulator += | ||
| scaling_factor_neg * gemini_neg_evaluations[j] + scaling_factor_pos * gemini_pos_evaluations[j]; | ||
|
|
||
| if constexpr (Curve::is_stdlib_type) { | ||
| auto builder = gemini_neg_evaluations[0].get_context(); | ||
| // TODO(https://github.com/AztecProtocol/barretenberg/issues/1114): insecure! | ||
| stdlib::bool_t dummy_round = stdlib::witness_t(builder, j >= log_n); | ||
| Fr zero = Fr(0); | ||
| scaling_factor_neg = Fr::conditional_assign(dummy_round, zero, scaling_factor_neg); | ||
| scaling_factor_pos = Fr::conditional_assign(dummy_round, zero, scaling_factor_pos); | ||
| } else { | ||
| if (j >= log_n) { | ||
| scaling_factor_neg = 0; | ||
| scaling_factor_pos = 0; | ||
| if constexpr (use_padding) { | ||
|
Contributor
Author
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. as above - avoid redundant padding |
||
| if constexpr (Curve::is_stdlib_type) { | ||
| auto builder = gemini_neg_evaluations[0].get_context(); | ||
| // TODO(https://github.com/AztecProtocol/barretenberg/issues/1114): insecure! | ||
| stdlib::bool_t dummy_round = stdlib::witness_t(builder, j >= log_n); | ||
| Fr zero = Fr(0); | ||
| scaling_factor_neg = Fr::conditional_assign(dummy_round, zero, scaling_factor_neg); | ||
| scaling_factor_pos = Fr::conditional_assign(dummy_round, zero, scaling_factor_pos); | ||
| } else { | ||
| if (j >= log_n) { | ||
| scaling_factor_neg = 0; | ||
| scaling_factor_pos = 0; | ||
| } | ||
| } | ||
| } | ||
| // Place the scaling factor to the 'scalars' vector | ||
|
|
||
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.
avoid padding logic in Translator and ECCVM (native and recursive)