Repository: cloudflare/daphne
Pull request #14 (2022-06-23 17:50:51)

Update agg request serialization
Partially addresses #8.
Based on #13 (merge that first).

Aligns agg request serialization with draft-ietf-ppm-dap-01. The main
thing that has changed is that the media type is used to distinguish agg
init requests from agg cont requests, rather than a byte encoded in the
message payload itself.

While at it, pick up some clippy fixes.


Patch:
diff --git a/daphne/src/auth.rs b/daphne/src/auth.rs
index 7f97103..2f9d6f4 100644
--- a/daphne/src/auth.rs
+++ b/daphne/src/auth.rs
@@ -4,7 +4,10 @@
 //! DAP request authorization.
 
 use crate::{
-    constants,
+    constants::{
+        media_type_from_leader, MEDIA_TYPE_AGG_CONT_REQ, MEDIA_TYPE_AGG_INIT_REQ,
+        MEDIA_TYPE_AGG_SHARE_REQ, MEDIA_TYPE_COLLECT_REQ,
+    },
     messages::{constant_time_eq, Id},
     DapError, DapRequest,
 };
@@ -57,14 +60,14 @@ pub trait BearerTokenProvider {
         task_id: &Id,
         media_type: &'static str,
     ) -> Result<BearerToken, DapError> {
-        if constants::media_type_from_leader(media_type) {
+        if media_type_from_leader(media_type) {
             let token = self
                 .get_leader_bearer_token_for(task_id)
                 .await?
-                .ok_or(DapError::Fatal(
-                    "attempted to authorize request with unknown task ID".into(),
-                ))?;
-            return Ok(token.clone());
+                .ok_or_else(|| {
+                    DapError::Fatal("attempted to authorize request with unknown task ID".into())
+                })?;
+            return Ok(token);
         }
 
         Err(DapError::Fatal(format!(
@@ -87,7 +90,12 @@ pub trait BearerTokenProvider {
         // following RFC 6750, Section 2.1. Note that we would also need to replace `From<String>
         // for BearerToken` with `TryFrom<String>` so that a `DapError` can be returned if the
         // token is not formatted properly.
-        if req.from_leader() {
+        if matches!(
+            req.media_type,
+            Some(MEDIA_TYPE_AGG_INIT_REQ)
+                | Some(MEDIA_TYPE_AGG_CONT_REQ)
+                | Some(MEDIA_TYPE_AGG_SHARE_REQ)
+        ) {
             if let Some(ref got) = req.sender_auth {
                 if let Ok(ref task_id) = option_task_id {
                     if let Some(expected) = self.get_leader_bearer_token_for(task_id).await? {
@@ -97,7 +105,7 @@ pub trait BearerTokenProvider {
             }
         }
 
-        if req.from_collector() {
+        if matches!(req.media_type, Some(MEDIA_TYPE_COLLECT_REQ)) {
             if let Some(ref got) = req.sender_auth {
                 if let Ok(ref task_id) = option_task_id {
                     if let Some(expected) = self.get_collector_bearer_token_for(task_id).await? {
diff --git a/daphne/src/constants.rs b/daphne/src/constants.rs
index 0586999..cbebf36 100644
--- a/daphne/src/constants.rs
+++ b/daphne/src/constants.rs
@@ -36,8 +36,8 @@ pub fn media_type_for(content_type: &str) -> Option<&'static str> {
 
 /// Returns true if the given media type is for a DAP request sent by the Leader.
 pub(crate) fn media_type_from_leader(media_type: &'static str) -> bool {
-    match media_type {
-        MEDIA_TYPE_AGG_INIT_REQ | MEDIA_TYPE_AGG_CONT_REQ | MEDIA_TYPE_AGG_SHARE_REQ => true,
-        _ => false,
-    }
+    matches!(
+        media_type,
+        MEDIA_TYPE_AGG_INIT_REQ | MEDIA_TYPE_AGG_CONT_REQ | MEDIA_TYPE_AGG_SHARE_REQ
+    )
 }
diff --git a/daphne/src/lib.rs b/daphne/src/lib.rs
index 67fc0d4..7a8ec00 100644
--- a/daphne/src/lib.rs
+++ b/daphne/src/lib.rs
@@ -12,10 +12,6 @@
 //! Daphne is not compatible with DAP tasks whose batch lifetime is longer than one aggregation.
 
 use crate::{
-    constants::{
-        MEDIA_TYPE_AGG_CONT_REQ, MEDIA_TYPE_AGG_INIT_REQ, MEDIA_TYPE_AGG_SHARE_REQ,
-        MEDIA_TYPE_COLLECT_REQ,
-    },
     messages::{CollectResp, HpkeConfig, Interval, Nonce, TransitionFailure},
     vdaf::{
         prio3::{prio3_append_prepare_state, prio3_decode_prepare_state, Prio3Error},
@@ -481,26 +477,6 @@ pub struct DapRequest<S> {
     pub sender_auth: Option<S>,
 }
 
-impl<S> DapRequest<S> {
-    /// Returns true if the request has a media type that suggests it was sent by the Leader.
-    pub(crate) fn from_leader(&self) -> bool {
-        match self.media_type {
-            Some(MEDIA_TYPE_AGG_INIT_REQ)
-            | Some(MEDIA_TYPE_AGG_CONT_REQ)
-            | Some(MEDIA_TYPE_AGG_SHARE_REQ) => true,
-            _ => false,
-        }
-    }
-
-    /// Returns true if the request has a media type that suggests it was sent by the Collector.
-    pub(crate) fn from_collector(&self) -> bool {
-        match self.media_type {
-            Some(MEDIA_TYPE_COLLECT_REQ) => true,
-            _ => false,
-        }
-    }
-}
-
 /// DAP response.
 #[derive(Debug)]
 pub struct DapResponse {
diff --git a/daphne/src/messages.rs b/daphne/src/messages.rs
index 2f83e2e..4218423 100644
--- a/daphne/src/messages.rs
+++ b/daphne/src/messages.rs
@@ -3,7 +3,7 @@
 
 //! Messages in the DAP protocol.
 
-use crate::{DapAbort, DapTaskConfig};
+use crate::DapTaskConfig;
 use prio::codec::{decode_u16_items, encode_u16_items, CodecError, Decode, Encode};
 use serde::{Deserialize, Serialize};
 use std::{
@@ -101,7 +101,7 @@ impl Decode for Report {
     }
 }
 
-/// An initial aggregate sub-request sent in an [`AggregateInitReq`]. The contents of this
+/// An initial aggregate sub-request sent in an [`AggregateInitializeReq`]. The contents of this
 /// structure pertain to a single report.
 #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
 #[allow(missing_docs)]
@@ -129,106 +129,66 @@ impl Decode for ReportShare {
     }
 }
 
-/// Aggregate request.
+/// Aggregate initialization request.
 #[derive(Clone, Debug, PartialEq)]
-pub struct AggregateReq {
+pub struct AggregateInitializeReq {
     pub task_id: Id,
     pub agg_job_id: Id,
-    pub var: AggregateReqVar,
-}
-
-impl AggregateReq {
-    pub(crate) fn get_report_shares_ref(&self) -> Result<&[ReportShare], DapAbort> {
-        match &self.var {
-            AggregateReqVar::Init { agg_param: _, seq } => Ok(seq),
-            _ => Err(DapAbort::UnrecognizedMessage),
-        }
-    }
-
-    pub(crate) fn get_transitions_ref(&self) -> Result<&[Transition], DapAbort> {
-        match &self.var {
-            AggregateReqVar::Continue { seq } => Ok(seq),
-            _ => Err(DapAbort::UnrecognizedMessage),
-        }
-    }
-
-    #[cfg(test)]
-    pub(crate) fn unwrap_agg_param_ref(&self) -> &[u8] {
-        assert_matches::assert_matches!(&self.var, AggregateReqVar::Init{ agg_param, .. } => agg_param)
-    }
+    pub agg_param: Vec<u8>,
+    pub report_shares: Vec<ReportShare>,
 }
 
-impl Encode for AggregateReq {
+impl Encode for AggregateInitializeReq {
     fn encode(&self, bytes: &mut Vec<u8>) {
         self.task_id.encode(bytes);
         self.agg_job_id.encode(bytes);
-        self.var.encode(bytes);
+        encode_u16_bytes(bytes, &self.agg_param);
+        encode_u16_items(bytes, &(), &self.report_shares);
     }
 }
 
-impl Decode for AggregateReq {
+impl Decode for AggregateInitializeReq {
     fn decode(bytes: &mut Cursor<&[u8]>) -> Result<Self, CodecError> {
         Ok(Self {
             task_id: Id::decode(bytes)?,
             agg_job_id: Id::decode(bytes)?,
-            var: AggregateReqVar::decode(bytes)?,
+            agg_param: decode_u16_bytes(bytes)?,
+            report_shares: decode_u16_items(&(), bytes)?,
         })
     }
 }
 
-/// Aggregate request variant.
+/// Aggregate continuation request.
 #[derive(Clone, Debug, PartialEq)]
-pub enum AggregateReqVar {
-    Init {
-        agg_param: Vec<u8>,
-        seq: Vec<ReportShare>,
-    },
-    Continue {
-        seq: Vec<Transition>,
-    },
-}
-
-impl Default for AggregateReqVar {
-    fn default() -> Self {
-        Self::Init {
-            agg_param: Vec::default(),
-            seq: Vec::default(),
-        }
-    }
+pub struct AggregateContinueReq {
+    pub task_id: Id,
+    pub agg_job_id: Id,
+    pub transitions: Vec<Transition>,
 }
 
-impl Encode for AggregateReqVar {
+impl Encode for AggregateContinueReq {
     fn encode(&self, bytes: &mut Vec<u8>) {
-        match self {
-            AggregateReqVar::Init { agg_param, seq } => {
-                0_u8.encode(bytes);
-                encode_u16_bytes(bytes, agg_param);
-                encode_u16_items(bytes, &(), seq);
-            }
-            AggregateReqVar::Continue { seq } => {
-                1_u8.encode(bytes);
-                encode_u16_items(bytes, &(), seq);
-            }
-        }
+        self.task_id.encode(bytes);
+        self.agg_job_id.encode(bytes);
+        encode_u16_items(bytes, &(), &self.transitions);
     }
 }
 
-impl Decode for AggregateReqVar {
+impl Decode for AggregateContinueReq {
     fn decode(bytes: &mut Cursor<&[u8]>) -> Result<Self, CodecError> {
-        match u8::decode(bytes)? {
-            0 => Ok(Self::Init {
-                agg_param: decode_u16_bytes(bytes)?,
-                seq: decode_u16_items(&(), bytes)?,
-            }),
-            1 => Ok(Self::Continue {
-                seq: decode_u16_items(&(), bytes)?,
-            }),
-            _ => Err(CodecError::UnexpectedValue),
-        }
+        Ok(Self {
+            task_id: Id::decode(bytes)?,
+            agg_job_id: Id::decode(bytes)?,
+            transitions: decode_u16_items(&(), bytes)?,
+        })
     }
 }
 
-/// Transition message.
+/// Transition message. This conveyes a message sent from one Aggregator to another during the
+/// preparation phase of VDAF evaluation.
+//
+// TODO spec: This is called `PrepareStep` in draft-ietf-ppm-dap-01. This is confusing because it
+// overloads a term used in draft-irtf-cfrg-draft-01.
 #[derive(Clone, Debug, PartialEq)]
 pub struct Transition {
     pub nonce: Nonce,
@@ -340,24 +300,23 @@ impl std::fmt::Display for TransitionFailure {
     }
 }
 
-/// An aggregate response sent from the Helper to the Leader in response to an (initial) aggregate
-/// request. The contents of this structure pertain to a single task and batch.
+/// An aggregate response sent from the Helper to the Leader.
 #[derive(Debug, PartialEq, Default)]
 #[allow(missing_docs)]
 pub struct AggregateResp {
-    pub seq: Vec<Transition>,
+    pub transitions: Vec<Transition>,
 }
 
 impl Encode for AggregateResp {
     fn encode(&self, bytes: &mut Vec<u8>) {
-        encode_u16_items(bytes, &(), &self.seq);
+        encode_u16_items(bytes, &(), &self.transitions);
     }
 }
 
 impl Decode for AggregateResp {
     fn decode(bytes: &mut Cursor<&[u8]>) -> Result<Self, CodecError> {
         Ok(Self {
-            seq: decode_u16_items(&(), bytes)?,
+            transitions: decode_u16_items(&(), bytes)?,
         })
     }
 }
diff --git a/daphne/src/roles.rs b/daphne/src/roles.rs
index 8b23c39..163126a 100644
--- a/daphne/src/roles.rs
+++ b/daphne/src/roles.rs
@@ -10,9 +10,9 @@ use crate::{
     },
     hpke::HpkeDecrypter,
     messages::{
-        constant_time_eq, AggregateReq, AggregateReqVar, AggregateResp, AggregateShareReq,
-        AggregateShareResp, CollectReq, CollectResp, Id, Interval, Nonce, Report, ReportShare,
-        TransitionFailure,
+        constant_time_eq, AggregateContinueReq, AggregateInitializeReq, AggregateResp,
+        AggregateShareReq, AggregateShareResp, CollectReq, CollectResp, Id, Interval, Nonce,
+        Report, ReportShare, TransitionFailure,
     },
     DapAbort, DapAggregateShare, DapCollectJob, DapError, DapHelperState, DapHelperTransition,
     DapLeaderProcessTelemetry, DapLeaderTransition, DapOutputShare, DapRequest, DapResponse,
@@ -256,7 +256,7 @@ pub trait DapLeader<S>: DapAuthorizedSender<S> + DapAggregator<S> {
         let reports = self.get_reports(task_id, selector).await?;
         telem.reports_processed += reports.len() as u64;
         if !reports.is_empty() {
-            // Prepare AggregateInitReq.
+            // Prepare AggregateInitializeReq.
             let agg_job_id = Id(rng.gen());
             let transition = task_config.vdaf.produce_agg_init_req(
                 self,
@@ -273,7 +273,7 @@ pub trait DapLeader<S>: DapAuthorizedSender<S> + DapAggregator<S> {
                 }
             };
 
-            // Send AggregateInitReq and receive AggregateResp.
+            // Send AggregateInitializeReq and receive AggregateResp.
             let resp = leader_post!(
                 self,
                 task_id,
@@ -284,7 +284,7 @@ pub trait DapLeader<S>: DapAuthorizedSender<S> + DapAggregator<S> {
             );
             let agg_resp = AggregateResp::get_decoded(&resp.payload)?;
 
-            // Prepare AggreagteContReq.
+            // Prepare AggreagteContinueReq.
             let transition =
                 task_config
                     .vdaf
@@ -299,7 +299,7 @@ pub trait DapLeader<S>: DapAuthorizedSender<S> + DapAggregator<S> {
                 }
             };
 
-            // Send AggregateContReq and receive AggregateResp.
+            // Send AggregateContinueReq and receive AggregateResp.
             let resp = leader_post!(
                 self,
                 task_id,
@@ -415,30 +415,32 @@ pub trait DapHelper<S>: DapAggregator<S> {
             return Err(DapAbort::UnauthorizedRequest);
         }
 
-        let agg_req = AggregateReq::get_decoded(&req.payload)?;
-        let task_config = self
-            .get_task_config_for(&agg_req.task_id)
-            .ok_or(DapAbort::UnrecognizedTask)?;
+        match req.media_type {
+            Some(MEDIA_TYPE_AGG_INIT_REQ) => {
+                let agg_init_req = AggregateInitializeReq::get_decoded(&req.payload)?;
+                let task_config = self
+                    .get_task_config_for(&agg_init_req.task_id)
+                    .ok_or(DapAbort::UnrecognizedTask)?;
 
-        match &agg_req.var {
-            AggregateReqVar::Init {
-                seq: report_shares, ..
-            } => {
                 let early_fails = self
-                    .mark_aggregated(&agg_req.task_id, report_shares)
+                    .mark_aggregated(&agg_init_req.task_id, &agg_init_req.report_shares)
                     .await?;
 
                 let transition = task_config.vdaf.handle_agg_init_req(
                     self,
                     &task_config.vdaf_verify_key,
-                    &agg_req,
+                    &agg_init_req,
                     |nonce| early_fails.get(nonce).copied(),
                 )?;
 
                 let agg_resp = match transition {
                     DapHelperTransition::Continue(state, agg_resp) => {
-                        self.put_helper_state(&agg_req.task_id, &agg_req.agg_job_id, &state)
-                            .await?;
+                        self.put_helper_state(
+                            &agg_init_req.task_id,
+                            &agg_init_req.agg_job_id,
+                            &state,
+                        )
+                        .await?;
                         agg_resp
                     }
                     DapHelperTransition::Finish(..) => {
@@ -451,18 +453,24 @@ pub trait DapHelper<S>: DapAggregator<S> {
                     payload: agg_resp.get_encoded(),
                 })
             }
-            AggregateReqVar::Continue { .. } => {
+            Some(MEDIA_TYPE_AGG_CONT_REQ) => {
+                let agg_cont_req = AggregateContinueReq::get_decoded(&req.payload)?;
+                let task_config = self
+                    .get_task_config_for(&agg_cont_req.task_id)
+                    .ok_or(DapAbort::UnrecognizedTask)?;
+
                 let state = self
-                    .get_helper_state(&agg_req.task_id, &agg_req.agg_job_id)
+                    .get_helper_state(&agg_cont_req.task_id, &agg_cont_req.agg_job_id)
                     .await?;
-                let transition = task_config.vdaf.handle_agg_cont_req(state, &agg_req)?;
+                let transition = task_config.vdaf.handle_agg_cont_req(state, &agg_cont_req)?;
 
                 let agg_resp = match transition {
                     DapHelperTransition::Continue(..) => {
                         return Err(DapError::fatal("unexpected transition (continued)").into());
                     }
                     DapHelperTransition::Finish(out_shares, agg_resp) => {
-                        self.put_out_shares(&agg_req.task_id, out_shares).await?;
+                        self.put_out_shares(&agg_cont_req.task_id, out_shares)
+                            .await?;
                         agg_resp
                     }
                 };
@@ -472,6 +480,8 @@ pub trait DapHelper<S>: DapAggregator<S> {
                     payload: agg_resp.get_encoded(),
                 })
             }
+            //TODO spec: Specify this behavior.
+            _ => Err(DapAbort::BadRequest("unexpected media type".into())),
         }
     }
 
diff --git a/daphne/src/vdaf/mod.rs b/daphne/src/vdaf/mod.rs
index d96ec75..f6f1ecc 100644
--- a/daphne/src/vdaf/mod.rs
+++ b/daphne/src/vdaf/mod.rs
@@ -7,8 +7,9 @@
 use crate::{
     hpke::HpkeDecrypter,
     messages::{
-        encode_u16_bytes, AggregateReq, AggregateReqVar, AggregateResp, HpkeCiphertext, HpkeConfig,
-        Id, Interval, Nonce, Report, ReportShare, Transition, TransitionFailure, TransitionVar,
+        encode_u16_bytes, AggregateContinueReq, AggregateInitializeReq, AggregateResp,
+        HpkeCiphertext, HpkeConfig, Id, Interval, Nonce, Report, ReportShare, Transition,
+        TransitionFailure, TransitionVar,
     },
     vdaf::prio3::{
         prio3_encode_prepare_message, prio3_helper_prepare_finish, prio3_leader_prepare_finish,
@@ -251,7 +252,7 @@ impl VdafConfig {
         task_id: &Id,
         agg_job_id: &Id,
         reports: Vec<Report>,
-    ) -> Result<DapLeaderTransition<AggregateReq>, DapAbort> {
+    ) -> Result<DapLeaderTransition<AggregateInitializeReq>, DapAbort> {
         let mut processed = HashSet::with_capacity(reports.len());
         let mut states = Vec::with_capacity(reports.len());
         let mut seq = Vec::with_capacity(reports.len());
@@ -308,13 +309,11 @@ impl VdafConfig {
 
         Ok(DapLeaderTransition::Continue(
             DapLeaderState { seq: states },
-            AggregateReq {
+            AggregateInitializeReq {
                 task_id: task_id.clone(),
                 agg_job_id: agg_job_id.clone(),
-                var: AggregateReqVar::Init {
-                    agg_param: Vec::new(),
-                    seq,
-                },
+                agg_param: Vec::default(),
+                report_shares: seq,
             },
         ))
     }
@@ -337,34 +336,34 @@ impl VdafConfig {
     ///
     /// * `task_id` indicates the DAP task for which the reports are being processed.
     ///
-    /// * `agg_req` is the aggregate request sent by the peer.
+    /// * `agg_init_req` is the request sent by the Leader.
     ///
     /// * `early_tran_fail_for` is a callback used to determine if a report should be rejected based on
     /// the sequence of aggregate and collect requests made for the task so far. Its input is the
-    /// nonce of report share in `agg_req` and its return value is an optional transition failure.
+    /// nonce of report share in `agg_init_req` and its return value is an optional transition failure.
     pub(crate) fn handle_agg_init_req<D, F>(
         &self,
         decrypter: &D,
         verify_key: &VdafVerifyKey,
-        agg_req: &AggregateReq,
+        agg_init_req: &AggregateInitializeReq,
         early_tran_fail_for: F,
     ) -> Result<DapHelperTransition<AggregateResp>, DapAbort>
     where
         D: HpkeDecrypter,
         F: Fn(&Nonce) -> Option<TransitionFailure>,
     {
-        let report_shares = agg_req.get_report_shares_ref()?;
-        let mut processed = HashSet::with_capacity(report_shares.len());
-        let mut states = Vec::with_capacity(report_shares.len());
-        let mut seq = Vec::with_capacity(report_shares.len());
-        for report_share in report_shares.iter() {
+        let num_reports = agg_init_req.report_shares.len();
+        let mut processed = HashSet::with_capacity(num_reports);
+        let mut states = Vec::with_capacity(num_reports);
+        let mut transitions = Vec::with_capacity(num_reports);
+        for report_share in agg_init_req.report_shares.iter() {
             if processed.contains(&report_share.nonce) {
                 return Err(DapAbort::UnrecognizedMessage);
             }
             processed.insert(report_share.nonce.clone());
 
             if let Some(failure) = early_tran_fail_for(&report_share.nonce) {
-                seq.push(Transition {
+                transitions.push(Transition {
                     nonce: report_share.nonce.clone(),
                     var: TransitionVar::Failed(failure),
                 });
@@ -375,7 +374,7 @@ impl VdafConfig {
                 decrypter,
                 false, // is_leader
                 verify_key,
-                &agg_req.task_id,
+                &agg_init_req.task_id,
                 &report_share.nonce,
                 &report_share.ignored_extensions,
                 &report_share.encrypted_input_share,
@@ -391,7 +390,7 @@ impl VdafConfig {
                 Err(e) => return Err(DapAbort::Internal(Box::new(e))),
             };
 
-            seq.push(Transition {
+            transitions.push(Transition {
                 nonce: report_share.nonce.clone(),
                 var,
             });
@@ -399,7 +398,7 @@ impl VdafConfig {
 
         Ok(DapHelperTransition::Continue(
             DapHelperState { seq: states },
-            AggregateResp { seq },
+            AggregateResp { transitions },
         ))
     }
 
@@ -421,15 +420,15 @@ impl VdafConfig {
         agg_job_id: &Id,
         state: DapLeaderState,
         agg_resp: AggregateResp,
-    ) -> Result<DapLeaderTransition<AggregateReq>, DapAbort> {
-        if agg_resp.seq.len() != state.seq.len() {
+    ) -> Result<DapLeaderTransition<AggregateContinueReq>, DapAbort> {
+        if agg_resp.transitions.len() != state.seq.len() {
             return Err(DapAbort::UnrecognizedMessage);
         }
 
         let mut seq = Vec::with_capacity(state.seq.len());
         let mut states = Vec::with_capacity(state.seq.len());
         for (helper, (leader_step, leader_message, leader_nonce)) in
-            agg_resp.seq.into_iter().zip(state.seq.into_iter())
+            agg_resp.transitions.into_iter().zip(state.seq.into_iter())
         {
             // TODO spec: Consider removing the nonce from the AggregateResp.
             if helper.nonce != leader_nonce {
@@ -492,10 +491,10 @@ impl VdafConfig {
 
         Ok(DapLeaderTransition::Uncommitted(
             DapLeaderUncommitted { seq: states },
-            AggregateReq {
+            AggregateContinueReq {
                 task_id: task_id.clone(),
                 agg_job_id: agg_job_id.clone(),
-                var: AggregateReqVar::Continue { seq },
+                transitions: seq,
             },
         ))
     }
@@ -509,11 +508,11 @@ impl VdafConfig {
     ///
     /// * `state` is the helper's current state.
     ///
-    /// * `agg_req` is the aggregate request sent by the Leader.
+    /// * `agg_cont_req` is the aggregate request sent by the Leader.
     pub(crate) fn handle_agg_cont_req(
         &self,
         state: DapHelperState,
-        agg_req: &AggregateReq,
+        agg_cont_req: &AggregateContinueReq,
     ) -> Result<DapHelperTransition<AggregateResp>, DapAbort> {
         let mut processed = HashSet::with_capacity(state.seq.len());
         let mut recognized = HashSet::with_capacity(state.seq.len());
@@ -521,10 +520,10 @@ impl VdafConfig {
             recognized.insert(nonce.clone());
         }
 
-        let leader_transitions = agg_req.get_transitions_ref()?;
-        let mut seq = Vec::with_capacity(state.seq.len());
-        let mut out_shares = Vec::with_capacity(state.seq.len());
-        let mut leader_iter = leader_transitions.iter();
+        let num_reports = state.seq.len();
+        let mut transitions = Vec::with_capacity(num_reports);
+        let mut out_shares = Vec::with_capacity(num_reports);
+        let mut leader_iter = agg_cont_req.transitions.iter();
         let mut helper_iter = state.seq.into_iter();
         for leader in &mut leader_iter {
             // If the nonce is not recognized, then respond with a transition failure.
@@ -578,7 +577,7 @@ impl VdafConfig {
                     }
                 };
 
-                seq.push(Transition {
+                transitions.push(Transition {
                     nonce: helper_nonce,
                     var,
                 });
@@ -589,7 +588,7 @@ impl VdafConfig {
 
         Ok(DapHelperTransition::Finish(
             out_shares,
-            AggregateResp { seq },
+            AggregateResp { transitions },
         ))
     }
 
@@ -611,13 +610,15 @@ impl VdafConfig {
         uncommitted: DapLeaderUncommitted,
         agg_resp: AggregateResp,
     ) -> Result<Vec<DapOutputShare>, DapAbort> {
-        if agg_resp.seq.len() != uncommitted.seq.len() {
+        if agg_resp.transitions.len() != uncommitted.seq.len() {
             return Err(DapAbort::UnrecognizedMessage);
         }
 
         let mut out_shares = Vec::with_capacity(uncommitted.seq.len());
-        for (helper, (out_share, leader_nonce)) in
-            agg_resp.seq.into_iter().zip(uncommitted.seq.into_iter())
+        for (helper, (out_share, leader_nonce)) in agg_resp
+            .transitions
+            .into_iter()
+            .zip(uncommitted.seq.into_iter())
         {
             // TODO spec: Consider removing the nonce from the AggregateResp.
             if helper.nonce != leader_nonce {
diff --git a/daphne/src/vdaf/prio3.rs b/daphne/src/vdaf/prio3.rs
index baed410..b013c92 100644
--- a/daphne/src/vdaf/prio3.rs
+++ b/daphne/src/vdaf/prio3.rs
@@ -169,7 +169,7 @@ pub(crate) fn prio3_leader_prepare_finish(
             VdafState::Prio3Field128(state),
             VdafMessage::Prio3ShareField128(share),
         ) => {
-            let vdaf = Prio3::new_aes128_histogram(2, &buckets)?;
+            let vdaf = Prio3::new_aes128_histogram(2, buckets)?;
             let (out_share, outbound) = leader_prep_fin!(vdaf, state, share, helper_share_data);
             let agg_share = VdafAggregateShare::Field128(vdaf.aggregate(&(), [out_share])?);
             (agg_share, outbound)
@@ -224,7 +224,7 @@ pub(crate) fn prio3_helper_prepare_finish(
             VdafAggregateShare::Field64(vdaf.aggregate(&(), [out_share])?)
         }
         (Prio3Config::Histogram { buckets }, VdafState::Prio3Field128(state)) => {
-            let vdaf = Prio3::new_aes128_histogram(2, &buckets)?;
+            let vdaf = Prio3::new_aes128_histogram(2, buckets)?;
             let out_share = helper_prep_fin!(vdaf, state, peer_message_data);
             VdafAggregateShare::Field128(vdaf.aggregate(&(), [out_share])?)
         }
@@ -273,7 +273,7 @@ pub(crate) fn prio3_decode_prepare_state(
             ))
         }
         Prio3Config::Histogram { buckets } => {
-            let vdaf = Prio3::new_aes128_histogram(2, &buckets)?;
+            let vdaf = Prio3::new_aes128_histogram(2, buckets)?;
             Ok(VdafState::Prio3Field128(
                 Prio3PrepareState::decode_with_param(&(&vdaf, agg_id), bytes)?,
             ))
@@ -322,7 +322,7 @@ pub(crate) fn prio3_unshard<M: IntoIterator<Item = Vec<u8>>>(
             Ok(DapAggregateResult::U64(agg_res))
         }
         Prio3Config::Histogram { buckets } => {
-            let vdaf = Prio3::new_aes128_histogram(2, &buckets)?;
+            let vdaf = Prio3::new_aes128_histogram(2, buckets)?;
             let agg_res = unshard!(vdaf, agg_shares)?;
             Ok(DapAggregateResult::U128Vec(agg_res))
         }
diff --git a/daphne_worker/src/dap.rs b/daphne_worker/src/dap.rs
index 179256a..38cfa87 100644
--- a/daphne_worker/src/dap.rs
+++ b/daphne_worker/src/dap.rs
@@ -63,10 +63,7 @@ pub(crate) async fn worker_request_to_dap(mut req: Request) -> Result<DapRequest
         None
     };
 
-    let sender_auth = req
-        .headers()
-        .get("DAP-Auth-Token")?
-        .map(|token| BearerToken::from(token));
+    let sender_auth = req.headers().get("DAP-Auth-Token")?.map(BearerToken::from);
 
     Ok(DapRequest {
         payload: req.bytes().await?,
@@ -127,12 +124,9 @@ impl<D> BearerTokenProvider for DaphneConfig<D> {
         &self,
         task_id: &Id,
     ) -> std::result::Result<Option<BearerToken>, DapError> {
-        let tokens = self
-            .collector_bearer_tokens
-            .as_ref()
-            .ok_or(DapError::Fatal(
-                "helper cannot authorize requests from collector".into(),
-            ))?;
+        let tokens = self.collector_bearer_tokens.as_ref().ok_or_else(|| {
+            DapError::Fatal("helper cannot authorize requests from collector".into())
+        })?;
         Ok(tokens.get(task_id).cloned())
     }
 }


Test patch:
diff --git a/daphne/src/messages_test.rs b/daphne/src/messages_test.rs
index ee6940b..c5e419e 100644
--- a/daphne/src/messages_test.rs
+++ b/daphne/src/messages_test.rs
@@ -2,8 +2,8 @@
 // SPDX-License-Identifier: BSD-3-Clause
 
 use crate::messages::{
-    AggregateReq, AggregateReqVar, AggregateResp, HpkeAeadId, HpkeCiphertext, HpkeConfig,
-    HpkeKdfId, HpkeKemId, Id, Nonce, Report, ReportShare, Transition, TransitionVar,
+    AggregateContinueReq, AggregateInitializeReq, AggregateResp, HpkeAeadId, HpkeCiphertext,
+    HpkeConfig, HpkeKdfId, HpkeKemId, Id, Nonce, Report, ReportShare, Transition, TransitionVar,
 };
 use prio::codec::{Decode, Encode};
 
@@ -49,79 +49,75 @@ fn read_report() {
 
 #[test]
 fn read_agg_init_req() {
-    let want = AggregateReq {
+    let want = AggregateInitializeReq {
         task_id: Id([23; 32]),
         agg_job_id: Id([1; 32]),
-        var: AggregateReqVar::Init {
-            agg_param: b"this is an aggregation parameter".to_vec(),
-            seq: vec![
-                ReportShare {
-                    nonce: Nonce {
-                        time: 1637361337,
-                        rand: 10496152761178246059,
-                    },
-                    ignored_extensions: b"these are extensions".to_vec(),
-                    encrypted_input_share: HpkeCiphertext {
-                        config_id: 23,
-                        enc: b"encapsulated key".to_vec(),
-                        payload: b"ciphertext".to_vec(),
-                    },
+        agg_param: b"this is an aggregation parameter".to_vec(),
+        report_shares: vec![
+            ReportShare {
+                nonce: Nonce {
+                    time: 1637361337,
+                    rand: 10496152761178246059,
                 },
-                ReportShare {
-                    nonce: Nonce {
-                        time: 163736423,
-                        rand: 123897432897439,
-                    },
-                    ignored_extensions: vec![],
-                    encrypted_input_share: HpkeCiphertext {
-                        config_id: 0,
-                        enc: vec![],
-                        payload: b"ciphertext".to_vec(),
-                    },
+                ignored_extensions: b"these are extensions".to_vec(),
+                encrypted_input_share: HpkeCiphertext {
+                    config_id: 23,
+                    enc: b"encapsulated key".to_vec(),
+                    payload: b"ciphertext".to_vec(),
                 },
-            ],
-        },
+            },
+            ReportShare {
+                nonce: Nonce {
+                    time: 163736423,
+                    rand: 123897432897439,
+                },
+                ignored_extensions: vec![],
+                encrypted_input_share: HpkeCiphertext {
+                    config_id: 0,
+                    enc: vec![],
+                    payload: b"ciphertext".to_vec(),
+                },
+            },
+        ],
     };
 
-    let got = AggregateReq::get_decoded(&want.get_encoded()).unwrap();
+    let got = AggregateInitializeReq::get_decoded(&want.get_encoded()).unwrap();
     assert_eq!(got, want);
 }
 
 #[test]
-fn read_agg_req() {
-    let want = AggregateReq {
+fn read_agg_cont_req() {
+    let want = AggregateContinueReq {
         task_id: Id([23; 32]),
         agg_job_id: Id([1; 32]),
-        var: AggregateReqVar::Continue {
-            seq: vec![
-                Transition {
-                    nonce: Nonce {
-                        time: 1637361337,
-                        rand: 10496152761178246059,
-                    },
-                    var: TransitionVar::Continued(b"this is a VDAF-specific message".to_vec()),
+        transitions: vec![
+            Transition {
+                nonce: Nonce {
+                    time: 1637361337,
+                    rand: 10496152761178246059,
                 },
-                Transition {
-                    nonce: Nonce {
-                        time: 163736423,
-                        rand: 123897432897439,
-                    },
-                    var: TransitionVar::Continued(
-                        b"believe it or not this is *also* a VDAF-specific message".to_vec(),
-                    ),
+                var: TransitionVar::Continued(b"this is a VDAF-specific message".to_vec()),
+            },
+            Transition {
+                nonce: Nonce {
+                    time: 163736423,
+                    rand: 123897432897439,
                 },
-            ],
-        },
+                var: TransitionVar::Continued(
+                    b"believe it or not this is *also* a VDAF-specific message".to_vec(),
+                ),
+            },
+        ],
     };
 
-    let got = AggregateReq::get_decoded(&want.get_encoded()).unwrap();
+    let got = AggregateContinueReq::get_decoded(&want.get_encoded()).unwrap();
     assert_eq!(got, want);
 }
 
 #[test]
 fn read_agg_resp() {
     let want = AggregateResp {
-        seq: vec![
+        transitions: vec![
             Transition {
                 nonce: Nonce {
                     time: 1637361337,
diff --git a/daphne/src/roles_test.rs b/daphne/src/roles_test.rs
index 52003de..1682ecb 100644
--- a/daphne/src/roles_test.rs
+++ b/daphne/src/roles_test.rs
@@ -6,7 +6,7 @@ use crate::{
     constants::{MEDIA_TYPE_AGG_INIT_REQ, MEDIA_TYPE_AGG_SHARE_REQ, MEDIA_TYPE_COLLECT_REQ},
     hpke::HpkeDecrypter,
     messages::{
-        AggregateReq, AggregateReqVar, AggregateShareReq, CollectReq, CollectResp, HpkeCiphertext,
+        AggregateInitializeReq, AggregateShareReq, CollectReq, CollectResp, HpkeCiphertext,
         HpkeConfig, Id, Interval, Nonce, Report, ReportShare, TransitionFailure,
     },
     roles::{DapAggregator, DapAuthorizedSender, DapHelper, DapLeader},
@@ -231,10 +231,11 @@ async fn http_post_aggregate_unauthorized_request() {
 
     let mut req = DapRequest {
         media_type: Some(MEDIA_TYPE_AGG_INIT_REQ),
-        payload: AggregateReq {
+        payload: AggregateInitializeReq {
             task_id: task_id.clone(),
             agg_job_id: Id(rng.gen()),
-            var: AggregateReqVar::default(),
+            agg_param: Vec::default(),
+            report_shares: Vec::default(),
         }
         .get_encoded(),
         url: task_config.helper_url.join("/aggregate").unwrap(),
diff --git a/daphne/src/vdaf/mod_test.rs b/daphne/src/vdaf/mod_test.rs
index c80d0df..5ca3c4d 100644
--- a/daphne/src/vdaf/mod_test.rs
+++ b/daphne/src/vdaf/mod_test.rs
@@ -4,9 +4,9 @@
 use crate::{
     hpke::HpkeSecretKey,
     messages::{
-        AggregateReq, AggregateReqVar, AggregateResp, HpkeAeadId, HpkeCiphertext, HpkeConfig,
-        HpkeKdfId, HpkeKemId, Id, Interval, Nonce, Report, Transition, TransitionFailure,
-        TransitionVar,
+        AggregateContinueReq, AggregateInitializeReq, AggregateResp, HpkeAeadId, HpkeCiphertext,
+        HpkeConfig, HpkeKdfId, HpkeKemId, Id, Interval, Nonce, Report, Transition,
+        TransitionFailure, TransitionVar,
     },
     DapAbort, DapAggregateResult, DapAggregateShare, DapError, DapHelperState, DapHelperTransition,
     DapLeaderState, DapLeaderTransition, DapLeaderUncommitted, DapMeasurement, DapOutputShare,
@@ -170,20 +170,19 @@ fn agg_init_req() {
         DapMeasurement::U64(0),
     ]);
 
-    let (leader_state, agg_req) = t.produce_agg_init_req(reports.clone()).unwrap_continue();
+    let (leader_state, agg_init_req) = t.produce_agg_init_req(reports.clone()).unwrap_continue();
     assert_eq!(leader_state.seq.len(), 3);
-    assert_eq!(agg_req.task_id, t.task_id);
-    assert_eq!(agg_req.unwrap_agg_param_ref().len(), 0);
-    let report_shares = agg_req.get_report_shares_ref().unwrap();
-    assert_eq!(report_shares.len(), 3);
-    for (report_shares, report) in report_shares.iter().zip(reports.iter()) {
+    assert_eq!(agg_init_req.task_id, t.task_id);
+    assert_eq!(agg_init_req.agg_param.len(), 0);
+    assert_eq!(agg_init_req.report_shares.len(), 3);
+    for (report_shares, report) in agg_init_req.report_shares.iter().zip(reports.iter()) {
         assert_eq!(report_shares.nonce, report.nonce);
     }
 
-    let (helper_state, agg_resp) = t.handle_agg_init_req(agg_req).unwrap_continue();
+    let (helper_state, agg_resp) = t.handle_agg_init_req(agg_init_req).unwrap_continue();
     assert_eq!(helper_state.seq.len(), 3);
-    assert_eq!(agg_resp.seq.len(), 3);
-    for (sub, report) in agg_resp.seq.iter().zip(reports.iter()) {
+    assert_eq!(agg_resp.transitions.len(), 3);
+    for (sub, report) in agg_resp.transitions.iter().zip(reports.iter()) {
         assert_eq!(sub.nonce, report.nonce);
     }
 }
@@ -210,9 +209,9 @@ fn agg_resp_fail_hpke_decrypt_err() {
     let (_, agg_req) = t.produce_agg_init_req(reports.clone()).unwrap_continue();
     let (_, agg_resp) = t.handle_agg_init_req(agg_req).unwrap_continue();
 
-    assert_eq!(agg_resp.seq.len(), 1);
+    assert_eq!(agg_resp.transitions.len(), 1);
     assert_matches!(
-        agg_resp.seq[0].var,
+        agg_resp.transitions[0].var,
         TransitionVar::Failed(TransitionFailure::HpkeDecryptError)
     );
 }
@@ -228,9 +227,9 @@ fn agg_resp_fail_report_replayed() {
     let (_, agg_req) = t.produce_agg_init_req(reports).unwrap_continue();
     let (_, agg_resp) = t.handle_agg_init_req(agg_req).unwrap_continue();
 
-    assert_eq!(agg_resp.seq.len(), 1);
+    assert_eq!(agg_resp.transitions.len(), 1);
     assert_matches!(
-        agg_resp.seq[0].var,
+        agg_resp.transitions[0].var,
         TransitionVar::Failed(TransitionFailure::ReportReplayed)
     );
 }
@@ -247,9 +246,9 @@ fn agg_resp_fail_batch_collected() {
     let (_, agg_req) = t.produce_agg_init_req(reports).unwrap_continue();
     let (_, agg_resp) = t.handle_agg_init_req(agg_req).unwrap_continue();
 
-    assert_eq!(agg_resp.seq.len(), 1);
+    assert_eq!(agg_resp.transitions.len(), 1);
     assert_matches!(
-        agg_resp.seq[0].var,
+        agg_resp.transitions[0].var,
         TransitionVar::Failed(TransitionFailure::BatchCollected)
     );
 }
@@ -262,9 +261,9 @@ fn agg_resp_abort_transition_out_of_order() {
     let (_, mut agg_resp) = t.handle_agg_init_req(agg_init_req).unwrap_continue();
 
     // Helper sends transitions out of order.
-    let tmp = agg_resp.seq[0].clone();
-    agg_resp.seq[0] = agg_resp.seq[1].clone();
-    agg_resp.seq[1] = tmp;
+    let tmp = agg_resp.transitions[0].clone();
+    agg_resp.transitions[0] = agg_resp.transitions[1].clone();
+    agg_resp.transitions[1] = tmp;
 
     assert_matches!(
         t.handle_agg_resp_expect_err(leader_state, agg_resp),
@@ -280,8 +279,8 @@ fn agg_resp_abort_nonce_repeated() {
     let (_, mut agg_resp) = t.handle_agg_init_req(agg_init_req).unwrap_continue();
 
     // Helper sends a transition twice.
-    let repeated_transition = agg_resp.seq[0].clone();
-    agg_resp.seq.push(repeated_transition);
+    let repeated_transition = agg_resp.transitions[0].clone();
+    agg_resp.transitions.push(repeated_transition);
 
     assert_matches!(
         t.handle_agg_resp_expect_err(leader_state, agg_resp),
@@ -298,7 +297,7 @@ fn agg_resp_abort_unrecognized_nonce() {
     let (_, mut agg_resp) = t.handle_agg_init_req(agg_init_req).unwrap_continue();
 
     // Helper sent a transition with an unrecognized Nonce.
-    agg_resp.seq.push(Transition {
+    agg_resp.transitions.push(Transition {
         nonce: Nonce {
             time: rng.gen(),
             rand: rng.gen(),
@@ -320,7 +319,7 @@ fn agg_resp_abort_invalid_transition() {
     let (_, mut agg_resp) = t.handle_agg_init_req(agg_init_req).unwrap_continue();
 
     // Helper sent a transition with an unrecognized Nonce.
-    agg_resp.seq[0].var = TransitionVar::Finished;
+    agg_resp.transitions[0].var = TransitionVar::Finished;
 
     assert_matches!(
         t.handle_agg_resp_expect_err(leader_state, agg_resp),
@@ -349,7 +348,7 @@ fn agg_cont_req() {
         .handle_agg_cont_req(helper_state, &agg_cont_req)
         .unwrap_finish();
     assert_eq!(helper_out_shares.len(), 5);
-    assert_eq!(agg_resp.seq.len(), 5);
+    assert_eq!(agg_resp.transitions.len(), 5);
 
     let leader_out_shares = t.handle_final_agg_resp(leader_uncommitted, agg_resp);
     assert_eq!(leader_out_shares.len(), 5);
@@ -402,23 +401,24 @@ fn agg_cont_req_skip_vdaf_prep_error() {
     let (_, mut agg_cont_req) = t
         .handle_agg_resp(leader_state, agg_resp)
         .unwrap_uncommitted();
-    assert_matches!(agg_cont_req.var, AggregateReqVar::Continue{ ref mut seq
-    } => {
-        // Simulate VDAF preparation error (due to the report being invalid, say). The leader will
-        // skip the report without processing it any further.
-        seq.remove(1);
-    });
+    // Simulate VDAF preparation error (due to the report being invalid, say). The leader will
+    // skip the report without processing it any further.
+    agg_cont_req.transitions.remove(1);
 
     let (helper_output_shares, agg_resp) = t
         .handle_agg_cont_req(helper_state, &agg_cont_req)
         .unwrap_finish();
 
     assert_eq!(2, helper_output_shares.len());
-    assert_eq!(2, agg_resp.seq.len());
-    assert_matches!(agg_init_req.var, AggregateReqVar::Init{ agg_param: _, seq } => {
-        assert_eq!(agg_resp.seq[0].nonce, seq[0].nonce);
-        assert_eq!(agg_resp.seq[1].nonce, seq[2].nonce);
-    });
+    assert_eq!(2, agg_resp.transitions.len());
+    assert_eq!(
+        agg_resp.transitions[0].nonce,
+        agg_init_req.report_shares[0].nonce
+    );
+    assert_eq!(
+        agg_resp.transitions[1].nonce,
+        agg_init_req.report_shares[2].nonce
+    );
 }
 
 #[test]
@@ -432,17 +432,17 @@ fn agg_cont_abort_unrecognized_nonce() {
     let (_, mut agg_cont_req) = t
         .handle_agg_resp(leader_state, agg_resp)
         .unwrap_uncommitted();
-    assert_matches!(agg_cont_req.var, AggregateReqVar::Continue{ ref mut seq
-    } => {
-        // Leader sends a Transition with an unrecognized nonce.
-        seq.insert(1, Transition{
+    // Leader sends a Transition with an unrecognized nonce.
+    agg_cont_req.transitions.insert(
+        1,
+        Transition {
             nonce: Nonce {
                 time: rng.gen(),
                 rand: rng.gen(),
             },
             var: TransitionVar::Finished, // Expected transition type for Prio3 at this stage
-        });
-    });
+        },
+    );
 
     assert_matches!(
         t.handle_agg_cont_req_expect_err(helper_state, &agg_cont_req),
@@ -460,13 +460,10 @@ fn agg_cont_req_abort_transition_out_of_order() {
     let (_, mut agg_cont_req) = t
         .handle_agg_resp(leader_state, agg_resp)
         .unwrap_uncommitted();
-    assert_matches!(agg_cont_req.var, AggregateReqVar::Continue{ ref mut seq
-    } => {
-        // Leader sends transitions out of order.
-        let tmp = seq[0].clone();
-        seq[0] = seq[1].clone();
-        seq[1] = tmp;
-    });
+    // Leader sends transitions out of order.
+    let tmp = agg_cont_req.transitions[0].clone();
+    agg_cont_req.transitions[0] = agg_cont_req.transitions[1].clone();
+    agg_cont_req.transitions[1] = tmp;
 
     assert_matches!(
         t.handle_agg_cont_req_expect_err(helper_state, &agg_cont_req),
@@ -484,12 +481,9 @@ fn agg_cont_req_abort_nonce_repeated() {
     let (_, mut agg_cont_req) = t
         .handle_agg_resp(leader_state, agg_resp)
         .unwrap_uncommitted();
-    assert_matches!(agg_cont_req.var, AggregateReqVar::Continue{ ref mut seq
-    } => {
-        // Leader sends a transition twice.
-        let repeated_transition = seq[0].clone();
-        seq.push(repeated_transition);
-    });
+    // Leader sends a transition twice.
+    let repeated_transition = agg_cont_req.transitions[0].clone();
+    agg_cont_req.transitions.push(repeated_transition);
 
     assert_matches!(
         t.handle_agg_cont_req_expect_err(helper_state, &agg_cont_req),
@@ -610,7 +604,10 @@ impl<'a> Test<'a> {
         reports
     }
 
-    fn produce_agg_init_req(&self, reports: Vec<Report>) -> DapLeaderTransition<AggregateReq> {
+    fn produce_agg_init_req(
+        &self,
+        reports: Vec<Report>,
+    ) -> DapLeaderTransition<AggregateInitializeReq> {
         self.vdaf
             .produce_agg_init_req(
                 &self.leader_hpke_secret_key,
@@ -624,7 +621,7 @@ impl<'a> Test<'a> {
 
     fn handle_agg_init_req(
         &mut self,
-        agg_init_req: AggregateReq,
+        agg_init_req: AggregateInitializeReq,
     ) -> DapHelperTransition<AggregateResp> {
         let agg_resp = self
             .vdaf
@@ -636,7 +633,7 @@ impl<'a> Test<'a> {
             )
             .unwrap();
 
-        for report_share in agg_init_req.get_report_shares_ref().unwrap() {
+        for report_share in agg_init_req.report_shares {
             self.helper_reports_aggregated
                 .insert(report_share.nonce.clone());
         }
@@ -648,7 +645,7 @@ impl<'a> Test<'a> {
         &self,
         leader_state: DapLeaderState,
         agg_resp: AggregateResp,
-    ) -> DapLeaderTransition<AggregateReq> {
+    ) -> DapLeaderTransition<AggregateContinueReq> {
         self.vdaf
             .handle_agg_resp(&self.task_id, &self.agg_job_id, leader_state, agg_resp)
             .unwrap()
@@ -668,20 +665,20 @@ impl<'a> Test<'a> {
     fn handle_agg_cont_req(
         &self,
         helper_state: DapHelperState,
-        agg_req: &AggregateReq,
+        agg_cont_req: &AggregateContinueReq,
     ) -> DapHelperTransition<AggregateResp> {
         self.vdaf
-            .handle_agg_cont_req(helper_state, agg_req)
+            .handle_agg_cont_req(helper_state, agg_cont_req)
             .unwrap()
     }
 
     fn handle_agg_cont_req_expect_err(
         &self,
         helper_state: DapHelperState,
-        agg_req: &AggregateReq,
+        agg_cont_req: &AggregateContinueReq,
     ) -> DapAbort {
         self.vdaf
-            .handle_agg_cont_req(helper_state, agg_req)
+            .handle_agg_cont_req(helper_state, agg_cont_req)
             .err()
             .expect("handle_agg_cont_req() succeeded; expected failure")
     }