Skip to content

Commit e5cba46

Browse files
authored
Pass Fingerprint by value instead of reference (#239)
Fingerprint is Copy, so it should be passed by value.
1 parent 4efaefa commit e5cba46

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
@@ -231,7 +231,7 @@ impl AggKeygenInput {
231231
let tweak_poly = shared_key.grind_fingerprint::<H>(fingerprint);
232232
// replace our poly with the one that has the fingerprint
233233
self.inner.agg_poly = shared_key.point_polynomial()[1..].to_vec();
234-
debug_assert!(self.shared_key().check_fingerprint::<H>(&fingerprint));
234+
debug_assert!(self.shared_key().check_fingerprint::<H>(fingerprint));
235235

236236
for (share_index, (_encryption_key, encrypted_secret_share)) in &mut self.encrypted_shares {
237237
// 💡 The share encryption is homomorphic so we can apply the tweak
@@ -557,7 +557,7 @@ mod test {
557557
assert_eq!(shared_key.pair_secret_share(*share.secret_share()), Some(share));
558558
}
559559

560-
assert!(shared_key.check_fingerprint::<sha2::Sha256>(&fingerprint), "fingerprint was grinded correctly");
560+
assert!(shared_key.check_fingerprint::<sha2::Sha256>(fingerprint), "fingerprint was grinded correctly");
561561
}
562562
}
563563

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)