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

Add report_too_early to PrepareError #2538

Merged
merged 2 commits into from
Jan 24, 2024
Merged
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
54 changes: 53 additions & 1 deletion messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2335,6 +2335,7 @@ pub enum PrepareError {
BatchSaturated = 6,
TaskExpired = 7,
InvalidMessage = 8,
ReportTooEarly = 9,
}

impl Encode for PrepareError {
Expand Down Expand Up @@ -2933,7 +2934,7 @@ mod tests {
AggregationJobContinueReq, AggregationJobInitializeReq, AggregationJobResp,
AggregationJobStep, BatchId, BatchSelector, Collection, CollectionReq, Duration, Extension,
ExtensionType, FixedSize, FixedSizeQuery, HpkeAeadId, HpkeCiphertext, HpkeConfig,
HpkeConfigId, HpkeKdfId, HpkeKemId, HpkePublicKey, InputShareAad, Interval,
HpkeConfigId, HpkeConfigList, HpkeKdfId, HpkeKemId, HpkePublicKey, InputShareAad, Interval,
PartialBatchSelector, PlaintextInputShare, PrepareContinue, PrepareError, PrepareInit,
PrepareResp, PrepareStepResult, Query, Report, ReportId, ReportIdChecksum, ReportMetadata,
ReportShare, Role, TaskId, Time, TimeInterval, Url,
Expand Down Expand Up @@ -3351,6 +3352,53 @@ mod tests {
])
}

#[test]
fn roundtrip_hpke_config_list() {
roundtrip_encoding(&[(
HpkeConfigList::new(Vec::from([
HpkeConfig::new(
HpkeConfigId::from(12),
HpkeKemId::P256HkdfSha256,
HpkeKdfId::HkdfSha512,
HpkeAeadId::Aes256Gcm,
HpkePublicKey::from(Vec::new()),
),
HpkeConfig::new(
HpkeConfigId::from(12),
HpkeKemId::P256HkdfSha256,
HpkeKdfId::HkdfSha512,
HpkeAeadId::Other(0x9999),
HpkePublicKey::from(Vec::new()),
),
])),
concat!(
"0012",
concat!(
"0C", // id
"0010", // kem_id
"0003", // kdf_id
"0002", // aead_id
concat!(
// public_key
"0000", // length
"", // opaque data
)
),
concat!(
"0C", // id
"0010", // kem_id
"0003", // kdf_id
"9999", // aead_id
concat!(
// public_key
"0000", // length
"", // opaque data
)
),
),
)]);
}

#[test]
fn roundtrip_report_metadata() {
roundtrip_encoding(&[
Expand Down Expand Up @@ -4313,6 +4361,10 @@ mod tests {
(PrepareError::HpkeUnknownConfigId, "03"),
(PrepareError::HpkeDecryptError, "04"),
(PrepareError::VdafPrepError, "05"),
(PrepareError::BatchSaturated, "06"),
(PrepareError::TaskExpired, "07"),
(PrepareError::InvalidMessage, "08"),
(PrepareError::ReportTooEarly, "09"),
])
}

Expand Down
Loading