Conversation
This reverts commit bdab848.
ivokub
requested changes
Dec 13, 2023
Collaborator
ivokub
left a comment
There was a problem hiding this comment.
Nice! All seems good. I already pushed some cosmetic changes. I think there are still a few issues:
- for two-chain we have wrapper for MillerLoop which goes from
[]G2Affineargument to[]*G2Affine. But we compute the lines in the method which uses[]G2Affine. However, as the slice contains of values then inside a method we are working on a copy ofG2Affinevalue and we are not updating the lazy lines of the input. I think we can either changeMillerLoopto take[]*G2Affineso that can modify inline or precompute the lines inPairingwrapper methodPairing.MillerLoopto already precompute. I like the first approach better because then we always will use lazy line computation. - I would still like to get PLONK verification without commitment working. I'm actually thinking about adding new
algoptoptionalgopts.ForceSafewhich performs safe arithmetic inside MSM. It is suboptimal (we could also only omit the selector we know is 0), but atleast would cover different cases. And I think we already know inside the circuit if there is commitment or not. - there are a few unused functions. I didn't want to remove yet as maybe could be useful in the future - for example Pairing.generators() in packages or addStep() in some packages. If you say they are good to remove then I can.
- I'm not sure, but isn't there regression for ScalarMulBase in 2-chains? Previously we had computed powers of twos, but now we're using generic scalar multiplication (with GLV nontheless). Have you run any comparisons which is better for base scalar mul - generic with GLV or double-and-add with precomputed points.
Contributor
Author
Collaborator
It seems all changes are already incorporated here. I'd merge only this and then close 874. |
This was referenced Dec 15, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
(first review #874
and Consensys/gnark-crypto#471)Some optimizations for the PLONK verifier gadget:
JointScalarMul(s1*p1+s2*p2using Shamir's trick)scalarBitsMul(scalar binary decomposition only once)MultiScalarMulto useJointScalarMulandscalarBitsMulin the folding case(x-1)^2has a better addition chain thanxorx^2)ScalarMulandMultiScalarMul(https://eprint.iacr.org/2019/1021, sec. 6.2)use1/xas a bijection in bw6 MiMC instead ofx^5(needs perf: use inverse as a bijection for bw6-761 mimc gnark-crypto#471)TODO:
MarshalG1ScalarMulandMultiScalarMulType of change
How has this been tested?
All current tests pass.
How has this been benchmarked?
Checklist:
golangci-lintdoes not output errors locally