Skip to content

Commit

Permalink
Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
akoshelev committed Mar 28, 2024
1 parent facf706 commit 02ee736
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ipa-core/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl HelperApp {
.query_processor
.complete(query_id)
.await?
.as_bytes())
.to_bytes())
}
}

Expand Down
2 changes: 1 addition & 1 deletion ipa-core/src/helpers/transport/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl From<QueryStatus> for HelperResponse {

impl<R: AsRef<dyn ProtocolResult>> From<R> for HelperResponse {
fn from(value: R) -> Self {
let v = value.as_ref().as_bytes();
let v = value.as_ref().to_bytes();
Self { body: v }
}
}
Expand Down
2 changes: 1 addition & 1 deletion ipa-core/src/net/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ pub(crate) mod tests {
results.to_vec(),
[Replicated::from((expected_results[0], expected_results[1]))]
.to_vec()
.as_bytes()
.to_bytes()
);
}
}
4 changes: 2 additions & 2 deletions ipa-core/src/net/server/handlers/query/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use axum::{routing::post, Extension, Json, Router};
use hyper::StatusCode;

use crate::{
helpers::{ApiError::NewQuery, BodyStream, Transport},
helpers::{ApiError, BodyStream, Transport},
net::{http_serde, Error, HttpTransport},
query::NewQueryError,
sync::Arc,
Expand All @@ -20,7 +20,7 @@ async fn handler(
.await
{
Ok(resp) => Ok(Json(resp.try_into()?)),
Err(err @ NewQuery(NewQueryError::State { .. })) => {
Err(err @ ApiError::NewQuery(NewQueryError::State { .. })) => {

Check warning on line 23 in ipa-core/src/net/server/handlers/query/create.rs

View check run for this annotation

Codecov / codecov/patch

ipa-core/src/net/server/handlers/query/create.rs#L23

Added line #L23 was not covered by tests
Err(Error::application(StatusCode::CONFLICT, err))
}
Err(err) => Err(Error::application(StatusCode::INTERNAL_SERVER_ERROR, err)),
Expand Down
2 changes: 1 addition & 1 deletion ipa-core/src/net/server/handlers/query/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ mod tests {
let results = handler(Extension(test_server.transport), req.clone())
.await
.unwrap();
assert_eq!(results, expected_results.as_bytes());
assert_eq!(results, expected_results.to_bytes());
}

struct OverrideReq {
Expand Down
6 changes: 3 additions & 3 deletions ipa-core/src/query/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ use crate::{
};

pub trait Result: Send + Debug {
fn as_bytes(&self) -> Vec<u8>;
fn to_bytes(&self) -> Vec<u8>;
}

impl<T> Result for Vec<T>
where
T: Serializable,
Vec<T>: Debug + Send,
{
fn as_bytes(&self) -> Vec<u8> {
fn to_bytes(&self) -> Vec<u8> {
let mut r = vec![0u8; self.len() * T::Size::USIZE];
for (i, row) in self.iter().enumerate() {
row.serialize(GenericArray::from_mut_slice(
Expand Down Expand Up @@ -156,7 +156,7 @@ mod tests {
fn serialize_result() {
let [input, ..] = (0u128..=3).map(Fp31::truncate_from).share();
let expected = input.clone();
let bytes = &input.as_bytes();
let bytes = &input.to_bytes();
assert_eq!(
expected,
AdditiveShare::<Fp31>::from_byte_slice(bytes)
Expand Down

0 comments on commit 02ee736

Please sign in to comment.