Skip to content

Commit f930a03

Browse files
authored
Merge pull request #234 from LLFourn/none_fingerprint
[❄] Fix Fingerprint::default
2 parents 3991c2a + 9da9e57 commit f930a03

File tree

5 files changed

+16
-21
lines changed

5 files changed

+16
-21
lines changed

schnorr_fun/src/frost/chilldkg/certpedpop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ mod test {
576576
threshold,
577577
n_receivers,
578578
n_extra_generators,
579-
Fingerprint::none(),
579+
Fingerprint::NONE,
580580
&mut rng
581581
);
582582

@@ -606,7 +606,7 @@ mod test {
606606
threshold,
607607
n_receivers,
608608
n_extra_generators,
609-
Fingerprint::none(),
609+
Fingerprint::NONE,
610610
&mut rng,
611611
);
612612

schnorr_fun/src/frost/chilldkg/encpedpop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ mod test {
530530
threshold,
531531
n_receivers,
532532
n_generators,
533-
Fingerprint::none(),
533+
Fingerprint::NONE,
534534
&mut rng,
535535
);
536536
}

schnorr_fun/src/frost/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -426,12 +426,6 @@ where
426426
/// A Frost signature share.
427427
pub type SignatureShare = Scalar<Public, Zero>;
428428

429-
/// The default fingerprint used for share generation in production
430-
pub const FROST_V0_FINGERPRINT: Fingerprint = Fingerprint {
431-
bit_length: 18,
432-
tag: "frost-v0",
433-
};
434-
435429
#[cfg(test)]
436430
mod test {
437431

schnorr_fun/src/frost/shared_key.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -455,13 +455,17 @@ pub struct Fingerprint {
455455
}
456456

457457
impl Fingerprint {
458-
/// Creates a fingerprint with no difficulty (no grinding required)
459-
pub fn none() -> Self {
460-
Self {
461-
bit_length: 0,
462-
tag: "",
463-
}
464-
}
458+
/// The default fingerprint used for share generation in production
459+
pub const FROST_V0: Self = Self {
460+
bit_length: 18,
461+
tag: "frost-v0",
462+
};
463+
464+
/// a 0-bit fingerprint which means it will have no affect.
465+
pub const NONE: Self = Self {
466+
bit_length: 0,
467+
tag: "",
468+
};
465469

466470
/// Count leading zero bits across a byte slice
467471
pub(crate) fn leading_zero_bits(bytes: &[u8]) -> usize {
@@ -480,10 +484,7 @@ impl Fingerprint {
480484

481485
impl Default for Fingerprint {
482486
fn default() -> Self {
483-
Self {
484-
bit_length: 8,
485-
tag: "frost-dkg",
486-
}
487+
Self::FROST_V0
487488
}
488489
}
489490

schnorr_fun/tests/frost_prop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ proptest! {
3131

3232
// // create some scalar polynomial for each party
3333
let mut rng = TestRng::deterministic_rng(RngAlgorithm::ChaCha);
34-
let (mut shared_key, mut secret_shares) = encpedpop::simulate_keygen(&frost.schnorr, threshold, n_parties, n_parties, Fingerprint::none(), &mut rng);
34+
let (mut shared_key, mut secret_shares) = encpedpop::simulate_keygen(&frost.schnorr, threshold, n_parties, n_parties, Fingerprint::NONE, &mut rng);
3535

3636
if let Some(tweak) = add_tweak {
3737
for secret_share in &mut secret_shares {

0 commit comments

Comments
 (0)