@@ -86,7 +86,7 @@ func NewPairing(api frontend.API) (*Pairing, error) {
8686//
8787// This function checks that the Qᵢ are in the correct subgroup, but does not
8888// check Pᵢ. See AssertIsOnG1.
89- func (pr Pairing ) Pair (P []* G1Affine , Q []* G2Affine ) (* GTEl , error ) {
89+ func (pr * Pairing ) Pair (P []* G1Affine , Q []* G2Affine ) (* GTEl , error ) {
9090 res , err := pr .MillerLoop (P , Q )
9191 if err != nil {
9292 return nil , fmt .Errorf ("miller loop: %w" , err )
@@ -99,7 +99,7 @@ func (pr Pairing) Pair(P []*G1Affine, Q []*G2Affine) (*GTEl, error) {
9999// ∏ᵢ e(Pᵢ, Qᵢ) =? 1
100100//
101101// This function doesn't check that the inputs are in the correct subgroups.
102- func (pr Pairing ) PairingCheck (P []* G1Affine , Q []* G2Affine ) error {
102+ func (pr * Pairing ) PairingCheck (P []* G1Affine , Q []* G2Affine ) error {
103103 // check input size match
104104 nP := len (P )
105105 nQ := len (Q )
@@ -181,15 +181,15 @@ func (pr Pairing) PairingCheck(P []*G1Affine, Q []*G2Affine) error {
181181 return nil
182182}
183183
184- func (pr Pairing ) IsEqual (x , y * GTEl ) frontend.Variable {
184+ func (pr * Pairing ) IsEqual (x , y * GTEl ) frontend.Variable {
185185 return pr .Ext12 .IsEqual (x , y )
186186}
187187
188- func (pr Pairing ) AssertIsEqual (x , y * GTEl ) {
188+ func (pr * Pairing ) AssertIsEqual (x , y * GTEl ) {
189189 pr .Ext12 .AssertIsEqual (x , y )
190190}
191191
192- func (pr Pairing ) MuxG2 (sel frontend.Variable , inputs ... * G2Affine ) * G2Affine {
192+ func (pr * Pairing ) MuxG2 (sel frontend.Variable , inputs ... * G2Affine ) * G2Affine {
193193 if len (inputs ) == 0 {
194194 return nil
195195 }
@@ -253,7 +253,7 @@ func (pr Pairing) MuxG2(sel frontend.Variable, inputs ...*G2Affine) *G2Affine {
253253 return & ret
254254}
255255
256- func (pr Pairing ) MuxGt (sel frontend.Variable , inputs ... * GTEl ) * GTEl {
256+ func (pr * Pairing ) MuxGt (sel frontend.Variable , inputs ... * GTEl ) * GTEl {
257257 if len (inputs ) == 0 {
258258 return nil
259259 }
@@ -304,19 +304,19 @@ func (pr Pairing) MuxGt(sel frontend.Variable, inputs ...*GTEl) *GTEl {
304304}
305305
306306// IsOnCurve returns a boolean indicating if the G1 point is in the curve.
307- func (pr Pairing ) IsOnCurve (P * G1Affine ) frontend.Variable {
307+ func (pr * Pairing ) IsOnCurve (P * G1Affine ) frontend.Variable {
308308 left , right := pr .g1 .computeCurveEquation (P )
309309 diff := pr .curveF .Sub (left , right )
310310 return pr .curveF .IsZero (diff )
311311}
312312
313- func (pr Pairing ) AssertIsOnG1 (P * G1Affine ) {
313+ func (pr * Pairing ) AssertIsOnG1 (P * G1Affine ) {
314314 pr .g1 .AssertIsOnG1 (P )
315315}
316316
317317// IsOnG1 returns a boolean indicating if the G1 point is on the curve and in
318318// the prime subgroup.
319- func (pr Pairing ) IsOnG1 (P * G1Affine ) frontend.Variable {
319+ func (pr * Pairing ) IsOnG1 (P * G1Affine ) frontend.Variable {
320320 // To check that a point P is on G1, we need to check it is of prime order r.
321321 // This means that we need to check:
322322 // [r]P == 0
@@ -338,24 +338,24 @@ func (pr Pairing) IsOnG1(P *G1Affine) frontend.Variable {
338338 return pr .api .And (isOnCurve , isInSubgroup )
339339}
340340
341- func (pr Pairing ) AssertIsOnTwist (Q * G2Affine ) {
341+ func (pr * Pairing ) AssertIsOnTwist (Q * G2Affine ) {
342342 pr .g2 .AssertIsOnTwist (Q )
343343}
344344
345345// IsOnTwist returns a boolean indicating if the G2 point is in the twist.
346- func (pr Pairing ) IsOnTwist (Q * G2Affine ) frontend.Variable {
346+ func (pr * Pairing ) IsOnTwist (Q * G2Affine ) frontend.Variable {
347347 left , right := pr .g2 .computeTwistEquation (Q )
348348 diff := pr .Ext2 .Sub (left , right )
349349 return pr .Ext2 .IsZero (diff )
350350}
351351
352- func (pr Pairing ) AssertIsOnG2 (Q * G2Affine ) {
352+ func (pr * Pairing ) AssertIsOnG2 (Q * G2Affine ) {
353353 pr .g2 .AssertIsOnG2 (Q )
354354}
355355
356356// IsOnG2 returns a boolean indicating if the G2 point is on the curve and in
357357// the prime subgroup.
358- func (pr Pairing ) IsOnG2 (Q * G2Affine ) frontend.Variable {
358+ func (pr * Pairing ) IsOnG2 (Q * G2Affine ) frontend.Variable {
359359 // 1 - is Q on curve
360360 isOnCurve := pr .IsOnTwist (Q )
361361 // 2 - is Q in the subgroup
@@ -383,7 +383,7 @@ var loopCounter = [64]int8{
383383//
384384// This function checks that the Qᵢ are in the correct subgroup, but does not
385385// check Pᵢ. See AssertIsOnG1.
386- func (pr Pairing ) MillerLoop (P []* G1Affine , Q []* G2Affine ) (* GTEl , error ) {
386+ func (pr * Pairing ) MillerLoop (P []* G1Affine , Q []* G2Affine ) (* GTEl , error ) {
387387
388388 // check input size match
389389 n := len (P )
@@ -403,7 +403,7 @@ func (pr Pairing) MillerLoop(P []*G1Affine, Q []*G2Affine) (*GTEl, error) {
403403}
404404
405405// millerLoopLines computes the multi-Miller loop from points in G1 and precomputed lines in G2
406- func (pr Pairing ) millerLoopLines (P []* G1Affine , lines []lineEvaluations , init * GTEl , first bool ) (* GTEl , error ) {
406+ func (pr * Pairing ) millerLoopLines (P []* G1Affine , lines []lineEvaluations , init * GTEl , first bool ) (* GTEl , error ) {
407407
408408 // check input size match
409409 n := len (P )
@@ -489,7 +489,7 @@ func (pr Pairing) millerLoopLines(P []*G1Affine, lines []lineEvaluations, init *
489489// where d = (p¹²-1)/r = (p¹²-1)/Φ₁₂(p) ⋅ Φ₁₂(p)/r = (p⁶-1)(p²+1)(p⁴ - p² +1)/r
490490// we use instead d=s ⋅ (p⁶-1)(p²+1)(p⁴ - p² +1)/r
491491// where s is the cofactor 3 (Hayashida et al.)
492- func (pr Pairing ) FinalExponentiation (e * GTEl ) * GTEl {
492+ func (pr * Pairing ) FinalExponentiation (e * GTEl ) * GTEl {
493493 z := pr .Copy (e )
494494
495495 // Easy part
@@ -531,7 +531,7 @@ func (pr Pairing) FinalExponentiation(e *GTEl) *GTEl {
531531// L. Eagen, and is based on a personal communication with A. Novakovic.
532532//
533533// [On Proving Pairings]: https://eprint.iacr.org/2024/640.pdf
534- func (pr Pairing ) AssertFinalExponentiationIsOne (x * GTEl ) {
534+ func (pr * Pairing ) AssertFinalExponentiationIsOne (x * GTEl ) {
535535 tower := pr .ToTower (x )
536536
537537 res , err := pr .curveF .NewHint (finalExpHint , 18 , tower [0 ], tower [1 ], tower [2 ], tower [3 ], tower [4 ], tower [5 ], tower [6 ], tower [7 ], tower [8 ], tower [9 ], tower [10 ], tower [11 ])
@@ -587,7 +587,7 @@ func (pr Pairing) AssertFinalExponentiationIsOne(x *GTEl) {
587587// doubleAndAddStep doubles p1 and adds p2 to the result in affine coordinates.
588588// Then evaluates the lines going through p1 and p2 or -p2 (line1) and p1 and p1+p2 (line2).
589589// https://eprint.iacr.org/2022/1162 (Section 6.1)
590- func (pr Pairing ) doubleAndAddStep (p1 , p2 * g2AffP ) (* g2AffP , * lineEvaluation , * lineEvaluation ) {
590+ func (pr * Pairing ) doubleAndAddStep (p1 , p2 * g2AffP ) (* g2AffP , * lineEvaluation , * lineEvaluation ) {
591591
592592 var line1 , line2 lineEvaluation
593593 var p g2AffP
@@ -641,7 +641,7 @@ func (pr Pairing) doubleAndAddStep(p1, p2 *g2AffP) (*g2AffP, *lineEvaluation, *l
641641
642642// doubleStep doubles p1 in affine coordinates, and evaluates the tangent line to p1.
643643// https://eprint.iacr.org/2022/1162 (Section 6.1)
644- func (pr Pairing ) doubleStep (p1 * g2AffP ) (* g2AffP , * lineEvaluation ) {
644+ func (pr * Pairing ) doubleStep (p1 * g2AffP ) (* g2AffP , * lineEvaluation ) {
645645
646646 var p g2AffP
647647 var line lineEvaluation
@@ -676,7 +676,7 @@ func (pr Pairing) doubleStep(p1 *g2AffP) (*g2AffP, *lineEvaluation) {
676676}
677677
678678// tripleStep triples p1 in affine coordinates, and evaluates the line in Miller loop
679- func (pr Pairing ) tripleStep (p1 * g2AffP ) (* g2AffP , * lineEvaluation , * lineEvaluation ) {
679+ func (pr * Pairing ) tripleStep (p1 * g2AffP ) (* g2AffP , * lineEvaluation , * lineEvaluation ) {
680680
681681 var line1 , line2 lineEvaluation
682682 var res g2AffP
@@ -731,7 +731,7 @@ func (pr Pairing) tripleStep(p1 *g2AffP) (*g2AffP, *lineEvaluation, *lineEvaluat
731731// and multiplies it in 𝔽p¹² by previous.
732732//
733733// This method is needed for evmprecompiles/ecpair.
734- func (pr Pairing ) MillerLoopAndMul (P * G1Affine , Q * G2Affine , previous * GTEl ) (* GTEl , error ) {
734+ func (pr * Pairing ) MillerLoopAndMul (P * G1Affine , Q * G2Affine , previous * GTEl ) (* GTEl , error ) {
735735 res , err := pr .MillerLoop ([]* G1Affine {P }, []* G2Affine {Q })
736736 if err != nil {
737737 return nil , fmt .Errorf ("miller loop: %w" , err )
@@ -750,14 +750,14 @@ func (pr Pairing) MillerLoopAndMul(P *G1Affine, Q *G2Affine, previous *GTEl) (*G
750750// This method is needed for evmprecompiles/ecpair.
751751//
752752// [On Proving Pairings]: https://eprint.iacr.org/2024/640.pdf
753- func (pr Pairing ) AssertMillerLoopAndFinalExpIsOne (P * G1Affine , Q * G2Affine , previous * GTEl ) {
753+ func (pr * Pairing ) AssertMillerLoopAndFinalExpIsOne (P * G1Affine , Q * G2Affine , previous * GTEl ) {
754754 t2 := pr .millerLoopAndFinalExpResult (P , Q , previous )
755755 pr .AssertIsEqual (t2 , pr .Ext12 .One ())
756756}
757757
758758// millerLoopAndFinalExpResult computes the Miller loop between P and Q,
759759// multiplies it in 𝔽p¹² by previous and returns the result.
760- func (pr Pairing ) millerLoopAndFinalExpResult (P * G1Affine , Q * G2Affine , previous * GTEl ) * GTEl {
760+ func (pr * Pairing ) millerLoopAndFinalExpResult (P * G1Affine , Q * G2Affine , previous * GTEl ) * GTEl {
761761 tower := pr .ToTower (previous )
762762
763763 // hint the non-residue witness
@@ -840,7 +840,7 @@ func (pr Pairing) millerLoopAndFinalExpResult(P *G1Affine, Q *G2Affine, previous
840840// This method is needed for evmprecompiles/ecpair.
841841//
842842// [On Proving Pairings]: https://eprint.iacr.org/2024/640.pdf
843- func (pr Pairing ) IsMillerLoopAndFinalExpOne (P * G1Affine , Q * G2Affine , previous * GTEl ) frontend.Variable {
843+ func (pr * Pairing ) IsMillerLoopAndFinalExpOne (P * G1Affine , Q * G2Affine , previous * GTEl ) frontend.Variable {
844844 t2 := pr .millerLoopAndFinalExpResult (P , Q , previous )
845845
846846 res := pr .IsEqual (t2 , pr .Ext12 .One ())
0 commit comments