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
currently we do
GT == e(a1,b1)*e(a2,b2)*e(a3,b3)
usingPair
for the triple-pairing, which means computing the multi-Miller loop and then reducing it to a unique value withFinalExponentiation
that should matchGT
from theVerifyingKey
.In this PR I wanted to check if including
GT
in the pairing computation (triple-pairing becomes quadruple) and usingFinalExponentiationCheck
(insidePairingCheck
) would result in less constraints (using #1143, #1155, #1207).N.B.:
QuadruplePairingCheck
method that merges the squares of the equivalence check with the Miller loop (similar to perf: optimizeDoublePairingCheck
i.e. e(a,b)e(c,d) == 1 #1230 but for 4 pairs). I implemented this and it saves 5.7% but add more code to gnark that is only useful for G16 verifier circuit.GT
in theVerifyingKey
and include it the triple-Miller loop to compute the hinted witness residue. This also should work but again more specialized methods and more lines of code for a single circuit that we probably don't care about much.Type of change
How has this been tested?
Tests pass.
How has this been benchmarked?
BN254-G16 verifier in a BN254 circuit:
QuadruplePairingCheck
): 1,310,727 scsChecklist:
golangci-lint
does not output errors locally