Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ template <typename Curve> class ShpleminiProver_ {
std::span<FF> multilinear_challenge,
const std::shared_ptr<CommitmentKey<Curve>>& commitment_key,
const std::shared_ptr<Transcript>& transcript,
const std::array<Polynomial, NUM_LIBRA_EVALUATIONS>& libra_polynomials = {},
const std::array<Polynomial, NUM_SMALL_IPA_EVALUATIONS>& libra_polynomials = {},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this global const is rather a SmallSubgroupIPA constant. I haven't thought the argument would be used elsewehere, so initially called it NUM_LIBRA_EVALUATIONS

const std::vector<Polynomial>& sumcheck_round_univariates = {},
const std::vector<std::array<FF, 3>>& sumcheck_round_evaluations = {},
RefSpan<Polynomial> concatenated_polynomials = {},
Expand Down Expand Up @@ -77,7 +77,7 @@ template <typename Curve> class ShpleminiProver_ {
template <typename Transcript>
static std::vector<OpeningClaim> compute_libra_opening_claims(
const FF gemini_r,
const std::array<Polynomial, NUM_LIBRA_EVALUATIONS>& libra_polynomials,
const std::array<Polynomial, NUM_SMALL_IPA_EVALUATIONS>& libra_polynomials,
const std::shared_ptr<Transcript>& transcript)
{
OpeningClaim new_claim;
Expand All @@ -86,10 +86,10 @@ template <typename Curve> class ShpleminiProver_ {

static constexpr FF subgroup_generator = Curve::subgroup_generator;

std::array<std::string, NUM_LIBRA_EVALUATIONS> libra_eval_labels = {
std::array<std::string, NUM_SMALL_IPA_EVALUATIONS> libra_eval_labels = {
"Libra:concatenation_eval", "Libra:shifted_big_sum_eval", "Libra:big_sum_eval", "Libra:quotient_eval"
};
const std::array<FF, NUM_LIBRA_EVALUATIONS> evaluation_points = {
const std::array<FF, NUM_SMALL_IPA_EVALUATIONS> evaluation_points = {
gemini_r, gemini_r * subgroup_generator, gemini_r, gemini_r
};
for (size_t idx = 0; idx < 4; idx++) {
Expand Down Expand Up @@ -251,7 +251,7 @@ template <typename Curve> class ShpleminiVerifier_ {
const std::vector<Fr> gemini_eval_challenge_powers =
gemini::powers_of_evaluation_challenge(gemini_evaluation_challenge, CONST_PROOF_SIZE_LOG_N);

std::array<Fr, NUM_LIBRA_EVALUATIONS> libra_evaluations;
std::array<Fr, NUM_SMALL_IPA_EVALUATIONS> libra_evaluations;
if (has_zk) {
libra_evaluations[0] = transcript->template receive_from_prover<Fr>("Libra:concatenation_eval");
libra_evaluations[1] = transcript->template receive_from_prover<Fr>("Libra:shifted_big_sum_eval");
Expand Down Expand Up @@ -373,7 +373,7 @@ template <typename Curve> class ShpleminiVerifier_ {
shplonk_batching_challenge,
shplonk_evaluation_challenge);

*consistency_checked = SmallSubgroupIPAVerifier<Curve>::check_evaluations_consistency(
*consistency_checked = SmallSubgroupIPAVerifier<Curve>::check_libra_evaluations_consistency(
libra_evaluations, gemini_evaluation_challenge, multivariate_challenge, libra_univariate_evaluation);
}

Expand Down Expand Up @@ -664,7 +664,7 @@ template <typename Curve> class ShpleminiVerifier_ {
std::vector<Fr>& scalars,
Fr& constant_term_accumulator,
const std::array<Commitment, NUM_LIBRA_COMMITMENTS>& libra_commitments,
const std::array<Fr, NUM_LIBRA_EVALUATIONS>& libra_evaluations,
const std::array<Fr, NUM_SMALL_IPA_EVALUATIONS>& libra_evaluations,
const Fr& gemini_evaluation_challenge,
const Fr& shplonk_batching_challenge,
const Fr& shplonk_evaluation_challenge)
Expand All @@ -682,8 +682,8 @@ template <typename Curve> class ShpleminiVerifier_ {
}

// compute corresponding scalars and the correction to the constant term
std::array<Fr, NUM_LIBRA_EVALUATIONS> denominators;
std::array<Fr, NUM_LIBRA_EVALUATIONS> batching_scalars;
std::array<Fr, NUM_SMALL_IPA_EVALUATIONS> denominators;
std::array<Fr, NUM_SMALL_IPA_EVALUATIONS> batching_scalars;
// compute Shplonk denominators and invert them
denominators[0] = Fr(1) / (shplonk_evaluation_challenge - gemini_evaluation_challenge);
denominators[1] =
Expand All @@ -693,7 +693,7 @@ template <typename Curve> class ShpleminiVerifier_ {

// compute the scalars to be multiplied against the commitments [libra_concatenated], [big_sum], [big_sum], and
// [libra_quotient]
for (size_t idx = 0; idx < NUM_LIBRA_EVALUATIONS; idx++) {
for (size_t idx = 0; idx < NUM_SMALL_IPA_EVALUATIONS; idx++) {
Fr scaling_factor = denominators[idx] * shplonk_challenge_power;
batching_scalars[idx] = -scaling_factor;
shplonk_challenge_power *= shplonk_batching_challenge;
Expand Down Expand Up @@ -763,7 +763,7 @@ template <typename Curve> class ShpleminiVerifier_ {

// Compute the next power of Shplonk batching challenge \nu
Fr shplonk_challenge_power = Fr{ 1 };
for (size_t j = 0; j < CONST_PROOF_SIZE_LOG_N + 2 + NUM_LIBRA_EVALUATIONS; ++j) {
for (size_t j = 0; j < CONST_PROOF_SIZE_LOG_N + 2 + NUM_SMALL_IPA_EVALUATIONS; ++j) {
shplonk_challenge_power *= shplonk_batching_challenge;
}

Expand Down Expand Up @@ -834,4 +834,4 @@ template <typename Curve> class ShpleminiVerifier_ {
}
};
};
} // namespace bb
} // namespace bb
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ TYPED_TEST(ShpleminiTest, ShpleminiZKNoSumcheckOpenings)

// Instantiate SmallSubgroupIPAProver, this prover sends commitments to Big Sum and Quotient polynomials
SmallSubgroupIPAProver<TypeParam> small_subgroup_ipa_prover(
zk_sumcheck_data, const_size_mle_opening_point, claimed_inner_product, prover_transcript, ck);
zk_sumcheck_data, const_size_mle_opening_point, claimed_inner_product, prover_transcript);
small_subgroup_ipa_prover.prove(ck);

// Reduce to KZG or IPA based on the curve used in the test Flavor
const auto opening_claim = ShpleminiProver::prove(this->n,
Expand Down Expand Up @@ -429,7 +430,8 @@ TYPED_TEST(ShpleminiTest, ShpleminiZKWithSumcheckOpenings)

// Instantiate SmallSubgroupIPAProver, this prover sends commitments to Big Sum and Quotient polynomials
SmallSubgroupIPAProver<TypeParam> small_subgroup_ipa_prover(
zk_sumcheck_data, challenge, claimed_inner_product, prover_transcript, ck);
zk_sumcheck_data, challenge, claimed_inner_product, prover_transcript);
small_subgroup_ipa_prover.prove(ck);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense to me to introduce this prove method but I'm curious whether there is logic behind what is passed to the constructor and what is passed to the prove method. E.g. why store a pointer to the transcript but pass in the commitment key directly? Should the class be static with a single method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved ck to the constructor, I guess treating ck and transcript differently does look confusing

In terms of having a single prove method - it would look nicer here, but then I'm using the object to extract witness polys and to pass them to Shplemini. Making prove() return the witness polynomials feels somewhat counter-intuitive


// Reduce proving to a single claimed fed to KZG or IPA
const auto opening_claim = ShpleminiProver::prove(this->n,
Expand Down Expand Up @@ -495,4 +497,4 @@ TYPED_TEST(ShpleminiTest, ShpleminiZKWithSumcheckOpenings)
EXPECT_EQ(this->vk()->pairing_check(pairing_points[0], pairing_points[1]), true);
}
}
} // namespace bb
} // namespace bb
Loading