Skip to content

Commit

Permalink
Merge pull request #1366 from andyleiserson/undead-code
Browse files Browse the repository at this point in the history
Remove some unneeded dead_code waivers; fix a test
  • Loading branch information
andyleiserson authored Oct 22, 2024
2 parents 47a455f + e68e014 commit 09ceb05
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
1 change: 0 additions & 1 deletion ipa-core/src/helpers/buffers/unordered_receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ where
inner: Arc<Mutex<OperatingState<S, C>>>,
}

#[allow(dead_code)]
impl<S, C> UnorderedReceiver<S, C>
where
S: Stream<Item = C> + Send,
Expand Down
2 changes: 1 addition & 1 deletion ipa-core/src/protocol/dp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ fn delta_constraint(num_bernoulli: u32, noise_params: &NoiseParams) -> bool {
lhs >= rhs
}
/// error of mechanism in Thm 1
#[allow(dead_code)]
#[cfg(all(test, unit_test))]
fn error(num_bernoulli: u32, noise_params: &NoiseParams) -> f64 {
noise_params.dimensions
* noise_params.quantization_scale.powi(2)
Expand Down
13 changes: 7 additions & 6 deletions ipa-core/src/protocol/ipa_prf/oprf_padding/insecure.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(dead_code)]

use std::f64::consts::E;

use rand::distributions::{BernoulliError, Distribution};
Expand Down Expand Up @@ -77,6 +75,7 @@ impl Dp {
})
}

#[cfg(all(test, unit_test))]
fn apply<I, R>(&self, mut input: I, rng: &mut R)
where
R: RngCore + CryptoRng,
Expand Down Expand Up @@ -521,16 +520,18 @@ mod test {
println!("A sample value equal to {sample} occurred {count} time(s)",);
}
}

#[test]
fn test_oprf_padding_dp_constructor() {
let mut actual = OPRFPaddingDp::new(-1.0, 1e-6, 10); // (epsilon, delta, sensitivity)
let mut expected = Err(Error::BadEpsilon(-1.0));
assert_eq!(expected, Ok(actual));
assert_eq!(expected, actual);
actual = OPRFPaddingDp::new(1.0, -1e-6, 10); // (epsilon, delta, sensitivity)
expected = Err(Error::BadDelta(-1e-6));
assert_eq!(expected, Ok(actual));
actual = OPRFPaddingDp::new(1.0, -1e-6, 1_000_001); // (epsilon, delta, sensitivity)
assert_eq!(expected, actual);
actual = OPRFPaddingDp::new(1.0, 1e-6, 1_000_001); // (epsilon, delta, sensitivity)
expected = Err(Error::BadSensitivity(1_000_001));
assert_eq!(expected, Ok(actual));
assert_eq!(expected, actual);
}

#[test]
Expand Down
2 changes: 0 additions & 2 deletions ipa-core/src/protocol/ipa_prf/shuffle/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ where
}
}

#[allow(dead_code)]
/// This struct stores some intermediate messages during the shuffle.
/// In a maliciously secure shuffle,
/// these messages need to be checked for consistency across helpers.
Expand All @@ -79,7 +78,6 @@ pub struct IntermediateShuffleMessages<S: SharedValue> {
x2_or_y2: Option<Vec<S>>,
}

#[allow(dead_code)]
impl<S: SharedValue> IntermediateShuffleMessages<S> {
/// When `IntermediateShuffleMessages` is initialized correctly,
/// this function returns `x1` when `Role = H1`
Expand Down
1 change: 0 additions & 1 deletion ipa-core/src/query/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use crate::{

/// The status of query processing
#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
#[allow(dead_code)]
pub enum QueryStatus {
/// Only query running on the coordinator helper can be in this state. Means that coordinator
/// sent out requests to other helpers and asked them to assume a given role for this query.
Expand Down

0 comments on commit 09ceb05

Please sign in to comment.