From d9e411aa75cca5975aa8542e748342310b6668bd Mon Sep 17 00:00:00 2001 From: "e.tatuzova" Date: Thu, 4 Jan 2024 12:02:05 +0400 Subject: [PATCH 1/2] Q computation updated #263 --- .../nil/crypto3/zk/snark/systems/plonk/placeholder/prover.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nil/crypto3/zk/snark/systems/plonk/placeholder/prover.hpp b/include/nil/crypto3/zk/snark/systems/plonk/placeholder/prover.hpp index 907b40d1f..6d1ff0bee 100644 --- a/include/nil/crypto3/zk/snark/systems/plonk/placeholder/prover.hpp +++ b/include/nil/crypto3/zk/snark/systems/plonk/placeholder/prover.hpp @@ -245,7 +245,7 @@ namespace nil { PROFILE_PLACEHOLDER_SCOPE("split_polynomial_dfs_conversion_time"); std::size_t split_polynomial_size = std::max( - (preprocessed_public_data.identity_polynomials.size() + 1) * (preprocessed_public_data.common_data.rows_amount -1 ), + (preprocessed_public_data.identity_polynomials.size() + 2) * (preprocessed_public_data.common_data.rows_amount -1 ), (constraint_system.lookup_poly_degree_bound() + 1) * (preprocessed_public_data.common_data.rows_amount -1 )//, ); split_polynomial_size = std::max( @@ -386,7 +386,7 @@ namespace nil { if(_is_lookup_enabled){ _commitment_scheme.append_eval_point(LOOKUP_BATCH, _proof.eval_proof.challenge); _commitment_scheme.append_eval_point(LOOKUP_BATCH, _proof.eval_proof.challenge * _omega); - _commitment_scheme.append_eval_point(LOOKUP_BATCH, _proof.eval_proof.challenge * + _commitment_scheme.append_eval_point(LOOKUP_BATCH, _proof.eval_proof.challenge * _omega.pow(preprocessed_public_data.common_data.usable_rows_amount)); } From 0d28bdfd5b325b5f20e2f2fa4a60e67b49d2ac99 Mon Sep 17 00:00:00 2001 From: "e.tatuzova" Date: Thu, 4 Jan 2024 14:34:07 +0400 Subject: [PATCH 2/2] Mini fri fix expand_factor=0#263 --- .../detail/polynomial/basic_fri.hpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/include/nil/crypto3/zk/commitments/detail/polynomial/basic_fri.hpp b/include/nil/crypto3/zk/commitments/detail/polynomial/basic_fri.hpp index 63ec1195c..5d2fde902 100644 --- a/include/nil/crypto3/zk/commitments/detail/polynomial/basic_fri.hpp +++ b/include/nil/crypto3/zk/commitments/detail/polynomial/basic_fri.hpp @@ -103,7 +103,7 @@ namespace nil { using polynomial_type = math::polynomial; struct params_type { - + using field_type = FieldType; using merkle_tree_type = containers::merkle_tree; using merkle_proof_type = typename containers::merkle_proof; @@ -143,7 +143,7 @@ namespace nil { const std::size_t max_degree; const std::vector>> D; - + // The total number of FRI-rounds, the sum of 'step_list'. const std::size_t r; const std::vector step_list; @@ -584,7 +584,7 @@ namespace nil { return correct_order_idx; } - + template, FRI>::value, bool>::type = true> - static typename FRI::proof_type proof_eval( + static typename FRI::proof_type proof_eval( const std::map> &g, const PolynomialType combined_Q, const std::map &precommitments, @@ -604,7 +604,7 @@ namespace nil { typename FRI::transcript_type &transcript ) { typename FRI::proof_type proof; - + BOOST_ASSERT(check_step_list(fri_params)); // TODO: add necessary checks //BOOST_ASSERT(check_initial_precommitment(precommitments, fri_params)); @@ -682,9 +682,11 @@ namespace nil { ) { for (const auto &[key, poly_vector]: g) { for (const auto& poly: poly_vector) { - // All the polynomials have the same size, so we have no bugs here. if (poly.size() != fri_params.D[0]->size()) { - g_coeffs[key].emplace_back(poly.coefficients()); + g_coeffs[key].emplace_back(poly.coefficients()); + } else { + // These polynomials won't be used + g_coeffs[key].emplace_back(math::polynomial()); } } } @@ -819,7 +821,7 @@ namespace nil { BOOST_ASSERT(combined_U.size() == denominators.size()); std::size_t evals_num = combined_U.size(); // TODO: Add size correcness checks. - + if (proof.final_polynomial.degree() > std::pow(2, std::log2(fri_params.max_degree + 1) - fri_params.r + 1) - 1) { return false;