Skip to content

Commit

Permalink
[❄] Make point_polynomial return a slice
Browse files Browse the repository at this point in the history
No need to clone here
  • Loading branch information
LLFourn committed Jul 31, 2024
1 parent de7acf3 commit 09ab9d4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions schnorr_fun/src/frost/shared_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ impl<T: PointType, Z: ZeroChoice> SharedKey<T, Z> {
/// To get the first coefficient of the polynomial typed correctly call [`public_key`].
///
/// [`public_key`]: Self::public_key
pub fn point_polynomial(&self) -> Vec<Point<Normal, Public, Zero>> {
self.point_polynomial.clone()
pub fn point_polynomial(&self) -> &[Point<Normal, Public, Zero>] {
&self.point_polynomial
}

/// ☠ Type unsafe: you have to make sure the polynomial fits the type parameters
Expand Down Expand Up @@ -157,8 +157,8 @@ impl<T: PointType, Z: ZeroChoice> SharedKey<T, Z> {
pub fn public_key(&self) -> Point<T, Public, Z> {
// SAFETY: we hold the first coefficient to match the type parameters always
let public_key = Z::cast_point(self.point_polynomial[0]).expect("invariant");
let public_key = T::cast_point(public_key).expect("invariant");
public_key
T::cast_point(public_key).expect("invariant")
}
}
}

Expand Down

0 comments on commit 09ab9d4

Please sign in to comment.