-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Use hash_to_curve
to derive global parameters
#251
Conversation
…into feat/hash_to_parameters
…into feat/hash_to_parameters
…into feat/hash_to_parameters
I have ignored those single integration tests for testnet1 and 2 given the other integration tests will synthesize the circuits from scratch and verify transaction generation works. We can resample these parameters in another PR. |
Got it. I am going through the files (40% done). Will finish soon. |
Great, I'm debugging the Merkle tree gadget at the moment, will keep file changes minimal! |
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 went through all the files. Everything looks good, though I haven't yet found why the Merkle tree test is failing.
Same, can't seem to isolate the issue. The fact that the Pedersen compressed CRH Merkle Tree variant passes, yet the Pedersen CRH MT variant fails seems odd. The compressed CRH calls the standard CRH as a subroutine and invokes |
I think I know why. Two ProjectiveCurve elements, even if they are the same, may not be "Eq". |
Unconfirmed. But see this code:
If two ProjectiveCurve "gadgets" are not Eq even if they are the same, then it would always target the wrong |
Wait nope, that is not right. They should be affine gadgets...let me think about it. |
I just checked it does seem to be Related, but unrelated, shouldn't this be a |
Nope. Inside curves, Affine is better. |
But I would say |
I definitely want to get to the bottom of this issue, however want to propose one way to remedy this issue. Ray has PR #249 which we could rebase to with a more generalized and refreshed implementation of Merkle tree. |
I agree. So merge this to testnet2 first and then see if #249 can fix it? |
I think that works. By the way, your suspicion is correct. If I add the following println!("{}: {} {}", i, previous_hash == *left_hash, previous_hash == *right_hash); The output looks as follows:
|
Actually let me have a try on this:
I have concerns that the implementation is not correct. |
Ah, nope, in our cases I would be Edwards curve. Let me check a little bit. |
I think we can narrow it down: either the parameters are not actually the same or there is an issue in allocating the tree path. The second is very likely because it explains why the compressed version passes. |
Agreed, it should be from a lower level of abstraction than Merkle Tree gadget given other variants of this test are passing. In the meantime, I'll follow the proposed course of merging this into |
Ok. I think this might be the explanation: In the native version, when computing MIDDLE nodes in the Merkle tree, we In the constraint version, it We need to change the native version. |
That sounds like the culprit! It would also explain why the compressed gadget variant passes. Given we reduce to affine and use the x-coordinate on it's own, this issue wouldn't arise then. |
The fix would be easy: just change the output type, in the native world, |
Should I make and push a fix to testnet2, or you will fix it? |
That sounds like a good idea, feel free to make the fix and push to testnet2! |
Motivation
Use
hash_to_curve
to derive global parameters.Pedersen CRH (& compressed variant) updates:
setup
method in favor ofhash_to_curve
ProjectiveCurve
Bowe Hopwood Pedersen CRH updates:
setup
method in favor ofhash_to_curve
Pedersen commitment (& compressed variant) updates:
setup
method in favor ofhash_to_curve
ProjectiveCurve
Schnorr signature updates:
setup
method in favor ofhash_to_curve
AffineCurve
toProjectiveCurve
CryptoRng
trait to methods whereRng
is usedGroup encryption updates:
setup
method in favor ofhash_to_curve
SG
signature group andSignatureScheme
implementation/variantCryptoRng
trait to methods whereRng
is usedDPC changes:
FromBytes(ToBytes())
to convert between encryption key and signature keyParameter changes:
Related PRs
Builds on #241