diff --git a/Cargo.lock b/Cargo.lock index 75f92ef5..f3450caa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13865,7 +13865,6 @@ dependencies = [ name = "polka-storage-provider-client" version = "0.1.0" dependencies = [ - "anyhow", "async-trait", "bls12_381", "cid 0.11.1", diff --git a/storage-provider/client/Cargo.toml b/storage-provider/client/Cargo.toml index 91fc1032..9de5a66b 100644 --- a/storage-provider/client/Cargo.toml +++ b/storage-provider/client/Cargo.toml @@ -35,7 +35,6 @@ tracing-subscriber = { workspace = true, features = ["env-filter"] } url = { workspace = true } [dev-dependencies] -anyhow.workspace = true libp2p = { workspace = true, features = ["identify", "macros", "noise", "rendezvous", "tcp", "tokio", "yamux"] } [lints] diff --git a/storage-provider/client/examples/peer-resolver.rs b/storage-provider/client/examples/peer-resolver.rs index 27c70d46..8e2f77b9 100644 --- a/storage-provider/client/examples/peer-resolver.rs +++ b/storage-provider/client/examples/peer-resolver.rs @@ -9,9 +9,8 @@ //! ID, the example will return an error. //! NOTE: This example is to be removed and implemented into the //! client at some point. -use std::time::Duration; +use std::{time::Duration, error::Error}; -use anyhow::{bail, Result}; use clap::Parser; use libp2p::{ futures::StreamExt, @@ -43,7 +42,7 @@ struct Cli { rendezvous_point: PeerId, } -fn create_swarm() -> Result> { +fn create_swarm() -> Result, Box> { Ok(SwarmBuilder::with_new_identity() .with_tokio() .with_tcp( @@ -61,7 +60,7 @@ async fn discover( peer_id_to_find: PeerId, rendezvous_point_address: Multiaddr, rendezvous_point: PeerId, -) -> Result { +) -> Result> { // Dial in to the rendezvous point. swarm.dial(rendezvous_point_address)?; @@ -94,7 +93,7 @@ async fn discover( }); } } - bail!("No registered multi-addresses found for Peer ID {peer_id_to_find}"); + return Err(format!("No registered multi-addresses found for Peer ID {peer_id_to_find}").into()); } other => tracing::debug!("Other event: {other:?}"), @@ -103,7 +102,7 @@ async fn discover( } #[tokio::main] -async fn main() -> Result<()> { +async fn main() -> Result<(), Box> { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) .try_init();