Skip to content

Commit

Permalink
pcs test working but something to investigate
Browse files Browse the repository at this point in the history
  • Loading branch information
ledwards2225 committed Jan 17, 2025
1 parent 259f586 commit 58b2217
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ template <typename Curve> class GeminiProver_ {
using Polynomial = bb::Polynomial<Fr>;
using Claim = ProverOpeningClaim<Curve>;

public:
struct PolynomialSet {
RefSpan<Polynomial> polynomials;
Polynomial batched;
Expand Down Expand Up @@ -129,7 +130,6 @@ template <typename Curve> class GeminiProver_ {
}
};

public:
static std::vector<Polynomial> compute_fold_polynomials(const size_t log_n,
std::span<const Fr> multilinear_challenge,
const Polynomial& A_0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ TYPED_TEST(ShpleminiTest, CorrectnessOfGeminiClaimBatching)
{
using Curve = TypeParam::Curve;
using GeminiProver = GeminiProver_<Curve>;
using PolynomialSet = GeminiProver::PolynomialSet;
using ShpleminiVerifier = ShpleminiVerifier_<Curve>;
using ShplonkVerifier = ShplonkVerifier_<Curve>;
using Fr = typename Curve::ScalarField;
Expand All @@ -153,22 +154,24 @@ TYPED_TEST(ShpleminiTest, CorrectnessOfGeminiClaimBatching)
// Collect multilinear evaluations
std::vector<Fr> rhos = gemini::powers_of_rho(rho, this->num_polynomials + this->num_shiftable);

Polynomial batched_unshifted(this->n);
Polynomial batched_to_be_shifted = Polynomial::shiftable(this->n);
// WORKTODO: investigate why using getter directly does not work in emplace_back calls below
RefVector<Polynomial> f_polynomials{ pcs_instance_witness.unshifted_polynomials };
RefVector<Polynomial> g_polynomials{ pcs_instance_witness.to_be_shifted_polynomials };

size_t idx = 0;
for (auto& poly : pcs_instance_witness.unshifted_polynomials) {
batched_unshifted.add_scaled(poly, rhos[idx]);
idx++;
}
std::vector<PolynomialSet> polynomial_sets;
polynomial_sets.emplace_back(f_polynomials);
polynomial_sets.emplace_back(g_polynomials,
/*get_form_to_open=*/&Polynomial::shifted);

for (auto& poly : pcs_instance_witness.to_be_shifted_polynomials) {
batched_to_be_shifted.add_scaled(poly, rhos[idx]);
idx++;
Fr rho_power{ 1 };
for (auto& poly_set : polynomial_sets) {
poly_set.compute_batched(rho, rho_power);
}

Polynomial batched = batched_unshifted;
batched += batched_to_be_shifted;
Polynomial batched(this->n);
for (auto& poly_set : polynomial_sets) {
batched += poly_set.get_batched_in_opening_form();
}

// Compute:
// - (d+1) opening pairs: {r, \hat{a}_0}, {-r^{2^i}, a_i}, i = 0, ..., d-1
Expand All @@ -182,7 +185,7 @@ TYPED_TEST(ShpleminiTest, CorrectnessOfGeminiClaimBatching)
}

auto [A_0_pos, A_0_neg] = GeminiProver::compute_partially_evaluated_batch_polynomials(
this->log_n, std::move(batched_unshifted), std::move(batched_to_be_shifted), gemini_eval_challenge);
this->log_n, std::move(polynomial_sets), gemini_eval_challenge);

const auto opening_claims = GeminiProver::construct_univariate_opening_claims(
this->log_n, std::move(A_0_pos), std::move(A_0_neg), std::move(fold_polynomials), gemini_eval_challenge);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ template <typename Curve> struct InstanceWitnessGenerator {
std::vector<Fr> unshifted_evals;
std::vector<Fr> shifted_evals;

RefSpan<Polynomial> get_unshifted_polynomials() { return RefVector(unshifted_polynomials); }
RefSpan<Polynomial> get_to_be_shifted_polynomials() { return RefVector(to_be_shifted_polynomials); }

InstanceWitnessGenerator(const size_t n,
const size_t num_polynomials,
const size_t num_shiftable,
Expand Down

0 comments on commit 58b2217

Please sign in to comment.