Skip to content

Commit

Permalink
Update subspace-gateway dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
shamil-gadelshin committed Dec 6, 2024
1 parent 135f043 commit 3f810b9
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 134 deletions.
169 changes: 44 additions & 125 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions crates/subspace-gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include = [
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
actix-web = "4"
actix-web = { version = "4", features = ["rustls"], default-features = false }
async-lock = "3.4.0"
anyhow = "1.0.89"
async-trait = "0.1.83"
Expand All @@ -30,7 +30,7 @@ futures = "0.3.31"
hex = "0.4.3"
jsonrpsee = { version = "0.24.5", features = ["server"] }
mimalloc = "0.1.43"
reqwest = { version = "0.12.9", features = ["json"] }
reqwest = { version = "0.12.9", features = ["json", "rustls-tls"], default-features = false }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
subspace-core-primitives = { version = "0.1.0", path = "../subspace-core-primitives" }
Expand Down
11 changes: 4 additions & 7 deletions crates/subspace-gateway/src/commands/http/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ where
#[derive(Serialize, Deserialize, Debug, Default)]
#[serde(rename_all = "camelCase")]
struct ObjectMapping {
hash: String,
hash: Blake3Hash,
piece_index: PieceIndex,
piece_offset: u32,
#[serde(deserialize_with = "string_to_u32")]
Expand Down Expand Up @@ -79,7 +79,7 @@ where
return HttpResponse::BadRequest().finish();
}

hash
Blake3Hash::try_from(hash.as_slice()).expect("Hash size was confirmed.")
}
Err(err) => {
error!(?key, ?err, "Invalid hash provided.");
Expand All @@ -93,7 +93,7 @@ where
return HttpResponse::BadRequest().finish();
};

if object_mapping.hash != key {
if object_mapping.hash != object_hash {
error!(
?key,
object_mapping_hash=?object_mapping.hash,
Expand All @@ -111,10 +111,7 @@ where
Ok(object) => {
trace!(?key, size=%object.len(), "Object fetched successfully");

let data_hash = {
let data_hash = blake3_hash(&object);
<Blake3Hash as AsRef<[u8]>>::as_ref(&data_hash).to_vec()
};
let data_hash = blake3_hash(&object);
if data_hash != object_hash {
error!(
?data_hash,
Expand Down

0 comments on commit 3f810b9

Please sign in to comment.