-
Notifications
You must be signed in to change notification settings - Fork 115
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
Conversation
{ | ||
(void)circuit_size; |
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.
Delete
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.
🙏
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.
done
…anscript using poly manifest
… raw pointer for commitment key
08befef
to
d990b38
Compare
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.
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) |
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.
You explained that adding this is necessary to work around an optimization targeting the recursive case.
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.
Yeah this was so I could construct MLEOpeningClaim
s 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(); |
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.
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); |
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.
polynomial ~> Polynomial is you renaming?
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.
Yeah they both alias the same thing, just trying to make it consistent throughout the prover and I prefer Polynomial
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.
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>; |
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.
This should contain the words HONK
and STANDARD
in it somewhere.
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.
Good call, done.
std::vector<Fr> opening_point; | ||
std::vector<MLEOpeningClaim> opening_claims; | ||
std::vector<MLEOpeningClaim> opening_claims_shifted; | ||
std::vector<Polynomial*> multivariate_polynomials; |
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.
This is idiomatic to Gemini -- raw pointers are in use there?
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.
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 |
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.
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) { |
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.
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)); |
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.
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.
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.
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.
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.
OK
{ | ||
(void)circuit_size; |
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.
🙏
@@ -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"); |
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.
Leaving a lot of logging statements in comments. Intended? OK if so.
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.
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.
* 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
* 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
* 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
* 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
No description provided.