-
Notifications
You must be signed in to change notification settings - Fork 189
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
Zero Knowledge Fold for Nova IVC from HyperNova #330
Conversation
@microsoft-github-policy-service agree company="University of Pennsylvania" |
Hi @jkwoods this is great! thanks! I'll take a deeper look at the PR. There's however something important missing: the commitments need to be hiding (e.g., they must include a blind at the time of commitment). Otherwise, we won't get the desired hiding property from this transformation. |
@srinathsetty Oh, of course, my bad. I'll get right on that. I assume the blinds also need to be optional/"toggleable". |
Sounds good! I think it will likely be easier to make blindfolding the default.
On Oct 3, 2024, at 4:17 PM, Jess Woods ***@***.***> wrote:
@srinathsetty<https://github.com/srinathsetty> Oh, of course, my bad. I'll get right on that. I assume the blinds also need to be optional/"toggleable".
—
Reply to this email directly, view it on GitHub<#330 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADSBJRXTHFCRBR5YDRQS3DDZZXGBJAVCNFSM6AAAAABPIDAGT2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJSGQ4TMNJZG4>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@srinathsetty It seems straightforward to me to add blinds to the Pedersen commitments, and keep track of how they are folded in the NIFS. But I am a little lost on what happens once the folding is done and we want to compress the IVC proof with a non zero knowledge SNARK. I assume we don't want use have blinded commitments in the spartan SNARK (or the IPA). So is there a point (after the folding in of the random/ZK layer in the IVC?) where we "de-blind" the commitments the Relaxed R1CS instance (by revealing |
^ Above code adds the blinding into the (Pedersen) commitments. On the commitment level, even though Pedersen Note the Pedersen Two things still to deal with:
|
^ In the above code, randomness is added to the hashing (in circuit and in the clear for the verifier). It is not perfectly clear to me why we add this randomness (so it may need to be calculated in a different way if I have misunderstood); @srinathsetty could you remind me why this is important? Also, I believe all this is finished now (except for the I believe this PR, when it is done, fixes #174. |
The random values are added inside a hash to make them simulataable. We can see this invoked in appendix D here: https://eprint.iacr.org/2021/370.pdf
When you run the test, it will tell you the expected value, we can just copy the value test failure prints. This should make the test pass.
|
Thanks @jkwoods for the PR! I left some comments. |
Hi @jkwoods thanks for the new updates! It looks great! I think we are almost near the finish line. I only had some minor comments, which I noted. |
An implementation of the zero-knowledge fold from Appendix D.4 of the HyperNova paper.
Changes "from the bottom up":
src/r1cs/mod.rs
:fold_relaxed()
methods forRelaxedR1CSInstance
andRelaxedR1CSWitness
(Previously, we were only able tofold()
RelaxedR1CSInstances/Witnesses with regular non-relaxed R1CSInstance/Witnesses. Since the random layer is a Relaxed instance, we need to be able to fold two RelaxedR1CSInstances/Witnesses together.)commit_T_relaxed()
method. Again, the same ascommit_T()
, but for two RelaxedR1CSInstances/Witnesses. Takes error terms into account.sample_random_instance_witness()
method to sample a random RelaxedR1CSInstance/Witness pair. UsesOsRng
for now. Based on Construction 5 from Appendix D in the HyperNova paper.sample_random_instance_witness()
src/nifs.rs
:prove_relaxed()
andverify_relaxed()
that are similar to theirprove()
andverify()
counterparts, except for two RelaxedR1CSInstances/Witnesses. They used thefold_relaxed()
andcommit_T_relaxed()
methods fromsrc/r1cs/mod.rs
. They use a new constant,NUM_FE_FOR_RO_RELAXED
, created insrc/constants.rs
, since we have to absorb more into the random oracle.src/lib.rs
:For
RecursiveSNARK
:randomizing_fold()
method. This is likeprove_step()
except instead of proving a new F iteration, it folds in a random layer. It returns a newRandomLayerRecursive
struct with information about the random fold, rather than modifying theRecursiveSNARK
struct.randomizing_fold()
is public right now (for completeness), but shouldn’t be used if the user wants to compress their snark, as callingCompressedSNARK
’sprove_randomizing()
will callrandomizing_fold()
itself. If there is a better way to make this tension less confusing, let me know.verify_randomizing()
method. This method exists for completeness, but probably wouldn't ever be used, as the randomizing layer is the last IVC fold, and will therefore be verified by theCompressedSNARK
verifier.For
CompressedSNARK
:CompressedSNARK
struct as a new optionalRandomLayerCompressed
field. This holds information about the last random fold.prove_randomizing()
method. the oldprove()
method is renamed to beprove_regular()
and we make a newprove()
function that automatically selects the correct prove (regular or randomizing), based on a boolean switch. This boolean switch is the only change that would need to be made to existing code that calls the Nova library. However, if such a change would cause issues, I could restructure this code to be randomizing or not based on a rust feature flag (or something else).verify_randomizing()
method. Similar to proving, the oldverify()
is renamed toverify_regular()
and a newverify()
function automatically selects the correct one, based on whether theCompressedSNARK
struct has theRandomLayerCompressed
field.benches/compressed-snark.rs
: