Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
jstuczyn committed May 31, 2024
1 parent 595aa12 commit f3752bb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
17 changes: 1 addition & 16 deletions common/credentials/src/coconut/bandwidth/issuance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use zeroize::{Zeroize, ZeroizeOnDrop};

pub use nym_validator_client::nyxd::{Coin, Hash};

#[derive(Zeroize, ZeroizeOnDrop, Serialize, Deserialize)]
#[derive(Serialize, Deserialize)]
pub enum BandwidthCredentialIssuanceDataVariant {
TicketBook(BandwidthVoucherIssuanceData),
FreePass,
Expand Down Expand Up @@ -298,18 +298,3 @@ fn make_recovery_bincode_serializer() -> impl bincode::Options {
.with_big_endian()
.with_varint_encoding()
}

#[cfg(test)]
mod tests {
use super::*;

fn assert_zeroize_on_drop<T: ZeroizeOnDrop>() {}

fn assert_zeroize<T: Zeroize>() {}

#[test]
fn credential_is_zeroized() {
assert_zeroize::<IssuanceBandwidthCredential>();
assert_zeroize_on_drop::<IssuanceBandwidthCredential>();
}
}
4 changes: 1 addition & 3 deletions common/credentials/src/coconut/bandwidth/voucher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ impl BandwidthVoucherIssuedData {
}
}

#[derive(Zeroize, ZeroizeOnDrop, Serialize, Deserialize)]
#[derive(Serialize, Deserialize)]
pub struct BandwidthVoucherIssuanceData {
/// the plain value (e.g., bandwidth) encoded in this voucher
// note: for legacy reasons we're only using the value of the coin and ignoring the denom
#[zeroize(skip)]
value: u128,

/// the hash of the deposit transaction
#[zeroize(skip)]
deposit_tx_hash: Hash,

/// base58 encoded private key ensuring the depositer requested these attributes
Expand Down
18 changes: 18 additions & 0 deletions common/nym_offline_compact_ecash/src/scheme/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,3 +626,21 @@ pub fn ttp_keygen(threshold: u64, num_authorities: u64) -> Result<Vec<KeyPairAut

Ok(keypairs)
}

#[cfg(test)]
mod tests {
use super::*;

fn assert_zeroize_on_drop<T: ZeroizeOnDrop>() {}

fn assert_zeroize<T: Zeroize>() {}

#[test]
fn secret_key_is_zeroized() {
assert_zeroize::<SecretKeyAuth>();
assert_zeroize_on_drop::<SecretKeyAuth>();

assert_zeroize::<SecretKeyUser>();
assert_zeroize_on_drop::<SecretKeyUser>();
}
}

0 comments on commit f3752bb

Please sign in to comment.