From 782892e3460640b99733dc94338b50ae06d88fc5 Mon Sep 17 00:00:00 2001 From: Tim Geoghegan Date: Fri, 16 Feb 2024 11:49:09 -0800 Subject: [PATCH] Adopt `prio::vdaf::dummy::Vdaf` everywhere ...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. --- Cargo.lock | 30 +- Cargo.toml | 4 +- aggregator/src/aggregator.rs | 16 +- .../src/aggregator/aggregate_init_tests.rs | 52 +- .../src/aggregator/aggregation_job_creator.rs | 13 +- .../src/aggregator/collection_job_driver.rs | 135 ++- .../src/aggregator/collection_job_tests.rs | 125 ++- .../src/aggregator/garbage_collector.rs | 248 +++--- aggregator/src/aggregator/http_handlers.rs | 374 ++++----- aggregator_core/Cargo.toml | 9 +- aggregator_core/src/datastore/models.rs | 4 +- aggregator_core/src/datastore/tests.rs | 784 +++++++++--------- aggregator_core/src/lib.rs | 5 +- collector/src/lib.rs | 16 +- core/Cargo.toml | 1 + core/src/dp.rs | 4 +- core/src/test_util/dummy_vdaf.rs | 297 ------- core/src/test_util/mod.rs | 1 - core/src/vdaf.rs | 34 +- messages/Cargo.toml | 4 +- 20 files changed, 871 insertions(+), 1285 deletions(-) delete mode 100644 core/src/test_util/dummy_vdaf.rs diff --git a/Cargo.lock b/Cargo.lock index c49894e3d..ba065c0c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1328,9 +1328,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" +checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" [[package]] name = "filetime" @@ -2838,19 +2838,18 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-iter" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" dependencies = [ "autocfg", "num-integer", @@ -2872,9 +2871,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", "libm", @@ -3422,8 +3421,7 @@ dependencies = [ [[package]] name = "prio" version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a16151e3c98087659ef5dc706040a415afa88294989e895c8987d9d0cdea83c" +source = "git+https://github.com/divviup/libprio-rs?branch=timg/dummy-vdaf-bugs#22ca5667f9f6d56806f468809c5ef8cb38a9a106" dependencies = [ "aes", "bitvec", @@ -3432,6 +3430,7 @@ dependencies = [ "fiat-crypto", "fixed", "getrandom", + "hex", "hmac", "num-bigint", "num-integer", @@ -3442,6 +3441,7 @@ dependencies = [ "rand_core 0.6.4", "rayon", "serde", + "serde_json", "sha2", "sha3", "subtle", @@ -3626,9 +3626,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" dependencies = [ "either", "rayon-core", @@ -3636,9 +3636,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", diff --git a/Cargo.toml b/Cargo.toml index 2c5c82ca7..4c3abba88 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,9 @@ 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"] } +# TODO(timg) go back to a released prio +prio = { git = "https://github.com/divviup/libprio-rs", branch = "timg/dummy-vdaf-bugs", features = ["multithreaded", "experimental"] } +#prio = { version = "0.16.0", features = ["multithreaded", "experimental"] } serde = { version = "1.0.196", features = ["derive"] } serde_json = "1.0.113" serde_test = "1.0.175" diff --git a/aggregator/src/aggregator.rs b/aggregator/src/aggregator.rs index 4c3032769..195e59e84 100644 --- a/aggregator/src/aggregator.rs +++ b/aggregator/src/aggregator.rs @@ -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::{ @@ -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, @@ -928,11 +926,11 @@ impl TaskAggregator { } #[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(), )) @@ -941,8 +939,8 @@ impl TaskAggregator { #[cfg(feature = "test-util")] VdafInstance::FakeFailsPrepStep => { - VdafOps::Fake(Arc::new(dummy_vdaf::Vdaf::new().with_prep_step_fn( - || -> Result, VdafError> { + VdafOps::Fake(Arc::new(dummy::Vdaf::new(1).with_prep_step_fn( + |_| -> Result, VdafError> { Err(VdafError::Uncategorized( "FakeFailsPrepStep failed at prep_step".to_string(), )) @@ -1166,7 +1164,7 @@ enum VdafOps { VerifyKey, ), #[cfg(feature = "test-util")] - Fake(Arc), + Fake(Arc), } /// Emits a match block dispatching on a [`VdafOps`] object. Takes a `&VdafOps` as the first @@ -1299,7 +1297,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); diff --git a/aggregator/src/aggregator/aggregate_init_tests.rs b/aggregator/src/aggregator/aggregate_init_tests.rs index fb0b2862b..c81ce4dfc 100644 --- a/aggregator/src/aggregator/aggregate_init_tests.rs +++ b/aggregator/src/aggregator/aggregate_init_tests.rs @@ -21,9 +21,7 @@ use janus_aggregator_core::{ }; use janus_core::{ auth_tokens::{AuthenticationToken, DAP_AUTH_HEADER}, - test_util::{ - dummy_vdaf, install_test_trace_subscriber, run_vdaf, runtime::TestRuntime, VdafTranscript, - }, + test_util::{install_test_trace_subscriber, run_vdaf, runtime::TestRuntime, VdafTranscript}, time::{Clock, MockClock, TimeExt as _}, vdaf::VdafInstance, }; @@ -36,7 +34,7 @@ use prio::{ codec::Encode, idpf::IdpfInput, vdaf::{ - self, + self, dummy, poplar1::{Poplar1, Poplar1AggregationParam}, xof::XofTurboShake128, }, @@ -179,12 +177,12 @@ pub(super) struct AggregationJobInitTestCase< _ephemeral_datastore: EphemeralDatastore, } -pub(super) async fn setup_aggregate_init_test() -> AggregationJobInitTestCase<0, dummy_vdaf::Vdaf> { +pub(super) async fn setup_aggregate_init_test() -> AggregationJobInitTestCase<0, dummy::Vdaf> { setup_aggregate_init_test_for_vdaf( - dummy_vdaf::Vdaf::new(), + dummy::Vdaf::new(1), VdafInstance::Fake, - dummy_vdaf::AggregationParam(0), - (), + dummy::AggregationParam(0), + 0, ) .await } @@ -330,10 +328,10 @@ pub(crate) async fn put_aggregation_job( #[tokio::test] async fn aggregation_job_init_authorization_dap_auth_token() { let test_case = setup_aggregate_init_test_without_sending_request( - dummy_vdaf::Vdaf::new(), + dummy::Vdaf::new(1), VdafInstance::Fake, - dummy_vdaf::AggregationParam(0), - (), + dummy::AggregationParam(0), + 0, AuthenticationToken::DapAuth(random()), ) .await; @@ -366,10 +364,10 @@ async fn aggregation_job_init_authorization_dap_auth_token() { #[tokio::test] async fn aggregation_job_init_malformed_authorization_header(#[case] header_value: &'static str) { let test_case = setup_aggregate_init_test_without_sending_request( - dummy_vdaf::Vdaf::new(), + dummy::Vdaf::new(1), VdafInstance::Fake, - dummy_vdaf::AggregationParam(0), - (), + dummy::AggregationParam(0), + 0, AuthenticationToken::Bearer(random()), ) .await; @@ -401,10 +399,10 @@ async fn aggregation_job_init_malformed_authorization_header(#[case] header_valu #[tokio::test] async fn aggregation_job_init_unexpected_taskprov_extension() { let test_case = setup_aggregate_init_test_without_sending_request( - dummy_vdaf::Vdaf::new(), + dummy::Vdaf::new(1), VdafInstance::Fake, - dummy_vdaf::AggregationParam(0), - (), + dummy::AggregationParam(0), + 0, random(), ) .await; @@ -416,11 +414,11 @@ async fn aggregation_job_init_unexpected_taskprov_extension() { ExtensionType::Taskprov, Vec::new(), )])) - .next(&()) + .next(&0) .0; let report_id = *prepare_init.report_share().metadata().id(); let aggregation_job_init_req = AggregationJobInitializeReq::new( - dummy_vdaf::AggregationParam(1).get_encoded().unwrap(), + dummy::AggregationParam(1).get_encoded().unwrap(), PartialBatchSelector::new_time_interval(), Vec::from([prepare_init]), ); @@ -448,7 +446,7 @@ async fn aggregation_job_mutation_aggregation_job() { // Put the aggregation job again, but with a different aggregation parameter. let mutated_aggregation_job_init_req = AggregationJobInitializeReq::new( - dummy_vdaf::AggregationParam(1).get_encoded().unwrap(), + dummy::AggregationParam(1).get_encoded().unwrap(), PartialBatchSelector::new_time_interval(), test_case.aggregation_job_init_req.prepare_inits().to_vec(), ); @@ -477,13 +475,13 @@ async fn aggregation_job_mutation_report_shares() { // Include a different report share than was included previously [ &prepare_inits[0..prepare_inits.len() - 1], - &[test_case.prepare_init_generator.next(&()).0], + &[test_case.prepare_init_generator.next(&0).0], ] .concat(), // Include an extra report share than was included previously [ prepare_inits, - &[test_case.prepare_init_generator.next(&()).0], + &[test_case.prepare_init_generator.next(&0).0], ] .concat(), // Reverse the order of the reports @@ -547,10 +545,10 @@ async fn aggregation_job_mutation_report_aggregations() { #[tokio::test] async fn aggregation_job_intolerable_clock_skew() { let mut test_case = setup_aggregate_init_test_without_sending_request( - dummy_vdaf::Vdaf::new(), + dummy::Vdaf::new(1), VdafInstance::Fake, - dummy_vdaf::AggregationParam(0), - (), + dummy::AggregationParam(0), + 0, AuthenticationToken::Bearer(random()), ) .await; @@ -571,7 +569,7 @@ async fn aggregation_job_intolerable_clock_skew() { .add(test_case.task.tolerable_clock_skew()) .unwrap(), ), - &(), + &0, ) .0, // Barely intolerable. @@ -588,7 +586,7 @@ async fn aggregation_job_intolerable_clock_skew() { .add(&Duration::from_seconds(1)) .unwrap(), ), - &(), + &0, ) .0, ]), diff --git a/aggregator/src/aggregator/aggregation_job_creator.rs b/aggregator/src/aggregator/aggregation_job_creator.rs index 7f83acb4d..51bb729e9 100644 --- a/aggregator/src/aggregator/aggregation_job_creator.rs +++ b/aggregator/src/aggregator/aggregation_job_creator.rs @@ -772,7 +772,7 @@ mod tests { }; use janus_core::{ hpke::test_util::generate_test_hpke_config_and_private_key, - test_util::{dummy_vdaf, install_test_trace_subscriber, run_vdaf}, + test_util::{install_test_trace_subscriber, run_vdaf}, time::{Clock, DurationExt, IntervalExt, MockClock, TimeExt}, vdaf::{VdafInstance, VERIFY_KEY_LENGTH}, }; @@ -782,7 +782,7 @@ mod tests { AggregationJobStep, Interval, PrepareError, ReportId, ReportMetadata, Role, TaskId, Time, }; use prio::vdaf::{ - self, + self, dummy, prio3::{Prio3, Prio3Count}, }; use rand::random; @@ -865,7 +865,7 @@ mod tests { tx.put_client_report(vdaf.as_ref(), &leader_report) .await .unwrap(); - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &helper_report) + tx.put_client_report(&dummy::Vdaf::new(1), &helper_report) .await .unwrap(); Ok(()) @@ -932,13 +932,10 @@ mod tests { read_and_verify_aggregate_info_for_task::< 0, TimeInterval, - dummy_vdaf::Vdaf, + dummy::Vdaf, _, >( - tx, - &dummy_vdaf::Vdaf::new(), - helper_task.id(), - &HashMap::new(), + tx, &dummy::Vdaf::new(1), helper_task.id(), &HashMap::new() ) .await; Ok(( diff --git a/aggregator/src/aggregator/collection_job_driver.rs b/aggregator/src/aggregator/collection_job_driver.rs index 387096a61..3a9524cb0 100644 --- a/aggregator/src/aggregator/collection_job_driver.rs +++ b/aggregator/src/aggregator/collection_job_driver.rs @@ -633,11 +633,7 @@ mod tests { }; use janus_core::{ retries::test_util::LimitedRetryer, - test_util::{ - dummy_vdaf::{self, AggregationParam}, - install_test_trace_subscriber, - runtime::TestRuntimeManager, - }, + test_util::{install_test_trace_subscriber, runtime::TestRuntimeManager}, time::{Clock, IntervalExt, MockClock, TimeExt}, vdaf::VdafInstance, Runtime, @@ -647,7 +643,10 @@ mod tests { AggregationJobStep, BatchSelector, Duration, HpkeCiphertext, HpkeConfigId, Interval, Query, ReportIdChecksum, }; - use prio::codec::{Decode, Encode}; + use prio::{ + codec::{Decode, Encode}, + vdaf::dummy, + }; use rand::random; use std::{sync::Arc, time::Duration as StdDuration}; use trillium_tokio::Stopper; @@ -660,7 +659,7 @@ mod tests { ) -> ( Task, Option>, - CollectionJob<0, TimeInterval, dummy_vdaf::Vdaf>, + CollectionJob<0, TimeInterval, dummy::Vdaf>, ) { let time_precision = Duration::from_seconds(500); let task = TaskBuilder::new(QueryType::TimeInterval, VdafInstance::Fake) @@ -671,9 +670,9 @@ mod tests { let leader_task = task.leader_view().unwrap(); let batch_interval = Interval::new(clock.now(), Duration::from_seconds(2000)).unwrap(); - let aggregation_param = AggregationParam(0); + let aggregation_param = dummy::AggregationParam(0); - let collection_job = CollectionJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + let collection_job = CollectionJob::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), random(), Query::new_time_interval(batch_interval), @@ -689,7 +688,7 @@ mod tests { Box::pin(async move { tx.put_aggregator_task(&task).await?; - tx.put_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>(&collection_job) + tx.put_collection_job::<0, TimeInterval, dummy::Vdaf>(&collection_job) .await?; let aggregation_job_id = random(); @@ -697,21 +696,19 @@ mod tests { .now() .to_batch_interval_start(task.time_precision()) .unwrap(); - tx.put_aggregation_job( - &AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( - *task.id(), - aggregation_job_id, - aggregation_param, - (), - Interval::from_time(&report_timestamp).unwrap(), - AggregationJobState::Finished, - AggregationJobStep::from(1), - ), - ) + tx.put_aggregation_job(&AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + aggregation_job_id, + aggregation_param, + (), + Interval::from_time(&report_timestamp).unwrap(), + AggregationJobState::Finished, + AggregationJobStep::from(1), + )) .await?; for offset in [0, 500, 1000, 1500] { - tx.put_batch(&Batch::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), Interval::new( clock.now().add(&Duration::from_seconds(offset)).unwrap(), @@ -729,10 +726,9 @@ mod tests { let report = LeaderStoredReport::new_dummy(*task.id(), report_timestamp); - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &report) - .await?; + tx.put_client_report(&dummy::Vdaf::new(1), &report).await?; - tx.put_report_aggregation(&ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + tx.put_report_aggregation(&ReportAggregation::<0, dummy::Vdaf>::new( *task.id(), aggregation_job_id, *report.metadata().id(), @@ -744,20 +740,20 @@ mod tests { .await?; tx.put_batch_aggregation( - &BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + &BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), Interval::new(clock.now(), time_precision).unwrap(), aggregation_param, 0, BatchAggregationState::Aggregating, - Some(dummy_vdaf::AggregateShare(0)), + Some(dummy::AggregateShare(0)), 5, ReportIdChecksum::get_decoded(&[3; 32]).unwrap(), ), ) .await?; tx.put_batch_aggregation( - &BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + &BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), Interval::new( clock.now().add(&Duration::from_seconds(1000)).unwrap(), @@ -767,7 +763,7 @@ mod tests { aggregation_param, 0, BatchAggregationState::Aggregating, - Some(dummy_vdaf::AggregateShare(0)), + Some(dummy::AggregateShare(0)), 5, ReportIdChecksum::get_decoded(&[2; 32]).unwrap(), ), @@ -811,7 +807,7 @@ mod tests { let leader_task = task.leader_view().unwrap(); let agg_auth_token = task.aggregator_auth_token(); let batch_interval = Interval::new(clock.now(), Duration::from_seconds(2000)).unwrap(); - let aggregation_param = AggregationParam(0); + let aggregation_param = dummy::AggregationParam(0); let report_timestamp = clock .now() .to_batch_interval_start(task.time_precision()) @@ -825,7 +821,7 @@ mod tests { tx.put_aggregator_task(&task).await?; for offset in [0, 500, 1000, 1500] { - tx.put_batch(&Batch::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), Interval::new( clock.now().add(&Duration::from_seconds(offset)).unwrap(), @@ -842,38 +838,33 @@ mod tests { } let collection_job_id = random(); - tx.put_collection_job( - &CollectionJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( - *task.id(), - collection_job_id, - Query::new_time_interval(batch_interval), - aggregation_param, - batch_interval, - CollectionJobState::Collectable, - ), - ) + tx.put_collection_job(&CollectionJob::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + collection_job_id, + Query::new_time_interval(batch_interval), + aggregation_param, + batch_interval, + CollectionJobState::Collectable, + )) .await?; let aggregation_job_id = random(); - tx.put_aggregation_job( - &AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( - *task.id(), - aggregation_job_id, - aggregation_param, - (), - Interval::from_time(&report_timestamp).unwrap(), - AggregationJobState::Finished, - AggregationJobStep::from(1), - ), - ) + tx.put_aggregation_job(&AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + aggregation_job_id, + aggregation_param, + (), + Interval::from_time(&report_timestamp).unwrap(), + AggregationJobState::Finished, + AggregationJobStep::from(1), + )) .await?; let report = LeaderStoredReport::new_dummy(*task.id(), report_timestamp); - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &report) - .await?; + tx.put_client_report(&dummy::Vdaf::new(1), &report).await?; - tx.put_report_aggregation(&ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + tx.put_report_aggregation(&ReportAggregation::<0, dummy::Vdaf>::new( *task.id(), aggregation_job_id, *report.metadata().id(), @@ -919,13 +910,13 @@ mod tests { let (clock, task) = (clock.clone(), task.clone()); Box::pin(async move { tx.update_batch_aggregation( - &BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + &BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), Interval::new(clock.now(), time_precision).unwrap(), aggregation_param, 0, BatchAggregationState::Aggregating, - Some(dummy_vdaf::AggregateShare(0)), + Some(dummy::AggregateShare(0)), 5, ReportIdChecksum::get_decoded(&[3; 32]).unwrap(), ), @@ -934,7 +925,7 @@ mod tests { .unwrap(); tx.update_batch_aggregation( - &BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + &BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), Interval::new( clock.now().add(&Duration::from_seconds(1000)).unwrap(), @@ -944,7 +935,7 @@ mod tests { aggregation_param, 0, BatchAggregationState::Aggregating, - Some(dummy_vdaf::AggregateShare(0)), + Some(dummy::AggregateShare(0)), 5, ReportIdChecksum::get_decoded(&[2; 32]).unwrap(), ), @@ -1001,8 +992,8 @@ mod tests { Box::pin(async move { let collection_job = tx - .get_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( - &dummy_vdaf::Vdaf::new(), + .get_collection_job::<0, TimeInterval, dummy::Vdaf>( + &dummy::Vdaf::new(1), &task_id, &collection_job_id, ) @@ -1052,8 +1043,8 @@ mod tests { Box::pin(async move { let collection_job = tx - .get_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( - &dummy_vdaf::Vdaf::new(), + .get_collection_job::<0, TimeInterval, dummy::Vdaf>( + &dummy::Vdaf::new(1), &task_id, &collection_job_id, ) @@ -1110,8 +1101,8 @@ mod tests { let collection_job = collection_job.clone(); Box::pin(async move { let abandoned_collection_job = tx - .get_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( - &dummy_vdaf::Vdaf::new(), + .get_collection_job::<0, TimeInterval, dummy::Vdaf>( + &dummy::Vdaf::new(1), collection_job.task_id(), collection_job.id(), ) @@ -1212,8 +1203,8 @@ mod tests { .run_unnamed_tx(|tx| { let collection_job = collection_job.clone(); Box::pin(async move { - tx.get_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( - &dummy_vdaf::Vdaf::new(), + tx.get_collection_job::<0, TimeInterval, dummy::Vdaf>( + &dummy::Vdaf::new(1), collection_job.task_id(), collection_job.id(), ) @@ -1313,8 +1304,8 @@ mod tests { .run_unnamed_tx(|tx| { let collection_job = collection_job.clone(); Box::pin(async move { - tx.get_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( - &dummy_vdaf::Vdaf::new(), + tx.get_collection_job::<0, TimeInterval, dummy::Vdaf>( + &dummy::Vdaf::new(1), collection_job.task_id(), collection_job.id(), ) @@ -1348,7 +1339,7 @@ mod tests { ds.run_unnamed_tx(|tx| { let collection_job = collection_job.clone(); Box::pin(async move { - tx.update_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>(&collection_job) + tx.update_collection_job::<0, TimeInterval, dummy::Vdaf>(&collection_job) .await }) }) @@ -1391,8 +1382,8 @@ mod tests { let collection_job = collection_job.clone(); Box::pin(async move { let collection_job = tx - .get_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( - &dummy_vdaf::Vdaf::new(), + .get_collection_job::<0, TimeInterval, dummy::Vdaf>( + &dummy::Vdaf::new(1), collection_job.task_id(), collection_job.id(), ) diff --git a/aggregator/src/aggregator/collection_job_tests.rs b/aggregator/src/aggregator/collection_job_tests.rs index 9a383425d..c96b396f9 100644 --- a/aggregator/src/aggregator/collection_job_tests.rs +++ b/aggregator/src/aggregator/collection_job_tests.rs @@ -25,11 +25,7 @@ use janus_aggregator_core::{ use janus_core::{ auth_tokens::AuthenticationToken, hpke::{self, HpkeApplicationInfo, Label}, - test_util::{ - dummy_vdaf::{self, AggregationParam}, - install_test_trace_subscriber, - runtime::TestRuntime, - }, + test_util::{install_test_trace_subscriber, runtime::TestRuntime}, time::{Clock, IntervalExt, MockClock}, vdaf::VdafInstance, }; @@ -38,7 +34,10 @@ use janus_messages::{ AggregateShareAad, AggregationJobStep, BatchId, BatchSelector, Collection, CollectionJobId, CollectionReq, Duration, FixedSizeQuery, Interval, Query, ReportIdChecksum, Role, Time, }; -use prio::codec::{Decode, Encode}; +use prio::{ + codec::{Decode, Encode}, + vdaf::dummy, +}; use rand::random; use serde_json::json; use std::{collections::HashSet, sync::Arc}; @@ -192,10 +191,10 @@ async fn setup_fixed_size_current_batch_collection_job_test_case( Box::pin(async move { for batch_id in [batch_id_1, batch_id_2] { let aggregation_job_id = random(); - tx.put_aggregation_job::<0, FixedSize, dummy_vdaf::Vdaf>(&AggregationJob::new( + tx.put_aggregation_job::<0, FixedSize, dummy::Vdaf>(&AggregationJob::new( *task.id(), aggregation_job_id, - AggregationParam::default(), + dummy::AggregationParam::default(), batch_id, interval, AggregationJobState::Finished, @@ -206,11 +205,11 @@ async fn setup_fixed_size_current_batch_collection_job_test_case( for ord in 0..task.min_batch_size() + 1 { let report = LeaderStoredReport::new_dummy(*task.id(), time); - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &report) + tx.put_client_report(&dummy::Vdaf::new(1), &report) .await .unwrap(); - tx.put_report_aggregation::<0, dummy_vdaf::Vdaf>(&ReportAggregation::new( + tx.put_report_aggregation::<0, dummy::Vdaf>(&ReportAggregation::new( *task.id(), aggregation_job_id, *report.metadata().id(), @@ -223,25 +222,23 @@ async fn setup_fixed_size_current_batch_collection_job_test_case( .unwrap(); } - tx.put_batch_aggregation::<0, FixedSize, dummy_vdaf::Vdaf>( - &BatchAggregation::new( - *task.id(), - batch_id, - AggregationParam::default(), - 0, - BatchAggregationState::Aggregating, - Some(dummy_vdaf::AggregateShare(0)), - task.min_batch_size() + 1, - ReportIdChecksum::default(), - ), - ) + tx.put_batch_aggregation::<0, FixedSize, dummy::Vdaf>(&BatchAggregation::new( + *task.id(), + batch_id, + dummy::AggregationParam::default(), + 0, + BatchAggregationState::Aggregating, + Some(dummy::AggregateShare(0)), + task.min_batch_size() + 1, + ReportIdChecksum::default(), + )) .await .unwrap(); - tx.put_batch::<0, FixedSize, dummy_vdaf::Vdaf>(&Batch::new( + tx.put_batch::<0, FixedSize, dummy::Vdaf>(&Batch::new( *task.id(), batch_id, - AggregationParam::default(), + dummy::AggregationParam::default(), BatchState::Closed, 0, interval, @@ -273,10 +270,10 @@ async fn collection_job_success_fixed_size() { let mut saw_batch_id_1 = false; let mut saw_batch_id_2 = false; - let vdaf = dummy_vdaf::Vdaf::new(); - let leader_aggregate_share = dummy_vdaf::AggregateShare(0); - let helper_aggregate_share = dummy_vdaf::AggregateShare(1); - let aggregation_param = dummy_vdaf::AggregationParam::default(); + let vdaf = dummy::Vdaf::new(1); + let leader_aggregate_share = dummy::AggregateShare(0); + let helper_aggregate_share = dummy::AggregateShare(1); + let aggregation_param = dummy::AggregationParam::default(); let request = CollectionReq::new( Query::new_fixed_size(FixedSizeQuery::CurrentBatch), aggregation_param.get_encoded().unwrap(), @@ -302,7 +299,7 @@ async fn collection_job_success_fixed_size() { let helper_aggregate_share_bytes = helper_aggregate_share.get_encoded().unwrap(); Box::pin(async move { let collection_job = tx - .get_collection_job::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_collection_job::<0, FixedSize, dummy::Vdaf>( &vdaf, task.id(), &collection_job_id, @@ -330,7 +327,7 @@ async fn collection_job_success_fixed_size() { ) .unwrap(); - tx.update_collection_job::<0, FixedSize, dummy_vdaf::Vdaf>( + tx.update_collection_job::<0, FixedSize, dummy::Vdaf>( &collection_job.with_state(CollectionJobState::Finished { report_count: task.min_batch_size() + 1, encrypted_helper_aggregate_share, @@ -383,8 +380,7 @@ async fn collection_job_success_fixed_size() { .unwrap(); assert_eq!( leader_aggregate_share, - dummy_vdaf::AggregateShare::get_decoded(decrypted_leader_aggregate_share.as_ref()) - .unwrap() + dummy::AggregateShare::get_decoded(decrypted_leader_aggregate_share.as_ref()).unwrap() ); let decrypted_helper_aggregate_share = hpke::open( @@ -402,8 +398,7 @@ async fn collection_job_success_fixed_size() { .unwrap(); assert_eq!( helper_aggregate_share, - dummy_vdaf::AggregateShare::get_decoded(decrypted_helper_aggregate_share.as_ref()) - .unwrap() + dummy::AggregateShare::get_decoded(decrypted_helper_aggregate_share.as_ref()).unwrap() ); } @@ -441,7 +436,7 @@ async fn collection_job_put_idempotence_time_interval() { ) .unwrap(), ), - AggregationParam::default().get_encoded().unwrap(), + dummy::AggregationParam::default().get_encoded().unwrap(), ); for _ in 0..2 { @@ -456,12 +451,10 @@ async fn collection_job_put_idempotence_time_interval() { .datastore .run_unnamed_tx(|tx| { let task_id = *test_case.task.id(); - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::new(1); Box::pin(async move { let collection_jobs = tx - .get_collection_jobs_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( - &vdaf, &task_id, - ) + .get_collection_jobs_for_task::<0, TimeInterval, dummy::Vdaf>(&vdaf, &task_id) .await .unwrap(); assert_eq!(collection_jobs.len(), 1); @@ -492,7 +485,7 @@ async fn collection_job_put_idempotence_time_interval_varied_collection_id() { ) .unwrap(), ), - AggregationParam::default().get_encoded().unwrap(), + dummy::AggregationParam::default().get_encoded().unwrap(), ); for collection_job_id in &collection_job_ids { @@ -510,8 +503,8 @@ async fn collection_job_put_idempotence_time_interval_varied_collection_id() { Box::pin(async move { let collection_jobs = tx - .get_collection_jobs_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( - &dummy_vdaf::Vdaf::new(), + .get_collection_jobs_for_task::<0, TimeInterval, dummy::Vdaf>( + &dummy::Vdaf::new(1), &task_id, ) .await @@ -546,7 +539,7 @@ async fn collection_job_put_idempotence_fixed_size_varied_collection_id() { let collection_job_ids = HashSet::from(random::<[CollectionJobId; 2]>()); let request = CollectionReq::new( Query::new_fixed_size(FixedSizeQuery::ByBatchId { batch_id }), - AggregationParam::default().get_encoded().unwrap(), + dummy::AggregationParam::default().get_encoded().unwrap(), ); for collection_job_id in &collection_job_ids { @@ -564,8 +557,8 @@ async fn collection_job_put_idempotence_fixed_size_varied_collection_id() { Box::pin(async move { let collection_jobs = tx - .get_collection_jobs_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( - &dummy_vdaf::Vdaf::new(), + .get_collection_jobs_for_task::<0, FixedSize, dummy::Vdaf>( + &dummy::Vdaf::new(1), &task_id, ) .await @@ -600,7 +593,7 @@ async fn collection_job_put_idempotence_time_interval_mutate_time_interval() { ) .unwrap(), ), - AggregationParam::default().get_encoded().unwrap(), + dummy::AggregationParam::default().get_encoded().unwrap(), ); let response = test_case @@ -616,7 +609,7 @@ async fn collection_job_put_idempotence_time_interval_mutate_time_interval() { ) .unwrap(), ), - AggregationParam::default().get_encoded().unwrap(), + dummy::AggregationParam::default().get_encoded().unwrap(), ); let response = test_case @@ -638,7 +631,7 @@ async fn collection_job_put_idempotence_time_interval_mutate_aggregation_param() ) .unwrap(), ), - AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), ); let response = test_case @@ -654,7 +647,7 @@ async fn collection_job_put_idempotence_time_interval_mutate_aggregation_param() ) .unwrap(), ), - AggregationParam(1).get_encoded().unwrap(), + dummy::AggregationParam(1).get_encoded().unwrap(), ); let response = test_case @@ -671,7 +664,7 @@ async fn collection_job_put_idempotence_fixed_size_current_batch() { let collection_job_id = random(); let request = CollectionReq::new( Query::new_fixed_size(FixedSizeQuery::CurrentBatch), - AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), ); let mut seen_batch_id = None; @@ -689,11 +682,9 @@ async fn collection_job_put_idempotence_fixed_size_current_batch() { .run_unnamed_tx(|tx| { let task_id = *test_case.task.id(); Box::pin(async move { - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::new(1); let collection_jobs = tx - .get_collection_jobs_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( - &vdaf, &task_id, - ) + .get_collection_jobs_for_task::<0, FixedSize, dummy::Vdaf>(&vdaf, &task_id) .await .unwrap(); assert_eq!(collection_jobs.len(), 1); @@ -722,7 +713,7 @@ async fn collection_job_put_idempotence_fixed_size_current_batch_mutate_aggregat let collection_job_id = random(); let request = CollectionReq::new( Query::new_fixed_size(FixedSizeQuery::CurrentBatch), - AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), ); let response = test_case @@ -733,7 +724,7 @@ async fn collection_job_put_idempotence_fixed_size_current_batch_mutate_aggregat let mutated_request = CollectionReq::new( Query::new_fixed_size(FixedSizeQuery::CurrentBatch), - AggregationParam(1).get_encoded().unwrap(), + dummy::AggregationParam(1).get_encoded().unwrap(), ); let response = test_case @@ -751,7 +742,7 @@ async fn collection_job_put_idempotence_fixed_size_current_batch_no_extra_report let collection_job_id_2 = random(); let request = Arc::new(CollectionReq::new( Query::new_fixed_size(FixedSizeQuery::CurrentBatch), - AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), )); // Create the first collection job. @@ -805,10 +796,10 @@ async fn collection_job_put_idempotence_fixed_size_by_batch_id() { .run_unnamed_tx(|tx| { let task_id = *test_case.task.id(); Box::pin(async move { - tx.put_batch(&Batch::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, FixedSize, dummy::Vdaf>::new( task_id, batch_id, - AggregationParam(0), + dummy::AggregationParam(0), BatchState::Closed, 0, Interval::new( @@ -827,7 +818,7 @@ async fn collection_job_put_idempotence_fixed_size_by_batch_id() { let request = CollectionReq::new( Query::new_fixed_size(FixedSizeQuery::ByBatchId { batch_id }), - AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), ); for _ in 0..2 { @@ -860,10 +851,10 @@ async fn collection_job_put_idempotence_fixed_size_by_batch_id_mutate_batch_id() let task_id = *test_case.task.id(); Box::pin(async move { for batch_id in [first_batch_id, second_batch_id] { - tx.put_batch(&Batch::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, FixedSize, dummy::Vdaf>::new( task_id, batch_id, - AggregationParam(0), + dummy::AggregationParam(0), BatchState::Closed, 0, Interval::new( @@ -888,7 +879,7 @@ async fn collection_job_put_idempotence_fixed_size_by_batch_id_mutate_batch_id() Query::new_fixed_size(FixedSizeQuery::ByBatchId { batch_id: first_batch_id, }), - AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), ), ) .await; @@ -901,7 +892,7 @@ async fn collection_job_put_idempotence_fixed_size_by_batch_id_mutate_batch_id() Query::new_fixed_size(FixedSizeQuery::ByBatchId { batch_id: second_batch_id, }), - AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), ), ) .await; @@ -921,8 +912,8 @@ async fn collection_job_put_idempotence_fixed_size_by_batch_id_mutate_aggregatio let collection_job_id = random(); let batch_id = random(); - let first_aggregation_param = AggregationParam(0); - let second_aggregation_param = AggregationParam(1); + let first_aggregation_param = dummy::AggregationParam(0); + let second_aggregation_param = dummy::AggregationParam(1); test_case .datastore @@ -930,7 +921,7 @@ async fn collection_job_put_idempotence_fixed_size_by_batch_id_mutate_aggregatio let task_id = *test_case.task.id(); Box::pin(async move { for aggregation_param in [first_aggregation_param, second_aggregation_param] { - tx.put_batch(&Batch::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, FixedSize, dummy::Vdaf>::new( task_id, batch_id, aggregation_param, diff --git a/aggregator/src/aggregator/garbage_collector.rs b/aggregator/src/aggregator/garbage_collector.rs index 56762970a..34bcec5d1 100644 --- a/aggregator/src/aggregator/garbage_collector.rs +++ b/aggregator/src/aggregator/garbage_collector.rs @@ -186,10 +186,7 @@ mod tests { test_util::noop_meter, }; use janus_core::{ - test_util::{ - dummy_vdaf::{self, AggregateShare, AggregationParam}, - install_test_trace_subscriber, - }, + test_util::install_test_trace_subscriber, time::{Clock, IntervalExt, MockClock, TimeExt}, vdaf::VdafInstance, }; @@ -198,6 +195,7 @@ mod tests { AggregationJobStep, Duration, FixedSizeQuery, HpkeCiphertext, HpkeConfigId, Interval, Query, ReportIdChecksum, ReportMetadata, ReportShare, Role, Time, }; + use prio::vdaf::dummy; use rand::random; use std::sync::Arc; @@ -211,7 +209,7 @@ mod tests { let clock = MockClock::new(OLDEST_ALLOWED_REPORT_TIMESTAMP); let ephemeral_datastore = ephemeral_datastore().await; let ds = Arc::new(ephemeral_datastore.datastore(clock.clone()).await); - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::new(1); // Setup. let task = ds @@ -239,17 +237,15 @@ mod tests { // Aggregation artifacts. let aggregation_job_id = random(); - tx.put_aggregation_job( - &AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( - *task.id(), - aggregation_job_id, - AggregationParam(0), - (), - Interval::from_time(&client_timestamp).unwrap(), - AggregationJobState::InProgress, - AggregationJobStep::from(0), - ), - ) + tx.put_aggregation_job(&AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + aggregation_job_id, + dummy::AggregationParam(0), + (), + Interval::from_time(&client_timestamp).unwrap(), + AggregationJobState::InProgress, + AggregationJobStep::from(0), + )) .await .unwrap(); @@ -260,10 +256,10 @@ mod tests { .unwrap(); // Collection artifacts. - tx.put_batch(&Batch::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), Interval::from_time(&client_timestamp).unwrap(), // unrealistic, but induces GC - AggregationParam(0), + dummy::AggregationParam(0), BatchState::Closed, 0, Interval::from_time(&client_timestamp).unwrap(), @@ -272,13 +268,13 @@ mod tests { .unwrap(); tx.put_batch_aggregation( - &BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + &BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), batch_identifier, - AggregationParam(0), + dummy::AggregationParam(0), 0, BatchAggregationState::Collected, - Some(AggregateShare(11)), + Some(dummy::AggregateShare(11)), 1, random(), ), @@ -286,16 +282,14 @@ mod tests { .await .unwrap(); - tx.put_collection_job( - &CollectionJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( - *task.id(), - random(), - Query::new_time_interval(batch_identifier), - AggregationParam(0), - batch_identifier, - CollectionJobState::Start, - ), - ) + tx.put_collection_job(&CollectionJob::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + random(), + Query::new_time_interval(batch_identifier), + dummy::AggregationParam(0), + batch_identifier, + CollectionJobState::Start, + )) .await .unwrap(); @@ -331,17 +325,17 @@ mod tests { let (vdaf, task) = (vdaf.clone(), Arc::clone(&task)); Box::pin(async move { assert!(tx - .get_client_reports_for_task::<0, dummy_vdaf::Vdaf>(&vdaf, task.id()) + .get_client_reports_for_task::<0, dummy::Vdaf>(&vdaf, task.id()) .await .unwrap() .is_empty()); assert!(tx - .get_aggregation_jobs_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>(task.id()) + .get_aggregation_jobs_for_task::<0, TimeInterval, dummy::Vdaf>(task.id()) .await .unwrap() .is_empty()); assert!(tx - .get_report_aggregations_for_task::<0, dummy_vdaf::Vdaf>( + .get_report_aggregations_for_task::<0, dummy::Vdaf>( &vdaf, &Role::Leader, task.id(), @@ -350,12 +344,12 @@ mod tests { .unwrap() .is_empty()); assert!(tx - .get_batches_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>(task.id()) + .get_batches_for_task::<0, TimeInterval, dummy::Vdaf>(task.id()) .await .unwrap() .is_empty()); assert!(tx - .get_batch_aggregations_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_batch_aggregations_for_task::<0, TimeInterval, dummy::Vdaf>( &vdaf, task.id(), ) @@ -363,10 +357,7 @@ mod tests { .unwrap() .is_empty()); assert!(tx - .get_collection_jobs_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( - &vdaf, - task.id(), - ) + .get_collection_jobs_for_task::<0, TimeInterval, dummy::Vdaf>(&vdaf, task.id(),) .await .unwrap() .is_empty()); @@ -384,7 +375,7 @@ mod tests { let clock = MockClock::new(OLDEST_ALLOWED_REPORT_TIMESTAMP); let ephemeral_datastore = ephemeral_datastore().await; let ds = Arc::new(ephemeral_datastore.datastore(clock.clone()).await); - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::new(1); // Setup. let task = ds @@ -420,21 +411,19 @@ mod tests { // Aggregation artifacts. let aggregation_job_id = random(); - tx.put_aggregation_job( - &AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( - *task.id(), - aggregation_job_id, - AggregationParam(0), - (), - Interval::from_time(&client_timestamp).unwrap(), - AggregationJobState::InProgress, - AggregationJobStep::from(0), - ), - ) + tx.put_aggregation_job(&AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + aggregation_job_id, + dummy::AggregationParam(0), + (), + Interval::from_time(&client_timestamp).unwrap(), + AggregationJobState::InProgress, + AggregationJobStep::from(0), + )) .await .unwrap(); - tx.put_report_aggregation(&ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + tx.put_report_aggregation(&ReportAggregation::<0, dummy::Vdaf>::new( *task.id(), aggregation_job_id, *report_share.metadata().id(), @@ -447,10 +436,10 @@ mod tests { .unwrap(); // Collection artifacts. - tx.put_batch(&Batch::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), Interval::from_time(&client_timestamp).unwrap(), // unrealistic, but induces GC - AggregationParam(0), + dummy::AggregationParam(0), BatchState::Closed, 0, Interval::from_time(&client_timestamp).unwrap(), @@ -459,13 +448,13 @@ mod tests { .unwrap(); tx.put_batch_aggregation( - &BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + &BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), batch_identifier, - AggregationParam(0), + dummy::AggregationParam(0), 0, BatchAggregationState::Collected, - Some(AggregateShare(11)), + Some(dummy::AggregateShare(11)), 1, random(), ), @@ -473,18 +462,16 @@ mod tests { .await .unwrap(); - tx.put_aggregate_share_job(&AggregateShareJob::< - 0, - TimeInterval, - dummy_vdaf::Vdaf, - >::new( - *task.id(), - batch_identifier, - AggregationParam(0), - AggregateShare(11), - 0, - ReportIdChecksum::default(), - )) + tx.put_aggregate_share_job( + &AggregateShareJob::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + batch_identifier, + dummy::AggregationParam(0), + dummy::AggregateShare(11), + 0, + ReportIdChecksum::default(), + ), + ) .await .unwrap(); @@ -520,17 +507,17 @@ mod tests { let (vdaf, task) = (vdaf.clone(), Arc::clone(&task)); Box::pin(async move { assert!(tx - .get_client_reports_for_task::<0, dummy_vdaf::Vdaf>(&vdaf, task.id()) + .get_client_reports_for_task::<0, dummy::Vdaf>(&vdaf, task.id()) .await .unwrap() .is_empty()); assert!(tx - .get_aggregation_jobs_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>(task.id()) + .get_aggregation_jobs_for_task::<0, TimeInterval, dummy::Vdaf>(task.id()) .await .unwrap() .is_empty()); assert!(tx - .get_report_aggregations_for_task::<0, dummy_vdaf::Vdaf>( + .get_report_aggregations_for_task::<0, dummy::Vdaf>( &vdaf, &Role::Leader, task.id(), @@ -539,12 +526,12 @@ mod tests { .unwrap() .is_empty()); assert!(tx - .get_batches_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>(task.id()) + .get_batches_for_task::<0, TimeInterval, dummy::Vdaf>(task.id()) .await .unwrap() .is_empty()); assert!(tx - .get_batch_aggregations_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_batch_aggregations_for_task::<0, TimeInterval, dummy::Vdaf>( &vdaf, task.id(), ) @@ -552,7 +539,7 @@ mod tests { .unwrap() .is_empty()); assert!(tx - .get_aggregate_share_jobs_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_aggregate_share_jobs_for_task::<0, TimeInterval, dummy::Vdaf>( &vdaf, task.id() ) @@ -573,7 +560,7 @@ mod tests { let clock = MockClock::new(OLDEST_ALLOWED_REPORT_TIMESTAMP); let ephemeral_datastore = ephemeral_datastore().await; let ds = Arc::new(ephemeral_datastore.datastore(clock.clone()).await); - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::new(1); // Setup. let task = ds @@ -605,10 +592,10 @@ mod tests { // Aggregation artifacts. let batch_id = random(); - let aggregation_job = AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let aggregation_job = AggregationJob::<0, FixedSize, dummy::Vdaf>::new( *task.id(), random(), - AggregationParam(0), + dummy::AggregationParam(0), batch_id, Interval::from_time(&client_timestamp).unwrap(), AggregationJobState::InProgress, @@ -623,10 +610,10 @@ mod tests { .unwrap(); // Collection artifacts. - tx.put_batch(&Batch::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, FixedSize, dummy::Vdaf>::new( *task.id(), batch_id, - AggregationParam(0), + dummy::AggregationParam(0), BatchState::Closed, 0, Interval::from_time(&client_timestamp).unwrap(), @@ -638,26 +625,24 @@ mod tests { .await .unwrap(); - tx.put_batch_aggregation( - &BatchAggregation::<0, FixedSize, dummy_vdaf::Vdaf>::new( - *task.id(), - batch_id, - AggregationParam(0), - 0, - BatchAggregationState::Collected, - Some(AggregateShare(11)), - 1, - random(), - ), - ) + tx.put_batch_aggregation(&BatchAggregation::<0, FixedSize, dummy::Vdaf>::new( + *task.id(), + batch_id, + dummy::AggregationParam(0), + 0, + BatchAggregationState::Collected, + Some(dummy::AggregateShare(11)), + 1, + random(), + )) .await .unwrap(); - tx.put_collection_job(&CollectionJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_collection_job(&CollectionJob::<0, FixedSize, dummy::Vdaf>::new( *task.id(), random(), Query::new_fixed_size(FixedSizeQuery::CurrentBatch), - AggregationParam(0), + dummy::AggregationParam(0), batch_id, CollectionJobState::Start, )) @@ -696,17 +681,17 @@ mod tests { let (vdaf, task) = (vdaf.clone(), Arc::clone(&task)); Box::pin(async move { assert!(tx - .get_client_reports_for_task::<0, dummy_vdaf::Vdaf>(&vdaf, task.id()) + .get_client_reports_for_task::<0, dummy::Vdaf>(&vdaf, task.id()) .await .unwrap() .is_empty()); assert!(tx - .get_aggregation_jobs_for_task::<0, FixedSize, dummy_vdaf::Vdaf>(task.id()) + .get_aggregation_jobs_for_task::<0, FixedSize, dummy::Vdaf>(task.id()) .await .unwrap() .is_empty()); assert!(tx - .get_report_aggregations_for_task::<0, dummy_vdaf::Vdaf>( + .get_report_aggregations_for_task::<0, dummy::Vdaf>( &vdaf, &Role::Leader, task.id(), @@ -715,7 +700,7 @@ mod tests { .unwrap() .is_empty()); assert!(tx - .get_batches_for_task::<0, FixedSize, dummy_vdaf::Vdaf>(task.id()) + .get_batches_for_task::<0, FixedSize, dummy::Vdaf>(task.id()) .await .unwrap() .is_empty()); @@ -725,18 +710,12 @@ mod tests { .unwrap() .is_empty()); assert!(tx - .get_batch_aggregations_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( - &vdaf, - task.id(), - ) + .get_batch_aggregations_for_task::<0, FixedSize, dummy::Vdaf>(&vdaf, task.id(),) .await .unwrap() .is_empty()); assert!(tx - .get_collection_jobs_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( - &vdaf, - task.id(), - ) + .get_collection_jobs_for_task::<0, FixedSize, dummy::Vdaf>(&vdaf, task.id(),) .await .unwrap() .is_empty()); @@ -754,7 +733,7 @@ mod tests { let clock = MockClock::new(OLDEST_ALLOWED_REPORT_TIMESTAMP); let ephemeral_datastore = ephemeral_datastore().await; let ds = Arc::new(ephemeral_datastore.datastore(clock.clone()).await); - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::new(1); // Setup. let task = ds @@ -794,10 +773,10 @@ mod tests { // Aggregation artifacts. let batch_id = random(); - let aggregation_job = AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let aggregation_job = AggregationJob::<0, FixedSize, dummy::Vdaf>::new( *task.id(), random(), - AggregationParam(0), + dummy::AggregationParam(0), batch_id, Interval::from_time(&client_timestamp).unwrap(), AggregationJobState::InProgress, @@ -805,7 +784,7 @@ mod tests { ); tx.put_aggregation_job(&aggregation_job).await.unwrap(); - let report_aggregation = ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + let report_aggregation = ReportAggregation::<0, dummy::Vdaf>::new( *task.id(), *aggregation_job.id(), *report_share.metadata().id(), @@ -819,10 +798,10 @@ mod tests { .unwrap(); // Collection artifacts. - tx.put_batch(&Batch::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, FixedSize, dummy::Vdaf>::new( *task.id(), batch_id, - AggregationParam(0), + dummy::AggregationParam(0), BatchState::Closed, 0, Interval::from_time(&client_timestamp).unwrap(), @@ -834,27 +813,25 @@ mod tests { .await .unwrap(); - tx.put_batch_aggregation( - &BatchAggregation::<0, FixedSize, dummy_vdaf::Vdaf>::new( - *task.id(), - batch_id, - AggregationParam(0), - 0, - BatchAggregationState::Collected, - Some(AggregateShare(11)), - 1, - random(), - ), - ) + tx.put_batch_aggregation(&BatchAggregation::<0, FixedSize, dummy::Vdaf>::new( + *task.id(), + batch_id, + dummy::AggregationParam(0), + 0, + BatchAggregationState::Collected, + Some(dummy::AggregateShare(11)), + 1, + random(), + )) .await .unwrap(); tx.put_aggregate_share_job( - &AggregateShareJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + &AggregateShareJob::<0, FixedSize, dummy::Vdaf>::new( *task.id(), batch_id, - AggregationParam(0), - AggregateShare(11), + dummy::AggregationParam(0), + dummy::AggregateShare(11), 0, ReportIdChecksum::default(), ), @@ -897,17 +874,17 @@ mod tests { let (vdaf, task) = (vdaf.clone(), Arc::clone(&task)); Box::pin(async move { assert!(tx - .get_client_reports_for_task::<0, dummy_vdaf::Vdaf>(&vdaf, task.id()) + .get_client_reports_for_task::<0, dummy::Vdaf>(&vdaf, task.id()) .await .unwrap() .is_empty()); assert!(tx - .get_aggregation_jobs_for_task::<0, FixedSize, dummy_vdaf::Vdaf>(task.id()) + .get_aggregation_jobs_for_task::<0, FixedSize, dummy::Vdaf>(task.id()) .await .unwrap() .is_empty()); assert!(tx - .get_report_aggregations_for_task::<0, dummy_vdaf::Vdaf>( + .get_report_aggregations_for_task::<0, dummy::Vdaf>( &vdaf, &Role::Leader, task.id(), @@ -916,20 +893,17 @@ mod tests { .unwrap() .is_empty()); assert!(tx - .get_batches_for_task::<0, FixedSize, dummy_vdaf::Vdaf>(task.id()) + .get_batches_for_task::<0, FixedSize, dummy::Vdaf>(task.id()) .await .unwrap() .is_empty()); assert!(tx - .get_batch_aggregations_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( - &vdaf, - task.id(), - ) + .get_batch_aggregations_for_task::<0, FixedSize, dummy::Vdaf>(&vdaf, task.id(),) .await .unwrap() .is_empty()); assert!(tx - .get_aggregate_share_jobs_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_aggregate_share_jobs_for_task::<0, FixedSize, dummy::Vdaf>( &vdaf, task.id(), ) diff --git a/aggregator/src/aggregator/http_handlers.rs b/aggregator/src/aggregator/http_handlers.rs index 64a5d059c..80514644e 100644 --- a/aggregator/src/aggregator/http_handlers.rs +++ b/aggregator/src/aggregator/http_handlers.rs @@ -840,11 +840,7 @@ mod tests { HpkeApplicationInfo, HpkeKeypair, Label, }, report_id::ReportIdChecksumExt, - test_util::{ - dummy_vdaf::{self, AggregationParam, OutputShare}, - install_test_trace_subscriber, run_vdaf, - runtime::TestRuntime, - }, + test_util::{install_test_trace_subscriber, run_vdaf, runtime::TestRuntime}, time::{Clock, DurationExt, MockClock, TimeExt}, vdaf::{VdafInstance, VERIFY_KEY_LENGTH}, }; @@ -863,6 +859,7 @@ mod tests { idpf::IdpfInput, topology::ping_pong::PingPongMessage, vdaf::{ + dummy, poplar1::{Poplar1, Poplar1AggregationParam}, xof::XofTurboShake128, Aggregator, @@ -1790,7 +1787,7 @@ mod tests { } #[tokio::test] - // Silence the unit_arg lint so that we can work with dummy_vdaf::Vdaf::{InputShare, + // Silence the unit_arg lint so that we can work with dummy::Vdaf::{InputShare, // Measurement} values (whose type is ()). #[allow(clippy::unit_arg, clippy::let_unit_value)] async fn aggregate_init() { @@ -1800,15 +1797,15 @@ mod tests { let helper_task = task.helper_view().unwrap(); - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::new(1); let verify_key: VerifyKey<0> = task.vdaf_verify_key().unwrap(); let hpke_key = helper_task.current_hpke_key(); - let measurement = (); + let measurement = 0; let prep_init_generator = PrepareInitGenerator::new( clock.clone(), helper_task.clone(), vdaf.clone(), - dummy_vdaf::AggregationParam(0), + dummy::AggregationParam(0), ); // prepare_init_0 is a "happy path" report. @@ -1867,7 +1864,7 @@ mod tests { break hpke_config; }; - let report_share_3 = generate_helper_report_share::( + let report_share_3 = generate_helper_report_share::( *task.id(), prepare_init_3.report_share().metadata().clone(), &wrong_hpke_config, @@ -1896,11 +1893,11 @@ mod tests { let transcript_5 = run_vdaf( &vdaf, verify_key.as_bytes(), - &dummy_vdaf::AggregationParam(0), + &dummy::AggregationParam(0), report_metadata_5.id(), &measurement, ); - let report_share_5 = generate_helper_report_share::( + let report_share_5 = generate_helper_report_share::( *task.id(), report_metadata_5, hpke_key.config(), @@ -1926,7 +1923,7 @@ mod tests { let transcript_6 = run_vdaf( &vdaf, verify_key.as_bytes(), - &dummy_vdaf::AggregationParam(0), + &dummy::AggregationParam(0), report_metadata_6.id(), &measurement, ); @@ -1956,11 +1953,11 @@ mod tests { let transcript_7 = run_vdaf( &vdaf, verify_key.as_bytes(), - &dummy_vdaf::AggregationParam(0), + &dummy::AggregationParam(0), report_metadata_7.id(), &measurement, ); - let report_share_7 = generate_helper_report_share::( + let report_share_7 = generate_helper_report_share::( *task.id(), report_metadata_7, hpke_key.config(), @@ -2003,19 +2000,19 @@ mod tests { let conflicting_aggregation_job = AggregationJob::new( *task.id(), random(), - dummy_vdaf::AggregationParam(0), + dummy::AggregationParam(0), (), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)) .unwrap(), AggregationJobState::InProgress, AggregationJobStep::from(0), ); - tx.put_aggregation_job::<0, TimeInterval, dummy_vdaf::Vdaf>( + tx.put_aggregation_job::<0, TimeInterval, dummy::Vdaf>( &conflicting_aggregation_job, ) .await .unwrap(); - tx.put_report_aggregation::<0, dummy_vdaf::Vdaf>(&ReportAggregation::new( + tx.put_report_aggregation::<0, dummy::Vdaf>(&ReportAggregation::new( *task.id(), *conflicting_aggregation_job.id(), *report_share_4.metadata().id(), @@ -2034,19 +2031,19 @@ mod tests { let non_conflicting_aggregation_job = AggregationJob::new( *task.id(), random(), - dummy_vdaf::AggregationParam(1), + dummy::AggregationParam(1), (), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)) .unwrap(), AggregationJobState::InProgress, AggregationJobStep::from(0), ); - tx.put_aggregation_job::<0, TimeInterval, dummy_vdaf::Vdaf>( + tx.put_aggregation_job::<0, TimeInterval, dummy::Vdaf>( &non_conflicting_aggregation_job, ) .await .unwrap(); - tx.put_report_aggregation::<0, dummy_vdaf::Vdaf>(&ReportAggregation::new( + tx.put_report_aggregation::<0, dummy::Vdaf>(&ReportAggregation::new( *task.id(), *non_conflicting_aggregation_job.id(), *report_share_8.metadata().id(), @@ -2060,7 +2057,7 @@ mod tests { // Put in an aggregate share job for the interval that report_share_5 falls into // which should cause it to later fail to prepare. - tx.put_aggregate_share_job::<0, TimeInterval, dummy_vdaf::Vdaf>( + tx.put_aggregate_share_job::<0, TimeInterval, dummy::Vdaf>( &AggregateShareJob::new( *task.id(), Interval::new( @@ -2068,8 +2065,8 @@ mod tests { *task.time_precision(), ) .unwrap(), - dummy_vdaf::AggregationParam(0), - dummy_vdaf::AggregateShare(0), + dummy::AggregationParam(0), + dummy::AggregateShare(0), 1, ReportIdChecksum::for_report_id(report_share_5.metadata().id()), ), @@ -2082,7 +2079,7 @@ mod tests { .await .unwrap(); - let aggregation_param = dummy_vdaf::AggregationParam(0); + let aggregation_param = dummy::AggregationParam(0); let request = AggregationJobInitializeReq::new( aggregation_param.get_encoded().unwrap(), PartialBatchSelector::new_time_interval(), @@ -2209,7 +2206,7 @@ mod tests { let vdaf = vdaf.clone(); Box::pin(async move { Ok(( - tx.get_aggregation_jobs_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + tx.get_aggregation_jobs_for_task::<0, TimeInterval, dummy::Vdaf>( task.id(), ) .await?, @@ -2272,17 +2269,17 @@ mod tests { let helper_task = task.helper_view().unwrap(); datastore.put_aggregator_task(&helper_task).await.unwrap(); - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::new(1); let prep_init_generator = PrepareInitGenerator::new( clock.clone(), helper_task.clone(), vdaf.clone(), - dummy_vdaf::AggregationParam(0), + dummy::AggregationParam(0), ); - let (prepare_init, _) = prep_init_generator.next(&()); + let (prepare_init, _) = prep_init_generator.next(&0); - let aggregation_param = dummy_vdaf::AggregationParam(0); + let aggregation_param = dummy::AggregationParam(0); let batch_id = random(); let request = AggregationJobInitializeReq::new( aggregation_param.get_encoded().unwrap(), @@ -2298,10 +2295,10 @@ mod tests { let timestamp = *prepare_init.report_share().metadata().time(); Box::pin(async move { let interval = Interval::new(timestamp, Duration::from_seconds(1)).unwrap(); - let batch = Batch::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let batch = Batch::<0, FixedSize, dummy::Vdaf>::new( *task.id(), batch_id, - AggregationParam(0), + dummy::AggregationParam(0), BatchState::Open, 0, interval, @@ -2311,17 +2308,16 @@ mod tests { // Insert for all possible shards, since we non-deterministically assign shards // to batches on insertion. for shard in 0..BATCH_AGGREGATION_SHARD_COUNT { - let batch_aggregation = - BatchAggregation::<0, FixedSize, dummy_vdaf::Vdaf>::new( - *task.id(), - batch_id, - AggregationParam(0), - shard, - BatchAggregationState::Collected, - Some(OutputShare().into()), - 1, - ReportIdChecksum::for_report_id(&random()), - ); + let batch_aggregation = BatchAggregation::<0, FixedSize, dummy::Vdaf>::new( + *task.id(), + batch_id, + dummy::AggregationParam(0), + shard, + BatchAggregationState::Collected, + Some(dummy::OutputShare(0).into()), + 1, + ReportIdChecksum::for_report_id(&random()), + ); tx.put_batch_aggregation(&batch_aggregation).await.unwrap(); } @@ -2369,8 +2365,8 @@ mod tests { let helper_task = task.helper_view().unwrap(); datastore.put_aggregator_task(&helper_task).await.unwrap(); - let vdaf = dummy_vdaf::Vdaf::new(); - let aggregation_param = dummy_vdaf::AggregationParam(0); + let vdaf = dummy::Vdaf::new(1); + let aggregation_param = dummy::AggregationParam(0); let prep_init_generator = PrepareInitGenerator::new( clock.clone(), helper_task.clone(), @@ -2422,12 +2418,12 @@ mod tests { // This report was encrypted with a global HPKE config that has the same config // ID as the task's HPKE config. - let (prepare_init_same_id, transcript_same_id) = prep_init_generator.next(&()); + let (prepare_init_same_id, transcript_same_id) = prep_init_generator.next(&0); // This report was encrypted with a global HPKE config that has the same config // ID as the task's HPKE config, but will fail to decrypt. let (prepare_init_same_id_corrupted, transcript_same_id_corrupted) = - prep_init_generator.next(&()); + prep_init_generator.next(&0); let encrypted_input_share = prepare_init_same_id_corrupted .report_share() @@ -2467,11 +2463,11 @@ mod tests { let transcript_different_id = run_vdaf( &vdaf, verify_key.as_bytes(), - &dummy_vdaf::AggregationParam(0), + &dummy::AggregationParam(0), report_metadata_different_id.id(), - &(), + &0, ); - let report_share_different_id = generate_helper_report_share::( + let report_share_different_id = generate_helper_report_share::( *task.id(), report_metadata_different_id, global_hpke_keypair_different_id.config(), @@ -2499,11 +2495,11 @@ mod tests { let transcript_different_id_corrupted = run_vdaf( &vdaf, verify_key.as_bytes(), - &dummy_vdaf::AggregationParam(0), + &dummy::AggregationParam(0), report_metadata_different_id_corrupted.id(), - &(), + &0, ); - let report_share_different_id_corrupted = generate_helper_report_share::( + let report_share_different_id_corrupted = generate_helper_report_share::( *task.id(), report_metadata_different_id_corrupted.clone(), global_hpke_keypair_different_id.config(), @@ -2537,7 +2533,7 @@ mod tests { let aggregation_job_id: AggregationJobId = random(); let request = AggregationJobInitializeReq::new( - dummy_vdaf::AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), PartialBatchSelector::new_time_interval(), Vec::from([ prepare_init_same_id.clone(), @@ -2608,7 +2604,7 @@ mod tests { async fn aggregate_init_change_report_timestamp() { let test_case = setup_aggregate_init_test().await; - let other_aggregation_parameter = dummy_vdaf::AggregationParam(1); + let other_aggregation_parameter = dummy::AggregationParam(1); assert_ne!(test_case.aggregation_param, other_aggregation_parameter); // This report has the same ID as the previous one, but a different timestamp. @@ -2625,7 +2621,7 @@ mod tests { ); let (mutated_timestamp_prepare_init, _) = test_case .prepare_init_generator - .next_with_metadata(mutated_timestamp_report_metadata, &()); + .next_with_metadata(mutated_timestamp_report_metadata, &0); // Send another aggregate job re-using the same report ID but with a different timestamp. It // should be flagged as a replay. @@ -2694,15 +2690,15 @@ mod tests { let prep_init_generator = PrepareInitGenerator::new( clock.clone(), helper_task.clone(), - dummy_vdaf::Vdaf::new(), - dummy_vdaf::AggregationParam(0), + dummy::Vdaf::new(1), + dummy::AggregationParam(0), ); datastore.put_aggregator_task(&helper_task).await.unwrap(); - let (prepare_init, _) = prep_init_generator.next(&()); + let (prepare_init, _) = prep_init_generator.next(&0); let request = AggregationJobInitializeReq::new( - dummy_vdaf::AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), PartialBatchSelector::new_time_interval(), Vec::from([prepare_init.clone()]), ); @@ -2742,15 +2738,15 @@ mod tests { let prep_init_generator = PrepareInitGenerator::new( clock.clone(), helper_task.clone(), - dummy_vdaf::Vdaf::new(), - dummy_vdaf::AggregationParam(0), + dummy::Vdaf::new(1), + dummy::AggregationParam(0), ); datastore.put_aggregator_task(&helper_task).await.unwrap(); - let (prepare_init, _) = prep_init_generator.next(&()); + let (prepare_init, _) = prep_init_generator.next(&0); let request = AggregationJobInitializeReq::new( - dummy_vdaf::AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), PartialBatchSelector::new_time_interval(), Vec::from([prepare_init.clone()]), ); @@ -2789,16 +2785,16 @@ mod tests { let prep_init_generator = PrepareInitGenerator::new( clock.clone(), helper_task.clone(), - dummy_vdaf::Vdaf::new(), - dummy_vdaf::AggregationParam(0), + dummy::Vdaf::new(1), + dummy::AggregationParam(0), ); datastore.put_aggregator_task(&helper_task).await.unwrap(); - let (prepare_init, _) = prep_init_generator.next(&()); + let (prepare_init, _) = prep_init_generator.next(&0); let request = AggregationJobInitializeReq::new( - dummy_vdaf::AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), PartialBatchSelector::new_time_interval(), Vec::from([prepare_init.clone(), prepare_init]), ); @@ -4420,23 +4416,18 @@ mod tests { ), ) .await?; - tx.put_aggregation_job( - &AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( - *task.id(), - aggregation_job_id, - dummy_vdaf::AggregationParam(0), - (), - Interval::new( - Time::from_seconds_since_epoch(0), - Duration::from_seconds(1), - ) + tx.put_aggregation_job(&AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + aggregation_job_id, + dummy::AggregationParam(0), + (), + Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)) .unwrap(), - AggregationJobState::InProgress, - AggregationJobStep::from(0), - ), - ) + AggregationJobState::InProgress, + AggregationJobStep::from(0), + )) .await?; - tx.put_report_aggregation(&ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + tx.put_report_aggregation(&ReportAggregation::<0, dummy::Vdaf>::new( *task.id(), aggregation_job_id, *report_metadata.id(), @@ -4490,9 +4481,7 @@ mod tests { ) .unwrap(), ), - dummy_vdaf::AggregationParam::default() - .get_encoded() - .unwrap(), + dummy::AggregationParam::default().get_encoded().unwrap(), ); let mut test_conn = test_case @@ -4525,9 +4514,7 @@ mod tests { ) .unwrap(), ), - dummy_vdaf::AggregationParam::default() - .get_encoded() - .unwrap(), + dummy::AggregationParam::default().get_encoded().unwrap(), ); let mut test_conn = test_case @@ -4559,7 +4546,7 @@ mod tests { ) .unwrap(), ), - // dummy_vdaf::AggregationParam is a tuple struct wrapping a u8, so this is not a valid + // dummy::AggregationParam is a tuple struct wrapping a u8, so this is not a valid // encoding of an aggregation parameter. Vec::from([0u8, 0u8]), ); @@ -4600,9 +4587,7 @@ mod tests { ) .unwrap(), ), - dummy_vdaf::AggregationParam::default() - .get_encoded() - .unwrap(), + dummy::AggregationParam::default().get_encoded().unwrap(), ); let (header, value) = task.collector_auth_token().request_authentication(); @@ -4641,9 +4626,7 @@ mod tests { let collection_job_id: CollectionJobId = random(); let req = CollectionReq::new( Query::new_time_interval(batch_interval), - dummy_vdaf::AggregationParam::default() - .get_encoded() - .unwrap(), + dummy::AggregationParam::default().get_encoded().unwrap(), ); // Incorrect authentication token. @@ -4715,9 +4698,7 @@ mod tests { let collection_job_id: CollectionJobId = random(); let request = CollectionReq::new( Query::new_time_interval(batch_interval), - dummy_vdaf::AggregationParam::default() - .get_encoded() - .unwrap(), + dummy::AggregationParam::default().get_encoded().unwrap(), ); let test_conn = test_case @@ -4792,9 +4773,9 @@ mod tests { ) .unwrap(); - let aggregation_param = dummy_vdaf::AggregationParam::default(); - let leader_aggregate_share = dummy_vdaf::AggregateShare(0); - let helper_aggregate_share = dummy_vdaf::AggregateShare(1); + let aggregation_param = dummy::AggregationParam::default(); + let leader_aggregate_share = dummy::AggregateShare(0); + let helper_aggregate_share = dummy::AggregateShare(1); let collection_job_id: CollectionJobId = random(); let request = CollectionReq::new( @@ -4808,7 +4789,7 @@ mod tests { let task_id = *test_case.task.id(); Box::pin(async move { - tx.put_batch(&Batch::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, TimeInterval, dummy::Vdaf>::new( task_id, batch_interval, aggregation_param, @@ -4827,7 +4808,7 @@ mod tests { .put_collection_job(&collection_job_id, &request) .await; - let want_collection_job = CollectionJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + let want_collection_job = CollectionJob::<0, TimeInterval, dummy::Vdaf>::new( *test_case.task.id(), collection_job_id, Query::new_time_interval(batch_interval), @@ -4835,7 +4816,7 @@ mod tests { batch_interval, CollectionJobState::Start, ); - let want_batches = Vec::from([Batch::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + let want_batches = Vec::from([Batch::<0, TimeInterval, dummy::Vdaf>::new( *test_case.task.id(), batch_interval, aggregation_param, @@ -4851,7 +4832,7 @@ mod tests { Box::pin(async move { let got_collection_job = tx - .get_collection_job(&dummy_vdaf::Vdaf::new(), &task_id, &collection_job_id) + .get_collection_job(&dummy::Vdaf::new(1), &task_id, &collection_job_id) .await? .unwrap(); let got_batches = tx.get_batches_for_task(&task_id).await?; @@ -4896,8 +4877,8 @@ mod tests { .unwrap(); let collection_job = tx - .get_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( - &dummy_vdaf::Vdaf::new(), + .get_collection_job::<0, TimeInterval, dummy::Vdaf>( + &dummy::Vdaf::new(1), task.id(), &collection_job_id, ) @@ -4910,7 +4891,7 @@ mod tests { leader_aggregate_share, }); - tx.update_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>(&collection_job) + tx.update_collection_job::<0, TimeInterval, dummy::Vdaf>(&collection_job) .await .unwrap(); Ok(()) @@ -4946,8 +4927,7 @@ mod tests { .unwrap(); assert_eq!( leader_aggregate_share, - dummy_vdaf::AggregateShare::get_decoded(decrypted_leader_aggregate_share.as_ref()) - .unwrap() + dummy::AggregateShare::get_decoded(decrypted_leader_aggregate_share.as_ref()).unwrap() ); let decrypted_helper_aggregate_share = hpke::open( @@ -4965,8 +4945,7 @@ mod tests { .unwrap(); assert_eq!( helper_aggregate_share, - dummy_vdaf::AggregateShare::get_decoded(decrypted_helper_aggregate_share.as_ref()) - .unwrap() + dummy::AggregateShare::get_decoded(decrypted_helper_aggregate_share.as_ref()).unwrap() ); } @@ -5005,17 +4984,17 @@ mod tests { let task = test_case.task.clone(); Box::pin(async move { tx.put_batch_aggregation( - &BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + &BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), Interval::new( Time::from_seconds_since_epoch(0), *task.time_precision(), ) .unwrap(), - dummy_vdaf::AggregationParam(0), + dummy::AggregationParam(0), 0, BatchAggregationState::Aggregating, - Some(dummy_vdaf::AggregateShare(0)), + Some(dummy::AggregateShare(0)), 10, ReportIdChecksum::get_decoded(&[2; 32]).unwrap(), ), @@ -5029,7 +5008,7 @@ mod tests { // Sending this request will consume a query for [0, time_precision). let request = CollectionReq::new( Query::new_time_interval(interval), - dummy_vdaf::AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), ); let test_conn = test_case.put_collection_job(&random(), &request).await; @@ -5039,7 +5018,7 @@ mod tests { // This request will not be allowed due to the query count already being consumed. let invalid_request = CollectionReq::new( Query::new_time_interval(interval), - dummy_vdaf::AggregationParam(1).get_encoded().unwrap(), + dummy::AggregationParam(1).get_encoded().unwrap(), ); let mut test_conn = test_case @@ -5072,13 +5051,13 @@ mod tests { let task = test_case.task.clone(); Box::pin(async move { tx.put_batch_aggregation( - &BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + &BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), interval, - dummy_vdaf::AggregationParam(0), + dummy::AggregationParam(0), 0, BatchAggregationState::Aggregating, - Some(dummy_vdaf::AggregateShare(0)), + Some(dummy::AggregateShare(0)), 10, ReportIdChecksum::get_decoded(&[2; 32]).unwrap(), ), @@ -5100,7 +5079,7 @@ mod tests { ) .unwrap(), ), - dummy_vdaf::AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), ); let test_conn = test_case.put_collection_job(&random(), &request).await; @@ -5110,7 +5089,7 @@ mod tests { // This request will not be allowed due to overlapping with the previous request. let invalid_request = CollectionReq::new( Query::new_time_interval(interval), - dummy_vdaf::AggregationParam(1).get_encoded().unwrap(), + dummy::AggregationParam(1).get_encoded().unwrap(), ); let mut test_conn = test_case @@ -5160,9 +5139,7 @@ mod tests { // Create a collection job let request = CollectionReq::new( Query::new_time_interval(batch_interval), - dummy_vdaf::AggregationParam::default() - .get_encoded() - .unwrap(), + dummy::AggregationParam::default().get_encoded().unwrap(), ); let test_conn = test_case @@ -5325,7 +5302,7 @@ mod tests { BatchSelector::new_time_interval( Interval::new(Time::from_seconds_since_epoch(0), *task.time_precision()).unwrap(), ), - dummy_vdaf::AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), 0, ReportIdChecksum::default(), ); @@ -5377,11 +5354,10 @@ mod tests { .run_unnamed_tx(|tx| { let task = helper_task.clone(); Box::pin(async move { - for aggregation_param in [ - dummy_vdaf::AggregationParam(0), - dummy_vdaf::AggregationParam(1), - ] { - tx.put_batch(&Batch::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + for aggregation_param in + [dummy::AggregationParam(0), dummy::AggregationParam(1)] + { + tx.put_batch(&Batch::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), interval_1, aggregation_param, @@ -5391,24 +5367,22 @@ mod tests { )) .await .unwrap(); - tx.put_batch_aggregation(&BatchAggregation::< - 0, - TimeInterval, - dummy_vdaf::Vdaf, - >::new( - *task.id(), - interval_1, - aggregation_param, - 0, - BatchAggregationState::Aggregating, - Some(dummy_vdaf::AggregateShare(64)), - interval_1_report_count, - interval_1_checksum, - )) + tx.put_batch_aggregation( + &BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + interval_1, + aggregation_param, + 0, + BatchAggregationState::Aggregating, + Some(dummy::AggregateShare(64)), + interval_1_report_count, + interval_1_checksum, + ), + ) .await .unwrap(); - tx.put_batch(&Batch::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), interval_2, aggregation_param, @@ -5418,24 +5392,22 @@ mod tests { )) .await .unwrap(); - tx.put_batch_aggregation(&BatchAggregation::< - 0, - TimeInterval, - dummy_vdaf::Vdaf, - >::new( - *task.id(), - interval_2, - aggregation_param, - 0, - BatchAggregationState::Aggregating, - Some(dummy_vdaf::AggregateShare(128)), - interval_2_report_count, - interval_2_checksum, - )) + tx.put_batch_aggregation( + &BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + interval_2, + aggregation_param, + 0, + BatchAggregationState::Aggregating, + Some(dummy::AggregateShare(128)), + interval_2_report_count, + interval_2_checksum, + ), + ) .await .unwrap(); - tx.put_batch(&Batch::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), interval_3, aggregation_param, @@ -5445,24 +5417,22 @@ mod tests { )) .await .unwrap(); - tx.put_batch_aggregation(&BatchAggregation::< - 0, - TimeInterval, - dummy_vdaf::Vdaf, - >::new( - *task.id(), - interval_3, - aggregation_param, - 0, - BatchAggregationState::Aggregating, - Some(dummy_vdaf::AggregateShare(256)), - interval_3_report_count, - interval_3_checksum, - )) + tx.put_batch_aggregation( + &BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + interval_3, + aggregation_param, + 0, + BatchAggregationState::Aggregating, + Some(dummy::AggregateShare(256)), + interval_3_report_count, + interval_3_checksum, + ), + ) .await .unwrap(); - tx.put_batch(&Batch::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), interval_4, aggregation_param, @@ -5472,20 +5442,18 @@ mod tests { )) .await .unwrap(); - tx.put_batch_aggregation(&BatchAggregation::< - 0, - TimeInterval, - dummy_vdaf::Vdaf, - >::new( - *task.id(), - interval_4, - aggregation_param, - 0, - BatchAggregationState::Aggregating, - Some(dummy_vdaf::AggregateShare(512)), - interval_4_report_count, - interval_4_checksum, - )) + tx.put_batch_aggregation( + &BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + interval_4, + aggregation_param, + 0, + BatchAggregationState::Aggregating, + Some(dummy::AggregateShare(512)), + interval_4_report_count, + interval_4_checksum, + ), + ) .await .unwrap(); } @@ -5505,7 +5473,7 @@ mod tests { ) .unwrap(), ), - dummy_vdaf::AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), 5, ReportIdChecksum::default(), ); @@ -5549,7 +5517,7 @@ mod tests { ) .unwrap(), ), - dummy_vdaf::AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), 10, ReportIdChecksum::get_decoded(&[3; 32]).unwrap(), ), @@ -5566,7 +5534,7 @@ mod tests { ) .unwrap(), ), - dummy_vdaf::AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), 20, ReportIdChecksum::get_decoded(&[4 ^ 8; 32]).unwrap(), ), @@ -5626,11 +5594,11 @@ mod tests { ) .unwrap(), ), - dummy_vdaf::AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), 10, ReportIdChecksum::get_decoded(&[3 ^ 2; 32]).unwrap(), ), - dummy_vdaf::AggregateShare(64 + 128), + dummy::AggregateShare(64 + 128), ), ( "third and fourth batches", @@ -5642,12 +5610,12 @@ mod tests { ) .unwrap(), ), - dummy_vdaf::AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), 10, ReportIdChecksum::get_decoded(&[8 ^ 4; 32]).unwrap(), ), // Should get sum over the third and fourth batches - dummy_vdaf::AggregateShare(256 + 512), + dummy::AggregateShare(256 + 512), ), ] { // Request the aggregate share multiple times. If the request parameters don't change, @@ -5686,7 +5654,7 @@ mod tests { aggregate_share_resp.encrypted_aggregate_share(), &AggregateShareAad::new( *task.id(), - dummy_vdaf::AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), request.batch_selector().clone(), ) .get_encoded() @@ -5696,7 +5664,7 @@ mod tests { // Should get the sum over the first and second aggregate shares let decoded_aggregate_share = - dummy_vdaf::AggregateShare::get_decoded(aggregate_share.as_ref()).unwrap(); + dummy::AggregateShare::get_decoded(aggregate_share.as_ref()).unwrap(); assert_eq!( decoded_aggregate_share, expected_result, "test case: {label:?}, iteration: {iteration}" @@ -5714,7 +5682,7 @@ mod tests { ) .unwrap(), ), - dummy_vdaf::AggregationParam(0).get_encoded().unwrap(), + dummy::AggregationParam(0).get_encoded().unwrap(), 20, ReportIdChecksum::get_decoded(&[8 ^ 4 ^ 3 ^ 2; 32]).unwrap(), ); @@ -5750,7 +5718,7 @@ mod tests { ) .unwrap(), ), - dummy_vdaf::AggregationParam(1).get_encoded().unwrap(), + dummy::AggregationParam(1).get_encoded().unwrap(), 10, ReportIdChecksum::get_decoded(&[3 ^ 2; 32]).unwrap(), ), @@ -5762,7 +5730,7 @@ mod tests { ) .unwrap(), ), - dummy_vdaf::AggregationParam(1).get_encoded().unwrap(), + dummy::AggregationParam(1).get_encoded().unwrap(), 10, ReportIdChecksum::get_decoded(&[4 ^ 8; 32]).unwrap(), ), diff --git a/aggregator_core/Cargo.toml b/aggregator_core/Cargo.toml index 02a7c4d61..1f9884f8a 100644 --- a/aggregator_core/Cargo.toml +++ b/aggregator_core/Cargo.toml @@ -10,7 +10,14 @@ version.workspace = true [features] default = [] -test-util = ["dep:hex", "dep:sqlx", "dep:testcontainers", "janus_core/test-util", "janus_messages/test-util"] +test-util = [ + "dep:hex", + "dep:sqlx", + "dep:testcontainers", + "janus_core/test-util", + "janus_messages/test-util", + "prio/test-util" +] [dependencies] anyhow.workspace = true diff --git a/aggregator_core/src/datastore/models.rs b/aggregator_core/src/datastore/models.rs index cd19c6947..70ae0442e 100644 --- a/aggregator_core/src/datastore/models.rs +++ b/aggregator_core/src/datastore/models.rs @@ -299,7 +299,7 @@ where } #[cfg(feature = "test-util")] -impl LeaderStoredReport<0, janus_core::test_util::dummy_vdaf::Vdaf> { +impl LeaderStoredReport<0, prio::vdaf::dummy::Vdaf> { pub fn new_dummy(task_id: TaskId, when: Time) -> Self { use janus_messages::HpkeConfigId; use rand::random; @@ -309,7 +309,7 @@ impl LeaderStoredReport<0, janus_core::test_util::dummy_vdaf::Vdaf> { ReportMetadata::new(random(), when), (), Vec::new(), - janus_core::test_util::dummy_vdaf::InputShare::default(), + prio::vdaf::dummy::InputShare::default(), HpkeCiphertext::new( HpkeConfigId::from(13), Vec::from("encapsulated_context_0"), diff --git a/aggregator_core/src/datastore/tests.rs b/aggregator_core/src/datastore/tests.rs index 4fcd1b32d..54613bf01 100644 --- a/aggregator_core/src/datastore/tests.rs +++ b/aggregator_core/src/datastore/tests.rs @@ -24,10 +24,7 @@ use janus_core::{ hpke::{ self, test_util::generate_test_hpke_config_and_private_key, HpkeApplicationInfo, Label, }, - test_util::{ - dummy_vdaf::{self, AggregateShare, AggregationParam}, - install_test_trace_subscriber, run_vdaf, - }, + test_util::{install_test_trace_subscriber, run_vdaf}, time::{Clock, DurationExt, IntervalExt, MockClock, TimeExt}, vdaf::{VdafInstance, VERIFY_KEY_LENGTH}, }; @@ -43,6 +40,7 @@ use prio::{ idpf::IdpfInput, topology::ping_pong::PingPongMessage, vdaf::{ + dummy, poplar1::{Poplar1, Poplar1AggregationParam}, prio3::Prio3Count, xof::XofTurboShake128, @@ -381,7 +379,7 @@ async fn roundtrip_report(ephemeral_datastore: EphemeralDatastore) { .unwrap(); let report_id = random(); - let report: LeaderStoredReport<0, dummy_vdaf::Vdaf> = LeaderStoredReport::new( + let report: LeaderStoredReport<0, dummy::Vdaf> = LeaderStoredReport::new( *task.id(), ReportMetadata::new(report_id, OLDEST_ALLOWED_REPORT_TIMESTAMP), (), // public share @@ -389,7 +387,7 @@ async fn roundtrip_report(ephemeral_datastore: EphemeralDatastore) { Extension::new(ExtensionType::Tbd, Vec::from("extension_data_0")), Extension::new(ExtensionType::Tbd, Vec::from("extension_data_1")), ]), - dummy_vdaf::InputShare::default(), // leader input share + dummy::InputShare::default(), // leader input share /* Dummy ciphertext for the helper share */ HpkeCiphertext::new( HpkeConfigId::from(13), @@ -401,10 +399,7 @@ async fn roundtrip_report(ephemeral_datastore: EphemeralDatastore) { // Write the report, and then read it back. ds.run_tx("test-put-client-report", |tx| { let report = report.clone(); - Box::pin(async move { - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &report) - .await - }) + Box::pin(async move { tx.put_client_report(&dummy::Vdaf::default(), &report).await }) }) .await .unwrap(); @@ -413,8 +408,8 @@ async fn roundtrip_report(ephemeral_datastore: EphemeralDatastore) { .run_unnamed_tx(|tx| { let task_id = *report.task_id(); Box::pin(async move { - tx.get_client_report::<0, dummy_vdaf::Vdaf>( - &dummy_vdaf::Vdaf::new(), + tx.get_client_report::<0, dummy::Vdaf>( + &dummy::Vdaf::default(), &task_id, &report_id, ) @@ -433,8 +428,8 @@ async fn roundtrip_report(ephemeral_datastore: EphemeralDatastore) { let task_id = *report.task_id(); Box::pin(async move { tx.put_client_report( - &dummy_vdaf::Vdaf::new(), - &LeaderStoredReport::<0, dummy_vdaf::Vdaf>::new( + &dummy::Vdaf::default(), + &LeaderStoredReport::<0, dummy::Vdaf>::new( task_id, ReportMetadata::new(report_id, Time::from_seconds_since_epoch(54321)), (), // public share @@ -442,7 +437,7 @@ async fn roundtrip_report(ephemeral_datastore: EphemeralDatastore) { Extension::new(ExtensionType::Tbd, Vec::from("extension_data_2")), Extension::new(ExtensionType::Tbd, Vec::from("extension_data_3")), ]), - dummy_vdaf::InputShare::default(), // leader input share + dummy::InputShare::default(), // leader input share /* Dummy ciphertext for the helper share */ HpkeCiphertext::new( HpkeConfigId::from(14), @@ -478,8 +473,8 @@ async fn roundtrip_report(ephemeral_datastore: EphemeralDatastore) { tx.verify_client_report_scrubbed(&task_id, &report_id).await; assert_matches!( - tx.get_client_report::<0, dummy_vdaf::Vdaf>( - &dummy_vdaf::Vdaf::new(), + tx.get_client_report::<0, dummy::Vdaf>( + &dummy::Vdaf::default(), &task_id, &report_id, ) @@ -499,8 +494,8 @@ async fn roundtrip_report(ephemeral_datastore: EphemeralDatastore) { .run_unnamed_tx(|tx| { let task_id = *report.task_id(); Box::pin(async move { - tx.get_client_report::<0, dummy_vdaf::Vdaf>( - &dummy_vdaf::Vdaf::new(), + tx.get_client_report::<0, dummy::Vdaf>( + &dummy::Vdaf::default(), &task_id, &report_id, ) @@ -521,7 +516,7 @@ async fn report_not_found(ephemeral_datastore: EphemeralDatastore) { let rslt = ds .run_unnamed_tx(|tx| { Box::pin(async move { - tx.get_client_report(&dummy_vdaf::Vdaf::new(), &random(), &random()) + tx.get_client_report(&dummy::Vdaf::default(), &random(), &random()) .await }) }) @@ -584,15 +579,15 @@ async fn get_unaggregated_client_reports_for_task(ephemeral_datastore: Ephemeral tx.put_aggregator_task(&task).await?; tx.put_aggregator_task(&unrelated_task).await?; - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &first_unaggregated_report) + tx.put_client_report(&dummy::Vdaf::default(), &first_unaggregated_report) .await?; - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &second_unaggregated_report) + tx.put_client_report(&dummy::Vdaf::default(), &second_unaggregated_report) .await?; - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &expired_report) + tx.put_client_report(&dummy::Vdaf::default(), &expired_report) .await?; - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &aggregated_report) + tx.put_client_report(&dummy::Vdaf::default(), &aggregated_report) .await?; - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &unrelated_report) + tx.put_client_report(&dummy::Vdaf::default(), &unrelated_report) .await?; // Mark aggregated_report as aggregated. @@ -621,7 +616,7 @@ async fn get_unaggregated_client_reports_for_task(ephemeral_datastore: Ephemeral Ok(tx .get_unaggregated_client_reports_for_task( - &dummy_vdaf::Vdaf::new(), + &dummy::Vdaf::default(), task.id(), 5000, ) @@ -654,7 +649,7 @@ async fn get_unaggregated_client_reports_for_task(ephemeral_datastore: Ephemeral Ok(tx .get_unaggregated_client_reports_for_task( - &dummy_vdaf::Vdaf::new(), + &dummy::Vdaf::default(), task.id(), 5000, ) @@ -691,7 +686,7 @@ async fn get_unaggregated_client_reports_for_task(ephemeral_datastore: Ephemeral Ok(tx .get_unaggregated_client_reports_for_task( - &dummy_vdaf::Vdaf::new(), + &dummy::Vdaf::default(), task.id(), 5000, ) @@ -812,15 +807,15 @@ async fn count_client_reports_for_interval(ephemeral_datastore: EphemeralDatasto tx.put_aggregator_task(&unrelated_task).await?; tx.put_aggregator_task(&no_reports_task).await?; - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &expired_report_in_interval) + tx.put_client_report(&dummy::Vdaf::default(), &expired_report_in_interval) .await?; - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &first_report_in_interval) + tx.put_client_report(&dummy::Vdaf::default(), &first_report_in_interval) .await?; - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &second_report_in_interval) + tx.put_client_report(&dummy::Vdaf::default(), &second_report_in_interval) .await?; - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &report_outside_interval) + tx.put_client_report(&dummy::Vdaf::default(), &report_outside_interval) .await?; - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &report_for_other_task) + tx.put_client_report(&dummy::Vdaf::default(), &report_for_other_task) .await?; Ok(()) @@ -928,10 +923,10 @@ async fn count_client_reports_for_batch_id(ephemeral_datastore: EphemeralDatasto .unwrap(), ); - let expired_aggregation_job = AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let expired_aggregation_job = AggregationJob::<0, FixedSize, dummy::Vdaf>::new( *task.id(), random(), - AggregationParam(22), + dummy::AggregationParam(22), batch_id, Interval::new( OLDEST_ALLOWED_REPORT_TIMESTAMP @@ -946,10 +941,10 @@ async fn count_client_reports_for_batch_id(ephemeral_datastore: EphemeralDatasto let expired_report_aggregation = expired_report .as_start_leader_report_aggregation(*expired_aggregation_job.id(), 0); - let aggregation_job_0 = AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let aggregation_job_0 = AggregationJob::<0, FixedSize, dummy::Vdaf>::new( *task.id(), random(), - AggregationParam(22), + dummy::AggregationParam(22), batch_id, Interval::new(OLDEST_ALLOWED_REPORT_TIMESTAMP, Duration::from_seconds(2)) .unwrap(), @@ -961,10 +956,10 @@ async fn count_client_reports_for_batch_id(ephemeral_datastore: EphemeralDatasto let aggregation_job_0_report_aggregation_1 = report_1.as_start_leader_report_aggregation(*aggregation_job_0.id(), 2); - let aggregation_job_1 = AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let aggregation_job_1 = AggregationJob::<0, FixedSize, dummy::Vdaf>::new( *task.id(), random(), - AggregationParam(23), + dummy::AggregationParam(23), batch_id, Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)) .unwrap(), @@ -976,11 +971,11 @@ async fn count_client_reports_for_batch_id(ephemeral_datastore: EphemeralDatasto let aggregation_job_1_report_aggregation_1 = report_1.as_start_leader_report_aggregation(*aggregation_job_1.id(), 1); - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &expired_report) + tx.put_client_report(&dummy::Vdaf::default(), &expired_report) .await?; - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &report_0) + tx.put_client_report(&dummy::Vdaf::default(), &report_0) .await?; - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &report_1) + tx.put_client_report(&dummy::Vdaf::default(), &report_1) .await?; tx.put_aggregation_job(&expired_aggregation_job).await?; @@ -1068,8 +1063,8 @@ async fn roundtrip_report_share(ephemeral_datastore: EphemeralDatastore) { // Verify that attempting to read the report share as a report receives the expected // error, and that the expected columns are NULL'ed out. assert_matches!( - tx.get_client_report::<0, dummy_vdaf::Vdaf>( - &dummy_vdaf::Vdaf::new(), + tx.get_client_report::<0, dummy::Vdaf>( + &dummy::Vdaf::default(), &task_id, &report_id, ) @@ -1153,19 +1148,19 @@ async fn roundtrip_aggregation_job(ephemeral_datastore: EphemeralDatastore) { .leader_view() .unwrap(); let batch_id = random(); - let leader_aggregation_job = AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let leader_aggregation_job = AggregationJob::<0, FixedSize, dummy::Vdaf>::new( *task.id(), random(), - AggregationParam(23), + dummy::AggregationParam(23), batch_id, Interval::new(OLDEST_ALLOWED_REPORT_TIMESTAMP, Duration::from_seconds(1)).unwrap(), AggregationJobState::InProgress, AggregationJobStep::from(0), ); - let helper_aggregation_job = AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let helper_aggregation_job = AggregationJob::<0, FixedSize, dummy::Vdaf>::new( *task.id(), random(), - AggregationParam(23), + dummy::AggregationParam(23), random(), Interval::new(OLDEST_ALLOWED_REPORT_TIMESTAMP, Duration::from_seconds(1)).unwrap(), AggregationJobState::InProgress, @@ -1299,10 +1294,10 @@ async fn roundtrip_aggregation_job(ephemeral_datastore: EphemeralDatastore) { ); // Trying to write an aggregation job again should fail. - let new_leader_aggregation_job = AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let new_leader_aggregation_job = AggregationJob::<0, FixedSize, dummy::Vdaf>::new( *task.id(), *leader_aggregation_job.id(), - AggregationParam(24), + dummy::AggregationParam(24), batch_id, Interval::new( Time::from_seconds_since_epoch(2345), @@ -1338,13 +1333,13 @@ async fn roundtrip_aggregation_job(ephemeral_datastore: EphemeralDatastore) { ); Box::pin(async move { Ok(( - tx.get_aggregation_job::<0, FixedSize, dummy_vdaf::Vdaf>( + tx.get_aggregation_job::<0, FixedSize, dummy::Vdaf>( new_leader_aggregation_job.task_id(), new_leader_aggregation_job.id(), ) .await .unwrap(), - tx.get_aggregation_job::<0, FixedSize, dummy_vdaf::Vdaf>( + tx.get_aggregation_job::<0, FixedSize, dummy::Vdaf>( new_helper_aggregation_job.task_id(), new_helper_aggregation_job.id(), ) @@ -1756,28 +1751,28 @@ async fn get_aggregation_jobs_for_task(ephemeral_datastore: EphemeralDatastore) .build() .leader_view() .unwrap(); - let first_aggregation_job = AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let first_aggregation_job = AggregationJob::<0, FixedSize, dummy::Vdaf>::new( *task.id(), random(), - AggregationParam(23), + dummy::AggregationParam(23), random(), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)).unwrap(), AggregationJobState::InProgress, AggregationJobStep::from(0), ); - let second_aggregation_job = AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let second_aggregation_job = AggregationJob::<0, FixedSize, dummy::Vdaf>::new( *task.id(), random(), - AggregationParam(42), + dummy::AggregationParam(42), random(), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)).unwrap(), AggregationJobState::InProgress, AggregationJobStep::from(0), ); - let aggregation_job_with_request_hash = AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let aggregation_job_with_request_hash = AggregationJob::<0, FixedSize, dummy::Vdaf>::new( *task.id(), random(), - AggregationParam(42), + dummy::AggregationParam(42), random(), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)).unwrap(), AggregationJobState::InProgress, @@ -1813,10 +1808,10 @@ async fn get_aggregation_jobs_for_task(ephemeral_datastore: EphemeralDatastore) .leader_view() .unwrap(); tx.put_aggregator_task(&unrelated_task).await?; - tx.put_aggregation_job(&AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_aggregation_job(&AggregationJob::<0, FixedSize, dummy::Vdaf>::new( *unrelated_task.id(), random(), - AggregationParam(82), + dummy::AggregationParam(82), random(), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)) .unwrap(), @@ -2140,10 +2135,10 @@ async fn check_other_report_aggregation_exists(ephemeral_datastore: EphemeralDat ds.run_unnamed_tx(|tx| { let task_id = *task.id(); Box::pin(async move { - tx.put_aggregation_job(&AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + tx.put_aggregation_job(&AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( task_id, aggregation_job_id, - dummy_vdaf::AggregationParam(0), + dummy::AggregationParam(0), (), Interval::new(OLDEST_ALLOWED_REPORT_TIMESTAMP, Duration::from_seconds(1)).unwrap(), AggregationJobState::InProgress, @@ -2164,7 +2159,7 @@ async fn check_other_report_aggregation_exists(ephemeral_datastore: EphemeralDat ) .await?; - let report_aggregation = ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + let report_aggregation = ReportAggregation::<0, dummy::Vdaf>::new( task_id, aggregation_job_id, report_id, @@ -2187,10 +2182,10 @@ async fn check_other_report_aggregation_exists(ephemeral_datastore: EphemeralDat let task_id = *task.id(); Box::pin(async move { assert!(tx - .check_other_report_aggregation_exists::<0, dummy_vdaf::Vdaf>( + .check_other_report_aggregation_exists::<0, dummy::Vdaf>( &task_id, &report_id, - &dummy_vdaf::AggregationParam(0), + &dummy::AggregationParam(0), &random(), ) .await @@ -2198,10 +2193,10 @@ async fn check_other_report_aggregation_exists(ephemeral_datastore: EphemeralDat // Aggregation job ID matches assert!(!tx - .check_other_report_aggregation_exists::<0, dummy_vdaf::Vdaf>( + .check_other_report_aggregation_exists::<0, dummy::Vdaf>( &task_id, &report_id, - &dummy_vdaf::AggregationParam(0), + &dummy::AggregationParam(0), &aggregation_job_id, ) .await @@ -2209,10 +2204,10 @@ async fn check_other_report_aggregation_exists(ephemeral_datastore: EphemeralDat // Wrong task ID assert!(!tx - .check_other_report_aggregation_exists::<0, dummy_vdaf::Vdaf>( + .check_other_report_aggregation_exists::<0, dummy::Vdaf>( &random(), &report_id, - &dummy_vdaf::AggregationParam(0), + &dummy::AggregationParam(0), &random(), ) .await @@ -2220,10 +2215,10 @@ async fn check_other_report_aggregation_exists(ephemeral_datastore: EphemeralDat // Wrong report ID assert!(!tx - .check_other_report_aggregation_exists::<0, dummy_vdaf::Vdaf>( + .check_other_report_aggregation_exists::<0, dummy::Vdaf>( &task_id, &random(), - &dummy_vdaf::AggregationParam(0), + &dummy::AggregationParam(0), &random(), ) .await @@ -2231,10 +2226,10 @@ async fn check_other_report_aggregation_exists(ephemeral_datastore: EphemeralDat // Wrong aggregation param assert!(!tx - .check_other_report_aggregation_exists::<0, dummy_vdaf::Vdaf>( + .check_other_report_aggregation_exists::<0, dummy::Vdaf>( &task_id, &report_id, - &dummy_vdaf::AggregationParam(1), + &dummy::AggregationParam(1), &random(), ) .await @@ -2253,10 +2248,10 @@ async fn check_other_report_aggregation_exists(ephemeral_datastore: EphemeralDat let task_id = *task.id(); Box::pin(async move { assert!(!tx - .check_other_report_aggregation_exists::<0, dummy_vdaf::Vdaf>( + .check_other_report_aggregation_exists::<0, dummy::Vdaf>( &task_id, &report_id, - &dummy_vdaf::AggregationParam(0), + &dummy::AggregationParam(0), &random(), ) .await @@ -2275,7 +2270,7 @@ async fn report_aggregation_not_found(ephemeral_datastore: EphemeralDatastore) { install_test_trace_subscriber(); let ds = ephemeral_datastore.datastore(MockClock::default()).await; - let vdaf = Arc::new(dummy_vdaf::Vdaf::default()); + let vdaf = Arc::new(dummy::Vdaf::default()); let rslt = ds .run_unnamed_tx(|tx| { @@ -2286,7 +2281,7 @@ async fn report_aggregation_not_found(ephemeral_datastore: EphemeralDatastore) { &Role::Leader, &random(), &random(), - &dummy_vdaf::AggregationParam::default(), + &dummy::AggregationParam::default(), &ReportId::from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]), ) .await @@ -2299,7 +2294,7 @@ async fn report_aggregation_not_found(ephemeral_datastore: EphemeralDatastore) { let rslt = ds .run_unnamed_tx(|tx| { Box::pin(async move { - tx.update_report_aggregation::<0, dummy_vdaf::Vdaf>(&ReportAggregation::new( + tx.update_report_aggregation::<0, dummy::Vdaf>(&ReportAggregation::new( random(), random(), ReportId::from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]), @@ -2540,7 +2535,7 @@ async fn get_collection_job(ephemeral_datastore: EphemeralDatastore) { Duration::from_seconds(200), ) .unwrap(); - let aggregation_param = AggregationParam(13); + let aggregation_param = dummy::AggregationParam(13); let (first_collection_job, second_collection_job) = ds .run_tx("test-put-collection-job", |tx| { @@ -2548,7 +2543,7 @@ async fn get_collection_job(ephemeral_datastore: EphemeralDatastore) { Box::pin(async move { tx.put_aggregator_task(&task).await.unwrap(); - let first_collection_job = CollectionJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + let first_collection_job = CollectionJob::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), random(), Query::new_time_interval(first_batch_interval), @@ -2558,7 +2553,7 @@ async fn get_collection_job(ephemeral_datastore: EphemeralDatastore) { ); tx.put_collection_job(&first_collection_job).await.unwrap(); - let second_collection_job = CollectionJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + let second_collection_job = CollectionJob::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), random(), Query::new_time_interval(second_batch_interval), @@ -2585,10 +2580,10 @@ async fn get_collection_job(ephemeral_datastore: EphemeralDatastore) { let first_collection_job = first_collection_job.clone(); let second_collection_job = second_collection_job.clone(); Box::pin(async move { - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::default(); let first_collection_job_again = tx - .get_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_collection_job::<0, TimeInterval, dummy::Vdaf>( &vdaf, task.id(), first_collection_job.id(), @@ -2599,7 +2594,7 @@ async fn get_collection_job(ephemeral_datastore: EphemeralDatastore) { assert_eq!(first_collection_job, first_collection_job_again); let second_collection_job_again = tx - .get_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_collection_job::<0, TimeInterval, dummy::Vdaf>( &vdaf, task.id(), second_collection_job.id(), @@ -2627,15 +2622,15 @@ async fn get_collection_job(ephemeral_datastore: EphemeralDatastore) { first_collection_job.with_state(CollectionJobState::Finished { report_count: 12, encrypted_helper_aggregate_share, - leader_aggregate_share: AggregateShare(41), + leader_aggregate_share: dummy::AggregateShare(41), }); - tx.update_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>(&first_collection_job) + tx.update_collection_job::<0, TimeInterval, dummy::Vdaf>(&first_collection_job) .await .unwrap(); let updated_first_collection_job = tx - .get_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_collection_job::<0, TimeInterval, dummy::Vdaf>( &vdaf, task.id(), first_collection_job.id(), @@ -2660,10 +2655,10 @@ async fn get_collection_job(ephemeral_datastore: EphemeralDatastore) { let second_collection_job = second_collection_job.clone(); Box::pin(async move { - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::default(); let first_collection_job = tx - .get_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_collection_job::<0, TimeInterval, dummy::Vdaf>( &vdaf, task.id(), first_collection_job.id(), @@ -2673,7 +2668,7 @@ async fn get_collection_job(ephemeral_datastore: EphemeralDatastore) { assert_eq!(first_collection_job, None); let second_collection_job = tx - .get_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_collection_job::<0, TimeInterval, dummy::Vdaf>( &vdaf, task.id(), second_collection_job.id(), @@ -2717,9 +2712,9 @@ async fn update_collection_jobs(ephemeral_datastore: EphemeralDatastore) { Box::pin(async move { tx.put_aggregator_task(&task).await?; - let vdaf = dummy_vdaf::Vdaf::new(); - let aggregation_param = AggregationParam(10); - let abandoned_collection_job = CollectionJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + let vdaf = dummy::Vdaf::default(); + let aggregation_param = dummy::AggregationParam(10); + let abandoned_collection_job = CollectionJob::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), random(), Query::new_time_interval(abandoned_batch_interval), @@ -2729,7 +2724,7 @@ async fn update_collection_jobs(ephemeral_datastore: EphemeralDatastore) { ); tx.put_collection_job(&abandoned_collection_job).await?; - let deleted_collection_job = CollectionJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + let deleted_collection_job = CollectionJob::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), random(), Query::new_time_interval(deleted_batch_interval), @@ -2740,7 +2735,7 @@ async fn update_collection_jobs(ephemeral_datastore: EphemeralDatastore) { tx.put_collection_job(&deleted_collection_job).await?; let abandoned_collection_job_again = tx - .get_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_collection_job::<0, TimeInterval, dummy::Vdaf>( &vdaf, task.id(), abandoned_collection_job.id(), @@ -2757,15 +2752,13 @@ async fn update_collection_jobs(ephemeral_datastore: EphemeralDatastore) { let deleted_collection_job = deleted_collection_job.with_state(CollectionJobState::Deleted); - tx.update_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( - &abandoned_collection_job, - ) - .await?; - tx.update_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>(&deleted_collection_job) + tx.update_collection_job::<0, TimeInterval, dummy::Vdaf>(&abandoned_collection_job) + .await?; + tx.update_collection_job::<0, TimeInterval, dummy::Vdaf>(&deleted_collection_job) .await?; let abandoned_collection_job_again = tx - .get_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_collection_job::<0, TimeInterval, dummy::Vdaf>( &vdaf, task.id(), abandoned_collection_job.id(), @@ -2774,7 +2767,7 @@ async fn update_collection_jobs(ephemeral_datastore: EphemeralDatastore) { .unwrap(); let deleted_collection_job_again = tx - .get_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_collection_job::<0, TimeInterval, dummy::Vdaf>( &vdaf, task.id(), deleted_collection_job.id(), @@ -2794,11 +2787,9 @@ async fn update_collection_jobs(ephemeral_datastore: EphemeralDatastore) { abandoned_collection_job.with_state(CollectionJobState::Start); // Verify: Update should fail - tx.update_collection_job::<0, TimeInterval, dummy_vdaf::Vdaf>( - &abandoned_collection_job, - ) - .await - .unwrap_err(); + tx.update_collection_job::<0, TimeInterval, dummy::Vdaf>(&abandoned_collection_job) + .await + .unwrap_err(); Ok(()) }) }) @@ -2820,7 +2811,7 @@ struct CollectionJobTestCase { should_be_acquired: bool, task_id: TaskId, batch_identifier: Q::BatchIdentifier, - agg_param: AggregationParam, + agg_param: dummy::AggregationParam, collection_job_id: Option, client_timestamp_interval: Interval, state: CollectionJobTestCaseState, @@ -2830,9 +2821,9 @@ struct CollectionJobTestCase { struct CollectionJobAcquireTestCase { task_ids: Vec, query_type: task::QueryType, - reports: Vec>, - aggregation_jobs: Vec>, - report_aggregations: Vec>, + reports: Vec>, + aggregation_jobs: Vec>, + report_aggregations: Vec>, collection_job_test_cases: Vec>, } @@ -2945,7 +2936,7 @@ async fn setup_collection_job_acquire_test_case( } for report in &test_case.reports { - tx.put_client_report(&dummy_vdaf::Vdaf::new(), report) + tx.put_client_report(&dummy::Vdaf::default(), report) .await?; } for aggregation_job in &test_case.aggregation_jobs { @@ -2957,7 +2948,7 @@ async fn setup_collection_job_acquire_test_case( } for test_case in test_case.collection_job_test_cases.iter_mut() { - tx.put_batch(&Batch::<0, Q, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, Q, dummy::Vdaf>::new( test_case.task_id, test_case.batch_identifier.clone(), test_case.agg_param, @@ -2968,7 +2959,7 @@ async fn setup_collection_job_acquire_test_case( .await?; let collection_job_id = random(); - tx.put_collection_job(&CollectionJob::<0, Q, dummy_vdaf::Vdaf>::new( + tx.put_collection_job(&CollectionJob::<0, Q, dummy::Vdaf>::new( test_case.task_id, collection_job_id, Q::query_for_batch_identifier(&test_case.batch_identifier), @@ -2984,7 +2975,7 @@ async fn setup_collection_job_acquire_test_case( Vec::new(), Vec::new(), ), - leader_aggregate_share: AggregateShare(0), + leader_aggregate_share: dummy::AggregateShare(0), }, CollectionJobTestCaseState::Abandoned => CollectionJobState::Abandoned, CollectionJobTestCaseState::Deleted => CollectionJobState::Deleted, @@ -3071,16 +3062,16 @@ async fn time_interval_collection_job_acquire_release_happy_path( ) .unwrap(); let aggregation_job_id = random(); - let aggregation_jobs = Vec::from([AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + let aggregation_jobs = Vec::from([AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( task_id, aggregation_job_id, - AggregationParam(0), + dummy::AggregationParam(0), (), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)).unwrap(), AggregationJobState::Finished, AggregationJobStep::from(1), )]); - let report_aggregations = Vec::from([ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + let report_aggregations = Vec::from([ReportAggregation::<0, dummy::Vdaf>::new( task_id, aggregation_job_id, *reports[0].metadata().id(), @@ -3094,7 +3085,7 @@ async fn time_interval_collection_job_acquire_release_happy_path( should_be_acquired: true, task_id, batch_identifier: batch_interval, - agg_param: AggregationParam(0), + agg_param: dummy::AggregationParam(0), collection_job_id: None, client_timestamp_interval: Interval::EMPTY, state: CollectionJobTestCaseState::Collectable, @@ -3207,16 +3198,16 @@ async fn fixed_size_collection_job_acquire_release_happy_path( )]); let batch_id = random(); let aggregation_job_id = random(); - let aggregation_jobs = Vec::from([AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let aggregation_jobs = Vec::from([AggregationJob::<0, FixedSize, dummy::Vdaf>::new( task_id, aggregation_job_id, - AggregationParam(0), + dummy::AggregationParam(0), batch_id, Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)).unwrap(), AggregationJobState::Finished, AggregationJobStep::from(1), )]); - let report_aggregations = Vec::from([ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + let report_aggregations = Vec::from([ReportAggregation::<0, dummy::Vdaf>::new( task_id, aggregation_job_id, *reports[0].metadata().id(), @@ -3241,7 +3232,7 @@ async fn fixed_size_collection_job_acquire_release_happy_path( should_be_acquired: true, task_id, batch_identifier: batch_id, - agg_param: AggregationParam(0), + agg_param: dummy::AggregationParam(0), collection_job_id: None, client_timestamp_interval: Interval::new( Time::from_seconds_since_epoch(0), @@ -3338,11 +3329,11 @@ async fn collection_job_acquire_no_aggregation_job_with_task_id( Duration::from_seconds(100), ) .unwrap(); - let aggregation_jobs = Vec::from([AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + let aggregation_jobs = Vec::from([AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( // Aggregation job task ID does not match collection job task ID other_task_id, random(), - AggregationParam(0), + dummy::AggregationParam(0), (), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)).unwrap(), AggregationJobState::Finished, @@ -3353,7 +3344,7 @@ async fn collection_job_acquire_no_aggregation_job_with_task_id( should_be_acquired: false, task_id, batch_identifier: batch_interval, - agg_param: AggregationParam(0), + agg_param: dummy::AggregationParam(0), collection_job_id: None, client_timestamp_interval: Interval::EMPTY, state: CollectionJobTestCaseState::Start, @@ -3393,11 +3384,11 @@ async fn collection_job_acquire_no_aggregation_job_with_agg_param( Duration::from_seconds(100), ) .unwrap(); - let aggregation_jobs = Vec::from([AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + let aggregation_jobs = Vec::from([AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( task_id, random(), // Aggregation job agg param does not match collection job agg param - AggregationParam(1), + dummy::AggregationParam(1), (), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)).unwrap(), AggregationJobState::Finished, @@ -3408,7 +3399,7 @@ async fn collection_job_acquire_no_aggregation_job_with_agg_param( should_be_acquired: false, task_id, batch_identifier: batch_interval, - agg_param: AggregationParam(0), + agg_param: dummy::AggregationParam(0), collection_job_id: None, client_timestamp_interval: Interval::EMPTY, state: CollectionJobTestCaseState::Start, @@ -3445,10 +3436,10 @@ async fn collection_job_acquire_report_shares_outside_interval( Time::from_seconds_since_epoch(200), )]); let aggregation_job_id = random(); - let aggregation_jobs = Vec::from([AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + let aggregation_jobs = Vec::from([AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( task_id, aggregation_job_id, - AggregationParam(0), + dummy::AggregationParam(0), (), Interval::new( Time::from_seconds_since_epoch(200), @@ -3458,7 +3449,7 @@ async fn collection_job_acquire_report_shares_outside_interval( AggregationJobState::Finished, AggregationJobStep::from(1), )]); - let report_aggregations = Vec::from([ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + let report_aggregations = Vec::from([ReportAggregation::<0, dummy::Vdaf>::new( task_id, aggregation_job_id, *reports[0].metadata().id(), @@ -3484,7 +3475,7 @@ async fn collection_job_acquire_report_shares_outside_interval( Duration::from_seconds(100), ) .unwrap(), - agg_param: AggregationParam(0), + agg_param: dummy::AggregationParam(0), collection_job_id: None, client_timestamp_interval: Interval::EMPTY, state: CollectionJobTestCaseState::Start, @@ -3512,17 +3503,17 @@ async fn collection_job_acquire_release_job_finished(ephemeral_datastore: Epheme Duration::from_seconds(100), ) .unwrap(); - let aggregation_jobs = Vec::from([AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + let aggregation_jobs = Vec::from([AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( task_id, aggregation_job_id, - AggregationParam(0), + dummy::AggregationParam(0), (), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)).unwrap(), AggregationJobState::Finished, AggregationJobStep::from(1), )]); - let report_aggregations = Vec::from([ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + let report_aggregations = Vec::from([ReportAggregation::<0, dummy::Vdaf>::new( task_id, aggregation_job_id, *reports[0].metadata().id(), @@ -3536,7 +3527,7 @@ async fn collection_job_acquire_release_job_finished(ephemeral_datastore: Epheme should_be_acquired: false, task_id, batch_identifier: batch_interval, - agg_param: AggregationParam(0), + agg_param: dummy::AggregationParam(0), collection_job_id: None, client_timestamp_interval: Interval::EMPTY, // collection job has already run to completion @@ -3579,19 +3570,19 @@ async fn collection_job_acquire_release_aggregation_job_in_progress( ) .unwrap(); let aggregation_jobs = Vec::from([ - AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( task_id, aggregation_job_ids[0], - AggregationParam(0), + dummy::AggregationParam(0), (), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)).unwrap(), AggregationJobState::Finished, AggregationJobStep::from(1), ), - AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( task_id, aggregation_job_ids[1], - AggregationParam(0), + dummy::AggregationParam(0), (), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)).unwrap(), // Aggregation job included in collect request is in progress @@ -3601,7 +3592,7 @@ async fn collection_job_acquire_release_aggregation_job_in_progress( ]); let report_aggregations = Vec::from([ - ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + ReportAggregation::<0, dummy::Vdaf>::new( task_id, aggregation_job_ids[0], *reports[0].metadata().id(), @@ -3610,7 +3601,7 @@ async fn collection_job_acquire_release_aggregation_job_in_progress( None, ReportAggregationState::Finished, ), - ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + ReportAggregation::<0, dummy::Vdaf>::new( task_id, aggregation_job_ids[1], *reports[1].metadata().id(), @@ -3625,7 +3616,7 @@ async fn collection_job_acquire_release_aggregation_job_in_progress( should_be_acquired: false, task_id, batch_identifier: batch_interval, - agg_param: AggregationParam(0), + agg_param: dummy::AggregationParam(0), collection_job_id: None, client_timestamp_interval: Interval::EMPTY, state: CollectionJobTestCaseState::Start, @@ -3664,19 +3655,19 @@ async fn collection_job_acquire_job_max(ephemeral_datastore: EphemeralDatastore) ) .unwrap(); let aggregation_jobs = Vec::from([ - AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( task_id, aggregation_job_ids[0], - AggregationParam(0), + dummy::AggregationParam(0), (), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)).unwrap(), AggregationJobState::Finished, AggregationJobStep::from(1), ), - AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( task_id, aggregation_job_ids[1], - AggregationParam(1), + dummy::AggregationParam(1), (), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)).unwrap(), AggregationJobState::Finished, @@ -3684,7 +3675,7 @@ async fn collection_job_acquire_job_max(ephemeral_datastore: EphemeralDatastore) ), ]); let report_aggregations = Vec::from([ - ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + ReportAggregation::<0, dummy::Vdaf>::new( task_id, aggregation_job_ids[0], *reports[0].metadata().id(), @@ -3693,7 +3684,7 @@ async fn collection_job_acquire_job_max(ephemeral_datastore: EphemeralDatastore) None, ReportAggregationState::Finished, ), - ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + ReportAggregation::<0, dummy::Vdaf>::new( task_id, aggregation_job_ids[1], *reports[0].metadata().id(), @@ -3709,7 +3700,7 @@ async fn collection_job_acquire_job_max(ephemeral_datastore: EphemeralDatastore) should_be_acquired: true, task_id, batch_identifier: batch_interval, - agg_param: AggregationParam(0), + agg_param: dummy::AggregationParam(0), collection_job_id: None, client_timestamp_interval: batch_interval, state: CollectionJobTestCaseState::Collectable, @@ -3718,7 +3709,7 @@ async fn collection_job_acquire_job_max(ephemeral_datastore: EphemeralDatastore) should_be_acquired: true, task_id, batch_identifier: batch_interval, - agg_param: AggregationParam(1), + agg_param: dummy::AggregationParam(1), collection_job_id: None, client_timestamp_interval: batch_interval, state: CollectionJobTestCaseState::Collectable, @@ -3808,28 +3799,28 @@ async fn collection_job_acquire_state_filtering(ephemeral_datastore: EphemeralDa ) .unwrap(); let aggregation_jobs = Vec::from([ - AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( task_id, aggregation_job_ids[0], - AggregationParam(0), + dummy::AggregationParam(0), (), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)).unwrap(), AggregationJobState::Finished, AggregationJobStep::from(1), ), - AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( task_id, aggregation_job_ids[1], - AggregationParam(1), + dummy::AggregationParam(1), (), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)).unwrap(), AggregationJobState::Finished, AggregationJobStep::from(1), ), - AggregationJob::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + AggregationJob::<0, TimeInterval, dummy::Vdaf>::new( task_id, aggregation_job_ids[2], - AggregationParam(2), + dummy::AggregationParam(2), (), Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)).unwrap(), AggregationJobState::Finished, @@ -3837,7 +3828,7 @@ async fn collection_job_acquire_state_filtering(ephemeral_datastore: EphemeralDa ), ]); let report_aggregations = Vec::from([ - ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + ReportAggregation::<0, dummy::Vdaf>::new( task_id, aggregation_job_ids[0], *reports[0].metadata().id(), @@ -3846,7 +3837,7 @@ async fn collection_job_acquire_state_filtering(ephemeral_datastore: EphemeralDa None, ReportAggregationState::Finished, ), - ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + ReportAggregation::<0, dummy::Vdaf>::new( task_id, aggregation_job_ids[1], *reports[0].metadata().id(), @@ -3855,7 +3846,7 @@ async fn collection_job_acquire_state_filtering(ephemeral_datastore: EphemeralDa None, ReportAggregationState::Finished, ), - ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + ReportAggregation::<0, dummy::Vdaf>::new( task_id, aggregation_job_ids[2], *reports[0].metadata().id(), @@ -3871,7 +3862,7 @@ async fn collection_job_acquire_state_filtering(ephemeral_datastore: EphemeralDa should_be_acquired: true, task_id, batch_identifier: batch_interval, - agg_param: AggregationParam(0), + agg_param: dummy::AggregationParam(0), collection_job_id: None, client_timestamp_interval: Interval::EMPTY, state: CollectionJobTestCaseState::Finished, @@ -3880,7 +3871,7 @@ async fn collection_job_acquire_state_filtering(ephemeral_datastore: EphemeralDa should_be_acquired: true, task_id, batch_identifier: batch_interval, - agg_param: AggregationParam(1), + agg_param: dummy::AggregationParam(1), collection_job_id: None, client_timestamp_interval: Interval::EMPTY, state: CollectionJobTestCaseState::Abandoned, @@ -3889,7 +3880,7 @@ async fn collection_job_acquire_state_filtering(ephemeral_datastore: EphemeralDa should_be_acquired: true, task_id, batch_identifier: batch_interval, - agg_param: AggregationParam(2), + agg_param: dummy::AggregationParam(2), collection_job_id: None, client_timestamp_interval: Interval::EMPTY, state: CollectionJobTestCaseState::Deleted, @@ -3943,8 +3934,8 @@ async fn roundtrip_batch_aggregation_time_interval(ephemeral_datastore: Ephemera .build() .leader_view() .unwrap(); - let aggregate_share = AggregateShare(23); - let aggregation_param = AggregationParam(12); + let aggregate_share = dummy::AggregateShare(23); + let aggregation_param = dummy::AggregationParam(12); let (first_batch_aggregation, second_batch_aggregation, third_batch_aggregation) = ds .run_tx("test-put-batch-aggregations", |tx| { @@ -3956,7 +3947,7 @@ async fn roundtrip_batch_aggregation_time_interval(ephemeral_datastore: Ephemera tx.put_aggregator_task(&other_task).await?; for when in [1000, 1100, 1200, 1300, 1400] { - tx.put_batch(&Batch::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), Interval::new(Time::from_seconds_since_epoch(when), time_precision) .unwrap(), @@ -3970,21 +3961,19 @@ async fn roundtrip_batch_aggregation_time_interval(ephemeral_datastore: Ephemera .unwrap(); } - let first_batch_aggregation = - BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( - *task.id(), - Interval::new(Time::from_seconds_since_epoch(1100), time_precision) - .unwrap(), - aggregation_param, - 0, - BatchAggregationState::Aggregating, - Some(aggregate_share), - 0, - ReportIdChecksum::default(), - ); + let first_batch_aggregation = BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + Interval::new(Time::from_seconds_since_epoch(1100), time_precision).unwrap(), + aggregation_param, + 0, + BatchAggregationState::Aggregating, + Some(aggregate_share), + 0, + ReportIdChecksum::default(), + ); let second_batch_aggregation = - BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), Interval::new(Time::from_seconds_since_epoch(1200), time_precision) .unwrap(), @@ -3996,33 +3985,28 @@ async fn roundtrip_batch_aggregation_time_interval(ephemeral_datastore: Ephemera ReportIdChecksum::default(), ); - let third_batch_aggregation = - BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( - *task.id(), - Interval::new(Time::from_seconds_since_epoch(1300), time_precision) - .unwrap(), - aggregation_param, - 2, - BatchAggregationState::Aggregating, - Some(aggregate_share), - 0, - ReportIdChecksum::default(), - ); + let third_batch_aggregation = BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + Interval::new(Time::from_seconds_since_epoch(1300), time_precision).unwrap(), + aggregation_param, + 2, + BatchAggregationState::Aggregating, + Some(aggregate_share), + 0, + ReportIdChecksum::default(), + ); // Start of this aggregation's interval is before the interval queried below. - tx.put_batch_aggregation( - &BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( - *task.id(), - Interval::new(Time::from_seconds_since_epoch(1000), time_precision) - .unwrap(), - aggregation_param, - 3, - BatchAggregationState::Collected, - None, - 0, - ReportIdChecksum::default(), - ), - ) + tx.put_batch_aggregation(&BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + Interval::new(Time::from_seconds_since_epoch(1000), time_precision).unwrap(), + aggregation_param, + 3, + BatchAggregationState::Collected, + None, + 0, + ReportIdChecksum::default(), + )) .await?; // Following three batches are within the interval queried below. @@ -4036,48 +4020,42 @@ async fn roundtrip_batch_aggregation_time_interval(ephemeral_datastore: Ephemera ); // Aggregation parameter differs from the one queried below. - tx.put_batch(&Batch::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), Interval::new(Time::from_seconds_since_epoch(1000), time_precision).unwrap(), - AggregationParam(13), + dummy::AggregationParam(13), BatchState::Closed, 0, Interval::new(Time::from_seconds_since_epoch(1000), time_precision).unwrap(), )) .await?; - tx.put_batch_aggregation( - &BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( - *task.id(), - Interval::new(Time::from_seconds_since_epoch(1000), time_precision) - .unwrap(), - AggregationParam(13), - 4, - BatchAggregationState::Aggregating, - Some(aggregate_share), - 0, - ReportIdChecksum::default(), - ), - ) + tx.put_batch_aggregation(&BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + Interval::new(Time::from_seconds_since_epoch(1000), time_precision).unwrap(), + dummy::AggregationParam(13), + 4, + BatchAggregationState::Aggregating, + Some(aggregate_share), + 0, + ReportIdChecksum::default(), + )) .await?; // Start of this aggregation's interval is after the interval queried below. - tx.put_batch_aggregation( - &BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( - *task.id(), - Interval::new(Time::from_seconds_since_epoch(1400), time_precision) - .unwrap(), - aggregation_param, - 5, - BatchAggregationState::Collected, - None, - 0, - ReportIdChecksum::default(), - ), - ) + tx.put_batch_aggregation(&BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( + *task.id(), + Interval::new(Time::from_seconds_since_epoch(1400), time_precision).unwrap(), + aggregation_param, + 5, + BatchAggregationState::Collected, + None, + 0, + ReportIdChecksum::default(), + )) .await?; // Task ID differs from that queried below. - tx.put_batch(&Batch::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, TimeInterval, dummy::Vdaf>::new( *other_task.id(), Interval::new(Time::from_seconds_since_epoch(1200), time_precision).unwrap(), aggregation_param, @@ -4086,19 +4064,16 @@ async fn roundtrip_batch_aggregation_time_interval(ephemeral_datastore: Ephemera Interval::new(Time::from_seconds_since_epoch(1200), time_precision).unwrap(), )) .await?; - tx.put_batch_aggregation( - &BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( - *other_task.id(), - Interval::new(Time::from_seconds_since_epoch(1200), time_precision) - .unwrap(), - aggregation_param, - 6, - BatchAggregationState::Aggregating, - Some(aggregate_share), - 0, - ReportIdChecksum::default(), - ), - ) + tx.put_batch_aggregation(&BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( + *other_task.id(), + Interval::new(Time::from_seconds_since_epoch(1200), time_precision).unwrap(), + aggregation_param, + 6, + BatchAggregationState::Aggregating, + Some(aggregate_share), + 0, + ReportIdChecksum::default(), + )) .await?; tx.check_timestamp_columns( @@ -4128,12 +4103,12 @@ async fn roundtrip_batch_aggregation_time_interval(ephemeral_datastore: Ephemera let third_batch_aggregation = third_batch_aggregation.clone(); Box::pin(async move { - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::default(); let batch_aggregations = TimeInterval::get_batch_aggregations_for_collection_identifier::< 0, - dummy_vdaf::Vdaf, + dummy::Vdaf, _, >( tx, @@ -4160,24 +4135,23 @@ async fn roundtrip_batch_aggregation_time_interval(ephemeral_datastore: Ephemera ); } - let first_batch_aggregation = - BatchAggregation::<0, TimeInterval, dummy_vdaf::Vdaf>::new( - *first_batch_aggregation.task_id(), - *first_batch_aggregation.batch_interval(), - *first_batch_aggregation.aggregation_parameter(), - first_batch_aggregation.ord(), - *first_batch_aggregation.state(), - Some(AggregateShare(92)), - 1, - ReportIdChecksum::get_decoded(&[1; 32]).unwrap(), - ); + let first_batch_aggregation = BatchAggregation::<0, TimeInterval, dummy::Vdaf>::new( + *first_batch_aggregation.task_id(), + *first_batch_aggregation.batch_interval(), + *first_batch_aggregation.aggregation_parameter(), + first_batch_aggregation.ord(), + *first_batch_aggregation.state(), + Some(dummy::AggregateShare(92)), + 1, + ReportIdChecksum::get_decoded(&[1; 32]).unwrap(), + ); tx.update_batch_aggregation(&first_batch_aggregation) .await?; let batch_aggregations = TimeInterval::get_batch_aggregations_for_collection_identifier::< 0, - dummy_vdaf::Vdaf, + dummy::Vdaf, _, >( tx, @@ -4216,12 +4190,12 @@ async fn roundtrip_batch_aggregation_time_interval(ephemeral_datastore: Ephemera ds.run_unnamed_tx(|tx| { let task = task.clone(); Box::pin(async move { - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::default(); - let batch_aggregations: Vec> = + let batch_aggregations: Vec> = TimeInterval::get_batch_aggregations_for_collection_identifier::< 0, - dummy_vdaf::Vdaf, + dummy::Vdaf, _, >( tx, @@ -4265,8 +4239,8 @@ async fn roundtrip_batch_aggregation_fixed_size(ephemeral_datastore: EphemeralDa .leader_view() .unwrap(); let batch_id = random(); - let aggregate_share = AggregateShare(23); - let aggregation_param = AggregationParam(12); + let aggregate_share = dummy::AggregateShare(23); + let aggregation_param = dummy::AggregationParam(12); let batch_aggregation = ds .run_unnamed_tx(|tx| { let task = task.clone(); @@ -4285,7 +4259,7 @@ async fn roundtrip_batch_aggregation_fixed_size(ephemeral_datastore: EphemeralDa tx.put_aggregator_task(&task).await?; tx.put_aggregator_task(&other_task).await?; - tx.put_batch(&Batch::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, FixedSize, dummy::Vdaf>::new( *task.id(), batch_id, aggregation_param, @@ -4297,7 +4271,7 @@ async fn roundtrip_batch_aggregation_fixed_size(ephemeral_datastore: EphemeralDa .await .unwrap(); - let batch_aggregation = BatchAggregation::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let batch_aggregation = BatchAggregation::<0, FixedSize, dummy::Vdaf>::new( *task.id(), batch_id, aggregation_param, @@ -4318,7 +4292,7 @@ async fn roundtrip_batch_aggregation_fixed_size(ephemeral_datastore: EphemeralDa // Wrong batch ID. let other_batch_id = random(); - tx.put_batch(&Batch::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, FixedSize, dummy::Vdaf>::new( *task.id(), other_batch_id, aggregation_param, @@ -4329,7 +4303,7 @@ async fn roundtrip_batch_aggregation_fixed_size(ephemeral_datastore: EphemeralDa )) .await .unwrap(); - tx.put_batch_aggregation(&BatchAggregation::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch_aggregation(&BatchAggregation::<0, FixedSize, dummy::Vdaf>::new( *task.id(), other_batch_id, aggregation_param, @@ -4342,7 +4316,7 @@ async fn roundtrip_batch_aggregation_fixed_size(ephemeral_datastore: EphemeralDa .await?; // Task ID differs from that queried below. - tx.put_batch(&Batch::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, FixedSize, dummy::Vdaf>::new( *other_task.id(), batch_id, aggregation_param, @@ -4353,7 +4327,7 @@ async fn roundtrip_batch_aggregation_fixed_size(ephemeral_datastore: EphemeralDa )) .await .unwrap(); - tx.put_batch_aggregation(&BatchAggregation::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch_aggregation(&BatchAggregation::<0, FixedSize, dummy::Vdaf>::new( *other_task.id(), batch_id, aggregation_param, @@ -4366,7 +4340,7 @@ async fn roundtrip_batch_aggregation_fixed_size(ephemeral_datastore: EphemeralDa .await?; // Index differs from that queried below. - tx.put_batch_aggregation(&BatchAggregation::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch_aggregation(&BatchAggregation::<0, FixedSize, dummy::Vdaf>::new( *task.id(), batch_id, aggregation_param, @@ -4390,10 +4364,10 @@ async fn roundtrip_batch_aggregation_fixed_size(ephemeral_datastore: EphemeralDa let task = task.clone(); let batch_aggregation = batch_aggregation.clone(); Box::pin(async move { - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::default(); let got_batch_aggregation = tx - .get_batch_aggregation::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_batch_aggregation::<0, FixedSize, dummy::Vdaf>( &vdaf, task.id(), &batch_id, @@ -4403,7 +4377,7 @@ async fn roundtrip_batch_aggregation_fixed_size(ephemeral_datastore: EphemeralDa .await?; assert_eq!(got_batch_aggregation.as_ref(), Some(&batch_aggregation)); - let batch_aggregation = BatchAggregation::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let batch_aggregation = BatchAggregation::<0, FixedSize, dummy::Vdaf>::new( *batch_aggregation.task_id(), *batch_aggregation.batch_id(), *batch_aggregation.aggregation_parameter(), @@ -4416,7 +4390,7 @@ async fn roundtrip_batch_aggregation_fixed_size(ephemeral_datastore: EphemeralDa tx.update_batch_aggregation(&batch_aggregation).await?; let got_batch_aggregation = tx - .get_batch_aggregation::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_batch_aggregation::<0, FixedSize, dummy::Vdaf>( &vdaf, task.id(), &batch_id, @@ -4437,10 +4411,10 @@ async fn roundtrip_batch_aggregation_fixed_size(ephemeral_datastore: EphemeralDa ds.run_unnamed_tx(|tx| { let task = task.clone(); Box::pin(async move { - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::default(); let got_batch_aggregation = tx - .get_batch_aggregation::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_batch_aggregation::<0, FixedSize, dummy::Vdaf>( &vdaf, task.id(), &batch_id, @@ -4475,11 +4449,11 @@ async fn roundtrip_aggregate_share_job_time_interval(ephemeral_datastore: Epheme .unwrap(); tx.put_aggregator_task(&task).await?; - tx.put_batch(&Batch::<0, TimeInterval, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, TimeInterval, dummy::Vdaf>::new( *task.id(), Interval::new(OLDEST_ALLOWED_REPORT_TIMESTAMP, Duration::from_seconds(100)) .unwrap(), - AggregationParam(11), + dummy::AggregationParam(11), BatchState::Closed, 0, Interval::new(OLDEST_ALLOWED_REPORT_TIMESTAMP, Duration::from_seconds(100)) @@ -4492,17 +4466,15 @@ async fn roundtrip_aggregate_share_job_time_interval(ephemeral_datastore: Epheme *task.id(), Interval::new(OLDEST_ALLOWED_REPORT_TIMESTAMP, Duration::from_seconds(100)) .unwrap(), - AggregationParam(11), - AggregateShare(42), + dummy::AggregationParam(11), + dummy::AggregateShare(42), 10, ReportIdChecksum::get_decoded(&[1; 32]).unwrap(), ); - tx.put_aggregate_share_job::<0, TimeInterval, dummy_vdaf::Vdaf>( - &aggregate_share_job, - ) - .await - .unwrap(); + tx.put_aggregate_share_job::<0, TimeInterval, dummy::Vdaf>(&aggregate_share_job) + .await + .unwrap(); tx.check_timestamp_columns( "aggregate_share_jobs", @@ -4523,10 +4495,10 @@ async fn roundtrip_aggregate_share_job_time_interval(ephemeral_datastore: Epheme ds.run_unnamed_tx(|tx| { let want_aggregate_share_job = aggregate_share_job.clone(); Box::pin(async move { - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::default(); let got_aggregate_share_job = tx - .get_aggregate_share_job::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_aggregate_share_job::<0, TimeInterval, dummy::Vdaf>( &vdaf, want_aggregate_share_job.task_id(), want_aggregate_share_job.batch_interval(), @@ -4539,7 +4511,7 @@ async fn roundtrip_aggregate_share_job_time_interval(ephemeral_datastore: Epheme assert_eq!(want_aggregate_share_job, got_aggregate_share_job); assert!(tx - .get_aggregate_share_job::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_aggregate_share_job::<0, TimeInterval, dummy::Vdaf>( &vdaf, want_aggregate_share_job.task_id(), &Interval::new( @@ -4556,7 +4528,7 @@ async fn roundtrip_aggregate_share_job_time_interval(ephemeral_datastore: Epheme let want_aggregate_share_jobs = Vec::from([want_aggregate_share_job.clone()]); let got_aggregate_share_jobs = tx - .get_aggregate_share_jobs_including_time::<0, dummy_vdaf::Vdaf>( + .get_aggregate_share_jobs_including_time::<0, dummy::Vdaf>( &vdaf, want_aggregate_share_job.task_id(), &OLDEST_ALLOWED_REPORT_TIMESTAMP @@ -4567,7 +4539,7 @@ async fn roundtrip_aggregate_share_job_time_interval(ephemeral_datastore: Epheme assert_eq!(got_aggregate_share_jobs, want_aggregate_share_jobs); let got_aggregate_share_jobs = tx - .get_aggregate_share_jobs_intersecting_interval::<0, dummy_vdaf::Vdaf>( + .get_aggregate_share_jobs_intersecting_interval::<0, dummy::Vdaf>( &vdaf, want_aggregate_share_job.task_id(), &Interval::new( @@ -4593,10 +4565,10 @@ async fn roundtrip_aggregate_share_job_time_interval(ephemeral_datastore: Epheme ds.run_unnamed_tx(|tx| { let want_aggregate_share_job = aggregate_share_job.clone(); Box::pin(async move { - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::default(); assert_eq!( - tx.get_aggregate_share_job::<0, TimeInterval, dummy_vdaf::Vdaf>( + tx.get_aggregate_share_job::<0, TimeInterval, dummy::Vdaf>( &vdaf, want_aggregate_share_job.task_id(), want_aggregate_share_job.batch_interval(), @@ -4608,7 +4580,7 @@ async fn roundtrip_aggregate_share_job_time_interval(ephemeral_datastore: Epheme ); assert_eq!( - tx.get_aggregate_share_jobs_including_time::<0, dummy_vdaf::Vdaf>( + tx.get_aggregate_share_jobs_including_time::<0, dummy::Vdaf>( &vdaf, want_aggregate_share_job.task_id(), &OLDEST_ALLOWED_REPORT_TIMESTAMP @@ -4621,7 +4593,7 @@ async fn roundtrip_aggregate_share_job_time_interval(ephemeral_datastore: Epheme ); assert!(tx - .get_aggregate_share_jobs_intersecting_interval::<0, dummy_vdaf::Vdaf>( + .get_aggregate_share_jobs_intersecting_interval::<0, dummy::Vdaf>( &vdaf, want_aggregate_share_job.task_id(), &Interval::new( @@ -4668,10 +4640,10 @@ async fn roundtrip_aggregate_share_job_fixed_size(ephemeral_datastore: Ephemeral tx.put_aggregator_task(&task).await?; let batch_id = random(); - tx.put_batch(&Batch::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, FixedSize, dummy::Vdaf>::new( *task.id(), batch_id, - AggregationParam(11), + dummy::AggregationParam(11), BatchState::Closed, 0, Interval::new(OLDEST_ALLOWED_REPORT_TIMESTAMP, Duration::from_seconds(1)) @@ -4683,13 +4655,13 @@ async fn roundtrip_aggregate_share_job_fixed_size(ephemeral_datastore: Ephemeral let aggregate_share_job = AggregateShareJob::new( *task.id(), batch_id, - AggregationParam(11), - AggregateShare(42), + dummy::AggregationParam(11), + dummy::AggregateShare(42), 10, ReportIdChecksum::get_decoded(&[1; 32]).unwrap(), ); - tx.put_aggregate_share_job::<0, FixedSize, dummy_vdaf::Vdaf>(&aggregate_share_job) + tx.put_aggregate_share_job::<0, FixedSize, dummy::Vdaf>(&aggregate_share_job) .await .unwrap(); @@ -4705,10 +4677,10 @@ async fn roundtrip_aggregate_share_job_fixed_size(ephemeral_datastore: Ephemeral ds.run_unnamed_tx(|tx| { let want_aggregate_share_job = aggregate_share_job.clone(); Box::pin(async move { - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::default(); let got_aggregate_share_job = tx - .get_aggregate_share_job::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_aggregate_share_job::<0, FixedSize, dummy::Vdaf>( &vdaf, want_aggregate_share_job.task_id(), want_aggregate_share_job.batch_id(), @@ -4720,7 +4692,7 @@ async fn roundtrip_aggregate_share_job_fixed_size(ephemeral_datastore: Ephemeral assert_eq!(want_aggregate_share_job, got_aggregate_share_job); assert!(tx - .get_aggregate_share_job::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_aggregate_share_job::<0, FixedSize, dummy::Vdaf>( &vdaf, want_aggregate_share_job.task_id(), &random(), @@ -4733,7 +4705,7 @@ async fn roundtrip_aggregate_share_job_fixed_size(ephemeral_datastore: Ephemeral let want_aggregate_share_jobs = Vec::from([want_aggregate_share_job.clone()]); let got_aggregate_share_jobs = tx - .get_aggregate_share_jobs_by_batch_id::<0, dummy_vdaf::Vdaf>( + .get_aggregate_share_jobs_by_batch_id::<0, dummy::Vdaf>( &vdaf, want_aggregate_share_job.task_id(), want_aggregate_share_job.batch_id(), @@ -4753,10 +4725,10 @@ async fn roundtrip_aggregate_share_job_fixed_size(ephemeral_datastore: Ephemeral ds.run_unnamed_tx(|tx| { let want_aggregate_share_job = aggregate_share_job.clone(); Box::pin(async move { - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::default(); assert_eq!( - tx.get_aggregate_share_job::<0, FixedSize, dummy_vdaf::Vdaf>( + tx.get_aggregate_share_job::<0, FixedSize, dummy::Vdaf>( &vdaf, want_aggregate_share_job.task_id(), want_aggregate_share_job.batch_id(), @@ -4768,7 +4740,7 @@ async fn roundtrip_aggregate_share_job_fixed_size(ephemeral_datastore: Ephemeral ); assert_eq!( - tx.get_aggregate_share_jobs_by_batch_id::<0, dummy_vdaf::Vdaf>( + tx.get_aggregate_share_jobs_by_batch_id::<0, dummy::Vdaf>( &vdaf, want_aggregate_share_job.task_id(), want_aggregate_share_job.batch_id(), @@ -4819,10 +4791,10 @@ async fn roundtrip_outstanding_batch(ephemeral_datastore: EphemeralDatastore) { let report_1 = LeaderStoredReport::new_dummy(*task_1.id(), OLDEST_ALLOWED_REPORT_TIMESTAMP); - tx.put_batch(&Batch::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, FixedSize, dummy::Vdaf>::new( *task_1.id(), batch_id_1, - AggregationParam(0), + dummy::AggregationParam(0), BatchState::Closed, 0, Interval::new(OLDEST_ALLOWED_REPORT_TIMESTAMP, Duration::from_seconds(1)) @@ -4848,10 +4820,10 @@ async fn roundtrip_outstanding_batch(ephemeral_datastore: EphemeralDatastore) { let report_2 = LeaderStoredReport::new_dummy(*task_2.id(), OLDEST_ALLOWED_REPORT_TIMESTAMP); - tx.put_batch(&Batch::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, FixedSize, dummy::Vdaf>::new( *task_2.id(), batch_id_2, - AggregationParam(0), + dummy::AggregationParam(0), BatchState::Closed, 0, Interval::new(OLDEST_ALLOWED_REPORT_TIMESTAMP, Duration::from_seconds(1)) @@ -4863,10 +4835,10 @@ async fn roundtrip_outstanding_batch(ephemeral_datastore: EphemeralDatastore) { // Write a few aggregation jobs & report aggregations to produce useful // min_size/max_size values to validate later. - let aggregation_job_0 = AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let aggregation_job_0 = AggregationJob::<0, FixedSize, dummy::Vdaf>::new( *task_1.id(), random(), - AggregationParam(0), + dummy::AggregationParam(0), batch_id_1, Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)) .unwrap(), @@ -4878,14 +4850,14 @@ async fn roundtrip_outstanding_batch(ephemeral_datastore: EphemeralDatastore) { let report_id_0_1 = random(); let transcript = run_vdaf( - &dummy_vdaf::Vdaf::new(), + &dummy::Vdaf::default(), task_1.vdaf_verify_key().unwrap().as_bytes(), - &dummy_vdaf::AggregationParam(0), + &dummy::AggregationParam(0), &report_id_0_1, - &(), + &0, ); - let report_aggregation_0_1 = ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + let report_aggregation_0_1 = ReportAggregation::<0, dummy::Vdaf>::new( *task_1.id(), *aggregation_job_0.id(), report_id_0_1, @@ -4897,7 +4869,7 @@ async fn roundtrip_outstanding_batch(ephemeral_datastore: EphemeralDatastore) { transition: transcript.helper_prepare_transitions[0].transition.clone(), }, ); - let report_aggregation_0_2 = ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + let report_aggregation_0_2 = ReportAggregation::<0, dummy::Vdaf>::new( *task_1.id(), *aggregation_job_0.id(), random(), @@ -4909,17 +4881,17 @@ async fn roundtrip_outstanding_batch(ephemeral_datastore: EphemeralDatastore) { }, // Not counted among min_size or max_size. ); - let aggregation_job_1 = AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let aggregation_job_1 = AggregationJob::<0, FixedSize, dummy::Vdaf>::new( *task_1.id(), random(), - AggregationParam(0), + dummy::AggregationParam(0), batch_id_1, Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)) .unwrap(), AggregationJobState::Finished, AggregationJobStep::from(1), ); - let report_aggregation_1_0 = ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + let report_aggregation_1_0 = ReportAggregation::<0, dummy::Vdaf>::new( *task_1.id(), *aggregation_job_1.id(), random(), @@ -4928,7 +4900,7 @@ async fn roundtrip_outstanding_batch(ephemeral_datastore: EphemeralDatastore) { None, ReportAggregationState::Finished, // Counted among min_size and max_size. ); - let report_aggregation_1_1 = ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + let report_aggregation_1_1 = ReportAggregation::<0, dummy::Vdaf>::new( *task_1.id(), *aggregation_job_1.id(), random(), @@ -4937,7 +4909,7 @@ async fn roundtrip_outstanding_batch(ephemeral_datastore: EphemeralDatastore) { None, ReportAggregationState::Finished, // Counted among min_size and max_size. ); - let report_aggregation_1_2 = ReportAggregation::<0, dummy_vdaf::Vdaf>::new( + let report_aggregation_1_2 = ReportAggregation::<0, dummy::Vdaf>::new( *task_1.id(), *aggregation_job_1.id(), random(), @@ -4949,10 +4921,10 @@ async fn roundtrip_outstanding_batch(ephemeral_datastore: EphemeralDatastore) { }, // Not counted among min_size or max_size. ); - let aggregation_job_2 = AggregationJob::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let aggregation_job_2 = AggregationJob::<0, FixedSize, dummy::Vdaf>::new( *task_2.id(), random(), - AggregationParam(0), + dummy::AggregationParam(0), batch_id_2, Interval::new(Time::from_seconds_since_epoch(0), Duration::from_seconds(1)) .unwrap(), @@ -4975,7 +4947,7 @@ async fn roundtrip_outstanding_batch(ephemeral_datastore: EphemeralDatastore) { report_aggregation_2_0, ] { tx.put_client_report( - &dummy_vdaf::Vdaf::new(), + &dummy::Vdaf::default(), &LeaderStoredReport::new( *report_aggregation.task_id(), ReportMetadata::new( @@ -4984,7 +4956,7 @@ async fn roundtrip_outstanding_batch(ephemeral_datastore: EphemeralDatastore) { ), (), // Dummy public share Vec::new(), - dummy_vdaf::InputShare::default(), // Dummy leader input share + dummy::InputShare::default(), // Dummy leader input share // Dummy helper encrypted input share HpkeCiphertext::new( HpkeConfigId::from(13), @@ -4997,24 +4969,24 @@ async fn roundtrip_outstanding_batch(ephemeral_datastore: EphemeralDatastore) { tx.put_report_aggregation(report_aggregation).await?; } - tx.put_batch_aggregation(&BatchAggregation::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch_aggregation(&BatchAggregation::<0, FixedSize, dummy::Vdaf>::new( *task_1.id(), batch_id_1, - AggregationParam(0), + dummy::AggregationParam(0), 0, BatchAggregationState::Aggregating, - Some(AggregateShare(0)), + Some(dummy::AggregateShare(0)), 1, ReportIdChecksum::default(), )) .await?; - tx.put_batch_aggregation(&BatchAggregation::<0, FixedSize, dummy_vdaf::Vdaf>::new( + tx.put_batch_aggregation(&BatchAggregation::<0, FixedSize, dummy::Vdaf>::new( *task_1.id(), batch_id_1, - AggregationParam(0), + dummy::AggregationParam(0), 1, BatchAggregationState::Aggregating, - Some(AggregateShare(0)), + Some(dummy::AggregateShare(0)), 1, ReportIdChecksum::default(), )) @@ -5125,10 +5097,10 @@ async fn roundtrip_batch(ephemeral_datastore: EphemeralDatastore) { let clock = MockClock::new(OLDEST_ALLOWED_REPORT_TIMESTAMP); let ds = ephemeral_datastore.datastore(clock.clone()).await; - let want_batch = Batch::<0, FixedSize, dummy_vdaf::Vdaf>::new( + let want_batch = Batch::<0, FixedSize, dummy::Vdaf>::new( random(), random(), - AggregationParam(2), + dummy::AggregationParam(2), BatchState::Closing, 1, Interval::new(OLDEST_ALLOWED_REPORT_TIMESTAMP, Duration::from_seconds(1)).unwrap(), @@ -5182,7 +5154,7 @@ async fn roundtrip_batch(ephemeral_datastore: EphemeralDatastore) { Some(&want_batch) ); assert_eq!( - tx.get_batch::<0, FixedSize, dummy_vdaf::Vdaf>( + tx.get_batch::<0, FixedSize, dummy::Vdaf>( &random(), want_batch.batch_identifier(), want_batch.aggregation_parameter() @@ -5191,7 +5163,7 @@ async fn roundtrip_batch(ephemeral_datastore: EphemeralDatastore) { None ); assert_eq!( - tx.get_batch::<0, FixedSize, dummy_vdaf::Vdaf>( + tx.get_batch::<0, FixedSize, dummy::Vdaf>( want_batch.task_id(), &random(), want_batch.aggregation_parameter() @@ -5200,10 +5172,10 @@ async fn roundtrip_batch(ephemeral_datastore: EphemeralDatastore) { None ); assert_eq!( - tx.get_batch::<0, FixedSize, dummy_vdaf::Vdaf>( + tx.get_batch::<0, FixedSize, dummy::Vdaf>( want_batch.task_id(), want_batch.batch_identifier(), - &AggregationParam(3) + &dummy::AggregationParam(3) ) .await?, None @@ -5248,7 +5220,7 @@ async fn roundtrip_batch(ephemeral_datastore: EphemeralDatastore) { Box::pin(async move { // Try reading the batch back, and verify it is expired. assert_eq!( - tx.get_batch::<0, FixedSize, dummy_vdaf::Vdaf>( + tx.get_batch::<0, FixedSize, dummy::Vdaf>( want_batch.task_id(), want_batch.batch_identifier(), want_batch.aggregation_parameter() @@ -5271,7 +5243,7 @@ async fn delete_expired_client_reports(ephemeral_datastore: EphemeralDatastore) let clock = MockClock::default(); let ds = ephemeral_datastore.datastore(clock.clone()).await; - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::default(); // Setup. let report_expiry_age = clock @@ -5308,11 +5280,11 @@ async fn delete_expired_client_reports(ephemeral_datastore: EphemeralDatastore) .sub(&Duration::from_seconds(1)) .unwrap(), ); - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &old_report) + tx.put_client_report(&dummy::Vdaf::default(), &old_report) .await?; - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &new_report) + tx.put_client_report(&dummy::Vdaf::default(), &new_report) .await?; - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &other_task_report) + tx.put_client_report(&dummy::Vdaf::default(), &other_task_report) .await?; Ok(( @@ -5368,7 +5340,7 @@ async fn delete_expired_client_reports_noop(ephemeral_datastore: EphemeralDatast let clock = MockClock::default(); let ds = ephemeral_datastore.datastore(clock.clone()).await; - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::default(); // Setup. let (task_id, new_report_id, old_report_id) = ds @@ -5389,9 +5361,9 @@ async fn delete_expired_client_reports_noop(ephemeral_datastore: EphemeralDatast ); let new_report = LeaderStoredReport::new_dummy(*task.id(), OLDEST_ALLOWED_REPORT_TIMESTAMP); - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &old_report) + tx.put_client_report(&dummy::Vdaf::default(), &old_report) .await?; - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &new_report) + tx.put_client_report(&dummy::Vdaf::default(), &new_report) .await?; Ok(( @@ -5442,7 +5414,7 @@ async fn delete_expired_aggregation_artifacts(ephemeral_datastore: EphemeralData let clock = MockClock::new(OLDEST_ALLOWED_REPORT_TIMESTAMP); let ds = ephemeral_datastore.datastore(clock.clone()).await; - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::default(); // Setup. async fn write_aggregation_artifacts( @@ -5459,7 +5431,7 @@ async fn delete_expired_aggregation_artifacts(ephemeral_datastore: EphemeralData let mut reports = Vec::new(); for client_timestamp in client_timestamps { let report = LeaderStoredReport::new_dummy(*task_id, *client_timestamp); - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &report) + tx.put_client_report(&dummy::Vdaf::default(), &report) .await .unwrap(); reports.push(report); @@ -5477,10 +5449,10 @@ async fn delete_expired_aggregation_artifacts(ephemeral_datastore: EphemeralData ) .unwrap(); - let aggregation_job = AggregationJob::<0, Q, dummy_vdaf::Vdaf>::new( + let aggregation_job = AggregationJob::<0, Q, dummy::Vdaf>::new( *task_id, random(), - AggregationParam(0), + dummy::AggregationParam(0), Q::partial_batch_identifier(&batch_identifier).clone(), client_timestamp_interval, AggregationJobState::InProgress, @@ -5808,7 +5780,7 @@ async fn delete_expired_aggregation_artifacts(ephemeral_datastore: EphemeralData let vdaf = vdaf.clone(); Box::pin(async move { let leader_time_interval_aggregation_job_ids = tx - .get_aggregation_jobs_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_aggregation_jobs_for_task::<0, TimeInterval, dummy::Vdaf>( &leader_time_interval_task_id, ) .await @@ -5816,7 +5788,7 @@ async fn delete_expired_aggregation_artifacts(ephemeral_datastore: EphemeralData .into_iter() .map(|job| *job.id()); let helper_time_interval_aggregation_job_ids = tx - .get_aggregation_jobs_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_aggregation_jobs_for_task::<0, TimeInterval, dummy::Vdaf>( &helper_time_interval_task_id, ) .await @@ -5824,7 +5796,7 @@ async fn delete_expired_aggregation_artifacts(ephemeral_datastore: EphemeralData .into_iter() .map(|job| *job.id()); let leader_fixed_size_aggregation_job_ids = tx - .get_aggregation_jobs_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_aggregation_jobs_for_task::<0, FixedSize, dummy::Vdaf>( &leader_fixed_size_task_id, ) .await @@ -5832,7 +5804,7 @@ async fn delete_expired_aggregation_artifacts(ephemeral_datastore: EphemeralData .into_iter() .map(|job| *job.id()); let helper_fixed_size_aggregation_job_ids = tx - .get_aggregation_jobs_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_aggregation_jobs_for_task::<0, FixedSize, dummy::Vdaf>( &helper_fixed_size_task_id, ) .await @@ -5846,7 +5818,7 @@ async fn delete_expired_aggregation_artifacts(ephemeral_datastore: EphemeralData .collect(); let leader_time_interval_report_aggregations = tx - .get_report_aggregations_for_task::<0, dummy_vdaf::Vdaf>( + .get_report_aggregations_for_task::<0, dummy::Vdaf>( &vdaf, &Role::Leader, &leader_time_interval_task_id, @@ -5854,7 +5826,7 @@ async fn delete_expired_aggregation_artifacts(ephemeral_datastore: EphemeralData .await .unwrap(); let helper_time_interval_report_aggregations = tx - .get_report_aggregations_for_task::<0, dummy_vdaf::Vdaf>( + .get_report_aggregations_for_task::<0, dummy::Vdaf>( &vdaf, &Role::Helper, &helper_time_interval_task_id, @@ -5862,7 +5834,7 @@ async fn delete_expired_aggregation_artifacts(ephemeral_datastore: EphemeralData .await .unwrap(); let leader_fixed_size_report_aggregations = tx - .get_report_aggregations_for_task::<0, dummy_vdaf::Vdaf>( + .get_report_aggregations_for_task::<0, dummy::Vdaf>( &vdaf, &Role::Leader, &leader_fixed_size_task_id, @@ -5870,7 +5842,7 @@ async fn delete_expired_aggregation_artifacts(ephemeral_datastore: EphemeralData .await .unwrap(); let helper_fixed_size_report_aggregations = tx - .get_report_aggregations_for_task::<0, dummy_vdaf::Vdaf>( + .get_report_aggregations_for_task::<0, dummy::Vdaf>( &vdaf, &Role::Helper, &helper_fixed_size_task_id, @@ -5922,10 +5894,10 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas left.merged_with(right).unwrap() }); - tx.put_batch(&Batch::<0, Q, dummy_vdaf::Vdaf>::new( + tx.put_batch(&Batch::<0, Q, dummy::Vdaf>::new( *task.id(), batch_identifier.clone(), - AggregationParam(0), + dummy::AggregationParam(0), BatchState::Closed, 0, client_timestamp_interval, @@ -5933,10 +5905,10 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas .await .unwrap(); - let batch_aggregation = BatchAggregation::<0, Q, dummy_vdaf::Vdaf>::new( + let batch_aggregation = BatchAggregation::<0, Q, dummy::Vdaf>::new( *task.id(), batch_identifier.clone(), - AggregationParam(0), + dummy::AggregationParam(0), 0, BatchAggregationState::Aggregating, None, @@ -5946,11 +5918,11 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas tx.put_batch_aggregation(&batch_aggregation).await.unwrap(); if task.role() == &Role::Leader { - let collection_job = CollectionJob::<0, Q, dummy_vdaf::Vdaf>::new( + let collection_job = CollectionJob::<0, Q, dummy::Vdaf>::new( *task.id(), random(), Q::query_for_batch_identifier(&batch_identifier), - AggregationParam(0), + dummy::AggregationParam(0), batch_identifier.clone(), CollectionJobState::Start, ); @@ -5994,11 +5966,11 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas time_bucket_start, ); } else { - tx.put_aggregate_share_job::<0, Q, dummy_vdaf::Vdaf>(&AggregateShareJob::new( + tx.put_aggregate_share_job::<0, Q, dummy::Vdaf>(&AggregateShareJob::new( *task.id(), batch_identifier.clone(), - AggregationParam(0), - AggregateShare(11), + dummy::AggregationParam(0), + dummy::AggregateShare(11), client_timestamps.len().try_into().unwrap(), random(), )) @@ -6538,10 +6510,10 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas .run_unnamed_tx(|tx| { let time_bucket_starts = time_bucket_starts.clone(); Box::pin(async move { - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::default(); let leader_time_interval_batch_ids = tx - .get_batches_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_batches_for_task::<0, TimeInterval, dummy::Vdaf>( &leader_time_interval_task_id, ) .await @@ -6554,7 +6526,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas ) }); let helper_time_interval_batch_ids = tx - .get_batches_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_batches_for_task::<0, TimeInterval, dummy::Vdaf>( &helper_time_interval_task_id, ) .await @@ -6567,9 +6539,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas ) }); let leader_fixed_size_batch_ids = tx - .get_batches_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( - &leader_fixed_size_task_id, - ) + .get_batches_for_task::<0, FixedSize, dummy::Vdaf>(&leader_fixed_size_task_id) .await .unwrap() .into_iter() @@ -6580,9 +6550,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas ) }); let helper_fixed_size_batch_ids = tx - .get_batches_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( - &helper_fixed_size_task_id, - ) + .get_batches_for_task::<0, FixedSize, dummy::Vdaf>(&helper_fixed_size_task_id) .await .unwrap() .into_iter() @@ -6593,7 +6561,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas ) }); let leader_fixed_size_time_bucketed_batch_ids = tx - .get_batches_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_batches_for_task::<0, FixedSize, dummy::Vdaf>( &leader_fixed_size_time_bucketed_task_id, ) .await @@ -6606,7 +6574,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas ) }); let other_task_batch_ids = tx - .get_batches_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>(&other_task_id) + .get_batches_for_task::<0, TimeInterval, dummy::Vdaf>(&other_task_id) .await .unwrap() .into_iter() @@ -6625,7 +6593,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas .collect(); let leader_time_interval_collection_job_ids = tx - .get_collection_jobs_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_collection_jobs_for_task::<0, TimeInterval, dummy::Vdaf>( &vdaf, &leader_time_interval_task_id, ) @@ -6634,7 +6602,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas .into_iter() .map(|collection_job| *collection_job.id()); let helper_time_interval_collection_job_ids = tx - .get_collection_jobs_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_collection_jobs_for_task::<0, TimeInterval, dummy::Vdaf>( &vdaf, &helper_time_interval_task_id, ) @@ -6643,7 +6611,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas .into_iter() .map(|collection_job| *collection_job.id()); let leader_fixed_size_collection_job_ids = tx - .get_collection_jobs_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_collection_jobs_for_task::<0, FixedSize, dummy::Vdaf>( &vdaf, &leader_fixed_size_task_id, ) @@ -6652,7 +6620,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas .into_iter() .map(|collection_job| *collection_job.id()); let helper_fixed_size_collection_job_ids = tx - .get_collection_jobs_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_collection_jobs_for_task::<0, FixedSize, dummy::Vdaf>( &vdaf, &helper_fixed_size_task_id, ) @@ -6661,7 +6629,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas .into_iter() .map(|collection_job| *collection_job.id()); let leader_fixed_size_time_bucketed_collection_job_ids = tx - .get_collection_jobs_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_collection_jobs_for_task::<0, FixedSize, dummy::Vdaf>( &vdaf, &leader_fixed_size_time_bucketed_task_id, ) @@ -6670,7 +6638,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas .into_iter() .map(|collection_job| *collection_job.id()); let other_task_collection_job_ids = tx - .get_collection_jobs_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_collection_jobs_for_task::<0, TimeInterval, dummy::Vdaf>( &vdaf, &other_task_id, ) @@ -6687,7 +6655,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas .collect(); let leader_time_interval_aggregate_share_job_ids = tx - .get_aggregate_share_jobs_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_aggregate_share_jobs_for_task::<0, TimeInterval, dummy::Vdaf>( &vdaf, &leader_time_interval_task_id, ) @@ -6701,7 +6669,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas ) }); let helper_time_interval_aggregate_share_job_ids = tx - .get_aggregate_share_jobs_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_aggregate_share_jobs_for_task::<0, TimeInterval, dummy::Vdaf>( &vdaf, &helper_time_interval_task_id, ) @@ -6715,7 +6683,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas ) }); let leader_fixed_size_aggregate_share_job_ids = tx - .get_aggregate_share_jobs_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_aggregate_share_jobs_for_task::<0, FixedSize, dummy::Vdaf>( &vdaf, &leader_fixed_size_task_id, ) @@ -6729,7 +6697,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas ) }); let helper_fixed_size_aggregate_share_job_ids = tx - .get_aggregate_share_jobs_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_aggregate_share_jobs_for_task::<0, FixedSize, dummy::Vdaf>( &vdaf, &helper_fixed_size_task_id, ) @@ -6743,7 +6711,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas ) }); let leader_fixed_size_time_bucketed_aggregate_share_job_ids = tx - .get_aggregate_share_jobs_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_aggregate_share_jobs_for_task::<0, FixedSize, dummy::Vdaf>( &vdaf, &leader_fixed_size_time_bucketed_task_id, ) @@ -6757,7 +6725,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas ) }); let other_task_aggregate_share_job_ids = tx - .get_aggregate_share_jobs_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_aggregate_share_jobs_for_task::<0, TimeInterval, dummy::Vdaf>( &vdaf, &other_task_id, ) @@ -6832,7 +6800,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas .collect(); let leader_time_interval_batch_aggregation_ids = tx - .get_batch_aggregations_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_batch_aggregations_for_task::<0, TimeInterval, dummy::Vdaf>( &vdaf, &leader_time_interval_task_id, ) @@ -6846,7 +6814,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas ) }); let helper_time_interval_batch_aggregation_ids = tx - .get_batch_aggregations_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_batch_aggregations_for_task::<0, TimeInterval, dummy::Vdaf>( &vdaf, &helper_time_interval_task_id, ) @@ -6860,7 +6828,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas ) }); let leader_fixed_size_batch_aggregation_ids = tx - .get_batch_aggregations_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_batch_aggregations_for_task::<0, FixedSize, dummy::Vdaf>( &vdaf, &leader_fixed_size_task_id, ) @@ -6874,7 +6842,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas ) }); let helper_fixed_size_batch_aggregation_ids = tx - .get_batch_aggregations_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_batch_aggregations_for_task::<0, FixedSize, dummy::Vdaf>( &vdaf, &helper_fixed_size_task_id, ) @@ -6888,7 +6856,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas ) }); let leader_fixed_size_time_bucketed_batch_aggregation_ids = tx - .get_batch_aggregations_for_task::<0, FixedSize, dummy_vdaf::Vdaf>( + .get_batch_aggregations_for_task::<0, FixedSize, dummy::Vdaf>( &vdaf, &leader_fixed_size_time_bucketed_task_id, ) @@ -6902,7 +6870,7 @@ async fn delete_expired_collection_artifacts(ephemeral_datastore: EphemeralDatas ) }); let other_task_batch_aggregation_ids = tx - .get_batch_aggregations_for_task::<0, TimeInterval, dummy_vdaf::Vdaf>( + .get_batch_aggregations_for_task::<0, TimeInterval, dummy::Vdaf>( &vdaf, &other_task_id, ) @@ -7283,22 +7251,19 @@ async fn reject_expired_reports_with_same_id(ephemeral_datastore: EphemeralDatas datastore .run_unnamed_tx(|tx| { - let report = LeaderStoredReport::<0, dummy_vdaf::Vdaf>::new( + let report = LeaderStoredReport::<0, dummy::Vdaf>::new( *task.id(), ReportMetadata::new(report_id, clock.now()), (), Vec::new(), - dummy_vdaf::InputShare::default(), + dummy::InputShare::default(), HpkeCiphertext::new( HpkeConfigId::from(13), Vec::from("encapsulated_context_0"), Vec::from("payload_0"), ), ); - Box::pin(async move { - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &report) - .await - }) + Box::pin(async move { tx.put_client_report(&dummy::Vdaf::default(), &report).await }) }) .await .unwrap(); @@ -7309,22 +7274,19 @@ async fn reject_expired_reports_with_same_id(ephemeral_datastore: EphemeralDatas // Insert a client report with the same ID, but a more current timestamp. let result = datastore .run_unnamed_tx(|tx| { - let report = LeaderStoredReport::<0, dummy_vdaf::Vdaf>::new( + let report = LeaderStoredReport::<0, dummy::Vdaf>::new( *task.id(), ReportMetadata::new(report_id, clock.now()), (), Vec::new(), - dummy_vdaf::InputShare::default(), + dummy::InputShare::default(), HpkeCiphertext::new( HpkeConfigId::from(13), Vec::from("encapsulated_context_0"), Vec::from("payload_0"), ), ); - Box::pin(async move { - tx.put_client_report(&dummy_vdaf::Vdaf::new(), &report) - .await - }) + Box::pin(async move { tx.put_client_report(&dummy::Vdaf::default(), &report).await }) }) .await; assert_matches!(result, Err(Error::MutationTargetAlreadyExists)); diff --git a/aggregator_core/src/lib.rs b/aggregator_core/src/lib.rs index 6aaef739b..ad155697e 100644 --- a/aggregator_core/src/lib.rs +++ b/aggregator_core/src/lib.rs @@ -16,9 +16,6 @@ use trillium_router::RouterConnExt; #[cfg(test)] use rstest_reuse; -#[cfg(feature = "test-util")] -use janus_core::test_util::dummy_vdaf; - pub mod datastore; pub mod query_type; pub mod task; @@ -51,7 +48,7 @@ impl VdafHasAggregationParameter } #[cfg(feature = "test-util")] -impl VdafHasAggregationParameter for dummy_vdaf::Vdaf {} +impl VdafHasAggregationParameter for prio::vdaf::dummy::Vdaf {} pub fn instrumented(handler: H) -> impl Handler { InstrumentedHandler(handler) diff --git a/collector/src/lib.rs b/collector/src/lib.rs index 688882139..d2be6eac0 100644 --- a/collector/src/lib.rs +++ b/collector/src/lib.rs @@ -755,7 +755,7 @@ mod tests { self, test_util::generate_test_hpke_config_and_private_key, HpkeApplicationInfo, Label, }, retries::test_util::test_http_request_exponential_backoff, - test_util::{dummy_vdaf, install_test_trace_subscriber, run_vdaf, VdafTranscript}, + test_util::{install_test_trace_subscriber, run_vdaf, VdafTranscript}, }; use janus_messages::{ problem_type::DapProblemType, @@ -768,7 +768,7 @@ mod tests { use prio::{ codec::Encode, field::Field64, - vdaf::{self, prio3::Prio3, AggregateShare, OutputShare}, + vdaf::{self, dummy, prio3::Prio3, AggregateShare, OutputShare}, }; use rand::random; use reqwest::{ @@ -879,7 +879,7 @@ mod tests { "http://example.com/dap".parse().unwrap(), AuthenticationToken::new_bearer_token_from_string("Y29sbGVjdG9yIHRva2Vu").unwrap(), hpke_keypair.clone(), - dummy_vdaf::Vdaf::new(), + dummy::Vdaf::new(1), ) .unwrap(); @@ -893,7 +893,7 @@ mod tests { "http://example.com".parse().unwrap(), AuthenticationToken::new_bearer_token_from_string("Y29sbGVjdG9yIHRva2Vu").unwrap(), hpke_keypair, - dummy_vdaf::Vdaf::new(), + dummy::Vdaf::new(1), ) .unwrap(); @@ -1891,14 +1891,14 @@ mod tests { async fn successful_delete() { install_test_trace_subscriber(); let mut server = mockito::Server::new_async().await; - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::new(1); let collector = setup_collector(&mut server, vdaf); let collection_job_id = random(); let collection_job = CollectionJob::new( collection_job_id, Query::new_fixed_size(FixedSizeQuery::ByBatchId { batch_id: random() }), - dummy_vdaf::AggregationParam(1), + dummy::AggregationParam(1), ); let matcher = collection_uri_regex_matcher(&collector.task_id); @@ -1928,14 +1928,14 @@ mod tests { async fn failed_delete() { install_test_trace_subscriber(); let mut server = mockito::Server::new_async().await; - let vdaf = dummy_vdaf::Vdaf::new(); + let vdaf = dummy::Vdaf::new(1); let collector = setup_collector(&mut server, vdaf); let collection_job_id = random(); let collection_job = CollectionJob::new( collection_job_id, Query::new_fixed_size(FixedSizeQuery::ByBatchId { batch_id: random() }), - dummy_vdaf::AggregationParam(1), + dummy::AggregationParam(1), ); let matcher = collection_uri_regex_matcher(&collector.task_id); diff --git a/core/Cargo.toml b/core/Cargo.toml index 18e8723c5..3834eba62 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -26,6 +26,7 @@ test-util = [ "dep:tracing-log", "dep:tracing-subscriber", "kube/ws", + "prio/test-util", "tokio/macros", "tokio/sync", ] diff --git a/core/src/dp.rs b/core/src/dp.rs index 427589316..b4733b5ca 100644 --- a/core/src/dp.rs +++ b/core/src/dp.rs @@ -1,5 +1,3 @@ -#[cfg(feature = "test-util")] -use crate::test_util::dummy_vdaf::Vdaf; use derivative::Derivative; #[cfg(feature = "fpvec_bounded_l2")] use fixed::traits::Fixed; @@ -8,6 +6,8 @@ use prio::flp::{ gadgets::{ParallelSumGadget, PolyEval}, types::fixedpoint_l2::{compatible_float::CompatibleFloat, FixedPointBoundedL2VecSum}, }; +#[cfg(feature = "test-util")] +use prio::vdaf::dummy::Vdaf; use prio::{ dp::{ DifferentialPrivacyBudget, DifferentialPrivacyDistribution, DifferentialPrivacyStrategy, diff --git a/core/src/test_util/dummy_vdaf.rs b/core/src/test_util/dummy_vdaf.rs deleted file mode 100644 index 1c719380c..000000000 --- a/core/src/test_util/dummy_vdaf.rs +++ /dev/null @@ -1,297 +0,0 @@ -//! Implements a lightweight dummy VDAF for use in tests. - -use prio::{ - codec::{CodecError, Decode, Encode}, - dp::distributions::ZCdpDiscreteGaussian, - vdaf::{self, Aggregatable, PrepareTransition, VdafError}, -}; -use std::fmt::Debug; -use std::io::Cursor; -use std::sync::Arc; - -type ArcPrepInitFn = - Arc Result<(), VdafError> + 'static + Send + Sync>; -type ArcPrepStepFn = - Arc Result, VdafError> + 'static + Send + Sync>; - -#[derive(Clone)] -pub struct Vdaf { - prep_init_fn: ArcPrepInitFn, - prep_step_fn: ArcPrepStepFn, - input_share: InputShare, -} - -impl Debug for Vdaf { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("Vdaf") - .field("prep_init_result", &"[omitted]") - .field("prep_step_result", &"[omitted]") - .finish() - } -} - -impl Vdaf { - /// The length of the verify key parameter for fake VDAF instantiations. - pub const VERIFY_KEY_LENGTH: usize = 0; - - pub fn new() -> Self { - Self { - prep_init_fn: Arc::new(|_| -> Result<(), VdafError> { Ok(()) }), - prep_step_fn: Arc::new(|| -> Result, VdafError> { - Ok(PrepareTransition::Finish(OutputShare())) - }), - input_share: InputShare::default(), - } - } - - pub fn with_prep_init_fn Result<(), VdafError>>( - mut self, - f: F, - ) -> Self - where - F: 'static + Send + Sync, - { - self.prep_init_fn = Arc::new(f); - self - } - - pub fn with_prep_step_fn Result, VdafError>>( - mut self, - f: F, - ) -> Self - where - F: 'static + Send + Sync, - { - self.prep_step_fn = Arc::new(f); - self - } - - pub fn with_input_share(mut self, input_share: InputShare) -> Self { - self.input_share = input_share; - self - } -} - -impl Default for Vdaf { - fn default() -> Self { - Self::new() - } -} - -impl vdaf::Vdaf for Vdaf { - type Measurement = (); - type AggregateResult = (); - type AggregationParam = AggregationParam; - type PublicShare = (); - type InputShare = InputShare; - type OutputShare = OutputShare; - type AggregateShare = AggregateShare; - - fn algorithm_id(&self) -> u32 { - // VDAF reserves the algorithm ID range 0xFFFF0000-0xFFFFFFFF for - // private use, such as this kind of test VDAF. - // - // https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vdaf-08#section-10 - 0xFFFF0000 - } - - fn num_aggregators(&self) -> usize { - 2 - } -} - -impl vdaf::AggregatorWithNoise<0, 16, ZCdpDiscreteGaussian> for Vdaf { - fn add_noise_to_agg_share( - &self, - _dp_strategy: &ZCdpDiscreteGaussian, - _agg_param: &Self::AggregationParam, - _agg_share: &mut Self::AggregateShare, - _num_measurements: usize, - ) -> Result<(), VdafError> { - Ok(()) - } -} - -impl vdaf::Aggregator<0, 16> for Vdaf { - type PrepareState = PrepareState; - type PrepareShare = (); - type PrepareMessage = (); - - fn prepare_init( - &self, - _verify_key: &[u8; 0], - _: usize, - aggregation_param: &Self::AggregationParam, - _nonce: &[u8; 16], - _: &Self::PublicShare, - input_share: &Self::InputShare, - ) -> Result<(Self::PrepareState, Self::PrepareShare), VdafError> { - (self.prep_init_fn)(aggregation_param)?; - Ok((PrepareState(input_share.0), ())) - } - - fn prepare_shares_to_prepare_message>( - &self, - _: &Self::AggregationParam, - _: M, - ) -> Result { - Ok(()) - } - - fn prepare_next( - &self, - _: Self::PrepareState, - _: Self::PrepareMessage, - ) -> Result, VdafError> { - (self.prep_step_fn)() - } - - fn aggregate>( - &self, - _: &Self::AggregationParam, - output_shares: M, - ) -> Result { - let mut aggregate_share = AggregateShare(0); - for output_share in output_shares { - aggregate_share.accumulate(&output_share)?; - } - Ok(aggregate_share) - } -} - -impl vdaf::Client<16> for Vdaf { - fn shard( - &self, - _measurement: &Self::Measurement, - _nonce: &[u8; 16], - ) -> Result<(Self::PublicShare, Vec), VdafError> { - Ok(((), Vec::from([self.input_share, self.input_share]))) - } -} - -impl vdaf::Collector for Vdaf { - fn unshard>( - &self, - _agg_param: &Self::AggregationParam, - _agg_shares: M, - _num_measurements: usize, - ) -> Result { - Ok(()) - } -} - -#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] -pub struct InputShare(pub u8); - -impl Encode for InputShare { - fn encode(&self, bytes: &mut Vec) -> Result<(), CodecError> { - self.0.encode(bytes) - } - - fn encoded_len(&self) -> Option { - self.0.encoded_len() - } -} - -impl Decode for InputShare { - fn decode(bytes: &mut Cursor<&[u8]>) -> Result { - Ok(Self(u8::decode(bytes)?)) - } -} - -#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct AggregationParam(pub u8); - -impl Encode for AggregationParam { - fn encode(&self, bytes: &mut Vec) -> Result<(), CodecError> { - self.0.encode(bytes) - } - - fn encoded_len(&self) -> Option { - self.0.encoded_len() - } -} - -impl Decode for AggregationParam { - fn decode(bytes: &mut Cursor<&[u8]>) -> Result { - Ok(Self(u8::decode(bytes)?)) - } -} - -#[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub struct OutputShare(); - -impl Decode for OutputShare { - fn decode(_: &mut Cursor<&[u8]>) -> Result { - Ok(Self()) - } -} - -impl Encode for OutputShare { - fn encode(&self, _: &mut Vec) -> Result<(), CodecError> { - Ok(()) - } - - fn encoded_len(&self) -> Option { - Some(0) - } -} - -#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] -pub struct PrepareState(pub u8); - -impl Encode for PrepareState { - fn encode(&self, bytes: &mut Vec) -> Result<(), CodecError> { - self.0.encode(bytes) - } - - fn encoded_len(&self) -> Option { - self.0.encoded_len() - } -} - -impl Decode for PrepareState { - fn decode(bytes: &mut Cursor<&[u8]>) -> Result { - Ok(Self(u8::decode(bytes)?)) - } -} - -#[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub struct AggregateShare(pub u64); - -impl Aggregatable for AggregateShare { - type OutputShare = OutputShare; - - fn merge(&mut self, other: &Self) -> Result<(), VdafError> { - self.0 += other.0; - Ok(()) - } - - fn accumulate(&mut self, _: &Self::OutputShare) -> Result<(), VdafError> { - self.0 += 1; - Ok(()) - } -} - -impl From for AggregateShare { - fn from(_: OutputShare) -> Self { - Self(1) - } -} - -impl Decode for AggregateShare { - fn decode(bytes: &mut Cursor<&[u8]>) -> Result { - let val = u64::decode(bytes)?; - Ok(Self(val)) - } -} - -impl Encode for AggregateShare { - fn encode(&self, bytes: &mut Vec) -> Result<(), CodecError> { - self.0.encode(bytes) - } - - fn encoded_len(&self) -> Option { - self.0.encoded_len() - } -} diff --git a/core/src/test_util/mod.rs b/core/src/test_util/mod.rs index bbb828b0b..4362f0b70 100644 --- a/core/src/test_util/mod.rs +++ b/core/src/test_util/mod.rs @@ -12,7 +12,6 @@ use std::{fmt::Debug, sync::Once}; use tracing_log::LogTracer; use tracing_subscriber::{prelude::*, EnvFilter, Registry}; -pub mod dummy_vdaf; pub mod kubernetes; pub mod runtime; pub mod testcontainers; diff --git a/core/src/vdaf.rs b/core/src/vdaf.rs index 2173cccfe..1a53796e2 100644 --- a/core/src/vdaf.rs +++ b/core/src/vdaf.rs @@ -339,8 +339,8 @@ macro_rules! vdaf_dispatch_impl_test_util { (impl match test_util $vdaf_instance:expr, ($vdaf:ident, $Vdaf:ident, $VERIFY_KEY_LEN:ident, $dp_strategy:ident, $DpStrategy:ident) => $body:tt) => { match $vdaf_instance { ::janus_core::vdaf::VdafInstance::Fake => { - let $vdaf = ::janus_core::test_util::dummy_vdaf::Vdaf::new(); - type $Vdaf = ::janus_core::test_util::dummy_vdaf::Vdaf; + let $vdaf = ::prio::vdaf::dummy::Vdaf::new(1); + type $Vdaf = ::prio::vdaf::dummy::Vdaf; const $VERIFY_KEY_LEN: usize = 0; type $DpStrategy = janus_core::dp::NoDifferentialPrivacy; let $dp_strategy = janus_core::dp::NoDifferentialPrivacy; @@ -348,14 +348,14 @@ macro_rules! vdaf_dispatch_impl_test_util { } ::janus_core::vdaf::VdafInstance::FakeFailsPrepInit => { - let $vdaf = ::janus_core::test_util::dummy_vdaf::Vdaf::new().with_prep_init_fn( + let $vdaf = ::prio::vdaf::dummy::Vdaf::new(1).with_prep_init_fn( |_| -> Result<(), ::prio::vdaf::VdafError> { ::std::result::Result::Err(::prio::vdaf::VdafError::Uncategorized( "FakeFailsPrepInit failed at prep_init".to_string(), )) }, ); - type $Vdaf = ::janus_core::test_util::dummy_vdaf::Vdaf; + type $Vdaf = ::prio::vdaf::dummy::Vdaf; const $VERIFY_KEY_LEN: usize = 0; type $DpStrategy = janus_core::dp::NoDifferentialPrivacy; let $dp_strategy = janus_core::dp::NoDifferentialPrivacy; @@ -363,21 +363,17 @@ macro_rules! vdaf_dispatch_impl_test_util { } ::janus_core::vdaf::VdafInstance::FakeFailsPrepStep => { - let $vdaf = ::janus_core::test_util::dummy_vdaf::Vdaf::new().with_prep_step_fn( - || -> Result< - ::prio::vdaf::PrepareTransition< - ::janus_core::test_util::dummy_vdaf::Vdaf, - 0, - 16, - >, - ::prio::vdaf::VdafError, - > { - ::std::result::Result::Err(::prio::vdaf::VdafError::Uncategorized( - "FakeFailsPrepStep failed at prep_step".to_string(), - )) - }, - ); - type $Vdaf = ::janus_core::test_util::dummy_vdaf::Vdaf; + let $vdaf = ::prio::vdaf::dummy::Vdaf::new(1).with_prep_step_fn( + |_| -> Result< + ::prio::vdaf::PrepareTransition<::prio::vdaf::dummy::Vdaf, 0, 16>, + ::prio::vdaf::VdafError, + > { + ::std::result::Result::Err(::prio::vdaf::VdafError::Uncategorized( + "FakeFailsPrepStep failed at prep_step".to_string(), + )) + }, + ); + type $Vdaf = ::prio::vdaf::dummy::Vdaf; const $VERIFY_KEY_LEN: usize = 0; type $DpStrategy = janus_core::dp::NoDifferentialPrivacy; let $dp_strategy = janus_core::dp::NoDifferentialPrivacy; diff --git a/messages/Cargo.toml b/messages/Cargo.toml index 4a6611b70..879c7f4d5 100644 --- a/messages/Cargo.toml +++ b/messages/Cargo.toml @@ -20,7 +20,9 @@ hex = "0.4" num_enum = "0.7.2" # We can't pull prio in from the workspace because that would enable default features, and we do not # want prio/crypto-dependencies -prio = { version = "0.16.0", default-features = false, features = ["multithreaded", "experimental"] } +# TODO(timg) go back to a released prio +prio = { git = "https://github.com/divviup/libprio-rs", branch = "timg/dummy-vdaf-bugs", default-features = false, features = ["multithreaded", "experimental"] } +#prio = { version = "0.16.0", default-features = false, features = ["multithreaded", "experimental"] } rand.workspace = true serde.workspace = true thiserror.workspace = true