Skip to content

Commit

Permalink
Affine coordinate are not correctly exposed from the underlying type.
Browse files Browse the repository at this point in the history
ProjectivePoints have 3 coordinates (x,y,z) and the AffinePoint incorrectly expose just the (x, y) coordinate without converting the representation from projective to affine.
  • Loading branch information
FilipLaurentiu committed Jan 29, 2025
1 parent e0eff28 commit 4f3a2b3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/starknet-types-core/src/curve/affine_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ impl AffinePoint {

/// Returns the `x` coordinate of the point.
pub fn x(&self) -> Felt {
Felt(*self.0.x())
Felt(*self.0.to_affine().x())
}

/// Returns the `y` coordinate of the point.
pub fn y(&self) -> Felt {
Felt(*self.0.y())
Felt(*self.0.to_affine().y())
}

// Returns the generator point of the StarkCurve
Expand All @@ -70,7 +70,7 @@ impl core::ops::Add<AffinePoint> for AffinePoint {
type Output = AffinePoint;

fn add(self, rhs: Self) -> Self::Output {
AffinePoint(self.0.operate_with_affine(&rhs.0))
AffinePoint(self.0.operate_with_affine(&rhs.0.to_affine()))
}
}

Expand Down

0 comments on commit 4f3a2b3

Please sign in to comment.