Skip to content

Commit

Permalink
Adopt prio::vdaf::dummy::Vdaf everywhere (#2692)
Browse files Browse the repository at this point in the history
...and remove the dummy VDAF we had in Janus itself. This is a step
toward implementing support for VDAFs that use an aggregation parameter
(#225). We could use Poplar1, of course, but what's _really_ interesting
is Mastic, which besides using an aggregation parameter, is a
single-round VDAF. I want to be able to contrast the implementation
complexity of VDAFs with an aggregation parameter and ones that also
take multiple rounds, and the dummy VDAF is most expedient way to wire
up the former.

Also adopts `prio` 0.16.1, to pick up some bug fixes to the dummy VDAF.
  • Loading branch information
tgeoghegan authored Feb 23, 2024
1 parent 78e5bbf commit bcd45c2
Show file tree
Hide file tree
Showing 20 changed files with 915 additions and 1,333 deletions.
53 changes: 27 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ k8s-openapi = { version = "0.20.0", features = ["v1_26"] } # keep this version
kube = { version = "0.87.2", default-features = false, features = ["client", "rustls-tls"] }
opentelemetry = { version = "0.21", features = ["metrics"] }
opentelemetry_sdk = { version = "0.21", features = ["metrics"] }
prio = { version = "0.16.0", features = ["multithreaded", "experimental"] }
prio = { version = "0.16.1", features = ["multithreaded", "experimental"] }
serde = { version = "1.0.196", features = ["derive"] }
serde_json = "1.0.113"
serde_test = "1.0.175"
Expand Down
16 changes: 7 additions & 9 deletions aggregator/src/aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ use janus_aggregator_core::{
task::{self, AggregatorTask, VerifyKey},
taskprov::PeerAggregator,
};
#[cfg(feature = "test-util")]
use janus_core::test_util::dummy_vdaf;
#[cfg(feature = "fpvec_bounded_l2")]
use janus_core::vdaf::Prio3FixedPointBoundedL2VecSumBitSize;
use janus_core::{
Expand Down Expand Up @@ -71,7 +69,7 @@ use opentelemetry::{
#[cfg(feature = "fpvec_bounded_l2")]
use prio::vdaf::prio3::Prio3FixedPointBoundedL2VecSumMultithreaded;
#[cfg(feature = "test-util")]
use prio::vdaf::{PrepareTransition, VdafError};
use prio::vdaf::{dummy, PrepareTransition, VdafError};
use prio::{
codec::{Decode, Encode, ParameterizedDecode},
dp::DifferentialPrivacyStrategy,
Expand Down Expand Up @@ -943,11 +941,11 @@ impl<C: Clock> TaskAggregator<C> {
}

#[cfg(feature = "test-util")]
VdafInstance::Fake => VdafOps::Fake(Arc::new(dummy_vdaf::Vdaf::new())),
VdafInstance::Fake => VdafOps::Fake(Arc::new(dummy::Vdaf::new(1))),

#[cfg(feature = "test-util")]
VdafInstance::FakeFailsPrepInit => VdafOps::Fake(Arc::new(
dummy_vdaf::Vdaf::new().with_prep_init_fn(|_| -> Result<(), VdafError> {
dummy::Vdaf::new(1).with_prep_init_fn(|_| -> Result<(), VdafError> {
Err(VdafError::Uncategorized(
"FakeFailsPrepInit failed at prep_init".to_string(),
))
Expand All @@ -956,8 +954,8 @@ impl<C: Clock> TaskAggregator<C> {

#[cfg(feature = "test-util")]
VdafInstance::FakeFailsPrepStep => {
VdafOps::Fake(Arc::new(dummy_vdaf::Vdaf::new().with_prep_step_fn(
|| -> Result<PrepareTransition<dummy_vdaf::Vdaf, 0, 16>, VdafError> {
VdafOps::Fake(Arc::new(dummy::Vdaf::new(1).with_prep_step_fn(
|_| -> Result<PrepareTransition<dummy::Vdaf, 0, 16>, VdafError> {
Err(VdafError::Uncategorized(
"FakeFailsPrepStep failed at prep_step".to_string(),
))
Expand Down Expand Up @@ -1181,7 +1179,7 @@ enum VdafOps {
VerifyKey<VERIFY_KEY_LENGTH>,
),
#[cfg(feature = "test-util")]
Fake(Arc<dummy_vdaf::Vdaf>),
Fake(Arc<dummy::Vdaf>),
}

/// Emits a match block dispatching on a [`VdafOps`] object. Takes a `&VdafOps` as the first
Expand Down Expand Up @@ -1314,7 +1312,7 @@ macro_rules! vdaf_ops_dispatch {
crate::aggregator::VdafOps::Fake(vdaf) => {
let $vdaf = vdaf;
let $verify_key = &VerifyKey::new([]);
type $Vdaf = ::janus_core::test_util::dummy_vdaf::Vdaf;
type $Vdaf = ::prio::vdaf::dummy::Vdaf;
const $VERIFY_KEY_LENGTH: usize = 0;
type $DpStrategy = janus_core::dp::NoDifferentialPrivacy;
let $dp_strategy = &Arc::new(janus_core::dp::NoDifferentialPrivacy);
Expand Down
Loading

0 comments on commit bcd45c2

Please sign in to comment.