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

Upgrade prio to 0.16.0 #473

Merged
merged 1 commit into from
Jan 16, 2024
Merged
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
139 changes: 137 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ hpke-rs-rust-crypto = "0.2.0"
http = "0.2"
matchit = "0.7.3"
paste = "1.0.14"
prio = { git = "https://github.com/divviup/libprio-rs", rev = "d0168336bbad1805231a69181b329e37ee962203" }
prio = "0.16.0"
prometheus = "0.13.3"
rand = "0.8.5"
rand_core = "0.6.4"
Expand Down
2 changes: 1 addition & 1 deletion daphne/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ hex.workspace = true
hpke-rs = { workspace = true, features = ["hazmat", "serialization"] }
hpke-rs-crypto.workspace = true
hpke-rs-rust-crypto.workspace = true
prio = { workspace = true, features = ["prio2"] }
prio = { workspace = true, features = ["experimental"] }
prometheus.workspace = true
rand.workspace = true
replace_with.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions daphne/dapf/src/bin/dapf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ async fn main() -> Result<()> {
);
let resp = http_client
.post(Url::parse(leader_url)?.join("upload")?)
.body(report.get_encoded_with_param(&version))
.body(report.get_encoded_with_param(&version)?)
.headers(headers)
.send()
.await?;
Expand Down Expand Up @@ -217,7 +217,7 @@ async fn main() -> Result<()> {

let resp = http_client
.post(Url::parse(leader_url)?.join("collect")?)
.body(collect_req.get_encoded_with_param(&version))
.body(collect_req.get_encoded_with_param(&version)?)
.headers(headers)
.send()
.await?;
Expand Down
12 changes: 10 additions & 2 deletions daphne/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::fmt::{Debug, Display};

use crate::{messages::TransitionFailure, vdaf::VdafError};
pub use aborts::DapAbort;
use prio::codec::CodecError;

use self::aborts::ProblemDetails;

Expand Down Expand Up @@ -45,6 +46,13 @@ impl DapError {
detail: None,
}
}

/// Construct a fatal encoding error.
pub fn encoding(e: CodecError) -> DapError {
DapError::Fatal(FatalDapError(format!(
"encountered fatal error during encoding: {e}"
)))
}
}

impl FatalDapError {
Expand All @@ -57,15 +65,15 @@ impl FatalDapError {
impl From<VdafError> for DapError {
fn from(e: VdafError) -> Self {
match e {
VdafError::Codec(..) | VdafError::Vdaf(..) => {
VdafError::Codec(..) | VdafError::Vdaf(..) | VdafError::Uncategorized(..) => {
Self::Transition(TransitionFailure::VdafPrepError)
}
}
}
}

#[derive(PartialEq, Eq)]
pub struct FatalDapError(String);
pub struct FatalDapError(pub(crate) String);

impl std::error::Error for FatalDapError {}

Expand Down
7 changes: 4 additions & 3 deletions daphne/src/hpke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,10 @@ impl HpkeDecrypter for HpkeReceiverConfig {
}

impl Encode for HpkeReceiverConfig {
fn encode(&self, bytes: &mut Vec<u8>) {
self.config.encode(bytes);
encode_u16_bytes(bytes, self.private_key.as_slice());
fn encode(&self, bytes: &mut Vec<u8>) -> Result<(), CodecError> {
self.config.encode(bytes)?;
encode_u16_bytes(bytes, self.private_key.as_slice())?;
Ok(())
}
}

Expand Down
Loading
Loading