Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit de60bc1

Browse files
ayashunskyIluvmagick
authored andcommitted
Simplified constraints
1 parent 4492e5c commit de60bc1

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

include/nil/blueprint/components/algebra/curves/detail/plonk/bls12_g2_point_double.hpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ namespace nil {
172172
nu = yP - lambda*xP,
173173
xR = lambda.pow(2) - 2*xP,
174174
yR = -(lambda*xR + nu),
175-
zero_check = (xP * yP).inversed();
175+
zero_check = yP.inversed();
176176

177177
for(std::size_t i = 0; i < 2; i++) {
178178
assignment.witness(component.W(i),start_row_index) = xP.data[i];
@@ -214,9 +214,9 @@ namespace nil {
214214
// (2yP)^2 (xR + 2xP) - (3xP^2)^2 = 0
215215
// (2yP) (yR + yP) + (3xP^2)(xR - xP) = 0
216216
// Additional constraint to assure that the double of (0,0) is (0,0):
217-
// ZC * xP^2 * yP^2 - xP * yP = 0
218-
// ZC * xP * yP * xR - ZC * xP * yP = 0
219-
// ZC * xP * yP * yR - ZC * xP * yP = 0
217+
// ZC * yP^2 - yP = 0
218+
// ZC * yP * xR - ZC * yP = 0
219+
// ZC * yP * yR - ZC * yP = 0
220220

221221
C1 = perform_fp2_sub(
222222
perform_fp2_mult(
@@ -239,13 +239,10 @@ namespace nil {
239239
)
240240
);
241241

242-
C3 = perform_fp2_sub(
243-
perform_fp2_mult(ZC,perform_fp2_mult(perform_fp2_mult(xP,yP),perform_fp2_mult(xP,yP))),
244-
perform_fp2_mult(xP,yP)
245-
);
242+
C3 = perform_fp2_sub( perform_fp2_mult(ZC,perform_fp2_mult(yP,yP)), yP);
246243

247-
C4 = perform_fp2_sub( xR, perform_fp2_mult(perform_fp2_mult(ZC,xR),perform_fp2_mult(xP,yP)));
248-
C5 = perform_fp2_sub( yR, perform_fp2_mult(perform_fp2_mult(ZC,yR),perform_fp2_mult(xP,yP)));
244+
C4 = perform_fp2_sub( xR, perform_fp2_mult(perform_fp2_mult(ZC,xR),yP));
245+
C5 = perform_fp2_sub( yR, perform_fp2_mult(perform_fp2_mult(ZC,yR),yP));
249246

250247
std::vector<constraint_type> Cs = {};
251248
for(std::size_t i = 0; i < 2; i++) {

0 commit comments

Comments
 (0)