-
Notifications
You must be signed in to change notification settings - Fork 4
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
Chunking RFC #2
Chunking RFC #2
Conversation
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.
Congratulations and kudos @mrmr1993 for submitted our first O(1) Labs official PRD.
Your PRD is a model of completeness, context, benefit, and problems solved. Well done!
|
||
### Technical approach in kimchi | ||
|
||
Support for chunked commitments already exists [in kimchi's supporting polynomial commitment library](https://github.com/o1-labs/proof-systems/blob/ca0b9e53d15e3ab5db6fb8c20617979cbf74215e/poly-commitment/src/srs.rs#L89). This RFC proposes to extend that support through to the kimchi prover, where an attempt to use the feature currently [results in an error](https://github.com/o1-labs/proof-systems/blob/ca0b9e53d15e3ab5db6fb8c20617979cbf74215e/kimchi/src/prover.rs#L170). This RFC also proposes to add support for chunked commitments and evaluations to pickles, where there is currently no support. |
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 feel like we "buried the lede" here, this detail would be very helpful in RFC summary section
0002-chunking.md
Outdated
|
||
Due to the requirement for proof layout homogeneity, the `Pickles.compile` interface should take parameters for the `step_num_chunks` and `wrap_num_chunks` at the toplevel. These arguments may be optional labelled arguments, since they will not be regularly used in the protocol circuits. These arguments will have to be passed explicitly by the user / caller when needed, since it will be prohibitively expensive to try all of the various options programatically on every compile. | ||
|
||
The `Pickles.compile` function should be modified to check for the number of chunks in each inductive rule's previous rule tags. When these are not consistent between inductive rules, the code must throw an error in order to achieve layout homogeneity. |
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.
The `Pickles.compile` function should be modified to check for the number of chunks in each inductive rule's previous rule tags. When these are not consistent between inductive rules, the code must throw an error in order to achieve layout homogeneity. | |
The `Pickles.compile` function must be modified to check for the number of chunks in each inductive rule's previous rule tags. When these numbers are not consistent between inductive rules, the code must throw an error in order to achieve layout homogeneity. |
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.
@mrmr1993 I love this first PRD, congratulations! What do we mean by "these" (these tags? or these numbers?)
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.
These numbers
is correct. The pickles recursion layer needs everything to have the 'same shape', but the 'number of chunks' result in different layouts for the proofs that it consumes. Is there a way to word this that would make that detail clearer?
Co-authored-by: Barrie Byron <[email protected]>
Co-authored-by: Barrie Byron <[email protected]>
Co-authored-by: Barrie Byron <[email protected]>
Co-authored-by: Barrie Byron <[email protected]>
Co-authored-by: Barrie Byron <[email protected]>
* [Add zero-knowledge for chunked proofs](https://github.com/o1-labs/proof-systems/pull/1045) | ||
* [Update bindings to enable chunking](https://github.com/MinaProtocol/mina/pull/13286) | ||
|
||
## Test Plan and Functional Requirements |
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 section needs a little more detail I think -- unit testing what specifically at each layer? Which parts of the system? And then we should sketch out the SnarkyJS test also in a bit more detail, but maybe that entails figuring out the SnarkyJS details first: I suppose something with ZkProgram though?
## Detailed design | ||
[detailed-design]: #detailed-design | ||
|
||
### Theory overview |
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 amazing content, but maybe it's better served as a chapter of the Mina book and linked to from this RFC, so it's more accessible? What do you think?
This is of course not clear from the current template, so we can adjust after we settle this.
domain_size = circuit_size + zk_rows | ||
``` | ||
|
||
### Technical approach in kimchi |
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 part I think is definitely perfect to remain in the RFC
|
||
This proposal optimizes for compatibility with the kimchi and pickles [versions proposed for deployment in the Berkeley hard-fork](https://github.com/MinaProtocol/MIPs/blob/main/MIPS/mip-kimchi.md), as well as the [proposed zkApps feature](https://github.com/MinaProtocol/MIPs/blob/main/MIPS/mip-zkapps.md), at the expense of some potential loss of performance when the feature is in use. Timing measurements can be found in the PR description for the [prototype implementation](https://github.com/o1-labs/proof-systems/pull/1033). | ||
|
||
## Detailed design |
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.
Does this impact anything other than Pickles/Kimchi and SnarkyJS (and the bindings)? Probably not, but just double checking. Maybe worth calling out explicitly? I tried to do that in the RFC I just drafted.
[unresolved-questions]: #unresolved-questions | ||
|
||
* What parts of the design do you expect to resolve through the RFC process before this gets merged? | ||
- SnarkyJS design |
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.
What exactly do we need to expose to the user? The number of chunks? Can't we compute that at circuit compile time? This is important for the SnarkyJS API design
Amazing RFC, @mrmr1993! I was intrigued by this because I love Lagrange polynomials:
I hope I didn't misunderstand the problem statement, but I think I found a way to do polynomial evaluations in O(n). So the problem, as I understood it, is to evaluate over the domain The rough idea to solve it is to use this formula for the Lagrange polynomials: And now split up each Lagrange polynomial in a way that matches the splitting up of where Plugging that into the evaluation formula for you arrive at corresponding formulas for the chunks All the where the right hand side is just the (As an aside, I think the LagrangeBasisEvaluations can be improved to need fewer multiplications and no division.) |
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.
Really nice write-up. Love the detail and the level it was written at. I've asked some questions that occur to me, which may be useful to the reader if answered with some detail.
``` | ||
by the curve point | ||
```text | ||
g_0^{a_0} + g_1^{a_1} + ... + g_n^{a_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.
I really like the way you describe this as what it is.
and | ||
``` | ||
(x - omega^(n-zk_rows+1)) * | ||
(x - omega^(n-zk_rows+2)) |
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.
nit: missing a *
here
``` | ||
(x - omega^(n-zk_rows+1)) * | ||
(x - omega^(n-zk_rows+2)) | ||
(x - omega^(n-1)) |
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.
and here
``` | ||
zk_polynomial(x) * | ||
( aggregation(x) | ||
* (w_0(x) + gamma + x * beta * shift_0) |
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.
It would be helpful (at least to me) to explain what shift
is
|
||
This prevents us from adding the `zk_rows` of randomness to the `aggregation` polynomial, since we cannot create a large enough `zk_polynomial` to mask out the relevant values. | ||
|
||
However, we *can* choose the values at `n-zk_rows+1`, and `n-zk_rows+2` at random. The verifier may still be able to guess the *ratio* `aggregation(x * omega)/aggregation(x)` at every non-randomised point in the domain, but they will have negligible (`~1/2^254`) probability of choosing the *actual value* of `aggregation(x)` for all values between `n-zk_rows+1` and `n-1`. |
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 lost me here. Could you explain what the targeted rows n-zk_rows+1
and n-zk_rows+2
are and why it helps to make them random? How could the verifier guess the ratio? What's the math that works out the negligible (~1/2^254
) probability? Why is it important not to guess only those values between n-zk_rows+1
and n-1
and not all the other rows?
|
||
The permutation argument interacts with the `c` chunks in parallel, so it is | ||
possible to cross-correlate between them to compromise zero knowledge. We know | ||
that there is some `c >= 1` such that `zk_rows = 2*c + k` from the above. Thus, |
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 thought we could not have zk_rows = 2c + k
because it's too big for the d8
domain size?
@mrmr1993 is this PR ready to merge? |
* Adds template for RFCs * Chunking RFC (#2) Added the chunking RFC --------- Co-authored-by: Brandon Kase <[email protected]> Co-authored-by: Matthew Ryan <[email protected]>
Fix MinaProtocol/mina#12880