Skip to content

Commit 9f94571

Browse files
committed
Pass Fingerprint by value instead of reference
Fingerprint is Copy, so it should be passed by value.
1 parent 5ae2b35 commit 9f94571

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

schnorr_fun/src/frost/chilldkg/encpedpop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ impl AggKeygenInput {
243243
let tweak_poly = shared_key.grind_fingerprint::<H>(fingerprint);
244244
// replace our poly with the one that has the fingerprint
245245
self.inner.agg_poly = shared_key.point_polynomial()[1..].to_vec();
246-
debug_assert!(self.shared_key().check_fingerprint::<H>(&fingerprint));
246+
debug_assert!(self.shared_key().check_fingerprint::<H>(fingerprint));
247247

248248
for (share_index, (_encryption_key, encrypted_secret_share)) in &mut self.encrypted_shares {
249249
// 💡 The share encryption is homomorphic so we can apply the tweak
@@ -566,7 +566,7 @@ mod test {
566566
assert_eq!(shared_key.pair_secret_share(*share.secret_share()), Some(share));
567567
}
568568

569-
assert!(shared_key.check_fingerprint::<sha2::Sha256>(&fingerprint), "fingerprint was grinded correctly");
569+
assert!(shared_key.check_fingerprint::<sha2::Sha256>(fingerprint), "fingerprint was grinded correctly");
570570
}
571571
}
572572
}

schnorr_fun/src/frost/shared_key.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,7 @@ impl<T: Normalized, Z: ZeroChoice> SharedKey<T, Z> {
195195
///
196196
/// Returns `true` if all coefficients match the fingerprint pattern, `false`
197197
/// if any coefficient fails to meet the difficulty requirement.
198-
pub fn check_fingerprint<H: crate::fun::hash::Hash32>(
199-
&self,
200-
fingerprint: &Fingerprint,
201-
) -> bool {
198+
pub fn check_fingerprint<H: crate::fun::hash::Hash32>(&self, fingerprint: Fingerprint) -> bool {
202199
use crate::fun::hash::HashAdd;
203200

204201
// the fingerprint is only placed on the non-constant coefficients so it
@@ -597,7 +594,7 @@ mod test {
597594

598595
// Verify the fingerprint is valid
599596
assert!(
600-
shared_key.check_fingerprint::<sha2::Sha256>(&fingerprint),
597+
shared_key.check_fingerprint::<sha2::Sha256>(fingerprint),
601598
"Grinded fingerprint should be valid"
602599
);
603600
}

0 commit comments

Comments
 (0)