Skip to content
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
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/dips/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ async-trait.workspace = true
uuid.workspace = true
tokio.workspace = true
indexer-monitor = { path = "../monitor" }
tracing.workspace = true

bytes = { version = "1.10.0", optional = true }
derivative = "2.2.0"
Expand Down
14 changes: 10 additions & 4 deletions crates/dips/src/ipfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use futures::TryStreamExt;
use http::Uri;
use ipfs_api_prelude::{IpfsApi, TryFromUri};
use serde::Deserialize;
use tracing;

use crate::DipsError;

Expand Down Expand Up @@ -50,10 +51,15 @@ impl IpfsFetcher for IpfsClient {
.map_ok(|chunk| chunk.to_vec())
.try_concat()
.await
.unwrap();

let manifest: GraphManifest = serde_yaml::from_slice(&content)
.map_err(|_| DipsError::InvalidSubgraphManifest(file.to_string()))?;
.map_err(|e| {
tracing::warn!("Failed to fetch subgraph manifest {}: {}", file, e);
DipsError::SubgraphManifestUnavailable(format!("{}: {}", file, e))
})?;

let manifest: GraphManifest = serde_yaml::from_slice(&content).map_err(|e| {
tracing::warn!("Failed to parse subgraph manifest {}: {}", file, e);
DipsError::InvalidSubgraphManifest(format!("{}: {}", file, e))
})?;

Ok(manifest)
}
Expand Down
2 changes: 2 additions & 0 deletions crates/dips/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ pub enum DipsError {
PayerNotAuthorised(Address),
#[error("voucher payee {actual} does not match the expected address {expected}")]
UnexpectedPayee { expected: Address, actual: Address },
#[error("cannot get subgraph manifest for {0}")]
SubgraphManifestUnavailable(String),
#[error("invalid subgraph id {0}")]
InvalidSubgraphManifest(String),
#[error("voucher for chain id {0}, subgraph manifest has network {1}")]
Expand Down
Loading