Skip to content
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

Lde/gemini shplonk in prover #67

Merged
merged 14 commits into from
Jan 19, 2023
Merged

Conversation

ledwards2225
Copy link
Collaborator

No description provided.

{
(void)circuit_size;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Delete

Copy link
Collaborator

Choose a reason for hiding this comment

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

🙏

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@ledwards2225 ledwards2225 force-pushed the lde/gemini_shplonk_in_prover branch from 08befef to d990b38 Compare January 19, 2023 19:51
Copy link
Collaborator

@codygunton codygunton left a comment

Choose a reason for hiding this comment

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

Looks good, mostly just asking questions in the comments.

@@ -127,6 +127,11 @@ template <typename Params> struct MLEOpeningClaim {
using Commitment = typename Params::Commitment;
using Fr = typename Params::Fr;

MLEOpeningClaim(auto commitment, auto evaluation)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You explained that adding this is necessary to work around an optimization targeting the recursive case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah this was so I could construct MLEOpeningClaims in place with emplace_back in the prover. Need a constructor for that and there was previously no need for one.

@@ -23,19 +24,20 @@ namespace {
constexpr std::string_view kzg_srs_path = "../srs_db/ignition";
}

template <class CK> inline CK* CreateCommitmentKey();
template <class CK> inline std::shared_ptr<CK> CreateCommitmentKey();
Copy link
Collaborator

Choose a reason for hiding this comment

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

IOU on what the right data structure is here, but we should just use this for now.

@@ -157,7 +162,7 @@ template <typename settings> void Prover<settings>::compute_grand_product_polyno

// Construct permutation polynomial 'z_perm' in lagrange form as:
// z_perm = [1 numererator_accum[0][0] numererator_accum[0][1] ... numererator_accum[0][n-2]]
polynomial z_perm(proving_key->n, proving_key->n);
Polynomial z_perm(proving_key->n, proving_key->n);
Copy link
Collaborator

Choose a reason for hiding this comment

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

polynomial ~> Polynomial is you renaming?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah they both alias the same thing, just trying to make it consistent throughout the prover and I prefer Polynomial

Copy link
Collaborator

Choose a reason for hiding this comment

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

Aha, thanks

@@ -280,7 +285,7 @@ template <typename settings> void Prover<settings>::execute_relation_check_round
{
// queue.flush_queue(); // NOTE: Don't remove; we may reinstate the queue

using Multivariates = sumcheck::Multivariates<barretenberg::fr, waffle::STANDARD_HONK_MANIFEST_SIZE>;
using Multivariates = sumcheck::Multivariates<Fr, waffle::TOTAL_NUM_POLYNOMIALS>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should contain the words HONK and STANDARD in it somewhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call, done.

std::vector<Fr> opening_point;
std::vector<MLEOpeningClaim> opening_claims;
std::vector<MLEOpeningClaim> opening_claims_shifted;
std::vector<Polynomial*> multivariate_polynomials;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is idiomatic to Gemini -- raw pointers are in use there?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, just matching what's done in Gemini. Should probably change in the future

for (size_t round_idx = 0; round_idx < proving_key->log_n; round_idx++) {
transcript.add_element("a_" + std::to_string(round_idx), barretenberg::fr(round_idx + 1000).to_buffer());
}
// TODO(luke): This functionality is performed within Gemini::reduce_prove(), called in the previous round. In the
Copy link
Collaborator

Choose a reason for hiding this comment

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

Right, we discussed this a week or two ago.

@@ -98,8 +108,10 @@ template <class FF_, size_t num_polys> class Multivariates {
}

explicit Multivariates(transcript::StandardTranscript transcript)
: multivariate_n(
static_cast<size_t>(transcript.get_field_element("circuit_size").from_montgomery_form().data[0]))
: multivariate_n([](std::vector<uint8_t> buffer) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is ugly, but it was done in a hurry by me, and I think it's fine for now.


auto transcript = Transcript(transcript::Manifest(manifest_rounds));
// Mock prover-transcript interactions prior to Sumcheck
auto transcript = Transcript(StandardHonk::create_unrolled_manifest(0, multivariate_d));
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was a little unsure of this (test more likely to break if it depends on external stuff), but I did this too and I think it's fine for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I actually think this is the right thing to do. If we change Sumcheck-related Manifest entries, we must change Sumcheck accordingly. If this test is using some fake Manifest, we then also have to go in and fix that. But this is a Sumcheck test, not a fake Manifest test.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK

{
(void)circuit_size;
Copy link
Collaborator

Choose a reason for hiding this comment

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

🙏

@@ -150,6 +164,10 @@ void Transcript::apply_fiat_shamir(const std::string& challenge_name /*, const b
// TODO(Cody): Coupling: this line insists that the challenges in the manifest
// are encountered in the order that matches the order of the proof construction functions.
// Future architecture should specify this data in a single place (?).
// info("apply_fiat_shamir: challenge name match");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Leaving a lot of logging statements in comments. Intended? OK if so.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I wasn't planning on leaving them in the final PR but I'd actually like to while were in major debugging mode. I wind up putting these statements in every branch for debugging anyway.

@ledwards2225 ledwards2225 marked this pull request as ready for review January 19, 2023 21:31
@codygunton codygunton merged commit 72fd093 into master Jan 19, 2023
@codygunton codygunton deleted the lde/gemini_shplonk_in_prover branch January 19, 2023 22:09
dbanks12 pushed a commit that referenced this pull request Jan 26, 2023
* update multivariates constructor to handle shifts and add evals to transcript using poly manifest
* computing claims in prover; still using mock commitments for non witness polynomials
* calling gemini reduce prove in prover; all tests passing; still using raw pointer for commitment key
* Updating PCS to use shared pointer instead of raw pointer for commitment key
* Codys sumcheck round size fix
* fixing multivariates constructor
* gemini, shplonk, and kzg all running in prover
dbanks12 pushed a commit that referenced this pull request Jan 27, 2023
* update multivariates constructor to handle shifts and add evals to transcript using poly manifest
* computing claims in prover; still using mock commitments for non witness polynomials
* calling gemini reduce prove in prover; all tests passing; still using raw pointer for commitment key
* Updating PCS to use shared pointer instead of raw pointer for commitment key
* Codys sumcheck round size fix
* fixing multivariates constructor
* gemini, shplonk, and kzg all running in prover
ludamad pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Jul 22, 2023
* update multivariates constructor to handle shifts and add evals to transcript using poly manifest
* computing claims in prover; still using mock commitments for non witness polynomials
* calling gemini reduce prove in prover; all tests passing; still using raw pointer for commitment key
* Updating PCS to use shared pointer instead of raw pointer for commitment key
* Codys sumcheck round size fix
* fixing multivariates constructor
* gemini, shplonk, and kzg all running in prover
ludamad pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Jul 24, 2023
* update multivariates constructor to handle shifts and add evals to transcript using poly manifest
* computing claims in prover; still using mock commitments for non witness polynomials
* calling gemini reduce prove in prover; all tests passing; still using raw pointer for commitment key
* Updating PCS to use shared pointer instead of raw pointer for commitment key
* Codys sumcheck round size fix
* fixing multivariates constructor
* gemini, shplonk, and kzg all running in prover
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants