Repository: NethermindEth/juno (go)

Issue:
Unexport point methods
[This](https://github.com/NethermindEth/juno/blob/cbd368b222ac19a69e75e8ab82f01443ad21f590/pkg/crypto/pedersen/points.go#L2062) and any other method that is defined on a point do not have to be exported.

Pull request:
Unexport point functions as not used elsewhere
Resolves #262 

Patch:
diff --git a/pkg/crypto/pedersen/pedersen.go b/pkg/crypto/pedersen/pedersen.go
index 555abe0c..b3dea7ac 100644
--- a/pkg/crypto/pedersen/pedersen.go
+++ b/pkg/crypto/pedersen/pedersen.go
@@ -34,7 +34,7 @@ func Digest(data ...*big.Int) *big.Int {
 			// Create a copy because *big.Int.And mutates.
 			copyX := new(big.Int).Set(x)
 			if copyX.And(copyX, big.NewInt(1)).Cmp(zero) != 0 {
-				pt1.Add(&points[2+i*252+j])
+				pt1.add(&points[2+i*252+j])
 			}
 			x.Rsh(x, 1)
 		}
diff --git a/pkg/crypto/pedersen/points.go b/pkg/crypto/pedersen/points.go
index 8c0848e1..00ad0960 100644
--- a/pkg/crypto/pedersen/points.go
+++ b/pkg/crypto/pedersen/points.go
@@ -2057,54 +2057,54 @@ func divMod(n, m, p *big.Int) *big.Int {
 	return r.Mod(r, p)
 }
 
-// Inf returns the point at infinity i.e. (0, 0) and can also be viewed
+// inf returns the point at infinity i.e. (0, 0) and can also be viewed
 // as a default initialiser for a point on an elliptic curve.
-func Inf() *point {
+func inf() *point {
 	return &point{new(big.Int), new(big.Int)}
 }
 
-// Mod sets p to the point given by (p2.x % z, p2.y % z) and returns p.
-func (p *point) Mod(p2 *point, z *big.Int) *point {
+// mod sets p to the point given by (p2.x % z, p2.y % z) and returns p.
+func (p *point) mod(p2 *point, z *big.Int) *point {
 	p.x.Mod(p2.x, z)
 	p.y.Mod(p2.y, z)
 	return p
 }
 
-// Set sets p's coordinates to p2's coordinates and returns p.
-func (p *point) Set(other *point) *point {
+// set sets p's coordinates to p2's coordinates and returns p.
+func (p *point) set(other *point) *point {
 	p.x.Set(other.x)
 	p.y.Set(other.y)
 	return p
 }
 
-// IsInf returns true if p represents the point at infinity (0, 0), and
+// isInf returns true if p represents the point at infinity (0, 0), and
 // false otherwise.
-func (p *point) IsInf() bool {
+func (p *point) isInf() bool {
 	return p.x.Sign() == 0 && p.y.Sign() == 0
 }
 
-// Add returns the sum of two points on an elliptic curve mod p and may
+// add returns the sum of two points on an elliptic curve mod p and may
 // return the point at infinity (see pedersen.Inf and *point.IsInf). It
 // is a port of the following https://github.com/starkware-libs/cairo-lang/blob/2abd303e1808612b724bc1412b2b5babd04bb4e7/src/starkware/python/math_utils.py#L147-L164.
-func (p *point) Add(other *point) {
-	if p.IsInf() {
-		p.Set(other)
+func (p *point) add(other *point) {
+	if p.isInf() {
+		p.set(other)
 		return
 	}
 
-	if other.IsInf() {
+	if other.isInf() {
 		return
 	}
 
-	a := Inf().Mod(p, prime)
-	b := Inf().Mod(other, prime)
+	a := inf().mod(p, prime)
+	b := inf().mod(other, prime)
 
 	var m *big.Int
 	if a.x.Cmp(b.x) == 0 {
 		tmp := new(big.Int).Sub(prime, b.y)
 		tmp.Mod(tmp, prime)
 		if a.y.Cmp(tmp) == 0 {
-			p.Set(Inf())
+			p.set(inf())
 			return
 		} else {
 			// Elliptic curve double.


Test patch:
diff --git a/pkg/crypto/pedersen/points_test.go b/pkg/crypto/pedersen/points_test.go
index ee6c8379..c6f18581 100644
--- a/pkg/crypto/pedersen/points_test.go
+++ b/pkg/crypto/pedersen/points_test.go
@@ -8,7 +8,7 @@ import (
 	"github.com/NethermindEth/juno/pkg/crypto/weierstrass"
 )
 
-// TestAdd does a basic test of the point.Add function.
+// TestAdd does a basic test of the point.add function.
 func TestAdd(t *testing.T) {
 	tests := [][]point{
 		// (0, 0) + (1, 1)
@@ -36,7 +36,7 @@ func TestAdd(t *testing.T) {
 	for _, test := range tests {
 		t.Run(fmt.Sprintf("(%d,%d).Add((%d,%d))", test[0].x, test[0].y, test[1].x, test[1].y), func(t *testing.T) {
 			x, y := new(big.Int).Set(test[0].x), new(big.Int).Set(test[0].y)
-			test[0].Add(&test[1])
+			test[0].add(&test[1])
 			wantX, wantY := curve.Add(x, y, test[1].x, test[1].y)
 			if test[0].x.Cmp(wantX) != 0 || test[0].y.Cmp(wantY) != 0 {
 				t.Errorf("got (%d, %d), want (%d, %d)", test[0].x, test[0].y, wantX, wantY)