You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: barretenberg/cpp/pil/vm2/ecc.pil
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
/**
3
3
* This subtrace supports point addition over the Grumpkin curve.
4
4
* Given two points, P & Q, this trace computes R = P + Q.
5
-
* PRECONDITIONS: The only assumption here is that the inputs P & Q are points on the Grumpkin curve (note that the Point at Infinity is considered on the curve):
5
+
* PRECONDITIONS: The only assumption here is that the inputs P & Q are points on the Grumpkin curve (note that the Point at Infinity = (0, 0) is considered on the curve):
6
6
* Grumpkin Curve Eqn in SW form: Y^2 = X^3 − 17.
7
7
* Note: Grumpkin forms a 2-cycle with BN254, i.e the base field of one is the scalar field of the other and vice-versa.
8
8
*
@@ -40,7 +40,7 @@ namespace ecc;
40
40
// P = (p_x, p_y, p_is_inf), Q = (q_x, q_y, q_is_inf), R = (r_x, r_y, r_is_inf),
41
41
// where the coordinates satisfy:
42
42
// y^2 = x^3 - 17 (unless is_inf is true).
43
-
// The point at infinity, O, does not exist on the curve (a property of SW curves). We represent it as:
43
+
// The point at infinity, O, does not have valid coordinates (a property of SW curves). We represent it as:
44
44
// O = (0, 0, true).
45
45
// Note: this is NOT enforced here for inputs, see ecc_mem.pil for example of constraining.
46
46
//
@@ -124,6 +124,11 @@ namespace ecc;
124
124
#[DOUBLE_PRED]
125
125
double_op - (x_match * y_match) = 0;
126
126
127
+
// If double_op is true, we check that p_is_inf == q_is_inf. #[DOUBLE_PRED] implies this (since x_match &
128
+
// y_match must imply p_is_inf == q_is_inf for points on the curve) however we include an extra check for
129
+
// the #[DOUBLE] lookup in scalar_mul, which ignores q_is_inf.
0 commit comments