From 9fe3af52a0feea5397ccb381fc1eb71d8a3829bb Mon Sep 17 00:00:00 2001 From: Frando Date: Tue, 21 Oct 2025 17:00:20 +0200 Subject: [PATCH 01/16] refactor: add rpc feature flag --- Cargo.lock | 6 +----- Cargo.toml | 12 +++++++++--- src/api.rs | 15 ++++++++++----- src/api/downloader.rs | 2 +- src/api/proto.rs | 2 +- src/provider/events.rs | 7 ++++++- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 43194fd75..0d227e6d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2032,8 +2032,6 @@ dependencies = [ [[package]] name = "irpc" version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e3fc4aa2bc2c1002655fab4254390f016f8b9bb65390600f9d8b11f9bdac76d" dependencies = [ "anyhow", "futures-buffered", @@ -2055,8 +2053,6 @@ dependencies = [ [[package]] name = "irpc-derive" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f5706d47257e3f40b9e7dbc1934942b5792cc6a8670b7dda8856c2f5709cf98" dependencies = [ "proc-macro2", "quote", @@ -4721,7 +4717,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 3b3fae05f..98d00ee17 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,11 +36,11 @@ chrono = "0.4.39" nested_enum_utils = "0.2.1" ref-cast = "1.0.24" arrayvec = "0.7.6" -iroh = "0.93" +iroh = { version = "0.93", default-features = false } self_cell = "1.1.0" genawaiter = { version = "0.99.1", features = ["futures03"] } iroh-base = "0.93" -irpc = { version = "0.9.0", features = ["rpc", "quinn_endpoint_setup", "spans", "stream", "derive"], default-features = false } +irpc = { version = "0.9.0", features = ["spans", "stream", "derive", "varint-util"], default-features = false } iroh-metrics = { version = "0.36" } redb = { version = "2.6.3", optional = true } reflink-copy = { version = "0.1.24", optional = true } @@ -62,9 +62,15 @@ atomic_refcell = "0.1.13" iroh = { version = "0.93", features = ["discovery-local-network"]} async-compression = { version = "0.4.30", features = ["lz4", "tokio"] } concat_const = "0.2.0" +irpc = { version = "0.9.0", features = ["rpc", "quinn_endpoint_setup", "spans", "stream", "derive"], default-features = false } [features] hide-proto-docs = [] metrics = [] -default = ["hide-proto-docs", "fs-store"] +default = ["hide-proto-docs", "fs-store", "rpc"] fs-store = ["dep:redb", "dep:reflink-copy"] +rpc = ["irpc/rpc", "irpc/quinn_endpoint_setup"] + +[patch.crates-io] +# irpc = { git = "https://github.com/n0-computer/irpc", branch = "Frando/varint-feature" } +irpc = { path = "../irpc" } diff --git a/src/api.rs b/src/api.rs index 3abb13bdb..fcd44658d 100644 --- a/src/api.rs +++ b/src/api.rs @@ -12,14 +12,13 @@ //! //! You can also [`connect`](Store::connect) to a remote store that is listening //! to rpc requests. -use std::{io, net::SocketAddr, ops::Deref}; +use std::{io, ops::Deref}; use bao_tree::io::EncodeError; use iroh::Endpoint; -use irpc::rpc::{listen, RemoteService}; use n0_snafu::SpanTrace; use nested_enum_utils::common_fields; -use proto::{Request, ShutdownRequest, SyncDbRequest}; +use proto::{ShutdownRequest, SyncDbRequest}; use ref_cast::RefCast; use serde::{Deserialize, Serialize}; use snafu::{Backtrace, IntoError, Snafu}; @@ -128,6 +127,7 @@ impl From for ExportBaoError { irpc::Error::OneshotRecv(e) => OneshotRecvSnafu.into_error(e), irpc::Error::Send(e) => SendSnafu.into_error(e), irpc::Error::Request(e) => RequestSnafu.into_error(e), + #[cfg(feature = "rpc")] irpc::Error::Write(e) => ExportBaoIoSnafu.into_error(e.into()), } } @@ -220,6 +220,7 @@ impl From for Error { } } +#[cfg(feature = "rpc")] impl From for Error { fn from(e: irpc::rpc::WriteError) -> Self { Self::Io(e.into()) @@ -298,16 +299,20 @@ impl Store { } /// Connect to a remote store as a rpc client. - pub fn connect(endpoint: quinn::Endpoint, addr: SocketAddr) -> Self { + #[cfg(feature = "rpc")] + pub fn connect(endpoint: quinn::Endpoint, addr: std::net::SocketAddr) -> Self { let sender = irpc::Client::quinn(endpoint, addr); Store::from_sender(sender) } /// Listen on a quinn endpoint for incoming rpc connections. + #[cfg(feature = "rpc")] pub async fn listen(self, endpoint: quinn::Endpoint) { + use self::proto::Request; + use irpc::rpc::RemoteService; let local = self.client.as_local().unwrap().clone(); let handler = Request::remote_handler(local); - listen::(endpoint, handler).await + irpc::rpc::listen::(endpoint, handler).await } pub async fn sync_db(&self) -> RequestResult<()> { diff --git a/src/api/downloader.rs b/src/api/downloader.rs index 4a5a25dd6..ddf42255e 100644 --- a/src/api/downloader.rs +++ b/src/api/downloader.rs @@ -31,7 +31,7 @@ pub struct Downloader { client: irpc::Client, } -#[rpc_requests(message = SwarmMsg, alias = "Msg")] +#[rpc_requests(message = SwarmMsg, alias = "Msg", rpc_feature = "rpc")] #[derive(Debug, Serialize, Deserialize)] enum SwarmProtocol { #[rpc(tx = mpsc::Sender)] diff --git a/src/api/proto.rs b/src/api/proto.rs index b2a0eed94..80478e934 100644 --- a/src/api/proto.rs +++ b/src/api/proto.rs @@ -87,7 +87,7 @@ impl HashSpecific for CreateTagMsg { } } -#[rpc_requests(message = Command, alias = "Msg")] +#[rpc_requests(message = Command, alias = "Msg", rpc_feature = "rpc")] #[derive(Debug, Serialize, Deserialize)] pub enum Request { #[rpc(tx = mpsc::Sender>)] diff --git a/src/provider/events.rs b/src/provider/events.rs index 7287fd1a1..1e236c771 100644 --- a/src/provider/events.rs +++ b/src/provider/events.rs @@ -531,7 +531,7 @@ impl EventSender { } } -#[rpc_requests(message = ProviderMessage)] +#[rpc_requests(message = ProviderMessage, rpc_feature = "rpc")] #[derive(Debug, Serialize, Deserialize)] pub enum ProviderProto { /// A new client connected to the provider. @@ -705,10 +705,15 @@ mod irpc_ext { .map_err(irpc::Error::from)?; Ok(req_tx) } + #[cfg(feature = "rpc")] irpc::Request::Remote(remote) => { let (s, _) = remote.write(msg).await?; Ok(s.into()) } + #[cfg(not(feature = "rpc"))] + irpc::Request::Remote(_) => { + unreachable!() + } } } } From 3c79c5f2024b23ab6ef90edc53d208f3f3ddb665 Mon Sep 17 00:00:00 2001 From: Frando Date: Tue, 21 Oct 2025 17:17:54 +0200 Subject: [PATCH 02/16] feat: compile on wasm32-unknown-unknown --- .cargo/config.toml | 3 +++ Cargo.lock | 22 ++++++++++------------ Cargo.toml | 14 ++++++++------ src/api.rs | 3 ++- src/provider.rs | 3 +-- src/provider/events.rs | 5 +++-- src/store/mem.rs | 11 ++++++++++- src/util/connection_pool.rs | 4 +--- 8 files changed, 38 insertions(+), 27 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 000000000..226dec961 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[target.wasm32-unknown-unknown] +runner = "wasm-bindgen-test-runner" +rustflags = ['--cfg', 'getrandom_backend="wasm_js"'] diff --git a/Cargo.lock b/Cargo.lock index 0d227e6d6..f02fd0c6e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -259,8 +259,7 @@ dependencies = [ [[package]] name = "bao-tree" version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff16d65e48353db458be63ee395c03028f24564fd48668389bd65fd945f5ac36" +source = "git+https://github.com/n0-computer/bao-tree.git?branch=Frando%2Fwasm#7f361d01f780353eb826b5c08ae6a494c380cad6" dependencies = [ "blake3", "bytes", @@ -1502,7 +1501,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.0", + "socket2 0.5.10", "tokio", "tower-service", "tracing", @@ -1830,6 +1829,7 @@ dependencies = [ "atomic_refcell", "bao-tree", "bytes", + "cfg_aliases", "chrono", "clap", "concat_const", @@ -1865,7 +1865,6 @@ dependencies = [ "test-strategy", "testresult", "tokio", - "tokio-util", "tracing", "tracing-subscriber", "tracing-test", @@ -1964,7 +1963,7 @@ dependencies = [ "once_cell", "socket2 0.5.10", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -2032,6 +2031,7 @@ dependencies = [ [[package]] name = "irpc" version = "0.9.0" +source = "git+https://github.com/n0-computer/irpc?branch=Frando%2Fvarint-feature#1bb4dbd41ce191c42b4fa1530eba4598fa30e12f" dependencies = [ "anyhow", "futures-buffered", @@ -2053,6 +2053,7 @@ dependencies = [ [[package]] name = "irpc-derive" version = "0.7.0" +source = "git+https://github.com/n0-computer/irpc?branch=Frando%2Fvarint-feature#1bb4dbd41ce191c42b4fa1530eba4598fa30e12f" dependencies = [ "proc-macro2", "quote", @@ -2866,8 +2867,7 @@ dependencies = [ [[package]] name = "positioned-io" version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8078ce4d22da5e8f57324d985cc9befe40c49ab0507a192d6be9e59584495c9" +source = "git+https://github.com/Frando/positioned-io?branch=Frando%2Fwasm#113f8f53cfb3fa295cba84a8b8cf33c91ad6d481" dependencies = [ "libc", "winapi", @@ -3084,7 +3084,7 @@ dependencies = [ "once_cell", "socket2 0.5.10", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -3441,7 +3441,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs 0.26.11", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -4017,7 +4017,7 @@ dependencies = [ "getrandom 0.3.3", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -4203,12 +4203,10 @@ checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" dependencies = [ "bytes", "futures-core", - "futures-io", "futures-sink", "futures-util", "hashbrown", "pin-project-lite", - "slab", "tokio", ] diff --git a/Cargo.toml b/Cargo.toml index 98d00ee17..9569aca03 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,14 +17,13 @@ bao-tree = { version = "0.15.1", features = ["experimental-mixed", "tokio_fsm", bytes = { version = "1", features = ["serde"] } derive_more = { version = "2.0.1", features = ["from", "try_from", "into", "debug", "display", "deref", "deref_mut"] } futures-lite = "2.6.0" -quinn = { package = "iroh-quinn", version = "0.14.0" } +quinn = { package = "iroh-quinn", version = "0.14.0", optional = true } n0-future = "0.2.0" n0-snafu = "0.2.2" range-collections = { version = "0.4.6", features = ["serde"] } smallvec = { version = "1", features = ["serde", "const_new"] } snafu = "0.8.5" -tokio = { version = "1.43.0", features = ["full"] } -tokio-util = { version = "0.7.13", features = ["full"] } +tokio = { version = "1.43.0", default-features = false, features = ["sync"] } tracing = "0.1.41" iroh-io = "0.6.1" rand = "0.9.2" @@ -69,8 +68,11 @@ hide-proto-docs = [] metrics = [] default = ["hide-proto-docs", "fs-store", "rpc"] fs-store = ["dep:redb", "dep:reflink-copy"] -rpc = ["irpc/rpc", "irpc/quinn_endpoint_setup"] +rpc = ["dep:quinn", "irpc/rpc", "irpc/quinn_endpoint_setup"] [patch.crates-io] -# irpc = { git = "https://github.com/n0-computer/irpc", branch = "Frando/varint-feature" } -irpc = { path = "../irpc" } +irpc = { git = "https://github.com/n0-computer/irpc", branch = "Frando/varint-feature" } +bao-tree = { git = "https://github.com/n0-computer/bao-tree.git", branch = "Frando/wasm" } + +[build-dependencies] +cfg_aliases = "0.2.1" diff --git a/src/api.rs b/src/api.rs index fcd44658d..26ebf3415 100644 --- a/src/api.rs +++ b/src/api.rs @@ -308,8 +308,9 @@ impl Store { /// Listen on a quinn endpoint for incoming rpc connections. #[cfg(feature = "rpc")] pub async fn listen(self, endpoint: quinn::Endpoint) { - use self::proto::Request; use irpc::rpc::RemoteService; + + use self::proto::Request; let local = self.client.as_local().unwrap().clone(); let handler = Request::remote_handler(local); irpc::rpc::listen::(endpoint, handler).await diff --git a/src/provider.rs b/src/provider.rs index 904a272fe..112114447 100644 --- a/src/provider.rs +++ b/src/provider.rs @@ -12,10 +12,9 @@ use std::{ use anyhow::Result; use bao_tree::ChunkRanges; -use iroh::endpoint::{self, VarInt}; +use iroh::endpoint::{self, ConnectionError, VarInt}; use iroh_io::{AsyncStreamReader, AsyncStreamWriter}; use n0_future::StreamExt; -use quinn::ConnectionError; use serde::{Deserialize, Serialize}; use snafu::Snafu; use tokio::select; diff --git a/src/provider/events.rs b/src/provider/events.rs index 1e236c771..9f9caee8b 100644 --- a/src/provider/events.rs +++ b/src/provider/events.rs @@ -1,5 +1,6 @@ use std::{fmt::Debug, io, ops::Deref}; +use iroh::endpoint::VarInt; use irpc::{ channel::{mpsc, none::NoSender, oneshot}, rpc_requests, Channels, WithChannels, @@ -106,11 +107,11 @@ impl From for io::Error { } pub trait HasErrorCode { - fn code(&self) -> quinn::VarInt; + fn code(&self) -> VarInt; } impl HasErrorCode for ProgressError { - fn code(&self) -> quinn::VarInt { + fn code(&self) -> VarInt { match self { ProgressError::Limit => ERR_LIMIT, ProgressError::Permission => ERR_PERMISSION, diff --git a/src/store/mem.rs b/src/store/mem.rs index 76bc0e6e4..302722325 100644 --- a/src/store/mem.rs +++ b/src/store/mem.rs @@ -32,7 +32,6 @@ use irpc::channel::mpsc; use n0_future::future::yield_now; use range_collections::range_set::RangeSetRange; use tokio::{ - io::AsyncReadExt, sync::watch, task::{JoinError, JoinSet}, }; @@ -755,8 +754,18 @@ async fn import_byte_stream( import_bytes(res.into(), scope, format, tx).await } +#[cfg(wasm_browser)] +async fn import_path(cmd: ImportPathMsg) -> anyhow::Result { + let _: ImportPathRequest = cmd.inner; + Err(anyhow::anyhow!( + "import_path is not supported in the browser" + )) +} + #[instrument(skip_all, fields(path = %cmd.path.display()))] +#[cfg(not(wasm_browser))] async fn import_path(cmd: ImportPathMsg) -> anyhow::Result { + use tokio::io::AsyncReadExt; let ImportPathMsg { inner: ImportPathRequest { diff --git a/src/util/connection_pool.rs b/src/util/connection_pool.rs index 33632b810..3e90dbcec 100644 --- a/src/util/connection_pool.rs +++ b/src/util/connection_pool.rs @@ -32,7 +32,6 @@ use tokio::sync::{ mpsc::{self, error::SendError as TokioSendError}, oneshot, Notify, }; -use tokio_util::time::FutureExt as TimeFutureExt; use tracing::{debug, error, info, trace}; pub type OnConnected = @@ -194,8 +193,7 @@ impl Context { }; // Connect to the node - let state = conn_fut - .timeout(context.options.connect_timeout) + let state = n0_future::time::timeout(context.options.connect_timeout, conn_fut) .await .map_err(|_| PoolConnectError::Timeout) .and_then(|r| r); From cec8c073db7a43d3f8e1746e4c99219b257d8777 Mon Sep 17 00:00:00 2001 From: Frando Date: Tue, 21 Oct 2025 17:20:21 +0200 Subject: [PATCH 03/16] chore: ci for wasm --- .github/workflows/ci.yaml | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b2a48b5e4..2019aff4c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -277,3 +277,43 @@ jobs: - uses: actions/checkout@v5 - run: pip install --user codespell[toml] - run: codespell --ignore-words-list=ans,atmost,crate,inout,ratatui,ser,stayin,swarmin,worl --skip=CHANGELOG.md + + wasm_build: + name: Build & test wasm32 + runs-on: ubuntu-latest + env: + RUSTFLAGS: '--cfg getrandom_backend="wasm_js"' + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install stable toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Add wasm target + run: rustup target add wasm32-unknown-unknown + + - name: Install wasm-tools + uses: bytecodealliance/actions/wasm-tools/setup@v1 + + - name: Install wasm-pack + uses: taiki-e/install-action@v2 + with: + tool: wasm-bindgen,wasm-pack + + - name: wasm32 build + run: cargo build --target wasm32-unknown-unknown + + # If the Wasm file contains any 'import "env"' declarations, then + # some non-Wasm-compatible code made it into the final code. + - name: Ensure no 'import "env"' in wasm + run: | + ! wasm-tools print --skeleton target/wasm32-unknown-unknown/debug/iroh_blobs.wasm | grep 'import "env"' + + - name: wasm32 test + run: wasm-pack test --node \ No newline at end of file From 541110f486fde508cf9d25619625978a8bea0201 Mon Sep 17 00:00:00 2001 From: Frando Date: Tue, 21 Oct 2025 17:27:11 +0200 Subject: [PATCH 04/16] fixup --- build.rs | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 build.rs diff --git a/build.rs b/build.rs new file mode 100644 index 000000000..7aae56820 --- /dev/null +++ b/build.rs @@ -0,0 +1,9 @@ +use cfg_aliases::cfg_aliases; + +fn main() { + // Setup cfg aliases + cfg_aliases! { + // Convenience aliases + wasm_browser: { all(target_family = "wasm", target_os = "unknown") }, + } +} From 7e8542d70396f92b2b188549d5b0be13ade1e0e3 Mon Sep 17 00:00:00 2001 From: Frando Date: Tue, 21 Oct 2025 17:37:16 +0200 Subject: [PATCH 05/16] fixup --- Cargo.lock | 12 ++++++------ Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f02fd0c6e..806301018 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1501,7 +1501,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.5.10", + "socket2 0.6.0", "tokio", "tower-service", "tracing", @@ -1963,7 +1963,7 @@ dependencies = [ "once_cell", "socket2 0.5.10", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3084,7 +3084,7 @@ dependencies = [ "once_cell", "socket2 0.5.10", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3441,7 +3441,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs 0.26.11", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4017,7 +4017,7 @@ dependencies = [ "getrandom 0.3.3", "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4715,7 +4715,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 9569aca03..0f4e018e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,7 +67,7 @@ irpc = { version = "0.9.0", features = ["rpc", "quinn_endpoint_setup", "spans", hide-proto-docs = [] metrics = [] default = ["hide-proto-docs", "fs-store", "rpc"] -fs-store = ["dep:redb", "dep:reflink-copy"] +fs-store = ["dep:redb", "dep:reflink-copy", "bao-tree/fs"] rpc = ["dep:quinn", "irpc/rpc", "irpc/quinn_endpoint_setup"] [patch.crates-io] From d7de28c8c73bd7cc9a34440e4035c2c09f09d273 Mon Sep 17 00:00:00 2001 From: Frando Date: Tue, 21 Oct 2025 18:26:05 +0200 Subject: [PATCH 06/16] bump --- Cargo.lock | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 806301018..aa5a9f9ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -259,7 +259,7 @@ dependencies = [ [[package]] name = "bao-tree" version = "0.15.1" -source = "git+https://github.com/n0-computer/bao-tree.git?branch=Frando%2Fwasm#7f361d01f780353eb826b5c08ae6a494c380cad6" +source = "git+https://github.com/n0-computer/bao-tree.git?branch=Frando%2Fwasm#800607243583126d06237a582049f606386d787a" dependencies = [ "blake3", "bytes", @@ -1501,7 +1501,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.0", + "socket2 0.5.10", "tokio", "tower-service", "tracing", @@ -1963,7 +1963,7 @@ dependencies = [ "once_cell", "socket2 0.5.10", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -2866,8 +2866,9 @@ dependencies = [ [[package]] name = "positioned-io" -version = "0.3.4" -source = "git+https://github.com/Frando/positioned-io?branch=Frando%2Fwasm#113f8f53cfb3fa295cba84a8b8cf33c91ad6d481" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4ec4b80060f033312b99b6874025d9503d2af87aef2dd4c516e253fbfcdada7" dependencies = [ "libc", "winapi", @@ -3084,7 +3085,7 @@ dependencies = [ "once_cell", "socket2 0.5.10", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -3441,7 +3442,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs 0.26.11", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -4017,7 +4018,7 @@ dependencies = [ "getrandom 0.3.3", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -4715,7 +4716,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] From b1ad881c37c86d1170519dca15dde1abf8a022c1 Mon Sep 17 00:00:00 2001 From: Frando Date: Tue, 21 Oct 2025 22:30:02 +0200 Subject: [PATCH 07/16] fix: feature flags in dev --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 0f4e018e3..44c63b4bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,7 +61,6 @@ atomic_refcell = "0.1.13" iroh = { version = "0.93", features = ["discovery-local-network"]} async-compression = { version = "0.4.30", features = ["lz4", "tokio"] } concat_const = "0.2.0" -irpc = { version = "0.9.0", features = ["rpc", "quinn_endpoint_setup", "spans", "stream", "derive"], default-features = false } [features] hide-proto-docs = [] From 869d659e90887546667808616bac6b57ab34b95b Mon Sep 17 00:00:00 2001 From: Frando Date: Tue, 21 Oct 2025 22:41:51 +0200 Subject: [PATCH 08/16] fix: time and spawn --- Cargo.lock | 12 ++++++------ examples/expiring-tags.rs | 6 +++--- examples/limit.rs | 2 +- src/api/downloader.rs | 2 +- src/get.rs | 3 ++- src/provider.rs | 2 +- src/store/fs.rs | 2 +- src/store/fs/meta.rs | 4 ++-- src/store/fs/util/entity_manager.rs | 2 +- src/store/gc.rs | 2 +- src/store/mem.rs | 6 +++--- src/store/readonly_mem.rs | 2 +- src/tests.rs | 2 +- src/util/connection_pool.rs | 8 ++++---- tests/blobs.rs | 2 +- tests/tags.rs | 2 +- 16 files changed, 30 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aa5a9f9ac..b0a9c0394 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1501,7 +1501,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.5.10", + "socket2 0.6.0", "tokio", "tower-service", "tracing", @@ -1963,7 +1963,7 @@ dependencies = [ "once_cell", "socket2 0.5.10", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3085,7 +3085,7 @@ dependencies = [ "once_cell", "socket2 0.5.10", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3442,7 +3442,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs 0.26.11", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4018,7 +4018,7 @@ dependencies = [ "getrandom 0.3.3", "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4716,7 +4716,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/examples/expiring-tags.rs b/examples/expiring-tags.rs index e19771e80..c8a4e1119 100644 --- a/examples/expiring-tags.rs +++ b/examples/expiring-tags.rs @@ -122,17 +122,17 @@ async fn print_store_info(store: &Store) -> anyhow::Result<()> { } async fn info_task(store: Store) -> anyhow::Result<()> { - tokio::time::sleep(Duration::from_secs(1)).await; + n0_future::time::sleep(Duration::from_secs(1)).await; loop { print_store_info(&store).await?; - tokio::time::sleep(Duration::from_secs(5)).await; + n0_future::time::sleep(Duration::from_secs(5)).await; } } async fn delete_expired_tags_task(store: Store, prefix: &str) -> anyhow::Result<()> { loop { delete_expired_tags(&store, prefix, false).await?; - tokio::time::sleep(Duration::from_secs(5)).await; + n0_future::time::sleep(Duration::from_secs(5)).await; } } diff --git a/examples/limit.rs b/examples/limit.rs index e44aeeb70..e77b53c40 100644 --- a/examples/limit.rs +++ b/examples/limit.rs @@ -156,7 +156,7 @@ fn throttle(delay_ms: u64) -> EventSender { ); // we could compute the delay from the size of the data to have a fixed rate. // but the size is almost always 16 KiB (16 chunks). - tokio::time::sleep(std::time::Duration::from_millis(delay_ms)).await; + n0_future::time::sleep(std::time::Duration::from_millis(delay_ms)).await; msg.tx.send(Ok(())).await.ok(); }); } diff --git a/src/api/downloader.rs b/src/api/downloader.rs index ddf42255e..5cdf3ad54 100644 --- a/src/api/downloader.rs +++ b/src/api/downloader.rs @@ -342,7 +342,7 @@ impl Downloader { pub fn new(store: &Store, endpoint: &Endpoint) -> Self { let (tx, rx) = tokio::sync::mpsc::channel::(32); let actor = DownloaderActor::new(store.clone(), endpoint.clone()); - tokio::spawn(actor.run(rx)); + n0_future::task::spawn(actor.run(rx)); Self { client: tx.into() } } diff --git a/src/get.rs b/src/get.rs index 15f40ea1b..d9c59b034 100644 --- a/src/get.rs +++ b/src/get.rs @@ -18,12 +18,13 @@ //! [iroh]: https://docs.rs/iroh use std::{ fmt::{self, Debug}, - time::{Duration, Instant}, + time::Duration, }; use anyhow::Result; use bao_tree::{io::fsm::BaoContentItem, ChunkNum}; use fsm::RequestCounters; +use n0_future::time::Instant; use n0_snafu::SpanTrace; use nested_enum_utils::common_fields; use serde::{Deserialize, Serialize}; diff --git a/src/provider.rs b/src/provider.rs index 112114447..34c807448 100644 --- a/src/provider.rs +++ b/src/provider.rs @@ -308,7 +308,7 @@ pub async fn handle_connection( while let Ok(pair) = StreamPair::accept(&connection, progress.clone()).await { let span = debug_span!("stream", stream_id = %pair.stream_id()); let store = store.clone(); - tokio::spawn(handle_stream(pair, store).instrument(span)); + n0_future::task::spawn(handle_stream(pair, store).instrument(span)); } progress .connection_closed(|| ConnectionClosed { connection_id }) diff --git a/src/store/fs.rs b/src/store/fs.rs index 8bf43f3d3..53c697abc 100644 --- a/src/store/fs.rs +++ b/src/store/fs.rs @@ -1561,7 +1561,7 @@ pub mod tests { let ranges = ChunkRanges::all(); let (hash, bao) = create_n0_bao(&data, &ranges)?; let obs = store.observe(hash); - let task = tokio::spawn(async move { + let task = n0_future::task::spawn(async move { obs.await_completion().await?; api::Result::Ok(()) }); diff --git a/src/store/fs/meta.rs b/src/store/fs/meta.rs index aac43cb4a..b03304ad1 100644 --- a/src/store/fs/meta.rs +++ b/src/store/fs/meta.rs @@ -766,7 +766,7 @@ impl Actor { self.cmds.push_back(cmd.into()).ok(); let tx = db.begin_read().context(TransactionSnafu)?; let tables = ReadOnlyTables::new(&tx).context(TableSnafu)?; - let timeout = tokio::time::sleep(self.options.max_read_duration); + let timeout = n0_future::time::sleep(self.options.max_read_duration); pin!(timeout); let mut n = 0; while let Some(cmd) = self.cmds.extract(Command::read_only, &mut timeout).await @@ -784,7 +784,7 @@ impl Actor { let ftx = self.ds.begin_write(); let tx = db.begin_write().context(TransactionSnafu)?; let mut tables = Tables::new(&tx, &ftx).context(TableSnafu)?; - let timeout = tokio::time::sleep(self.options.max_read_duration); + let timeout = n0_future::time::sleep(self.options.max_read_duration); pin!(timeout); let mut n = 0; while let Some(cmd) = self diff --git a/src/store/fs/util/entity_manager.rs b/src/store/fs/util/entity_manager.rs index b0b2898ea..ea5762594 100644 --- a/src/store/fs/util/entity_manager.rs +++ b/src/store/fs/util/entity_manager.rs @@ -723,7 +723,7 @@ impl EntityManager

{ options.entity_response_inbox_size, options.entity_futures_initial_capacity, ); - tokio::spawn(actor.run()); + n0_future::task::spawn(actor.run()); Self(send) } diff --git a/src/store/gc.rs b/src/store/gc.rs index ca8404c92..435c06fbf 100644 --- a/src/store/gc.rs +++ b/src/store/gc.rs @@ -221,7 +221,7 @@ pub async fn run_gc(store: Store, config: GcConfig) { let mut live = HashSet::new(); loop { live.clear(); - tokio::time::sleep(config.interval).await; + n0_future::time::sleep(config.interval).await; if let Some(ref cb) = config.add_protected { match (cb)(&mut live).await { ProtectOutcome::Continue => {} diff --git a/src/store/mem.rs b/src/store/mem.rs index 302722325..8df9f08d8 100644 --- a/src/store/mem.rs +++ b/src/store/mem.rs @@ -120,7 +120,7 @@ impl MemStore { pub fn new_with_opts(opts: Options) -> Self { let (sender, receiver) = tokio::sync::mpsc::channel(32); - tokio::spawn( + n0_future::task::spawn( Actor { commands: receiver, tasks: JoinSet::new(), @@ -139,7 +139,7 @@ impl MemStore { let store = Self::from_sender(sender.into()); if let Some(gc_config) = opts.gc_config { - tokio::spawn(run_gc(store.deref().clone(), gc_config)); + n0_future::task::spawn(run_gc(store.deref().clone(), gc_config)); } store @@ -1107,7 +1107,7 @@ mod tests { let store2 = MemStore::new(); let mut or = store2.observe(hash).stream().await?; - tokio::spawn(async move { + n0_future::task::spawn(async move { while let Some(event) = or.next().await { println!("event: {event:?}"); } diff --git a/src/store/readonly_mem.rs b/src/store/readonly_mem.rs index cb46228cd..1f7e1a4e7 100644 --- a/src/store/readonly_mem.rs +++ b/src/store/readonly_mem.rs @@ -369,7 +369,7 @@ impl ReadonlyMemStore { } let (sender, receiver) = tokio::sync::mpsc::channel(1); let actor = Actor::new(receiver, entries); - tokio::spawn(actor.run()); + n0_future::task::spawn(actor.run()); let local = irpc::LocalSender::from(sender); Self { client: local.into(), diff --git a/src/tests.rs b/src/tests.rs index d5ec46f86..deae18bc8 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -264,7 +264,7 @@ async fn two_nodes_observe( let mut stream = store2 .remote() .observe(conn.clone(), ObserveRequest::new(hash)); - let remote_observe_task = tokio::spawn(async move { + let remote_observe_task = n0_future::task::spawn(async move { let mut current = Bitfield::empty(); while let Some(item) = stream.next().await { current = current.combine(item?); diff --git a/src/util/connection_pool.rs b/src/util/connection_pool.rs index 3e90dbcec..95f68560f 100644 --- a/src/util/connection_pool.rs +++ b/src/util/connection_pool.rs @@ -263,7 +263,7 @@ impl Context { break; } // set the idle timer - idle_timer.as_mut().set_future(tokio::time::sleep(context.options.idle_timeout)); + idle_timer.as_mut().set_future(n0_future::time::sleep(context.options.idle_timeout)); } // Idle timeout - request shutdown @@ -420,7 +420,7 @@ impl ConnectionPool { let (actor, tx) = Actor::new(endpoint, alpn, options); // Spawn the main actor - tokio::spawn(actor.run()); + n0_future::task::spawn(actor.run()); Self { tx } } @@ -710,7 +710,7 @@ mod tests { assert_eq!(cid1, cid2); connection_ids.insert(id, cid1); } - tokio::time::sleep(Duration::from_millis(1000)).await; + n0_future::time::sleep(Duration::from_millis(1000)).await; for id in &ids { let cid1 = *connection_ids.get(id).expect("Connection ID not found"); let (cid2, res) = client.echo(*id, msg.clone()).await??; @@ -842,7 +842,7 @@ mod tests { let conn = pool.get_or_connect(ids[0]).await?; let cid1 = conn.stable_id(); conn.close(0u32.into(), b"test"); - tokio::time::sleep(Duration::from_millis(500)).await; + n0_future::time::sleep(Duration::from_millis(500)).await; let conn = pool.get_or_connect(ids[0]).await?; let cid2 = conn.stable_id(); assert_ne!(cid1, cid2); diff --git a/tests/blobs.rs b/tests/blobs.rs index 16f626cc9..e59930a29 100644 --- a/tests/blobs.rs +++ b/tests/blobs.rs @@ -109,7 +109,7 @@ async fn blobs_smoke_fs_rpc() -> TestResult { let client = irpc::util::make_client_endpoint(unspecified, &[cert.as_ref()])?; let td = tempfile::tempdir()?; let store = FsStore::load(td.path().join("a")).await?; - tokio::spawn(store.deref().clone().listen(server.clone())); + n0_future::task::spawn(store.deref().clone().listen(server.clone())); let api = Store::connect(client, server.local_addr()?); blobs_smoke(td.path(), api.blobs()).await?; api.shutdown().await?; diff --git a/tests/tags.rs b/tests/tags.rs index 5fe929488..3df517756 100644 --- a/tests/tags.rs +++ b/tests/tags.rs @@ -154,7 +154,7 @@ async fn tags_smoke_fs_rpc() -> TestResult<()> { let client = irpc::util::make_client_endpoint(unspecified, &[cert.as_ref()])?; let td = tempfile::tempdir()?; let store = FsStore::load(td.path().join("a")).await?; - tokio::spawn(store.deref().clone().listen(server.clone())); + n0_future::task::spawn(store.deref().clone().listen(server.clone())); let api = Store::connect(client, server.local_addr()?); tags_smoke(api.tags()).await?; api.shutdown().await?; From f4d36c4a21d5eb011b1c613b366d9652af6d000f Mon Sep 17 00:00:00 2001 From: Frando Date: Tue, 21 Oct 2025 22:49:44 +0200 Subject: [PATCH 09/16] fixup feature flags and bump n0-future --- Cargo.lock | 6 +++--- Cargo.toml | 14 +++++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b0a9c0394..ac02e4f03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1845,7 +1845,7 @@ dependencies = [ "iroh-quinn", "iroh-test", "irpc", - "n0-future 0.2.0", + "n0-future 0.3.0", "n0-snafu", "nested_enum_utils", "postcard", @@ -2286,9 +2286,9 @@ dependencies = [ [[package]] name = "n0-future" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d7dd42bd0114c9daa9c4f2255d692a73bba45767ec32cf62892af6fe5d31f6" +checksum = "439e746b307c1fd0c08771c3cafcd1746c3ccdb0d9c7b859d3caded366b6da76" dependencies = [ "cfg_aliases", "derive_more 1.0.0", diff --git a/Cargo.toml b/Cargo.toml index 44c63b4bd..cac0038b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ bytes = { version = "1", features = ["serde"] } derive_more = { version = "2.0.1", features = ["from", "try_from", "into", "debug", "display", "deref", "deref_mut"] } futures-lite = "2.6.0" quinn = { package = "iroh-quinn", version = "0.14.0", optional = true } -n0-future = "0.2.0" +n0-future = "0.3" n0-snafu = "0.2.2" range-collections = { version = "0.4.6", features = ["serde"] } smallvec = { version = "1", features = ["serde", "const_new"] } @@ -62,6 +62,9 @@ iroh = { version = "0.93", features = ["discovery-local-network"]} async-compression = { version = "0.4.30", features = ["lz4", "tokio"] } concat_const = "0.2.0" +[build-dependencies] +cfg_aliases = "0.2.1" + [features] hide-proto-docs = [] metrics = [] @@ -73,5 +76,10 @@ rpc = ["dep:quinn", "irpc/rpc", "irpc/quinn_endpoint_setup"] irpc = { git = "https://github.com/n0-computer/irpc", branch = "Frando/varint-feature" } bao-tree = { git = "https://github.com/n0-computer/bao-tree.git", branch = "Frando/wasm" } -[build-dependencies] -cfg_aliases = "0.2.1" +[[example]] +name = "expiring-tags" +required-features = ["fs-store"] + +[[example]] +name = "random_store" +required-features = ["fs-store"] From bd3b62aad58f08239f0f76028f5f85942b0a93fb Mon Sep 17 00:00:00 2001 From: Frando Date: Tue, 21 Oct 2025 22:50:14 +0200 Subject: [PATCH 10/16] fix: more n0-future --- src/api/downloader.rs | 4 ++-- src/store/readonly_mem.rs | 2 +- src/tests.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api/downloader.rs b/src/api/downloader.rs index 5cdf3ad54..a5e5cbf41 100644 --- a/src/api/downloader.rs +++ b/src/api/downloader.rs @@ -13,7 +13,7 @@ use irpc::{channel::mpsc, rpc_requests}; use n0_future::{future, stream, BufferedStreamExt, Stream, StreamExt}; use rand::seq::SliceRandom; use serde::{de::Error, Deserialize, Serialize}; -use tokio::task::JoinSet; +use n0_future::task::JoinSet; use tracing::instrument::Instrument; use super::Store; @@ -42,7 +42,7 @@ struct DownloaderActor { store: Store, pool: ConnectionPool, tasks: JoinSet<()>, - running: HashSet, + running: HashSet, } #[derive(Debug, Serialize, Deserialize)] diff --git a/src/store/readonly_mem.rs b/src/store/readonly_mem.rs index 1f7e1a4e7..4a0dd122d 100644 --- a/src/store/readonly_mem.rs +++ b/src/store/readonly_mem.rs @@ -26,7 +26,7 @@ use irpc::channel::mpsc; use n0_future::future::{self, yield_now}; use range_collections::range_set::RangeSetRange; use ref_cast::RefCast; -use tokio::task::{JoinError, JoinSet}; +use n0_future::task::{JoinError, JoinSet}; use super::util::BaoTreeSender; use crate::{ diff --git a/src/tests.rs b/src/tests.rs index deae18bc8..e4d3e9704 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -344,7 +344,7 @@ fn event_handler( let (count_tx, count_rx) = tokio::sync::watch::channel(0usize); let (events_tx, mut events_rx) = EventSender::channel(16, EventMask::ALL_READONLY); let allowed_nodes = allowed_nodes.into_iter().collect::>(); - let task = AbortOnDropHandle::new(tokio::task::spawn(async move { + let task = AbortOnDropHandle::new(n0_future::task::spawn(async move { while let Some(event) = events_rx.recv().await { match event { ProviderMessage::ClientConnected(msg) => { @@ -358,7 +358,7 @@ fn event_handler( ProviderMessage::PushRequestReceived(mut msg) => { msg.tx.send(Ok(())).await.ok(); let count_tx = count_tx.clone(); - tokio::task::spawn(async move { + n0_future::task::spawn(async move { while let Ok(Some(update)) = msg.rx.recv().await { if let RequestUpdate::Completed(_) = update { count_tx.send_modify(|x| *x += 1); From ce43f1cc4f4f84e8197367602cd58a9a1f4b15a9 Mon Sep 17 00:00:00 2001 From: Frando Date: Wed, 22 Oct 2025 00:09:46 +0200 Subject: [PATCH 11/16] fix: more time fixes --- src/provider.rs | 9 ++------- src/store/mem.rs | 10 +++++----- src/store/util.rs | 10 +++++++++- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/provider.rs b/src/provider.rs index 34c807448..e3a70c969 100644 --- a/src/provider.rs +++ b/src/provider.rs @@ -3,18 +3,13 @@ //! Note that while using this API directly is fine, the standard way //! to provide data is to just register a [`crate::BlobsProtocol`] protocol //! handler with an [`iroh::Endpoint`](iroh::protocol::Router). -use std::{ - fmt::Debug, - future::Future, - io, - time::{Duration, Instant}, -}; +use std::{fmt::Debug, future::Future, io, time::Duration}; use anyhow::Result; use bao_tree::ChunkRanges; use iroh::endpoint::{self, ConnectionError, VarInt}; use iroh_io::{AsyncStreamReader, AsyncStreamWriter}; -use n0_future::StreamExt; +use n0_future::{time::Instant, StreamExt}; use serde::{Deserialize, Serialize}; use snafu::Snafu; use tokio::select; diff --git a/src/store/mem.rs b/src/store/mem.rs index 8df9f08d8..bbdd78913 100644 --- a/src/store/mem.rs +++ b/src/store/mem.rs @@ -14,7 +14,6 @@ use std::{ num::NonZeroU64, ops::Deref, sync::Arc, - time::SystemTime, }; use bao_tree::{ @@ -29,12 +28,13 @@ use bao_tree::{ }; use bytes::Bytes; use irpc::channel::mpsc; -use n0_future::future::yield_now; -use range_collections::range_set::RangeSetRange; -use tokio::{ - sync::watch, +use n0_future::{ + future::yield_now, task::{JoinError, JoinSet}, + time::SystemTime, }; +use range_collections::range_set::RangeSetRange; +use tokio::sync::watch; use tracing::{error, info, instrument, trace, Instrument}; use super::util::{BaoTreeSender, PartialMemStorage}; diff --git a/src/store/util.rs b/src/store/util.rs index 03be152bb..03630a6fc 100644 --- a/src/store/util.rs +++ b/src/store/util.rs @@ -1,8 +1,9 @@ -use std::{borrow::Borrow, fmt, time::SystemTime}; +use std::{borrow::Borrow, fmt}; use bao_tree::io::mixed::EncodedItem; use bytes::Bytes; use derive_more::{From, Into}; +use n0_future::time::SystemTime; mod sparse_mem_file; use irpc::channel::mpsc; @@ -68,6 +69,13 @@ impl fmt::Display for Tag { impl Tag { /// Create a new tag that does not exist yet. pub fn auto(time: SystemTime, exists: impl Fn(&[u8]) -> bool) -> Self { + // On wasm, SystemTime is web_time::SystemTime, but we need a std system time + // to convert to chrono. + // TODO: Upstream to n0-future or expose SystemTimeExt on wasm + #[cfg(wasm_browser)] + let time = std::time::SystemTime::UNIX_EPOCH + + time.duration_since(SystemTime::UNIX_EPOCH).unwrap(); + let now = chrono::DateTime::::from(time); let mut i = 0; loop { From bd099e1f248bcc58da04f508e24f08376d7c2435 Mon Sep 17 00:00:00 2001 From: Frando Date: Wed, 22 Oct 2025 00:43:26 +0200 Subject: [PATCH 12/16] bump deps --- Cargo.lock | 8 ++++---- Cargo.toml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 84350476a..518ff0a99 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -259,7 +259,7 @@ dependencies = [ [[package]] name = "bao-tree" version = "0.15.1" -source = "git+https://github.com/n0-computer/bao-tree.git?branch=Frando%2Fwasm#800607243583126d06237a582049f606386d787a" +source = "git+https://github.com/n0-computer/bao-tree?branch=main#109ce557ec3feafb29a4702a0d1d195b1d52a706" dependencies = [ "blake3", "bytes", @@ -1909,7 +1909,7 @@ dependencies = [ [[package]] name = "irpc" version = "0.10.0" -source = "git+https://github.com/n0-computer/irpc?branch=Frando%2Fvarint-feature#417ad94ca8e13b6e2174eb00d8ac9c9d827f0f3a" +source = "git+https://github.com/n0-computer/irpc?branch=main#83c9dcbfe000f016e9a77419472a8b717036d5c8" dependencies = [ "anyhow", "futures-buffered", @@ -1931,7 +1931,7 @@ dependencies = [ [[package]] name = "irpc-derive" version = "0.8.0" -source = "git+https://github.com/n0-computer/irpc?branch=Frando%2Fvarint-feature#417ad94ca8e13b6e2174eb00d8ac9c9d827f0f3a" +source = "git+https://github.com/n0-computer/irpc?branch=main#83c9dcbfe000f016e9a77419472a8b717036d5c8" dependencies = [ "proc-macro2", "quote", @@ -4290,7 +4290,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 5567e6fc7..e6f448bc7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,10 +73,6 @@ default = ["hide-proto-docs", "fs-store", "rpc"] fs-store = ["dep:redb", "dep:reflink-copy", "bao-tree/fs"] rpc = ["dep:quinn", "irpc/rpc", "irpc/quinn_endpoint_setup"] -[patch.crates-io] -irpc = { git = "https://github.com/n0-computer/irpc", branch = "Frando/varint-feature" } -bao-tree = { git = "https://github.com/n0-computer/bao-tree.git", branch = "Frando/wasm" } - [[example]] name = "expiring-tags" required-features = ["fs-store"] @@ -84,3 +80,7 @@ required-features = ["fs-store"] [[example]] name = "random_store" required-features = ["fs-store"] + +[patch.crates-io] +irpc = { git = "https://github.com/n0-computer/irpc", branch = "main" } +bao-tree = { git = "https://github.com/n0-computer/bao-tree", branch = "main" } From 042d17e4a6e5e63f140eaba73bc09cb1ef257f82 Mon Sep 17 00:00:00 2001 From: Frando Date: Wed, 22 Oct 2025 10:49:41 +0200 Subject: [PATCH 13/16] fix: wasm needs --no-default-features --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2019aff4c..46c5acf44 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -307,7 +307,7 @@ jobs: tool: wasm-bindgen,wasm-pack - name: wasm32 build - run: cargo build --target wasm32-unknown-unknown + run: cargo build --target wasm32-unknown-unknown --no-default-features # If the Wasm file contains any 'import "env"' declarations, then # some non-Wasm-compatible code made it into the final code. From a4320cd019e7f02b3787a95040d2048a3750e8dd Mon Sep 17 00:00:00 2001 From: Frando Date: Wed, 22 Oct 2025 10:49:53 +0200 Subject: [PATCH 14/16] chore: fmt --- src/api/downloader.rs | 3 +-- src/store/readonly_mem.rs | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/api/downloader.rs b/src/api/downloader.rs index e74d933e3..9f5bfbc2d 100644 --- a/src/api/downloader.rs +++ b/src/api/downloader.rs @@ -10,10 +10,9 @@ use anyhow::bail; use genawaiter::sync::Gen; use iroh::{Endpoint, EndpointId}; use irpc::{channel::mpsc, rpc_requests}; -use n0_future::{future, stream, BufferedStreamExt, Stream, StreamExt}; +use n0_future::{future, stream, task::JoinSet, BufferedStreamExt, Stream, StreamExt}; use rand::seq::SliceRandom; use serde::{de::Error, Deserialize, Serialize}; -use n0_future::task::JoinSet; use tracing::instrument::Instrument; use super::Store; diff --git a/src/store/readonly_mem.rs b/src/store/readonly_mem.rs index 4a0dd122d..649acdcbc 100644 --- a/src/store/readonly_mem.rs +++ b/src/store/readonly_mem.rs @@ -23,10 +23,12 @@ use bao_tree::{ }; use bytes::Bytes; use irpc::channel::mpsc; -use n0_future::future::{self, yield_now}; +use n0_future::{ + future::{self, yield_now}, + task::{JoinError, JoinSet}, +}; use range_collections::range_set::RangeSetRange; use ref_cast::RefCast; -use n0_future::task::{JoinError, JoinSet}; use super::util::BaoTreeSender; use crate::{ From 6ad91f7e012bbb1879ea704f830f4e1c02182851 Mon Sep 17 00:00:00 2001 From: Frando Date: Wed, 22 Oct 2025 11:17:05 +0200 Subject: [PATCH 15/16] fix: disable wasm tests, needs more dep fiddling --- .github/workflows/ci.yaml | 241 +++++++++++++++++++------------------- 1 file changed, 119 insertions(+), 122 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 46c5acf44..d4ed50ee4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,7 +2,7 @@ name: CI on: pull_request: - types: [ 'labeled', 'unlabeled', 'opened', 'synchronize', 'reopened' ] + types: ["labeled", "unlabeled", "opened", "synchronize", "reopened"] merge_group: push: branches: @@ -24,7 +24,7 @@ jobs: tests: name: CI Test Suite if: "github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')" - uses: './.github/workflows/tests.yaml' + uses: "./.github/workflows/tests.yaml" cross_build: name: Cross Build Only @@ -35,8 +35,8 @@ jobs: fail-fast: false matrix: target: - # cross tests are currently broken vor armv7 and aarch64 - # see https://github.com/cross-rs/cross/issues/1311 + # cross tests are currently broken vor armv7 and aarch64 + # see https://github.com/cross-rs/cross/issues/1311 # - armv7-linux-androideabi # - aarch64-linux-android # Freebsd execution fails in cross @@ -45,29 +45,29 @@ jobs: # Netbsd execution fails to link in cross # - x86_64-unknown-netbsd steps: - - name: Checkout - uses: actions/checkout@v5 - with: - submodules: recursive - - - name: Install rust stable - uses: dtolnay/rust-toolchain@stable - - - name: Cleanup Docker - continue-on-error: true - run: | - docker kill $(docker ps -q) - - # See https://github.com/cross-rs/cross/issues/1222 - - uses: taiki-e/install-action@cross - - - name: build - # cross tests are currently broken vor armv7 and aarch64 - # see https://github.com/cross-rs/cross/issues/1311. So on - # those platforms we only build but do not run tests. - run: cross build --all --target ${{ matrix.target }} - env: - RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG'}} + - name: Checkout + uses: actions/checkout@v5 + with: + submodules: recursive + + - name: Install rust stable + uses: dtolnay/rust-toolchain@stable + + - name: Cleanup Docker + continue-on-error: true + run: | + docker kill $(docker ps -q) + + # See https://github.com/cross-rs/cross/issues/1222 + - uses: taiki-e/install-action@cross + + - name: build + # cross tests are currently broken vor armv7 and aarch64 + # see https://github.com/cross-rs/cross/issues/1311. So on + # those platforms we only build but do not run tests. + run: cross build --all --target ${{ matrix.target }} + env: + RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG'}} android_build: name: Android Build Only @@ -82,38 +82,38 @@ jobs: - aarch64-linux-android - armv7-linux-androideabi steps: - - name: Checkout - uses: actions/checkout@v5 - - - name: Set up Rust - uses: dtolnay/rust-toolchain@stable - with: - target: ${{ matrix.target }} - - name: Install rustup target - run: rustup target add ${{ matrix.target }} - - - name: Setup Java - uses: actions/setup-java@v5 - with: - distribution: 'temurin' - java-version: '17' - - - name: Setup Android SDK - uses: android-actions/setup-android@v3 - - - name: Setup Android NDK - uses: arqu/setup-ndk@main - id: setup-ndk - with: - ndk-version: r23 - add-to-path: true - - - name: Build - env: - ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} - run: | - cargo install --version 3.5.4 cargo-ndk - cargo ndk --target ${{ matrix.target }} build + - name: Checkout + uses: actions/checkout@v5 + + - name: Set up Rust + uses: dtolnay/rust-toolchain@stable + with: + target: ${{ matrix.target }} + - name: Install rustup target + run: rustup target add ${{ matrix.target }} + + - name: Setup Java + uses: actions/setup-java@v5 + with: + distribution: "temurin" + java-version: "17" + + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + + - name: Setup Android NDK + uses: arqu/setup-ndk@main + id: setup-ndk + with: + ndk-version: r23 + add-to-path: true + + - name: Build + env: + ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} + run: | + cargo install --version 3.5.4 cargo-ndk + cargo ndk --target ${{ matrix.target }} build cross_test: name: Cross Test @@ -126,26 +126,26 @@ jobs: target: - i686-unknown-linux-gnu steps: - - name: Checkout - uses: actions/checkout@v5 - with: - submodules: recursive + - name: Checkout + uses: actions/checkout@v5 + with: + submodules: recursive - - name: Install rust stable - uses: dtolnay/rust-toolchain@stable + - name: Install rust stable + uses: dtolnay/rust-toolchain@stable - - name: Cleanup Docker - continue-on-error: true - run: | - docker kill $(docker ps -q) + - name: Cleanup Docker + continue-on-error: true + run: | + docker kill $(docker ps -q) - # See https://github.com/cross-rs/cross/issues/1222 - - uses: taiki-e/install-action@cross + # See https://github.com/cross-rs/cross/issues/1222 + - uses: taiki-e/install-action@cross - - name: test - run: cross test --all --target ${{ matrix.target }} -- --test-threads=1 - env: - RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG' }} + - name: test + run: cross test --all --target ${{ matrix.target }} -- --test-threads=1 + env: + RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG' }} check_semver: runs-on: ubuntu-latest @@ -185,13 +185,13 @@ jobs: RUSTC_WRAPPER: "sccache" SCCACHE_GHA_ENABLED: "on" steps: - - uses: actions/checkout@v5 - - uses: dtolnay/rust-toolchain@stable - with: - components: rustfmt - - uses: mozilla-actions/sccache-action@v0.0.9 - - uses: taiki-e/install-action@cargo-make - - run: cargo make format-check + - uses: actions/checkout@v5 + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - uses: mozilla-actions/sccache-action@v0.0.9 + - uses: taiki-e/install-action@cargo-make + - run: cargo make format-check check_docs: timeout-minutes: 30 @@ -201,17 +201,17 @@ jobs: RUSTC_WRAPPER: "sccache" SCCACHE_GHA_ENABLED: "on" steps: - - uses: actions/checkout@v5 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: nightly-2025-09-28 - - name: Install sccache - uses: mozilla-actions/sccache-action@v0.0.9 - - - name: Docs - run: cargo doc --workspace --all-features --no-deps --document-private-items - env: - RUSTDOCFLAGS: --cfg docsrs + - uses: actions/checkout@v5 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly-2025-09-28 + - name: Install sccache + uses: mozilla-actions/sccache-action@v0.0.9 + + - name: Docs + run: cargo doc --workspace --all-features --no-deps --document-private-items + env: + RUSTDOCFLAGS: --cfg docsrs clippy_check: timeout-minutes: 30 @@ -220,23 +220,23 @@ jobs: RUSTC_WRAPPER: "sccache" SCCACHE_GHA_ENABLED: "on" steps: - - uses: actions/checkout@v5 - - uses: dtolnay/rust-toolchain@stable - with: - components: clippy - - name: Install sccache - uses: mozilla-actions/sccache-action@v0.0.9 + - uses: actions/checkout@v5 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - name: Install sccache + uses: mozilla-actions/sccache-action@v0.0.9 - # TODO: We have a bunch of platform-dependent code so should - # probably run this job on the full platform matrix - - name: clippy check (all features) - run: cargo clippy --workspace --all-features --all-targets --bins --tests --benches + # TODO: We have a bunch of platform-dependent code so should + # probably run this job on the full platform matrix + - name: clippy check (all features) + run: cargo clippy --workspace --all-features --all-targets --bins --tests --benches - - name: clippy check (no features) - run: cargo clippy --workspace --no-default-features --lib --bins --tests + - name: clippy check (no features) + run: cargo clippy --workspace --no-default-features --lib --bins --tests - - name: clippy check (default features) - run: cargo clippy --workspace --all-targets + - name: clippy check (default features) + run: cargo clippy --workspace --all-targets msrv: if: "github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')" @@ -247,16 +247,16 @@ jobs: RUSTC_WRAPPER: "sccache" SCCACHE_GHA_ENABLED: "on" steps: - - uses: actions/checkout@v5 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ env.MSRV }} - - name: Install sccache - uses: mozilla-actions/sccache-action@v0.0.9 + - uses: actions/checkout@v5 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ env.MSRV }} + - name: Install sccache + uses: mozilla-actions/sccache-action@v0.0.9 - - name: Check MSRV all features - run: | - cargo +$MSRV check --workspace --all-targets + - name: Check MSRV all features + run: | + cargo +$MSRV check --workspace --all-targets cargo_deny: timeout-minutes: 30 @@ -274,9 +274,9 @@ jobs: timeout-minutes: 30 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 - - run: pip install --user codespell[toml] - - run: codespell --ignore-words-list=ans,atmost,crate,inout,ratatui,ser,stayin,swarmin,worl --skip=CHANGELOG.md + - uses: actions/checkout@v5 + - run: pip install --user codespell[toml] + - run: codespell --ignore-words-list=ans,atmost,crate,inout,ratatui,ser,stayin,swarmin,worl --skip=CHANGELOG.md wasm_build: name: Build & test wasm32 @@ -314,6 +314,3 @@ jobs: - name: Ensure no 'import "env"' in wasm run: | ! wasm-tools print --skeleton target/wasm32-unknown-unknown/debug/iroh_blobs.wasm | grep 'import "env"' - - - name: wasm32 test - run: wasm-pack test --node \ No newline at end of file From 345460894e97c3e458c295e0a6c965514410105f Mon Sep 17 00:00:00 2001 From: Frando Date: Wed, 22 Oct 2025 14:22:14 +0200 Subject: [PATCH 16/16] fixup --- .github/workflows/ci.yaml | 240 +++++++++++++++++++------------------- 1 file changed, 120 insertions(+), 120 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d4ed50ee4..7a3eac76c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,7 +2,7 @@ name: CI on: pull_request: - types: ["labeled", "unlabeled", "opened", "synchronize", "reopened"] + types: [ 'labeled', 'unlabeled', 'opened', 'synchronize', 'reopened' ] merge_group: push: branches: @@ -24,7 +24,7 @@ jobs: tests: name: CI Test Suite if: "github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')" - uses: "./.github/workflows/tests.yaml" + uses: './.github/workflows/tests.yaml' cross_build: name: Cross Build Only @@ -35,8 +35,8 @@ jobs: fail-fast: false matrix: target: - # cross tests are currently broken vor armv7 and aarch64 - # see https://github.com/cross-rs/cross/issues/1311 + # cross tests are currently broken vor armv7 and aarch64 + # see https://github.com/cross-rs/cross/issues/1311 # - armv7-linux-androideabi # - aarch64-linux-android # Freebsd execution fails in cross @@ -45,29 +45,29 @@ jobs: # Netbsd execution fails to link in cross # - x86_64-unknown-netbsd steps: - - name: Checkout - uses: actions/checkout@v5 - with: - submodules: recursive - - - name: Install rust stable - uses: dtolnay/rust-toolchain@stable - - - name: Cleanup Docker - continue-on-error: true - run: | - docker kill $(docker ps -q) - - # See https://github.com/cross-rs/cross/issues/1222 - - uses: taiki-e/install-action@cross - - - name: build - # cross tests are currently broken vor armv7 and aarch64 - # see https://github.com/cross-rs/cross/issues/1311. So on - # those platforms we only build but do not run tests. - run: cross build --all --target ${{ matrix.target }} - env: - RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG'}} + - name: Checkout + uses: actions/checkout@v5 + with: + submodules: recursive + + - name: Install rust stable + uses: dtolnay/rust-toolchain@stable + + - name: Cleanup Docker + continue-on-error: true + run: | + docker kill $(docker ps -q) + + # See https://github.com/cross-rs/cross/issues/1222 + - uses: taiki-e/install-action@cross + + - name: build + # cross tests are currently broken vor armv7 and aarch64 + # see https://github.com/cross-rs/cross/issues/1311. So on + # those platforms we only build but do not run tests. + run: cross build --all --target ${{ matrix.target }} + env: + RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG'}} android_build: name: Android Build Only @@ -82,38 +82,38 @@ jobs: - aarch64-linux-android - armv7-linux-androideabi steps: - - name: Checkout - uses: actions/checkout@v5 - - - name: Set up Rust - uses: dtolnay/rust-toolchain@stable - with: - target: ${{ matrix.target }} - - name: Install rustup target - run: rustup target add ${{ matrix.target }} - - - name: Setup Java - uses: actions/setup-java@v5 - with: - distribution: "temurin" - java-version: "17" - - - name: Setup Android SDK - uses: android-actions/setup-android@v3 - - - name: Setup Android NDK - uses: arqu/setup-ndk@main - id: setup-ndk - with: - ndk-version: r23 - add-to-path: true - - - name: Build - env: - ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} - run: | - cargo install --version 3.5.4 cargo-ndk - cargo ndk --target ${{ matrix.target }} build + - name: Checkout + uses: actions/checkout@v5 + + - name: Set up Rust + uses: dtolnay/rust-toolchain@stable + with: + target: ${{ matrix.target }} + - name: Install rustup target + run: rustup target add ${{ matrix.target }} + + - name: Setup Java + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: '17' + + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + + - name: Setup Android NDK + uses: arqu/setup-ndk@main + id: setup-ndk + with: + ndk-version: r23 + add-to-path: true + + - name: Build + env: + ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} + run: | + cargo install --version 3.5.4 cargo-ndk + cargo ndk --target ${{ matrix.target }} build cross_test: name: Cross Test @@ -126,26 +126,26 @@ jobs: target: - i686-unknown-linux-gnu steps: - - name: Checkout - uses: actions/checkout@v5 - with: - submodules: recursive + - name: Checkout + uses: actions/checkout@v5 + with: + submodules: recursive - - name: Install rust stable - uses: dtolnay/rust-toolchain@stable + - name: Install rust stable + uses: dtolnay/rust-toolchain@stable - - name: Cleanup Docker - continue-on-error: true - run: | - docker kill $(docker ps -q) + - name: Cleanup Docker + continue-on-error: true + run: | + docker kill $(docker ps -q) - # See https://github.com/cross-rs/cross/issues/1222 - - uses: taiki-e/install-action@cross + # See https://github.com/cross-rs/cross/issues/1222 + - uses: taiki-e/install-action@cross - - name: test - run: cross test --all --target ${{ matrix.target }} -- --test-threads=1 - env: - RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG' }} + - name: test + run: cross test --all --target ${{ matrix.target }} -- --test-threads=1 + env: + RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG' }} check_semver: runs-on: ubuntu-latest @@ -185,13 +185,13 @@ jobs: RUSTC_WRAPPER: "sccache" SCCACHE_GHA_ENABLED: "on" steps: - - uses: actions/checkout@v5 - - uses: dtolnay/rust-toolchain@stable - with: - components: rustfmt - - uses: mozilla-actions/sccache-action@v0.0.9 - - uses: taiki-e/install-action@cargo-make - - run: cargo make format-check + - uses: actions/checkout@v5 + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - uses: mozilla-actions/sccache-action@v0.0.9 + - uses: taiki-e/install-action@cargo-make + - run: cargo make format-check check_docs: timeout-minutes: 30 @@ -201,17 +201,17 @@ jobs: RUSTC_WRAPPER: "sccache" SCCACHE_GHA_ENABLED: "on" steps: - - uses: actions/checkout@v5 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: nightly-2025-09-28 - - name: Install sccache - uses: mozilla-actions/sccache-action@v0.0.9 - - - name: Docs - run: cargo doc --workspace --all-features --no-deps --document-private-items - env: - RUSTDOCFLAGS: --cfg docsrs + - uses: actions/checkout@v5 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly-2025-09-28 + - name: Install sccache + uses: mozilla-actions/sccache-action@v0.0.9 + + - name: Docs + run: cargo doc --workspace --all-features --no-deps --document-private-items + env: + RUSTDOCFLAGS: --cfg docsrs clippy_check: timeout-minutes: 30 @@ -220,23 +220,23 @@ jobs: RUSTC_WRAPPER: "sccache" SCCACHE_GHA_ENABLED: "on" steps: - - uses: actions/checkout@v5 - - uses: dtolnay/rust-toolchain@stable - with: - components: clippy - - name: Install sccache - uses: mozilla-actions/sccache-action@v0.0.9 + - uses: actions/checkout@v5 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - name: Install sccache + uses: mozilla-actions/sccache-action@v0.0.9 - # TODO: We have a bunch of platform-dependent code so should - # probably run this job on the full platform matrix - - name: clippy check (all features) - run: cargo clippy --workspace --all-features --all-targets --bins --tests --benches + # TODO: We have a bunch of platform-dependent code so should + # probably run this job on the full platform matrix + - name: clippy check (all features) + run: cargo clippy --workspace --all-features --all-targets --bins --tests --benches - - name: clippy check (no features) - run: cargo clippy --workspace --no-default-features --lib --bins --tests + - name: clippy check (no features) + run: cargo clippy --workspace --no-default-features --lib --bins --tests - - name: clippy check (default features) - run: cargo clippy --workspace --all-targets + - name: clippy check (default features) + run: cargo clippy --workspace --all-targets msrv: if: "github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')" @@ -247,16 +247,16 @@ jobs: RUSTC_WRAPPER: "sccache" SCCACHE_GHA_ENABLED: "on" steps: - - uses: actions/checkout@v5 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ env.MSRV }} - - name: Install sccache - uses: mozilla-actions/sccache-action@v0.0.9 + - uses: actions/checkout@v5 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ env.MSRV }} + - name: Install sccache + uses: mozilla-actions/sccache-action@v0.0.9 - - name: Check MSRV all features - run: | - cargo +$MSRV check --workspace --all-targets + - name: Check MSRV all features + run: | + cargo +$MSRV check --workspace --all-targets cargo_deny: timeout-minutes: 30 @@ -274,9 +274,9 @@ jobs: timeout-minutes: 30 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 - - run: pip install --user codespell[toml] - - run: codespell --ignore-words-list=ans,atmost,crate,inout,ratatui,ser,stayin,swarmin,worl --skip=CHANGELOG.md + - uses: actions/checkout@v5 + - run: pip install --user codespell[toml] + - run: codespell --ignore-words-list=ans,atmost,crate,inout,ratatui,ser,stayin,swarmin,worl --skip=CHANGELOG.md wasm_build: name: Build & test wasm32 @@ -313,4 +313,4 @@ jobs: # some non-Wasm-compatible code made it into the final code. - name: Ensure no 'import "env"' in wasm run: | - ! wasm-tools print --skeleton target/wasm32-unknown-unknown/debug/iroh_blobs.wasm | grep 'import "env"' + ! wasm-tools print --skeleton target/wasm32-unknown-unknown/debug/iroh_blobs.wasm | grep 'import "env"' \ No newline at end of file