Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove draft09 version of vdaf config #748

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/dapf/src/acceptance/load_testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ fn jobs_per_batch() -> impl Iterator<Item = usize> {
fn vdaf_config_params() -> impl Iterator<Item = VdafConfig> {
[
VdafConfig::Prio2 { dimension: 99_992 },
VdafConfig::Prio3Draft09(
VdafConfig::Prio3(
daphne::vdaf::Prio3Config::SumVecField64MultiproofHmacSha256Aes128 {
bits: 1,
length: 100_000,
chunk_length: 320,
num_proofs: 2,
},
),
VdafConfig::Prio3Draft09(
VdafConfig::Prio3(
daphne::vdaf::Prio3Config::SumVecField64MultiproofHmacSha256Aes128 {
bits: 1,
length: 100_000,
Expand Down
4 changes: 2 additions & 2 deletions crates/dapf/src/cli_parsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ impl DefaultVdafConfigs {
match self {
Self::Prio2Dimension99k => VdafConfig::Prio2 { dimension: 99_992 },
Self::Prio3Draft09NumProofs2 => {
VdafConfig::Prio3Draft09(Prio3Config::SumVecField64MultiproofHmacSha256Aes128 {
VdafConfig::Prio3(Prio3Config::SumVecField64MultiproofHmacSha256Aes128 {
bits: 1,
length: 100_000,
chunk_length: 320,
num_proofs: 2,
})
}
Self::Prio3Draft09NumProofs3 => {
VdafConfig::Prio3Draft09(Prio3Config::SumVecField64MultiproofHmacSha256Aes128 {
VdafConfig::Prio3(Prio3Config::SumVecField64MultiproofHmacSha256Aes128 {
bits: 1,
length: 100_000,
chunk_length: 320,
Expand Down
15 changes: 12 additions & 3 deletions crates/dapf/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -841,14 +841,23 @@ async fn handle_test_routes(action: TestAction, http_client: HttpClient) -> anyh
} => {
let vdaf = use_or_request_from_user_or_default(vdaf, CliVdafConfig::default, "vdaf")?
.into_vdaf_config();
let vdaf_verify_key = encode_base64url(vdaf.gen_verify_key());
let CliDapBatchMode(query) = use_or_request_from_user_or_default(
query,
|| DapBatchMode::LeaderSelected {
max_batch_size: None,
},
"query",
)?;

let leader = use_or_request_from_user(leader_url, "leader url")?;
let helper = use_or_request_from_user(helper_url, "helper url")?;

let vdaf_verify_key = encode_base64url(vdaf.gen_verify_key({
let vl = deduce_dap_version_from_url(&leader)?;
let vh = deduce_dap_version_from_url(&helper)?;
assert_eq!(vl, vh, "leader and helper url version are mismatched");
vl
}));
let role = use_or_request_from_user(role, "role")?;
let default_task_id = TaskId(thread_rng().gen());
let internal_task = InternalTestAddTask {
Expand All @@ -858,8 +867,8 @@ async fn handle_test_routes(action: TestAction, http_client: HttpClient) -> anyh
"task id",
)?
.into(),
leader: use_or_request_from_user(leader_url, "leader url")?,
helper: use_or_request_from_user(helper_url, "helper url")?,
leader,
helper,
vdaf: InternalTestVdaf::from(vdaf),
leader_authentication_token: use_or_request_from_user(
leader_auth_token,
Expand Down
12 changes: 6 additions & 6 deletions crates/daphne-server/src/roles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,25 +187,25 @@ mod test_utils {
cmd.vdaf.length,
cmd.vdaf.chunk_length,
) {
("Prio3Count", None, None, None) => VdafConfig::Prio3Draft09(Prio3Config::Count),
("Prio3Sum", Some(bits), None, None) => VdafConfig::Prio3Draft09(Prio3Config::Sum {
("Prio3Count", None, None, None) => VdafConfig::Prio3(Prio3Config::Count),
("Prio3Sum", Some(bits), None, None) => VdafConfig::Prio3(Prio3Config::Sum {
bits: bits.parse().map_err(|e| fatal_error!(err = ?e, "failed to parse bits for Prio3Config::Sum"))?,
}),
("Prio3SumVec", Some(bits), Some(length), Some(chunk_length)) => {
VdafConfig::Prio3Draft09(Prio3Config::SumVec {
VdafConfig::Prio3(Prio3Config::SumVec {
bits: bits.parse().map_err(|e| fatal_error!(err = ?e, "failed to parse bits for Prio3Config::SumVec"))?,
length: length.parse().map_err(|e| fatal_error!(err = ?e, "failed to parse length for Prio3Config::SumVec"))?,
chunk_length: chunk_length.parse().map_err(|e| fatal_error!(err = ?e, "failed to parse chunk_length for Prio3Config::SumVec"))?,
})
}
("Prio3Histogram", None, Some(length), Some(chunk_length)) => {
VdafConfig::Prio3Draft09(Prio3Config::Histogram {
VdafConfig::Prio3(Prio3Config::Histogram {
length: length.parse().map_err(|e| fatal_error!(err = ?e, "failed to parse length for Prio3Config::Histogram"))?,
chunk_length: chunk_length.parse().map_err(|e| fatal_error!(err = ?e, "failed to parse chunk_length for Prio3Config::Histogram"))?,
})
}
("Prio3SumVecField64MultiproofHmacSha256Aes128", Some(bits), Some(length), Some(chunk_length)) => {
VdafConfig::Prio3Draft09(Prio3Config::SumVecField64MultiproofHmacSha256Aes128 {
VdafConfig::Prio3(Prio3Config::SumVecField64MultiproofHmacSha256Aes128 {
bits: bits.parse().map_err(|e| fatal_error!(err = ?e, "failed to parse bits for Prio3Config::SumVecField64MultiproofHmacSha256Aes128"))?,
length: length.parse().map_err(|e| fatal_error!(err = ?e, "failed to parse length for Prio3Config::SumVecField64MultiproofHmacSha256Aes128"))?,
chunk_length: chunk_length.parse().map_err(|e| fatal_error!(err = ?e, "failed to parse chunk_length for Prio3Config::SumVecField64MultiproofHmacSha256Aes128"))?,
Expand All @@ -221,7 +221,7 @@ mod test_utils {
fatal_error!(err = "VDAF verify key is not valid URL-safe base64")
})?;
let vdaf_verify_key = vdaf
.get_decoded_verify_key(&vdaf_verify_key_data)
.get_decoded_verify_key(&vdaf_verify_key_data, version)
.map_err(|e| fatal_error!(err = ?e, "failed to decode verify key"))?;

// Collector HPKE config.
Expand Down
6 changes: 3 additions & 3 deletions crates/daphne-server/tests/e2e/test_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use std::{
use tokio::time::timeout;
use url::Url;

const VDAF_CONFIG: &VdafConfig = &VdafConfig::Prio3Draft09(Prio3Config::Sum { bits: 10 });
const VDAF_CONFIG: &VdafConfig = &VdafConfig::Prio3(Prio3Config::Sum { bits: 10 });
pub(crate) const MIN_BATCH_SIZE: u64 = 10;
pub(crate) const MAX_BATCH_SIZE: u32 = 12;
pub(crate) const TIME_PRECISION: Duration = 3600; // seconds
Expand Down Expand Up @@ -117,7 +117,7 @@ impl TestRunner {
min_batch_size: MIN_BATCH_SIZE,
query: query_config.clone(),
vdaf: *VDAF_CONFIG,
vdaf_verify_key: VDAF_CONFIG.gen_verify_key(),
vdaf_verify_key: VDAF_CONFIG.gen_verify_key(version),
collector_hpke_config: collector_hpke_receiver.config.clone(),
method: Default::default(),
num_agg_span_shards: global_config.default_num_agg_span_shards,
Expand Down Expand Up @@ -170,7 +170,7 @@ impl TestRunner {
"type": "Prio3Sum",
"bits": assert_matches!(
t.task_config.vdaf,
VdafConfig::Prio3Draft09(Prio3Config::Sum{ bits }) => format!("{bits}")
VdafConfig::Prio3(Prio3Config::Sum{ bits }) => format!("{bits}")
),
});

Expand Down
34 changes: 0 additions & 34 deletions crates/daphne-service-utils/src/test_route_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,40 +35,6 @@ pub struct InternalTestVdaf {
impl From<VdafConfig> for InternalTestVdaf {
fn from(vdaf: VdafConfig) -> Self {
let (typ, bits, length, chunk_length) = match vdaf {
VdafConfig::Prio3Draft09(prio3) => match prio3 {
Prio3Config::Count => ("Prio3Draft09Count", None, None, None),
Prio3Config::Sum { bits } => ("Prio3Draft09Sum", Some(bits), None, None),
Prio3Config::Histogram {
length,
chunk_length,
} => (
"Prio3Draft09Histogram",
None,
Some(length),
Some(chunk_length),
),
Prio3Config::SumVec {
bits,
length,
chunk_length,
} => (
"Prio3Draft09SumVec",
Some(bits),
Some(length),
Some(chunk_length),
),
Prio3Config::SumVecField64MultiproofHmacSha256Aes128 {
bits,
length,
chunk_length,
num_proofs: _unimplemented,
} => (
"Prio3Draft09SumVecField64MultiproofHmacSha256Aes128",
Some(bits),
Some(length),
Some(chunk_length),
),
},
VdafConfig::Prio3(prio3) => match prio3 {
Prio3Config::Count => ("Prio3Count", None, None, None),
Prio3Config::Sum { bits } => ("Prio3Sum", Some(bits), None, None),
Expand Down
4 changes: 2 additions & 2 deletions crates/daphne/benches/aggregation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn consume_reports_vary_vdaf_dimension(c: &mut Criterion) {

let mut g = c.benchmark_group(function!());
for vdaf_length in vdaf_lengths {
let vdaf = VdafConfig::Prio3Draft09(Prio3Config::SumVecField64MultiproofHmacSha256Aes128 {
let vdaf = VdafConfig::Prio3(Prio3Config::SumVecField64MultiproofHmacSha256Aes128 {
bits: 1,
length: vdaf_length,
chunk_length: 320,
Expand All @@ -67,7 +67,7 @@ fn consume_reports_vary_vdaf_dimension(c: &mut Criterion) {

fn consume_reports_vary_num_reports(c: &mut Criterion) {
const VDAF: VdafConfig =
VdafConfig::Prio3Draft09(Prio3Config::SumVecField64MultiproofHmacSha256Aes128 {
VdafConfig::Prio3(Prio3Config::SumVecField64MultiproofHmacSha256Aes128 {
bits: 1,
length: 1000,
chunk_length: 320,
Expand Down
2 changes: 1 addition & 1 deletion crates/daphne/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ impl DapTaskParameters {
task_expiration: now + 86400 * 14, // expires in two weeks
vdaf_config: messages::taskprov::VdafConfig {
dp_config: messages::taskprov::DpConfig::None,
var: (&self.vdaf).try_into()?,
var: messages::taskprov::VdafTypeVar::of_config(&self.vdaf, self.version)?,
},
};

Expand Down
38 changes: 20 additions & 18 deletions crates/daphne/src/protocol/aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,23 +304,23 @@ impl DapTaskConfig {
prep_state: helper_prep_state,
} => {
let res = match &self.vdaf {
VdafConfig::Prio3Draft09(prio3_config) => {
prio3_draft09_prep_finish_from_shares(
VdafConfig::Prio3(prio3_config) => match self.version {
DapVersion::Draft09 => prio3_draft09_prep_finish_from_shares(
prio3_config,
1,
helper_prep_state.clone(),
helper_prep_share.clone(),
leader_prep_share,
)
}
VdafConfig::Prio3(prio3_config) => prio3_prep_finish_from_shares(
prio3_config,
1,
task_id,
helper_prep_state.clone(),
helper_prep_share.clone(),
leader_prep_share,
),
),
DapVersion::Latest => prio3_prep_finish_from_shares(
prio3_config,
1,
task_id,
helper_prep_state.clone(),
helper_prep_share.clone(),
leader_prep_share,
),
},
VdafConfig::Prio2 { dimension } => prio2_prep_finish_from_shares(
*dimension,
helper_prep_state.clone(),
Expand Down Expand Up @@ -459,12 +459,14 @@ impl DapTaskConfig {
};

let res = match &self.vdaf {
VdafConfig::Prio3Draft09(prio3_config) => {
prio3_draft09_prep_finish(prio3_config, leader.prep_state, prep_msg)
}
VdafConfig::Prio3(prio3_config) => {
prio3_prep_finish(prio3_config, leader.prep_state, prep_msg, *task_id)
}
VdafConfig::Prio3(prio3_config) => match self.version {
DapVersion::Draft09 => {
prio3_draft09_prep_finish(prio3_config, leader.prep_state, prep_msg)
}
DapVersion::Latest => {
prio3_prep_finish(prio3_config, leader.prep_state, prep_msg, *task_id)
}
},
VdafConfig::Prio2 { dimension } => {
prio2_prep_finish(*dimension, leader.prep_state, prep_msg)
}
Expand Down
13 changes: 6 additions & 7 deletions crates/daphne/src/protocol/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl VdafConfig {
let mut rng = thread_rng();
let report_id = ReportId(rng.gen());
let (public_share, input_shares) = self
.produce_input_shares(measurement, &report_id.0, task_id)
.produce_input_shares(measurement, &report_id.0, task_id, version)
.map_err(DapError::from_vdaf)?;
Self::produce_report_with_extensions_for_shares(
public_share,
Expand Down Expand Up @@ -122,14 +122,13 @@ impl VdafConfig {
measurement: DapMeasurement,
nonce: &[u8; 16],
task_id: &TaskId,
version: DapVersion,
) -> Result<(Vec<u8>, [Vec<u8>; 2]), VdafError> {
match self {
Self::Prio3Draft09(prio3_config) => {
Ok(prio3_draft09_shard(prio3_config, measurement, nonce)?)
}
Self::Prio3(prio3_config) => {
Ok(prio3_shard(prio3_config, measurement, nonce, *task_id)?)
}
Self::Prio3(prio3_config) => match version {
DapVersion::Draft09 => Ok(prio3_draft09_shard(prio3_config, measurement, nonce)?),
DapVersion::Latest => Ok(prio3_shard(prio3_config, measurement, nonce, *task_id)?),
},
Self::Prio2 { dimension } => Ok(prio2_shard(*dimension, measurement, nonce)?),
#[cfg(feature = "experimental")]
VdafConfig::Mastic {
Expand Down
10 changes: 6 additions & 4 deletions crates/daphne/src/protocol/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ impl VdafConfig {

let num_measurements = usize::try_from(report_count).unwrap();
match self {
Self::Prio3Draft09(prio3_config) => {
prio3_draft09_unshard(prio3_config, num_measurements, agg_shares)
}
Self::Prio3(prio3_config) => prio3_unshard(prio3_config, num_measurements, agg_shares),
Self::Prio3(prio3_config) => match version {
DapVersion::Draft09 => {
prio3_draft09_unshard(prio3_config, num_measurements, agg_shares)
}
DapVersion::Latest => prio3_unshard(prio3_config, num_measurements, agg_shares),
},
Self::Prio2 { dimension } => prio2_unshard(*dimension, num_measurements, agg_shares),
#[cfg(feature = "experimental")]
Self::Mastic {
Expand Down
11 changes: 5 additions & 6 deletions crates/daphne/src/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ mod test {
use std::iter::zip;

const TEST_VDAF: &VdafConfig = &VdafConfig::Prio3(Prio3Config::Count);
const TEST_VDAF_DRAFT09: &VdafConfig = &VdafConfig::Prio3Draft09(Prio3Config::Count);

fn roundtrip_report(version: DapVersion) {
let t = AggregationJobTest::new(TEST_VDAF, HpkeKemId::X25519HkdfSha256, version);
Expand Down Expand Up @@ -211,7 +210,7 @@ mod test {
#[test]
fn roundtrip_report_vdaf_draft09() {
let version = DapVersion::Draft09;
let t = AggregationJobTest::new(TEST_VDAF_DRAFT09, HpkeKemId::X25519HkdfSha256, version);
let t = AggregationJobTest::new(TEST_VDAF, HpkeKemId::X25519HkdfSha256, version);
let report = t
.task_config
.vdaf
Expand Down Expand Up @@ -714,7 +713,7 @@ mod test {
#[test]
fn finish_agg_job_vdaf_draft09() {
let version = DapVersion::Draft09;
let t = AggregationJobTest::new(TEST_VDAF_DRAFT09, HpkeKemId::X25519HkdfSha256, version);
let t = AggregationJobTest::new(TEST_VDAF, HpkeKemId::X25519HkdfSha256, version);
let reports = t.produce_reports(vec![
DapMeasurement::U64(1),
DapMeasurement::U64(1),
Expand Down Expand Up @@ -982,7 +981,7 @@ mod test {
let (invalid_public_share, mut invalid_input_shares) = self
.task_config
.vdaf
.produce_input_shares(measurement, &report_id.0, &self.task_id)
.produce_input_shares(measurement, &report_id.0, &self.task_id, version)
.unwrap();
invalid_input_shares[1][0] ^= 1; // The first bit is incorrect!
VdafConfig::produce_report_with_extensions_for_shares(
Expand All @@ -1008,7 +1007,7 @@ mod test {
let (mut invalid_public_share, invalid_input_shares) = self
.task_config
.vdaf
.produce_input_shares(measurement, &report_id.0, &self.task_id)
.produce_input_shares(measurement, &report_id.0, &self.task_id, version)
.unwrap();
invalid_public_share.push(1); // Add spurious byte at the end
VdafConfig::produce_report_with_extensions_for_shares(
Expand All @@ -1034,7 +1033,7 @@ mod test {
let (invalid_public_share, mut invalid_input_shares) = self
.task_config
.vdaf
.produce_input_shares(measurement, &report_id.0, &self.task_id)
.produce_input_shares(measurement, &report_id.0, &self.task_id, version)
.unwrap();
invalid_input_shares[0].push(1); // Add a spurious byte to the Leader's share
invalid_input_shares[1].push(1); // Add a spurious byte to the Helper's share
Expand Down
Loading
Loading