From 4c8a7d12ceb4333c565549f62de73a02edabebb4 Mon Sep 17 00:00:00 2001 From: redshiftzero Date: Thu, 25 Jan 2024 11:18:08 -0500 Subject: [PATCH 1/3] ci: add job building with no alloc feature --- .github/workflows/rust.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 93fc5ce..a892e56 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -40,6 +40,23 @@ jobs: command: test args: --features ${{ matrix.backend }} + build_no_alloc: + name: build without alloc + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - run: rustup target add thumbv7em-none-eabihf + - uses: Swatinem/rust-cache@v1 + - uses: actions-rs/cargo@v1 + with: + command: build + args: --target thumbv7em-none-eabihf --no-default-features + fmt: name: Rustfmt runs-on: ubuntu-latest From 661c3562731320d613a96c588f3fd1581058ef6e Mon Sep 17 00:00:00 2001 From: redshiftzero Date: Fri, 26 Jan 2024 11:38:27 -0500 Subject: [PATCH 2/3] dependencies: move once_cell to `std` feature `decaf377` is failing to compile with default features on `thumbv7em-none-eabihf` due to the fact that `std` is required by `once_cell` because it does not declare `#![no_std]` --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d340f9e..789b2b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,7 @@ license = "MIT OR Apache-2.0" [dependencies] # no-alloc, no-std cfg-if = "1.0" -hex = { version ="=0.4.2", default-features = false } -once_cell = { version= "1.8", default-features = false } +hex = { version ="=0.4.2", default-features = false } subtle = "2.5" tracing-subscriber = { version = "0.3", default-features = false } zeroize = { version = "1.7", default-features = false } @@ -32,6 +31,7 @@ ark-bls12-377 = { version = "0.4", optional = true } ark-ed-on-bls12-377 = { version = "0.4", optional = true } ark-groth16 = { version = "0.4", optional = true } ark-snark = { version = "0.4", optional = true } +once_cell = { version= "1.8", optional = true, default-features = false } # This matches what ark-std (a library for no_std compatibility) does, having # a default feature of std - without the ark-std std feature, decaf377 doesn't From fb9b87a8547acacefea7ee161e6a2be76b1b9309 Mon Sep 17 00:00:00 2001 From: redshiftzero Date: Fri, 26 Jan 2024 11:42:22 -0500 Subject: [PATCH 3/3] dependencies: configure `subtle` features for `std` only --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 789b2b5..f4b51c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0" # no-alloc, no-std cfg-if = "1.0" hex = { version ="=0.4.2", default-features = false } -subtle = "2.5" +subtle = { version="2.5", default-features = false } tracing-subscriber = { version = "0.3", default-features = false } zeroize = { version = "1.7", default-features = false } # no-std @@ -39,7 +39,7 @@ once_cell = { version= "1.8", optional = true, default-features = false } [features] default = ["arkworks"] alloc = ["once_cell/alloc", "tracing-subscriber/alloc", "zeroize/alloc"] -std = ["alloc", "tracing/std", "anyhow/std", "tracing-subscriber/std", "zeroize/std", "once_cell/std", "num-bigint/std", "hex/std"] +std = ["alloc", "tracing/std", "anyhow/std", "tracing-subscriber/std", "zeroize/std", "once_cell/std", "num-bigint/std", "hex/std", "subtle/std"] parallel = ["ark-ff/parallel", "ark-ec/parallel", "ark-groth16/parallel", "ark-std/parallel", "ark-r1cs-std/parallel"] # TODO: eventually, feature-gate all arkworks deps behind this feature. arkworks = ["std", "ark-std", "ark-ec", "ark-ff", "ark-serialize", "ark-bls12-377", "ark-ed-on-bls12-377"]