From 464234be20dd360ce4dccfeec11386101f0979dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Mon, 15 Sep 2025 09:47:44 -0300 Subject: [PATCH 1/2] refactor: use standard IPFS gateway URLs instead of Kubo RPC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Migone --- availability-oracle/src/ipfs.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/availability-oracle/src/ipfs.rs b/availability-oracle/src/ipfs.rs index 508b32c..a21b21d 100644 --- a/availability-oracle/src/ipfs.rs +++ b/availability-oracle/src/ipfs.rs @@ -48,15 +48,14 @@ impl IpfsImpl { } } - async fn call(&self, route: &'static str, arg: Cid) -> Result { + async fn call(&self, cid: Cid) -> Result { let _permit = self.semaphore.acquire().await; - // URL security: We control the endpoint and the route, the `arg` is a CID. + // Using standard IPFS gateway URL format let url = format!( - "{}/api/v0/{}?arg={}", + "{}/ipfs/{}", self.endpoint.trim_end_matches('/'), - route, - arg + cid ); self.client .get(&url) @@ -67,10 +66,10 @@ impl IpfsImpl { .and_then(|x| x) .map_err(|e| match e.status().map(|e| e.as_u16()) { Some(GATEWAY_TIMEOUT) | Some(CLOUDFLARE_TIMEOUT) => { - IpfsError::GatewayTimeout(arg, e.into()) + IpfsError::GatewayTimeout(cid, e.into()) } - _ if e.is_timeout() => IpfsError::ClientTimeout(arg, e.into()), - Some(NOT_FOUND) => IpfsError::NotFound(arg, e.into()), + _ if e.is_timeout() => IpfsError::ClientTimeout(cid, e.into()), + Some(NOT_FOUND) => IpfsError::NotFound(cid, e.into()), _ => IpfsError::Other(e.into()), }) } @@ -97,7 +96,7 @@ impl Ipfs for IpfsImpl { ) -> Result { let mut last_err = None; for _ in 0..=retries { - match ipfs.call("cat", cid).await { + match ipfs.call(cid).await { Ok(res) => return Ok(res), Err(e) => { last_err = Some(e); From 40b7ac138168d88a96d3bf42529d4ae872949969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Mon, 15 Sep 2025 09:57:20 -0300 Subject: [PATCH 2/2] ci: contribute to cargo format happiness MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Migone --- availability-oracle/src/ipfs.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/availability-oracle/src/ipfs.rs b/availability-oracle/src/ipfs.rs index a21b21d..ee17ec4 100644 --- a/availability-oracle/src/ipfs.rs +++ b/availability-oracle/src/ipfs.rs @@ -52,11 +52,7 @@ impl IpfsImpl { let _permit = self.semaphore.acquire().await; // Using standard IPFS gateway URL format - let url = format!( - "{}/ipfs/{}", - self.endpoint.trim_end_matches('/'), - cid - ); + let url = format!("{}/ipfs/{}", self.endpoint.trim_end_matches('/'), cid); self.client .get(&url) .timeout(self.timeout)