Skip to content

Commit d05f08d

Browse files
ramfox“ramfox”
andauthored
chore: upgrade experiments to using iroh 0.93, iroh-blobs 0.95, etc (#42)
* chore: upgrade content-discovery * chore: upgrade h3-iroh * chore: upgrade iroh-dag-sync * chore: upgrade iroh-pkarr-naming-system * chore: remove dead code --------- Co-authored-by: “ramfox” <“[email protected]”>
1 parent 9f78f23 commit d05f08d

File tree

18 files changed

+390
-447
lines changed

18 files changed

+390
-447
lines changed

content-discovery/Cargo.lock

Lines changed: 346 additions & 376 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

content-discovery/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ missing_debug_implementations = "warn"
2626
unused-async = "warn"
2727

2828
[workspace.dependencies]
29-
iroh = { version ="0.91", features = ["discovery-pkarr-dht"] }
30-
iroh-base = "0.91"
31-
iroh-blobs = { version = "0.93" }
29+
iroh = { version ="0.93", features = ["discovery-pkarr-dht"] }
30+
iroh-base = "0.93"
31+
iroh-blobs = { version = "0.95" }
3232
# explicitly specified until iroh minimal crates issues are solved, see https://github.com/n0-computer/iroh/pull/3255
3333
tokio = { version = "1.44.1" }
3434
tokio-stream = { version = "0.1.17" }

content-discovery/iroh-content-discovery-cli/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ async fn query(args: QueryArgs) -> anyhow::Result<()> {
8686
async fn create_client_endpoint() -> Result<endpoint::Endpoint, BindError> {
8787
let discovery = iroh::discovery::pkarr::dht::DhtDiscovery::builder()
8888
.dht(true)
89-
.n0_dns_pkarr_relay()
90-
.build()?;
89+
.n0_dns_pkarr_relay();
9190
endpoint::Endpoint::builder()
9291
.discovery(discovery)
9392
.bind()

content-discovery/iroh-content-discovery/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ tokio-stream = { workspace = true }
2828
n0-future = { workspace = true, optional = true }
2929
futures-buffered = { workspace = true, optional = true }
3030
snafu = "0.8.6"
31-
ed25519-dalek = "2.1.1"
31+
ed25519-dalek = "3.0.0-pre.1"
3232

3333
[features]
3434
client = [

content-discovery/iroh-content-tracker/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ humantime = "2.1.0"
2020
iroh = { workspace = true }
2121
iroh-blobs = { workspace = true }
2222
postcard = { workspace = true, features = ["alloc", "use-std"] }
23-
rand = "0.8"
23+
rand = "0.9.2"
2424
rcgen = "0.12.0"
2525
redb = "1.5.0"
2626
serde = { version = "1", features = ["derive"] }
@@ -37,7 +37,7 @@ iroh-content-discovery = { path = "../iroh-content-discovery", features = ["clie
3737

3838
clap = { version = "4", features = ["derive"], optional = true }
3939
serde-big-array = "0.5.1"
40-
ssh-key = { version = "0.6", features = ["ed25519"] }
40+
ssh-key = { version = "0.7.0-rc.3", features = ["ed25519"] }
4141

4242
[features]
4343
cli = ["clap"]

content-discovery/iroh-content-tracker/src/iroh_blobs_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ pub fn random_hash_seq_ranges(sizes: &[u64], mut rng: impl Rng) -> ChunkRangesSe
207207
.iter()
208208
.map(|size| ChunkNum::full_chunks(*size).0)
209209
.sum::<u64>();
210-
let random_chunk = rng.gen_range(0..total_chunks);
210+
let random_chunk = rng.random_range(0..total_chunks);
211211
let mut remaining = random_chunk;
212212
let mut ranges = vec![];
213213
ranges.push(ChunkRanges::empty());

content-discovery/iroh-content-tracker/src/main.rs

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ use std::{
44
net::{SocketAddrV4, SocketAddrV6},
55
path::PathBuf,
66
sync::atomic::{AtomicBool, Ordering},
7-
time::{Duration, Instant},
87
};
98

109
use clap::Parser;
11-
use iroh::{endpoint::BindError, Endpoint, Watcher};
10+
use iroh::{endpoint::BindError, Endpoint};
1211
use iroh_content_discovery::protocol::ALPN;
1312
use iroh_content_tracker::{
1413
io::{
@@ -43,22 +42,6 @@ macro_rules! log {
4342
};
4443
}
4544

46-
/// Wait until the endpoint has figured out it's own DERP region.
47-
async fn await_relay_region(endpoint: &Endpoint) -> anyhow::Result<()> {
48-
let t0 = Instant::now();
49-
loop {
50-
let addr = endpoint.node_addr().initialized().await;
51-
if addr.relay_url().is_some() {
52-
break;
53-
}
54-
if t0.elapsed() > Duration::from_secs(10) {
55-
anyhow::bail!("timeout waiting for DERP region");
56-
}
57-
tokio::time::sleep(Duration::from_millis(50)).await;
58-
}
59-
Ok(())
60-
}
61-
6245
async fn create_endpoint(
6346
key: iroh::SecretKey,
6447
ipv4_addr: Option<SocketAddrV4>,
@@ -112,8 +95,8 @@ async fn server(args: Args) -> anyhow::Result<()> {
11295
create_endpoint(key.clone(), options.ipv4_bind_addr, options.ipv6_bind_addr).await?;
11396
let db = Tracker::new(options, endpoint.clone())?;
11497
db.dump().await?;
115-
await_relay_region(&endpoint).await?;
116-
let addr = endpoint.node_addr().initialized().await;
98+
endpoint.online().await;
99+
let addr = endpoint.node_addr();
117100
println!("tracker addr: {}\n", addr.node_id);
118101
info!("listening on {:?}", addr);
119102
// let db2 = db.clone();
@@ -169,7 +152,7 @@ pub async fn load_secret_key(key_path: PathBuf) -> anyhow::Result<iroh::SecretKe
169152
let secret_key = SecretKey::from_bytes(&kp.private.to_bytes());
170153
Ok(secret_key)
171154
} else {
172-
let secret_key = SecretKey::generate(rand::rngs::OsRng);
155+
let secret_key = SecretKey::generate(&mut rand::rng());
173156
let ckey = ssh_key::private::Ed25519Keypair {
174157
public: secret_key.public().public().into(),
175158
private: secret_key.secret().into(),

content-discovery/iroh-content-tracker/src/tracker.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ impl Tracker {
10271027
) -> anyhow::Result<Stats> {
10281028
let cap = format!("{content} at {host}");
10291029
let HashAndFormat { hash, format } = content;
1030-
let mut rng = rand::thread_rng();
1030+
let mut rng = rand::rng();
10311031
let stats = if probe_kind == ProbeKind::Incomplete {
10321032
tracing::debug!("Size probing {}...", cap);
10331033
let (size, stats) = unverified_size(connection, hash).await?;
@@ -1042,7 +1042,7 @@ impl Tracker {
10421042
match format {
10431043
BlobFormat::Raw => {
10441044
let size = self.get_or_insert_size(connection, hash).await?;
1045-
let random_chunk = rng.gen_range(0..ChunkNum::chunks(size).0);
1045+
let random_chunk = rng.random_range(0..ChunkNum::chunks(size).0);
10461046
tracing::debug!("Chunk probing {}, chunk {}", cap, random_chunk);
10471047
let stats = chunk_probe(connection, hash, ChunkNum(random_chunk)).await?;
10481048
tracing::debug!(
@@ -1055,7 +1055,7 @@ impl Tracker {
10551055
}
10561056
BlobFormat::HashSeq => {
10571057
let (hs, sizes) = self.get_or_insert_sizes(connection, hash).await?;
1058-
let ranges = random_hash_seq_ranges(&sizes, rand::thread_rng());
1058+
let ranges = random_hash_seq_ranges(&sizes, rand::rng());
10591059
let text = ranges
10601060
.iter_non_empty_infinite()
10611061
.map(|(index, ranges)| format!("child={index}, ranges={ranges:?}"))

content-discovery/iroh-content-tracker/tests/smoke.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async fn smoke_test() -> anyhow::Result<()> {
2626
let accept_task = tokio::spawn(tracker.clone().accept_loop(tracker_ep.clone()));
2727
let tracker_id = tracker_ep.node_id();
2828
let store = MemStore::new();
29-
let blobs = BlobsProtocol::new(&store, provider_ep.clone(), None);
29+
let blobs = BlobsProtocol::new(&store, None);
3030
let provider_router = RouterBuilder::new(provider_ep.clone())
3131
.accept(iroh_blobs::ALPN, blobs.clone())
3232
.spawn();

h3-iroh/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ http-body = { version = "1", optional = true }
1515
http-body-util = { version = "0.1", optional = true }
1616
hyper = { version = "1.5", optional = true }
1717
hyper-util = { version = "0.1", optional = true }
18-
iroh = "0.91"
19-
iroh-base = { version = "0.91", features = ["ticket"] }
18+
iroh = "0.93"
19+
iroh-base = { version = "0.93", features = ["ticket"] }
2020
tokio = { version = "1", features = ["io-util"], default-features = false}
2121
tokio-util = "0.7"
2222
tower = { version = "0.5", optional = true }

0 commit comments

Comments
 (0)