-
Notifications
You must be signed in to change notification settings - Fork 52
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
Incomplete SW group operations may be worthwhile #14
Comments
A potential fix for completeness during additions is probably this:
Since the initial value is random, it may be able to provide some sort of "reject sampling". |
This issue shows that maybe one can do this without exceptions inside the circuit: zcash/zcash#3924 So the idea would be to convert to affine form, check for exceptional cases in the scalar, perform scalar multiplications via the foregoing algorithm, and to then convert back to projective form. |
In particular these portions seem relevant: * |
For the record, based on a measurement, our current implementation has roughly 12 constraints and 71 non-zeros per addition. |
The solution
So the saving is not significant. |
If the projective form is unused, but we only use the affine form, then maybe we can have fewer constraints, I assume:
Given that the affine form is likely to behave very differently from the complete form, it seems better to have a separate trait for it (so, not CurveVar). Any idea on the traits and implementations? |
I think the idea would be to use the exceptional-addition inside scalar multiplication, where it seems we can do an edge-case once check at the beginning. So we would have a specialized scalar multiplication, while leaving addition and doubling as-is |
By the way, another option for some curves with a cofactor is to convert to an alternate form (eg: edwards), and to perform the scalar arithmetic there, and to then convert back to short weierstrass form. |
Is there an API to call scalar multiplications over an EdwardsVar as in the second link? |
@zhenfeizhang The current library implements group elements on Edward curves as And the |
NVM, it's slower than [ELM02] because it assumes inversions are expensive. It's instead faster than [CJLM06], which is a followup to [ELM02]. |
I guess there was some misunderstanding. I am wondering about group muls over looking at the code here: it seems that there isn't an API -- the caller needs to decomposite the scalars and then do the scalar mul. |
@zhenfeizhang I look up the curve's interface, does this one work for you? https://github.com/arkworks-rs/succinct_r1cs/blob/0164f52ae0109c6e0a89c75fc9abc66c4ec0c5dc/r1cs-std/src/groups/mod.rs#L91 |
LOL. This is likely a private repo :-) I don't have access |
Sorry, wrong link. This one: Line 91 in 636f93a
|
Yes. Thanks! |
So, this is implemented now, but without the optimizations from zcash/zcash#3924 |
This is to be left as a todo for the future.
There seems to be a big gap in constraints & density of complete vs incomplete group operations, as well as operations on affine vs projective.
Ideally, if permitted by completeness and soundness, incomplete + affine can lead to fewer constraints & lower density.
However, it seems to require certain efforts to investigate whether the soundness holds, and to what extent. And completeness would be a separate issue that the application needs to handle. Especially, the application needs to have some sort of "reject sampling" so that it can retry proving until it avoids the incompleteness barriers.
The text was updated successfully, but these errors were encountered: