Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/nostd-build.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

2 changes: 1 addition & 1 deletion crates/iris-crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions crates/iris-ztd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
8 changes: 7 additions & 1 deletion crates/iris-ztd/src/fixed.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -44,12 +46,14 @@ macro_rules! fixed_noun {
}
}

#[cfg(feature = "alloc")]
impl<const V: $t> NounEncode for $n<V> {
fn to_noun(&self) -> Noun {
V.to_noun()
}
}

#[cfg(feature = "alloc")]
impl<const V: $t> NounDecode for $n<V> {
fn from_noun(noun: &Noun) -> Option<Self> {
let v: $d = NounDecode::from_noun(noun)?;
Expand Down Expand Up @@ -164,12 +168,14 @@ impl<'de, const V: u64> Deserialize<'de> for FixedTas<V> {
}
}

#[cfg(feature = "alloc")]
impl<const V: u64> NounEncode for FixedTas<V> {
fn to_noun(&self) -> Noun {
V.to_noun()
}
}

#[cfg(feature = "alloc")]
impl<const V: u64> NounDecode for FixedTas<V> {
fn from_noun(noun: &Noun) -> Option<Self> {
let v: u64 = NounDecode::from_noun(noun)?;
Expand Down
Loading