diff --git a/schnorr_fun/src/share_backup.rs b/schnorr_fun/src/share_backup.rs index bf8cea5e..87737248 100644 --- a/schnorr_fun/src/share_backup.rs +++ b/schnorr_fun/src/share_backup.rs @@ -196,9 +196,12 @@ pub fn decode_backup( let mut threshold_bytes = Vec::::from_base32(&data[..2]).map_err(FrostBackupDecodeError::Bech32DecodeError)?; - threshold_bytes.extend(vec![0; 8 - threshold_bytes.len()]); - let threshold = - 1 + usize::from_le_bytes(threshold_bytes.try_into().expect("8 bytes must fit u8")); + threshold_bytes.resize((usize::BITS / 8) as usize, 0); + let threshold = 1 + usize::from_le_bytes( + threshold_bytes + .try_into() + .expect("(usize::BITS / 8) bytes must fit usize"), + ); let identifier: [u5; 4] = data[2..(2 + 4)].try_into().expect("4 bytes has to fit"); diff --git a/secp256kfun/src/poly.rs b/secp256kfun/src/poly.rs index f8c02b17..4c2b7cea 100644 --- a/secp256kfun/src/poly.rs +++ b/secp256kfun/src/poly.rs @@ -289,8 +289,6 @@ mod test { let interpolation = poly::point::interpolate(points); - dbg!(&poly); - dbg!(&interpolation); let (interpolated_coeffs, zero_coeffs) = interpolation.split_at(poly.len()); let n_extra_points = indicies.len() - poly.len(); assert_eq!(