Add further must_uses

This commit is contained in:
Luke Parker
2022-07-07 14:28:42 -04:00
parent 6c76458063
commit f7106f09ed
4 changed files with 8 additions and 0 deletions

View File

@@ -76,6 +76,7 @@ impl Bulletproofs {
Ok(res) Ok(res)
} }
#[must_use]
pub fn verify<R: RngCore + CryptoRng>(&self, rng: &mut R, commitments: &[EdwardsPoint]) -> bool { pub fn verify<R: RngCore + CryptoRng>(&self, rng: &mut R, commitments: &[EdwardsPoint]) -> bool {
if commitments.len() > 16 { if commitments.len() > 16 {
return false; return false;

View File

@@ -227,6 +227,7 @@ impl Algorithm<Ed25519> for ClsagMultisig {
share share
} }
#[must_use]
fn verify( fn verify(
&self, &self,
_: dfg::EdwardsPoint, _: dfg::EdwardsPoint,
@@ -247,6 +248,7 @@ impl Algorithm<Ed25519> for ClsagMultisig {
return None; return None;
} }
#[must_use]
fn verify_share( fn verify_share(
&self, &self,
verification_share: dfg::EdwardsPoint, verification_share: dfg::EdwardsPoint,

View File

@@ -46,10 +46,12 @@ pub trait Algorithm<C: Curve>: Clone {
) -> C::F; ) -> C::F;
/// Verify a signature /// Verify a signature
#[must_use]
fn verify(&self, group_key: C::G, nonce: C::G, sum: C::F) -> Option<Self::Signature>; fn verify(&self, group_key: C::G, nonce: C::G, sum: C::F) -> Option<Self::Signature>;
/// Verify a specific share given as a response. Used to determine blame if signature /// Verify a specific share given as a response. Used to determine blame if signature
/// verification fails /// verification fails
#[must_use]
fn verify_share( fn verify_share(
&self, &self,
verification_share: C::G, verification_share: C::G,
@@ -145,6 +147,7 @@ impl<C: Curve, H: Hram<C>> Algorithm<C> for Schnorr<C, H> {
schnorr::sign::<C>(params.secret_share(), nonce, c).s schnorr::sign::<C>(params.secret_share(), nonce, c).s
} }
#[must_use]
fn verify(&self, group_key: C::G, nonce: C::G, sum: C::F) -> Option<Self::Signature> { fn verify(&self, group_key: C::G, nonce: C::G, sum: C::F) -> Option<Self::Signature> {
let sig = SchnorrSignature { R: nonce, s: sum }; let sig = SchnorrSignature { R: nonce, s: sum };
if schnorr::verify::<C>(group_key, self.c.unwrap(), &sig) { if schnorr::verify::<C>(group_key, self.c.unwrap(), &sig) {
@@ -154,6 +157,7 @@ impl<C: Curve, H: Hram<C>> Algorithm<C> for Schnorr<C, H> {
} }
} }
#[must_use]
fn verify_share( fn verify_share(
&self, &self,
verification_share: C::G, verification_share: C::G,

View File

@@ -33,6 +33,7 @@ pub(crate) fn sign<C: Curve>(
} }
} }
#[must_use]
pub(crate) fn verify<C: Curve>( pub(crate) fn verify<C: Curve>(
public_key: C::G, public_key: C::G,
challenge: C::F, challenge: C::F,