From 83664c19d94fd2aa4ca6da96b2ddec510fd6e328 Mon Sep 17 00:00:00 2001 From: Jonathan Hoyland Date: Thu, 9 Jan 2025 16:56:22 +0000 Subject: [PATCH] Pass `not_before` to `internal_task` endpoint. --- crates/dapf/src/main.rs | 4 ++++ crates/daphne-server/src/roles/mod.rs | 3 +-- crates/daphne-server/tests/e2e/test_runner.rs | 2 ++ crates/daphne-service-utils/src/test_route_types.rs | 1 + crates/daphne/src/roles/helper/mod.rs | 2 +- crates/daphne/src/testing/mod.rs | 2 +- 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/crates/dapf/src/main.rs b/crates/dapf/src/main.rs index 9775d9b36..320bb3041 100644 --- a/crates/dapf/src/main.rs +++ b/crates/dapf/src/main.rs @@ -905,6 +905,10 @@ async fn handle_test_routes(action: TestAction, http_client: HttpClient) -> anyh || 604_800u64, "task should expire in", )?, + task_commencement: SystemTime::now() + .duration_since(SystemTime::UNIX_EPOCH) + .unwrap() + .as_secs(), }; print_json(&internal_task); diff --git a/crates/daphne-server/src/roles/mod.rs b/crates/daphne-server/src/roles/mod.rs index ec96287a8..dafdd45e3 100644 --- a/crates/daphne-server/src/roles/mod.rs +++ b/crates/daphne-server/src/roles/mod.rs @@ -111,7 +111,6 @@ mod test_utils { fatal_error, hpke::{HpkeConfig, HpkeReceiverConfig}, messages::decode_base64url_vec, - roles::DapAggregator, vdaf::{Prio3Config, VdafConfig}, DapBatchMode, DapError, DapTaskConfig, DapVersion, }; @@ -304,7 +303,7 @@ mod test_utils { leader_url: cmd.leader, helper_url: cmd.helper, time_precision: cmd.time_precision, - not_before: self.get_current_time(), + not_before: cmd.task_commencement, not_after: cmd.task_expiration, min_batch_size: cmd.min_batch_size, query, diff --git a/crates/daphne-server/tests/e2e/test_runner.rs b/crates/daphne-server/tests/e2e/test_runner.rs index e21ad7848..832bad9aa 100644 --- a/crates/daphne-server/tests/e2e/test_runner.rs +++ b/crates/daphne-server/tests/e2e/test_runner.rs @@ -235,6 +235,7 @@ impl TestRunner { "time_precision": t.task_config.time_precision, "collector_hpke_config": collector_hpke_config_base64url.clone(), "task_expiration": t.task_config.not_after, + "task_commencement": t.task_config.not_before, }); let add_task_path = format!("{}/internal/test/add_task", version.as_ref()); let res: InternalTestCommandResult = t @@ -262,6 +263,7 @@ impl TestRunner { "time_precision": t.task_config.time_precision, "collector_hpke_config": collector_hpke_config_base64url.clone(), "task_expiration": t.task_config.not_after, + "task_commencement": t.task_config.not_before, }); let res: InternalTestCommandResult = t .helper_post_internal(&add_task_path, &helper_add_task_cmd) diff --git a/crates/daphne-service-utils/src/test_route_types.rs b/crates/daphne-service-utils/src/test_route_types.rs index 3fba74fde..f6545d27e 100644 --- a/crates/daphne-service-utils/src/test_route_types.rs +++ b/crates/daphne-service-utils/src/test_route_types.rs @@ -113,5 +113,6 @@ pub struct InternalTestAddTask { pub max_batch_size: Option, pub time_precision: Duration, pub collector_hpke_config: String, // base64url + pub task_commencement: Time, pub task_expiration: Time, } diff --git a/crates/daphne/src/roles/helper/mod.rs b/crates/daphne/src/roles/helper/mod.rs index 128728905..1ebfd692d 100644 --- a/crates/daphne/src/roles/helper/mod.rs +++ b/crates/daphne/src/roles/helper/mod.rs @@ -52,7 +52,7 @@ pub async fn handle_agg_job_init_req( /// Handle a request for an aggregate share. This is called by the Leader to complete a /// collection job. -pub async fn handle_agg_share_req<'req, A: DapHelper>( +pub async fn handle_agg_share_req( aggregator: &A, req: DapRequest, ) -> Result { diff --git a/crates/daphne/src/testing/mod.rs b/crates/daphne/src/testing/mod.rs index 23b3d2025..a79c23e91 100644 --- a/crates/daphne/src/testing/mod.rs +++ b/crates/daphne/src/testing/mod.rs @@ -672,7 +672,7 @@ impl DapAggregator for InMemoryAggregator { ) -> Result { // Always opt-in with four shards. Ok(task_config.into_opted_in(&taskprov::OptInParam { - not_before: self.get_current_time(), + not_before: self.get_current_time() - 60, num_agg_span_shards: NonZeroUsize::new(4).unwrap(), })) }