From b5fb1904db2b49bf8cd80c91c889654268f52932 Mon Sep 17 00:00:00 2001 From: ko1N Date: Tue, 7 Apr 2026 20:20:51 +0200 Subject: [PATCH 1/2] Disable default arrayvec features --- Cargo.toml | 2 ++ crates/iris-crypto/Cargo.toml | 2 +- crates/iris-ztd/Cargo.toml | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4eb892e..95da8ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,3 +57,5 @@ ibig = { version = "0.3", default-features = false, features = ["num-traits"] } crypto-bigint = { version = "0.6", default-features = false, features = ["serde"] } serdect = { version = "0.3", default-features = false } serde = { version = "1.0", default-features = false, features = ["derive"] } +arrayvec = { version = "0.7", default-features = false } + diff --git a/crates/iris-crypto/Cargo.toml b/crates/iris-crypto/Cargo.toml index 4b21b11..9892056 100644 --- a/crates/iris-crypto/Cargo.toml +++ b/crates/iris-crypto/Cargo.toml @@ -21,7 +21,7 @@ hmac = { version = "0.12", default-features = false } sha2 = { version = "0.10", default-features = false } bs58 = { version = "0.5", default-features = false, features = [] } serde = { workspace = true } -arrayvec = "0.7" +arrayvec = { workspace = true } tsify = { workspace = true, optional = true } wasm-bindgen = { workspace = true, optional = true } crypto-bigint.workspace = true diff --git a/crates/iris-ztd/Cargo.toml b/crates/iris-ztd/Cargo.toml index 0f1b65e..3f51c02 100644 --- a/crates/iris-ztd/Cargo.toml +++ b/crates/iris-ztd/Cargo.toml @@ -20,10 +20,10 @@ arrayref = "0.3" num-traits = { version = "0.2", default-features = false } serde = { workspace = true } iris-ztd-derive = { workspace = true } -arrayvec = "0.7" +arrayvec = { workspace = true } tsify = { workspace = true, optional = true } wasm-bindgen = { workspace = true, optional = true } -either = { version = "1", default_features = false } +either = { version = "1", default-features = false } [dev-dependencies] serde_json = { version = "1", default-features = false, features = ["alloc"] } From 19e438997ecec3ea7fd3daed902608a0a8fc7773 Mon Sep 17 00:00:00 2001 From: ko1N Date: Tue, 7 Apr 2026 21:47:15 +0200 Subject: [PATCH 2/2] Add missing alloc feature gates and add ci step --- .github/workflows/nostd-build.yaml | 32 ++++++++++++++++++++++++++++++ crates/iris-ztd/src/fixed.rs | 8 +++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/nostd-build.yaml diff --git a/.github/workflows/nostd-build.yaml b/.github/workflows/nostd-build.yaml new file mode 100644 index 0000000..3f79a19 --- /dev/null +++ b/.github/workflows/nostd-build.yaml @@ -0,0 +1,32 @@ +name: no_std Build + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@1.91.0 + with: + targets: wasm32-unknown-unknown + + - name: Check iris-ztd no-alloc + run: cargo check -p iris-ztd --no-default-features --target wasm32-unknown-unknown + + - name: Check iris-ztd alloc + run: cargo check -p iris-ztd --no-default-features --features alloc --target wasm32-unknown-unknown + + - name: Check iris-crypto alloc + run: cargo check -p iris-crypto --no-default-features --features alloc --target wasm32-unknown-unknown diff --git a/crates/iris-ztd/src/fixed.rs b/crates/iris-ztd/src/fixed.rs index 94d0782..f14332c 100644 --- a/crates/iris-ztd/src/fixed.rs +++ b/crates/iris-ztd/src/fixed.rs @@ -1,4 +1,6 @@ -use crate::{Digest, Hashable, Noun, NounDecode, NounEncode}; +use crate::{Digest, Hashable}; +#[cfg(feature = "alloc")] +use crate::{Noun, NounDecode, NounEncode}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; macro_rules! fixed_noun { @@ -44,12 +46,14 @@ macro_rules! fixed_noun { } } + #[cfg(feature = "alloc")] impl NounEncode for $n { fn to_noun(&self) -> Noun { V.to_noun() } } + #[cfg(feature = "alloc")] impl NounDecode for $n { fn from_noun(noun: &Noun) -> Option { let v: $d = NounDecode::from_noun(noun)?; @@ -164,12 +168,14 @@ impl<'de, const V: u64> Deserialize<'de> for FixedTas { } } +#[cfg(feature = "alloc")] impl NounEncode for FixedTas { fn to_noun(&self) -> Noun { V.to_noun() } } +#[cfg(feature = "alloc")] impl NounDecode for FixedTas { fn from_noun(noun: &Noun) -> Option { let v: u64 = NounDecode::from_noun(noun)?;