From 8486c0ca1fe719d03c12996cf25ed555649585df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cramfox=E2=80=9D?= <“kasey@n0.computer”> Date: Tue, 4 Feb 2025 16:07:39 -0500 Subject: [PATCH] chore: upgrade to `iroh`, `iroh-gossip`, and `iroh-blobs` v0.32.0 --- Cargo.lock | 353 ++++++++++++++++++++++++++++++----------------- Cargo.toml | 15 +- src/net.rs | 4 +- src/net/codec.rs | 9 +- src/ticket.rs | 32 ++++- tests/client.rs | 10 +- tests/sync.rs | 33 ++--- tests/util.rs | 7 +- 8 files changed, 291 insertions(+), 172 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bcc7933..1ff668a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -649,6 +649,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -962,12 +972,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" -[[package]] -name = "dyn-clone" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" - [[package]] name = "ecdsa" version = "0.16.9" @@ -2003,12 +2007,13 @@ checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "iroh" -version = "0.31.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27ee97c8412bbf06d7c5253c6638a8bac741cb44d405669cedbfd7d47cd68090" +checksum = "ac3a813bde213da0740a28141ea97be251bd8df27f00d9d0938a3d55c0c6e5cb" dependencies = [ "aead", "anyhow", + "atomic-waker", "axum", "backoff", "bytes", @@ -2018,9 +2023,6 @@ dependencies = [ "der", "derive_more", "ed25519-dalek", - "futures-buffered", - "futures-lite 2.6.0", - "futures-sink", "futures-util", "governor", "hickory-resolver", @@ -2036,6 +2038,7 @@ dependencies = [ "iroh-quinn-proto", "iroh-quinn-udp", "iroh-relay", + "n0-future", "netdev", "netwatch", "pin-project", @@ -2055,8 +2058,6 @@ dependencies = [ "tokio", "tokio-rustls", "tokio-stream", - "tokio-tungstenite", - "tokio-tungstenite-wasm", "tokio-util", "tracing", "url", @@ -2067,9 +2068,9 @@ dependencies = [ [[package]] name = "iroh-base" -version = "0.31.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0546d176f79fb63a5efeb8eb8c692c483920e35bd9ba66c028928cf2ca27239b" +checksum = "d56b4a9e4db1e505710d0aaca2afc17dd92aeac2dd06a34ccf9934dab7240bc9" dependencies = [ "curve25519-dalek", "data-encoding", @@ -2099,8 +2100,7 @@ dependencies = [ [[package]] name = "iroh-blobs" version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78917ffda5c440e23f1dc5680cb506cbdb2bd9f919fee0720a792e26321dff0" +source = "git+https://github.com/n0-computer/iroh-blobs.git?branch=iroh-0-32-0#7842e24107ff222b19ee6a9523860481c1098ee9" dependencies = [ "anyhow", "async-channel", @@ -2127,8 +2127,8 @@ dependencies = [ "parking_lot", "portable-atomic", "postcard", - "quic-rpc", - "quic-rpc-derive", + "quic-rpc 0.18.1", + "quic-rpc-derive 0.17.3", "rand", "range-collections", "redb 2.4.0", @@ -2145,6 +2145,7 @@ dependencies = [ "tokio-util", "tracing", "tracing-futures", + "tracing-test", "walkdir", ] @@ -2174,15 +2175,14 @@ dependencies = [ "iroh-gossip", "iroh-io", "iroh-metrics", - "iroh-test", "nested_enum_utils", "num_enum", "parking_lot", "portable-atomic", "postcard", "proptest", - "quic-rpc", - "quic-rpc-derive", + "quic-rpc 0.18.1", + "quic-rpc-derive 0.18.1", "rand", "rand_chacha", "rand_core", @@ -2203,13 +2203,14 @@ dependencies = [ "tokio-util", "tracing", "tracing-subscriber", + "tracing-test", ] [[package]] name = "iroh-gossip" -version = "0.31.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e8c9abdd79f8cf4a77173c59c112b0695febc5dea7b16d785beecc208561590" +checksum = "e3ea3b0c1ba4868fa65039839881b33826cd0546177fd55c77e9058fb13890c9" dependencies = [ "anyhow", "async-channel", @@ -2229,9 +2230,11 @@ dependencies = [ "rand_core", "serde", "serde-error", + "thiserror 2.0.11", "tokio", "tokio-util", "tracing", + "tracing-test", ] [[package]] @@ -2268,20 +2271,19 @@ dependencies = [ [[package]] name = "iroh-net-report" -version = "0.31.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "547eacca10cd072412b04d784336e29c5e81e7ba4fbb9c1ad70777f7874a5d1a" +checksum = "6043244fda74da51f46c6199ff7f7e1c350d58b650e39983ae24ca4cfd46f4be" dependencies = [ "anyhow", "bytes", "derive_more", - "futures-buffered", - "futures-lite 2.6.0", "hickory-resolver", "iroh-base", "iroh-metrics", "iroh-quinn", "iroh-relay", + "n0-future", "netwatch", "portmapper", "rand", @@ -2297,46 +2299,52 @@ dependencies = [ [[package]] name = "iroh-quinn" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ba75a5c57cff299d2d7ca1ddee053f66339d1756bd79ec637bcad5aa61100e" +checksum = "76c6245c9ed906506ab9185e8d7f64857129aee4f935e899f398a3bd3b70338d" dependencies = [ "bytes", + "cfg_aliases", "iroh-quinn-proto", "iroh-quinn-udp", "pin-project-lite", "rustc-hash", "rustls", "socket2", - "thiserror 1.0.69", + "thiserror 2.0.11", "tokio", "tracing", + "web-time", ] [[package]] name = "iroh-quinn-proto" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2c869ba52683d3d067c83ab4c00a2fda18eaf13b1434d4c1352f428674d4a5d" +checksum = "929d5d8fa77d5c304d3ee7cae9aede31f13908bd049f9de8c7c0094ad6f7c535" dependencies = [ "bytes", + "getrandom", "rand", "ring", "rustc-hash", "rustls", + "rustls-pki-types", "rustls-platform-verifier", "slab", - "thiserror 1.0.69", + "thiserror 2.0.11", "tinyvec", "tracing", + "web-time", ] [[package]] name = "iroh-quinn-udp" -version = "0.5.5" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfcfc0abc2fdf8cf18a6c72893b7cbebeac2274a3b1306c1760c48c0e10ac5e0" +checksum = "c53afaa1049f7c83ea1331f5ebb9e6ebc5fdd69c468b7a22dd598b02c9bcc973" dependencies = [ + "cfg_aliases", "libc", "once_cell", "socket2", @@ -2346,20 +2354,17 @@ dependencies = [ [[package]] name = "iroh-relay" -version = "0.31.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e4c13758cac9d81a6793b59eba17da2ccbf90a76278ec160d7c8f90b1bb903" +checksum = "b0700bfc2dcd5d6b28a9176dddbc989a6c90b06fc49e9e60069213408450ab47" dependencies = [ "anyhow", "bytes", + "cfg_aliases", "clap", "dashmap", "data-encoding", "derive_more", - "futures-buffered", - "futures-lite 2.6.0", - "futures-sink", - "futures-util", "governor", "hickory-proto", "hickory-resolver", @@ -2372,6 +2377,7 @@ dependencies = [ "iroh-quinn", "iroh-quinn-proto", "lru", + "n0-future", "num_enum", "pin-project", "postcard", @@ -2388,7 +2394,6 @@ dependencies = [ "serde", "stun-rs", "thiserror 2.0.11", - "time", "tokio", "tokio-rustls", "tokio-rustls-acme", @@ -2402,18 +2407,6 @@ dependencies = [ "webpki-roots", ] -[[package]] -name = "iroh-test" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aca0e7c59e447ab8ced8cd4841d95fe13ed44dce203c6ece1a963cf1be2aed25" -dependencies = [ - "anyhow", - "tokio", - "tracing", - "tracing-subscriber", -] - [[package]] name = "is_terminal_polyfill" version = "1.70.1" @@ -2428,16 +2421,18 @@ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "jni" -version = "0.19.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" dependencies = [ "cesu8", + "cfg-if", "combine", "jni-sys", "log", "thiserror 1.0.69", "walkdir", + "windows-sys 0.45.0", ] [[package]] @@ -2556,26 +2551,6 @@ dependencies = [ "hashbrown 0.15.2", ] -[[package]] -name = "mainline" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b751ffb57303217bcae8f490eee6044a5b40eadf6ca05ff476cad37e7b7970d" -dependencies = [ - "bytes", - "crc", - "ed25519-dalek", - "flume", - "lru", - "rand", - "serde", - "serde_bencode", - "serde_bytes", - "sha1_smol", - "thiserror 1.0.69", - "tracing", -] - [[package]] name = "match_cfg" version = "0.1.0" @@ -2660,6 +2635,27 @@ dependencies = [ "uuid", ] +[[package]] +name = "n0-future" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "399e11dc3b0e8d9d65b27170d22f5d779d52d9bed888db70d7e0c2c7ce3dfc52" +dependencies = [ + "cfg_aliases", + "derive_more", + "futures-buffered", + "futures-lite 2.6.0", + "futures-util", + "js-sys", + "pin-project", + "send_wrapper", + "tokio", + "tokio-util", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-time", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -3216,13 +3212,11 @@ checksum = "92eff194c72f00f3076855b413ad2d940e3a6e307fa697e5c7733e738341aed4" dependencies = [ "bytes", "document-features", - "dyn-clone", "ed25519-dalek", "flume", "futures", "js-sys", "lru", - "mainline", "self_cell", "simple-dns", "thiserror 2.0.11", @@ -3565,6 +3559,28 @@ dependencies = [ "tracing", ] +[[package]] +name = "quic-rpc" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09b61cd874b52a79146069fc15456f5cf7abafea818e2fdd828598456349d6a4" +dependencies = [ + "anyhow", + "document-features", + "flume", + "futures-lite 2.6.0", + "futures-sink", + "futures-util", + "pin-project", + "serde", + "slab", + "smallvec", + "time", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "quic-rpc-derive" version = "0.17.3" @@ -3572,7 +3588,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a32e88a525c7616b2bfce4be94a875eeac46bf20faea5e580cb54dc739e64e5" dependencies = [ "proc-macro2", - "quic-rpc", + "quic-rpc 0.17.3", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "quic-rpc-derive" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d94974ee26d4e97acfab1fd55df2a1ca676af24021a08354ed1c42b70a39e914" +dependencies = [ + "proc-macro2", + "quic-rpc 0.18.1", "quote", "syn 1.0.109", ] @@ -4093,12 +4121,11 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" dependencies = [ "openssl-probe", - "rustls-pemfile", "rustls-pki-types", "schannel", "security-framework", @@ -4124,11 +4151,11 @@ dependencies = [ [[package]] name = "rustls-platform-verifier" -version = "0.3.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afbb878bdfdf63a336a5e63561b1835e7a8c91524f51621db870169eac84b490" +checksum = "e012c45844a1790332c9386ed4ca3a06def221092eda277e6f079728f8ea99da" dependencies = [ - "core-foundation", + "core-foundation 0.10.0", "core-foundation-sys", "jni", "log", @@ -4139,8 +4166,8 @@ dependencies = [ "rustls-webpki", "security-framework", "security-framework-sys", - "webpki-roots", - "winapi", + "webpki-root-certs", + "windows-sys 0.52.0", ] [[package]] @@ -4239,15 +4266,14 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.11.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" dependencies = [ "bitflags 2.7.0", - "core-foundation", + "core-foundation 0.10.0", "core-foundation-sys", "libc", - "num-bigint", "security-framework-sys", ] @@ -4276,6 +4302,12 @@ dependencies = [ "serde", ] +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + [[package]] name = "serde" version = "1.0.217" @@ -4294,25 +4326,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_bencode" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a70dfc7b7438b99896e7f8992363ab8e2c4ba26aa5ec675d32d1c3c2c33d413e" -dependencies = [ - "serde", - "serde_bytes", -] - -[[package]] -name = "serde_bytes" -version = "0.11.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" -dependencies = [ - "serde", -] - [[package]] name = "serde_derive" version = "1.0.217" @@ -4388,12 +4401,6 @@ dependencies = [ "digest", ] -[[package]] -name = "sha1_smol" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" - [[package]] name = "sha2" version = "0.10.8" @@ -4767,7 +4774,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ "bitflags 2.7.0", - "core-foundation", + "core-foundation 0.9.4", "system-configuration-sys", ] @@ -4949,7 +4956,6 @@ dependencies = [ "bytes", "libc", "mio", - "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", @@ -5020,9 +5026,9 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.21.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" +checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9" dependencies = [ "futures-util", "log", @@ -5032,9 +5038,9 @@ dependencies = [ [[package]] name = "tokio-tungstenite-wasm" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e57a65894797a018b28345fa298a00c450a574aa9671e50b18218a6292a55ac" +checksum = "e21a5c399399c3db9f08d8297ac12b500e86bca82e930253fdc62eaf9c0de6ae" dependencies = [ "futures-channel", "futures-util", @@ -5198,6 +5204,27 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "tracing-test" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "557b891436fe0d5e0e363427fc7f217abf9ccd510d5136549847bdcbcd011d68" +dependencies = [ + "tracing-core", + "tracing-subscriber", + "tracing-test-macro", +] + +[[package]] +name = "tracing-test-macro" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04659ddb06c87d233c566112c1c9c5b9e98256d9af50ec3bc9c8327f873a7568" +dependencies = [ + "quote", + "syn 2.0.96", +] + [[package]] name = "try-lock" version = "0.2.5" @@ -5206,9 +5233,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" -version = "0.21.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" +checksum = "18e5b8366ee7a95b16d32197d0b2604b43a0be89dc5fac9f8e96ccafbaedda8a" dependencies = [ "byteorder", "bytes", @@ -5219,7 +5246,6 @@ dependencies = [ "rand", "sha1", "thiserror 1.0.69", - "url", "utf-8", ] @@ -5502,6 +5528,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-root-certs" +version = "0.26.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09aed61f5e8d2c18344b3faa33a4c837855fe56642757754775548fee21386c4" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "webpki-roots" version = "0.26.7" @@ -5715,6 +5750,15 @@ dependencies = [ "windows-targets 0.53.0", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -5742,6 +5786,21 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -5789,6 +5848,12 @@ dependencies = [ "windows_x86_64_msvc 0.53.0", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -5807,6 +5872,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -5825,6 +5896,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -5855,6 +5932,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -5873,6 +5956,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -5891,6 +5980,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -5909,6 +6004,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" diff --git a/Cargo.toml b/Cargo.toml index 4403a20..ff4f7e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,11 +35,11 @@ futures-buffered = "0.2.4" futures-lite = "2.3.0" futures-util = { version = "0.3.25" } hex = "0.4" -iroh-base = { version = "0.31", features = ["ticket"] } +iroh-base = { version = "0.32", features = ["ticket"] } iroh-blobs = { version = "0.31" } -iroh-gossip = { version = "0.31", optional = true, features = ["net"] } +iroh-gossip = { version = "0.32", optional = true, features = ["net"] } iroh-metrics = { version = "0.31", default-features = false } -iroh = { version = "0.31", optional = true } +iroh = { version = "0.32", optional = true } num_enum = "0.7" postcard = { version = "1", default-features = false, features = ["alloc", "use-std", "experimental-derive"] } rand = "0.8.5" @@ -58,8 +58,8 @@ tracing = "0.1" # rpc nested_enum_utils = { version = "0.1.0", optional = true } -quic-rpc = { version = "0.17", optional = true } -quic-rpc-derive = { version = "0.17", optional = true } +quic-rpc = { version = "0.18", optional = true } +quic-rpc-derive = { version = "0.18", optional = true } serde-error = { version = "0.1.3", optional = true } portable-atomic = { version = "1.9.0", optional = true } @@ -73,11 +73,11 @@ colored = { version = "2.1", optional = true } shellexpand = { version = "3.1", optional = true } [dev-dependencies] -iroh-test = "0.31" rand_chacha = "0.3.1" tokio = { version = "1", features = ["sync", "macros"] } proptest = "1.2.0" tempfile = "3.4" +tracing-test = "0.2.5" test-strategy = "0.4" tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } parking_lot = "0.12.3" @@ -117,3 +117,6 @@ rpc = [ [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "iroh_docsrs"] + +[patch.crates-io] +iroh-blobs = { git = "https://github.com/n0-computer/iroh-blobs.git", branch = "iroh-0-32-0" } diff --git a/src/net.rs b/src/net.rs index 67ebfaf..fb9c7c4 100644 --- a/src/net.rs +++ b/src/net.rs @@ -5,7 +5,7 @@ use std::{ time::{Duration, Instant}, }; -use iroh::{endpoint::get_remote_node_id, Endpoint, NodeAddr, PublicKey}; +use iroh::{Endpoint, NodeAddr, PublicKey}; #[cfg(feature = "metrics")] use iroh_metrics::inc; use serde::{Deserialize, Serialize}; @@ -115,7 +115,7 @@ where { let t_start = Instant::now(); let connection = connecting.await.map_err(AcceptError::connect)?; - let peer = get_remote_node_id(&connection).map_err(AcceptError::connect)?; + let peer = connection.remote_node_id().map_err(AcceptError::connect)?; let (mut send_stream, mut recv_stream) = connection .accept_bi() .await diff --git a/src/net/codec.rs b/src/net/codec.rs index b8f4060..571bce1 100644 --- a/src/net/codec.rs +++ b/src/net/codec.rs @@ -297,6 +297,7 @@ mod tests { use iroh::SecretKey; use iroh_blobs::Hash; use rand_core::{CryptoRngCore, SeedableRng}; + use tracing_test::traced_test; use super::*; use crate::{ @@ -419,16 +420,16 @@ mod tests { } #[tokio::test] + #[traced_test] async fn test_sync_many_authors_memory() -> Result<()> { - let _guard = iroh_test::logging::setup(); let alice_store = store::Store::memory(); let bob_store = store::Store::memory(); test_sync_many_authors(alice_store, bob_store).await } #[tokio::test] + #[traced_test] async fn test_sync_many_authors_fs() -> Result<()> { - let _guard = iroh_test::logging::setup(); let tmpdir = tempfile::tempdir()?; let alice_store = store::fs::Store::persistent(tmpdir.path().join("a.db"))?; let bob_store = store::fs::Store::persistent(tmpdir.path().join("b.db"))?; @@ -612,16 +613,16 @@ mod tests { } #[tokio::test] + #[traced_test] async fn test_sync_timestamps_memory() -> Result<()> { - let _guard = iroh_test::logging::setup(); let alice_store = store::Store::memory(); let bob_store = store::Store::memory(); test_sync_timestamps(alice_store, bob_store).await } #[tokio::test] + #[traced_test] async fn test_sync_timestamps_fs() -> Result<()> { - let _guard = iroh_test::logging::setup(); let tmpdir = tempfile::tempdir()?; let alice_store = store::fs::Store::persistent(tmpdir.path().join("a.db"))?; let bob_store = store::fs::Store::persistent(tmpdir.path().join("b.db"))?; diff --git a/src/ticket.rs b/src/ticket.rs index 6e8ebb5..cb78098 100644 --- a/src/ticket.rs +++ b/src/ticket.rs @@ -65,8 +65,8 @@ impl std::str::FromStr for DocTicket { mod tests { use std::str::FromStr; + use anyhow::{ensure, Context, Result}; use iroh::PublicKey; - use iroh_test::{assert_eq_hex, hexdump::parse_hexdump}; use super::*; use crate::NamespaceId; @@ -106,6 +106,34 @@ mod tests { 00 # no relay url 00 # no direct addresses ").unwrap(); - assert_eq_hex!(base32, expected); + assert_eq!(base32, expected); + } + + /// Parses a commented multi line hexdump into a vector of bytes. + /// + /// This is useful to write wire level protocol tests. + pub fn parse_hexdump(s: &str) -> Result> { + let mut result = Vec::new(); + + for (line_number, line) in s.lines().enumerate() { + let data_part = line.split('#').next().unwrap_or(""); + let cleaned: String = data_part.chars().filter(|c| !c.is_whitespace()).collect(); + + ensure!( + cleaned.len() % 2 == 0, + "Non-even number of hex chars detected on line {}.", + line_number + 1 + ); + + for i in (0..cleaned.len()).step_by(2) { + let byte_str = &cleaned[i..i + 2]; + let byte = u8::from_str_radix(byte_str, 16) + .with_context(|| format!("Invalid hex data on line {}.", line_number + 1))?; + + result.push(byte); + } + } + + Ok(result) } } diff --git a/tests/client.rs b/tests/client.rs index 6aacd05..f932eeb 100644 --- a/tests/client.rs +++ b/tests/client.rs @@ -9,15 +9,15 @@ use iroh_docs::store::Query; use rand::RngCore; use testresult::TestResult; use tokio::io::AsyncWriteExt; +use tracing_test::traced_test; use util::Node; mod util; /// Test that closing a doc does not close other instances. #[tokio::test] +#[traced_test] async fn test_doc_close() -> Result<()> { - let _guard = iroh_test::logging::setup(); - let node = Node::memory().spawn().await?; let author = node.authors().default().await?; // open doc two times @@ -38,9 +38,8 @@ async fn test_doc_close() -> Result<()> { } #[tokio::test] +#[traced_test] async fn test_doc_import_export() -> TestResult<()> { - let _guard = iroh_test::logging::setup(); - let node = Node::memory().spawn().await?; // create temp file @@ -156,9 +155,8 @@ async fn test_default_author_memory() -> Result<()> { } #[tokio::test] +#[traced_test] async fn test_default_author_persist() -> TestResult<()> { - let _guard = iroh_test::logging::setup(); - let iroh_root_dir = tempfile::TempDir::new()?; let iroh_root = iroh_root_dir.path(); diff --git a/tests/sync.rs b/tests/sync.rs index ac8feff..d06cd97 100644 --- a/tests/sync.rs +++ b/tests/sync.rs @@ -22,7 +22,7 @@ use iroh_docs::{ }; use rand::{CryptoRng, Rng, SeedableRng}; use tracing::{debug, error_span, info, Instrument}; -use tracing_subscriber::{prelude::*, EnvFilter}; +use tracing_test::traced_test; mod util; use util::{Builder, Node}; @@ -73,8 +73,8 @@ macro_rules! match_event { /// This tests the simplest scenario: A node connects to another node, and performs sync. #[tokio::test] +#[traced_test] async fn sync_simple() -> Result<()> { - setup_logging(); let mut rng = test_rng(b"sync_simple"); let nodes = spawn_nodes(2, &mut rng).await?; let clients = nodes.iter().map(|node| node.client()).collect::>(); @@ -133,9 +133,9 @@ async fn sync_simple() -> Result<()> { /// Test subscribing to replica events (without sync) #[tokio::test] +#[traced_test] async fn sync_subscribe_no_sync() -> Result<()> { let mut rng = test_rng(b"sync_subscribe"); - setup_logging(); let node = spawn_node(0, &mut rng).await?; let client = node.client(); let doc = client.docs().create().await?; @@ -152,12 +152,12 @@ async fn sync_subscribe_no_sync() -> Result<()> { } #[tokio::test] +#[traced_test] async fn sync_gossip_bulk() -> Result<()> { let n_entries: usize = std::env::var("N_ENTRIES") .map(|x| x.parse().expect("N_ENTRIES must be a number")) .unwrap_or(100); let mut rng = test_rng(b"sync_gossip_bulk"); - setup_logging(); let nodes = spawn_nodes(2, &mut rng).await?; let clients = nodes.iter().map(|node| node.client()).collect::>(); @@ -242,10 +242,10 @@ async fn sync_gossip_bulk() -> Result<()> { /// This tests basic sync and gossip with 3 peers. #[tokio::test] +#[traced_test] #[ignore = "flaky"] async fn sync_full_basic() -> testresult::TestResult<()> { let mut rng = test_rng(b"sync_full_basic"); - setup_logging(); let mut nodes = spawn_nodes(2, &mut rng).await?; let mut clients = nodes .iter() @@ -424,9 +424,9 @@ async fn sync_full_basic() -> testresult::TestResult<()> { } #[tokio::test] +#[traced_test] async fn sync_open_close() -> Result<()> { let mut rng = test_rng(b"sync_subscribe_stop_close"); - setup_logging(); let node = spawn_node(0, &mut rng).await?; let client = node.client(); @@ -448,9 +448,9 @@ async fn sync_open_close() -> Result<()> { } #[tokio::test] +#[traced_test] async fn sync_subscribe_stop_close() -> Result<()> { let mut rng = test_rng(b"sync_subscribe_stop_close"); - setup_logging(); let node = spawn_node(0, &mut rng).await?; let client = node.client(); @@ -487,9 +487,9 @@ async fn sync_subscribe_stop_close() -> Result<()> { } #[tokio::test] +#[traced_test] #[cfg(feature = "test-utils")] async fn test_sync_via_relay() -> Result<()> { - let _guard = iroh_test::logging::setup(); let (relay_map, _relay_url, _guard) = iroh::test_utils::run_relay_server().await?; let node1 = Node::memory() @@ -581,11 +581,11 @@ async fn test_sync_via_relay() -> Result<()> { } #[tokio::test] +#[traced_test] #[cfg(feature = "test-utils")] #[ignore = "flaky"] async fn sync_restart_node() -> Result<()> { let mut rng = test_rng(b"sync_restart_node"); - setup_logging(); let (relay_map, _relay_url, _guard) = iroh::test_utils::run_relay_server().await?; let discovery_server = iroh::test_utils::DnsPkarrServer::run().await?; @@ -752,7 +752,6 @@ async fn test_download_policies() -> Result<()> { const EXPECTED_B_DOWNLOADED: usize = 3; let mut rng = test_rng(b"sync_download_policies"); - setup_logging(); let nodes = spawn_nodes(2, &mut rng).await?; let clients = nodes.iter().map(|node| node.client()).collect::>(); @@ -860,9 +859,9 @@ async fn test_download_policies() -> Result<()> { /// Test sync between many nodes with propagation through sync reports. #[tokio::test(flavor = "multi_thread")] +#[traced_test] #[ignore = "flaky"] async fn sync_big() -> Result<()> { - setup_logging(); let mut rng = test_rng(b"sync_big"); let n_nodes = std::env::var("NODES") .map(|v| v.parse().expect("NODES must be a number")) @@ -982,6 +981,7 @@ async fn sync_big() -> Result<()> { } #[tokio::test] +#[traced_test] #[cfg(feature = "test-utils")] async fn test_list_docs_stream() -> testresult::TestResult<()> { let node = Node::memory() @@ -1156,6 +1156,7 @@ impl PartialEq for (Entry, Bytes) { } #[tokio::test] +#[traced_test] async fn doc_delete() -> Result<()> { let node = Node::memory() .gc_interval(Some(Duration::from_millis(100))) @@ -1185,9 +1186,9 @@ async fn doc_delete() -> Result<()> { } #[tokio::test] +#[traced_test] async fn sync_drop_doc() -> Result<()> { let mut rng = test_rng(b"sync_drop_doc"); - setup_logging(); let node = spawn_node(0, &mut rng).await?; let client = node.client(); @@ -1241,14 +1242,6 @@ async fn get_latest( Ok(content.to_vec()) } -fn setup_logging() { - tracing_subscriber::registry() - .with(tracing_subscriber::fmt::layer().with_writer(std::io::stderr)) - .with(EnvFilter::from_default_env()) - .try_init() - .ok(); -} - async fn next(mut stream: impl Stream> + Unpin) -> T { let event = stream .next() diff --git a/tests/util.rs b/tests/util.rs index f0d75e2..06c6e49 100644 --- a/tests/util.rs +++ b/tests/util.rs @@ -11,7 +11,6 @@ use iroh::{discovery::Discovery, dns::DnsResolver, NodeId, RelayMode, SecretKey} use iroh_blobs::{ net_protocol::Blobs, store::{GcConfig, Store as BlobStore}, - util::local_pool::LocalPool, }; use iroh_docs::protocol::Docs; use iroh_gossip::net::Gossip; @@ -38,7 +37,6 @@ pub struct Node { router: iroh::protocol::Router, client: Client, store: S, - local_pool: LocalPool, rpc_task: AbortOnDropHandle<()>, } @@ -136,9 +134,8 @@ impl Builder { builder = builder.dns_resolver(dns_resolver); } let endpoint = builder.bind().await?; - let local_pool = LocalPool::single(); let mut router = iroh::protocol::Router::builder(endpoint.clone()); - let blobs = Blobs::builder(store.clone()).build(&local_pool, &endpoint); + let blobs = Blobs::builder(store.clone()).build(&endpoint); let gossip = Gossip::builder().spawn(endpoint.clone()).await?; let builder = match self.path { Some(ref path) => Docs::persistent(path.to_path_buf()), @@ -209,7 +206,6 @@ impl Builder { client, store, rpc_task: AbortOnDropHandle::new(rpc_task), - local_pool, }) } @@ -314,7 +310,6 @@ impl Node { /// Shuts down the node pub async fn shutdown(self) -> anyhow::Result<()> { self.router.shutdown().await?; - self.local_pool.shutdown().await; self.rpc_task.abort(); Ok(()) }