-
Notifications
You must be signed in to change notification settings - Fork 411
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
Perf: Groth16 verifier circuit with pre-computed lines #925
Closed
Conversation
This file contains 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
This was referenced Nov 22, 2023
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
(This PR includes #874)
Currently the verification computes the multi-pairing check:
e({kSum, proof.Krs, proof.Ar}, {vk.G2.GammaNeg, vk.G2.DeltaNeg, proof.Bs}) == vk.E
where
proof.Bs
is a variable G2 point (part of the proof) butvk.G2.GammaNeg
andvk.G2.DeltaNeg
are fixed G2 points wrt to circuit (part of the SRS).Similarly to #874, we can use a fixed-argument multi-Miller loop for
ML({kSum, proof.Krs}, {vk.G2.GammaNeg, vk.G2.DeltaNeg})
and a normal (variable-argument) Miller loop for
ML({proof.Ar}, {proof.Bs})
and then multiply them and apply the final exponentiation step on the result.
Note: we can further merge the squarings and the lines multiplications inside the two Miller loops but we would need to implement a generic
MillerLoop
that deals with the second arguments being variable or fixed — or have a specific method for 3 pairings where 2 are fixed-arg. This is more work given that we have already a good SCS reduction and Groth16 is not a priority. However for R1CS we lose some constraints.Type of change
How has this been tested?
Curent tests in
std/recursion/groth16
.How has this been benchmarked?
This is 96991 R1CS and 388211 SCS saving.
This is 253 R1CS and 5513 SCS increase! That's not terrible but allows to have a generic interface for both emulated and native G16 recursion.
Checklist:
golangci-lint
does not output errors locally