Migrate to iroh 1.0 and iroh-blobs 0.103

The 0.35 pin's rationale ("the post-0.35 rewrite is not yet production
quality") expired when iroh hit 1.0 in June 2026: the rewrite line
(0.103) is now the production line and the only one receiving fixes.

The rewrite replaced wrappable store traits with an irpc-based API, so
the seams moved:

- shaped.rs: the 440-line ShapedStore trait wrapper becomes a provider
  event handler. Trust gating (untrusted peers see only openly-served
  hashes) now intercepts requests before any bytes move; upload rate
  limiting rides the provider's Throttle hook; upload progress events
  come from per-request update streams. The TokenBucket is unchanged.
- store.rs: FsStore's API handle replaces the store traits, and the
  LocalPool machinery for non-Send futures is gone. GC is now the
  store's built-in periodic mark-and-sweep, fed by a pin-roots snapshot
  via the protect callback (new config knob gc_interval_secs, default
  300); the on-demand Gc request answers Unimplemented, and the gc
  conformance test polls the sweep instead.
- transfer.rs: BlobsProtocol + Router replace handle_connection, the
  new multi-provider Downloader replaces the old queue, and mdns
  discovery moved to the iroh-mdns-address-lookup crate (it left iroh
  core in 1.0). Ticket-embedded provider addresses feed a MemoryLookup
  address book. Endpoint presets: Minimal (LAN-only default) or N0
  (wan_upload), preserving the old relay posture.
- Node* became Endpoint* throughout; announcement signatures use iroh's
  own Signature type (ed25519-dalek dep dropped); iroh-io dropped.

Known regression: max_download_bytes_per_sec is currently not enforced
— download shaping rode the old store's batch writer and 0.103's
downloader has no equivalent seam yet.

Announcement wire format note: EndpointAddr serializes differently than
NodeAddr, so pre- and post-migration daemons won't parse each other's
LAN announcements. Announcements are live-only, nothing stored breaks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-16 14:03:15 +02:00
parent a2d150225a
commit ad69f7d884
14 changed files with 1807 additions and 2248 deletions
+2 -7
View File
@@ -83,13 +83,8 @@ fn wait_complete(socket: &Path, hash: &str, timeout: Duration) -> bool {
fn forge_ticket(real_ticket: &str, target_hash: &str) -> String {
let ticket = iroh_blobs::ticket::BlobTicket::from_str(real_ticket).unwrap();
let hash = iroh_blobs::Hash::from_str(target_hash).unwrap();
iroh_blobs::ticket::BlobTicket::new(
ticket.node_addr().clone(),
hash,
iroh_blobs::BlobFormat::Raw,
)
.unwrap()
.to_string()
iroh_blobs::ticket::BlobTicket::new(ticket.addr().clone(), hash, iroh_blobs::BlobFormat::Raw)
.to_string()
}
#[test]
+44 -16
View File
@@ -122,7 +122,11 @@ fn materialize_unknown_hash_is_not_found() {
#[test]
fn gc_drops_unpinned_and_keeps_pinned() {
let daemon = support::spawn_daemon();
// Since iroh-blobs 0.103 gc is a periodic loop inside the store, not
// an on-demand request; run it fast so the sweep happens in-test.
let daemon_dir = tempfile::tempdir().unwrap();
let daemon =
support::spawn_daemon_with_env(daemon_dir.path(), &[("VARDE_GC_INTERVAL", "1")]);
let mut client = support::Client::connect(&daemon.socket);
let dir = tempfile::tempdir().unwrap();
@@ -143,11 +147,27 @@ fn gc_drops_unpinned_and_keeps_pinned() {
});
assert!(reply.ok, "pin failed: {:?}", reply.error);
// The on-demand request reports the new reality honestly.
let reply = client.request(&Request::Gc {});
assert!(reply.ok, "gc failed: {:?}", reply.error);
match reply.data {
Some(ResponseData::GcDone { blobs_removed }) => assert!(blobs_removed >= 1),
other => panic!("unexpected gc reply: {other:?}"),
assert!(!reply.ok, "on-demand gc should be unimplemented");
// Wait for the periodic sweep to collect the loose blob.
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(20);
loop {
let err = materialize(
&mut client,
&doomed,
&dir.path().join("probe"),
MaterializeMode::Copy,
);
if err.is_err() {
break;
}
assert!(
std::time::Instant::now() < deadline,
"unpinned blob survived gc for 20s"
);
std::thread::sleep(std::time::Duration::from_millis(500));
}
// Pinned tree still materializes; loose blob is gone.
@@ -167,21 +187,29 @@ fn gc_drops_unpinned_and_keeps_pinned() {
.unwrap_err();
assert_eq!(err, ErrorCode::NotFound);
// Unpinning and collecting again drops the tree too.
// Unpinning lets the next sweep drop the tree too.
let reply = client.request(&Request::Unpin {
hash: kept_root.clone(),
});
assert!(reply.ok);
let reply = client.request(&Request::Gc {});
assert!(reply.ok);
let err = materialize(
&mut client,
&kept_root,
&dir.path().join("out3"),
MaterializeMode::Copy,
)
.unwrap_err();
assert_eq!(err, ErrorCode::NotFound);
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(20);
loop {
let err = materialize(
&mut client,
&kept_root,
&dir.path().join("out3"),
MaterializeMode::Copy,
);
if let Err(code) = err {
assert_eq!(code, ErrorCode::NotFound);
break;
}
assert!(
std::time::Instant::now() < deadline,
"unpinned tree survived gc for 20s"
);
std::thread::sleep(std::time::Duration::from_millis(500));
}
}
#[test]