@@ -227,7 +227,7 @@ impl DapGlobalConfig {
227
227
}
228
228
}
229
229
230
- /// DAP Query configuration.
230
+ /// DAP batch configuration.
231
231
#[ derive( Clone , Debug , Deserialize , Eq , PartialEq , Serialize ) ]
232
232
#[ serde( rename_all = "snake_case" ) ]
233
233
#[ cfg_attr( any( test, feature = "test-utils" ) , derive( deepsize:: DeepSizeOf ) ) ]
@@ -241,7 +241,8 @@ pub enum DapBatchMode {
241
241
/// Aggregators are meant to stop aggregating reports when this limit is reached.
242
242
LeaderSelected {
243
243
#[ serde( default ) ]
244
- max_batch_size : Option < NonZeroU32 > ,
244
+ #[ serde( rename = "max_batch_size" ) ]
245
+ draft09_max_batch_size : Option < NonZeroU32 > ,
245
246
} ,
246
247
}
247
248
@@ -553,6 +554,9 @@ impl DapTaskParameters {
553
554
now : Time ,
554
555
taskprov_config : roles:: aggregator:: TaskprovConfig < ' _ > ,
555
556
) -> Result < ( DapTaskConfig , TaskId , TaskprovAdvertisement ) , DapError > {
557
+ let not_before = now;
558
+ let not_after = now + 86400 * 14 ; // expires in two weeks
559
+
556
560
let taskprov_advertisement = messages:: taskprov:: TaskprovAdvertisement {
557
561
task_info,
558
562
leader_url : messages:: taskprov:: UrlBytes {
@@ -561,16 +565,23 @@ impl DapTaskParameters {
561
565
helper_url : messages:: taskprov:: UrlBytes {
562
566
bytes : self . helper_url . to_string ( ) . into_bytes ( ) ,
563
567
} ,
564
- query_config : messages:: taskprov:: QueryConfig {
565
- time_precision : self . time_precision ,
566
- max_batch_query_count : 1 ,
567
- min_batch_size : self . min_batch_size . try_into ( ) . unwrap ( ) ,
568
- batch_mode : ( & self . query ) . try_into ( ) ?,
568
+ time_precision : self . time_precision ,
569
+ min_batch_size : self . min_batch_size . try_into ( ) . unwrap ( ) ,
570
+ query_config : ( & self . query ) . try_into ( ) ?,
571
+ lifetime : messages:: taskprov:: TaskLifetime :: from_validity_range (
572
+ self . version ,
573
+ not_before,
574
+ not_after,
575
+ ) ,
576
+ vdaf_config : ( & self . vdaf ) . try_into ( ) ?,
577
+ extensions : Vec :: new ( ) ,
578
+ draft09_max_batch_query_count : match self . version {
579
+ DapVersion :: Draft09 => Some ( 1 ) ,
580
+ DapVersion :: Latest => None ,
569
581
} ,
570
- task_expiration : now + 86400 * 14 , // expires in two weeks
571
- vdaf_config : messages:: taskprov:: VdafConfig {
572
- dp_config : messages:: taskprov:: DpConfig :: None ,
573
- var : ( & self . vdaf ) . try_into ( ) ?,
582
+ draft09_dp_config : match self . version {
583
+ DapVersion :: Draft09 => Some ( messages:: taskprov:: DpConfig :: None ) ,
584
+ DapVersion :: Latest => None ,
574
585
} ,
575
586
} ;
576
587
@@ -736,7 +747,7 @@ impl DapTaskConfig {
736
747
) -> Result < bool , DapAbort > {
737
748
match self . query {
738
749
DapBatchMode :: LeaderSelected {
739
- max_batch_size : Some ( max_batch_size) ,
750
+ draft09_max_batch_size : Some ( max_batch_size) ,
740
751
} => {
741
752
if report_count > u64:: from ( max_batch_size. get ( ) ) {
742
753
return Err ( DapAbort :: InvalidBatchSize {
@@ -749,7 +760,7 @@ impl DapTaskConfig {
749
760
}
750
761
DapBatchMode :: TimeInterval
751
762
| DapBatchMode :: LeaderSelected {
752
- max_batch_size : None ,
763
+ draft09_max_batch_size : None ,
753
764
} => ( ) ,
754
765
} ;
755
766
0 commit comments