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/actions/test-fn-dsa/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,38 @@ runs:
cargo check --no-default-features --features "alloc,rand" --target thumbv7em-none-eabi
echo "✅ no_std check completed"

# Per-crate feature selection. Every other feature gate in CI is workspace-wide
# (`--all-features`), where the `lib-q-fn-dsa` facade enables `shake256x4` on `-comm` and
# feature unification hands that same `-comm` build to every leaf — so a leaf whose own
# `shake256x4` forwards nothing still compiles and the missing forward is invisible.
# `-kgen`/`-sign` shipped exactly that (`shake256x4 = []`, as upstream fn-dsa 0.3.0 does):
# the feature flipped their call sites onto `fn_dsa_comm::shake::SHAKE256x4`, which `-comm`
# only compiles under the same feature, so `cargo check -p lib-q-fn-dsa-kgen --features
# shake256x4` failed with E0433 for every consumer that selected the crate directly.
# Keep one `-p` per invocation: merging them re-unifies the features and tests nothing.
- name: Per-crate feature wiring (shake256x4)
shell: bash
run: |
echo "🔗 Checking per-crate feature wiring (no cross-crate feature unification)..."
cd "${{ github.workspace }}"
for p in lib-q-fn-dsa-comm lib-q-fn-dsa-kgen lib-q-fn-dsa-sign; do
cargo check -p "$p" --features shake256x4
done
for p in lib-q-fn-dsa-comm lib-q-fn-dsa-kgen lib-q-fn-dsa-sign lib-q-fn-dsa-vrfy; do
cargo check -p "$p" --all-features
done
# Manifest-level guard for the same invariant (fails without building the broken config).
cargo test -p lib-q-fn-dsa-kgen --test feature_forwarding
# SHAKE256x4 must equal four 64-bit-interleaved SHAKE256 streams on BOTH dispatch
# paths; x86_64 takes the AVX2 branch unless no_avx2 forces the portable one.
cargo test -p lib-q-fn-dsa-comm --features shake256x4 shake256x4
cargo test -p lib-q-fn-dsa-comm --features shake256x4,no_avx2 shake256x4
# Exercises the feature through keygen/signing (gauss::sample_tv carries its own
# shake256x4 test-vector set).
cargo test -p lib-q-fn-dsa-kgen --features shake256x4
cargo test -p lib-q-fn-dsa-sign --features shake256x4
echo "✅ Per-crate feature wiring verified"

- name: Run quick FN-DSA smoke tests
shell: bash
run: |
Expand Down
7 changes: 6 additions & 1 deletion lib-q-fn-dsa/fn-dsa-kgen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ num-traits = { workspace = true }
[features]
default = []
no_avx2 = []
shake256x4 = []
# MUST forward to `-comm`: the type this crate switches to under the feature
# (`fn_dsa_comm::shake::SHAKE256x4`) is itself `#[cfg(feature = "shake256x4")]` inside
# `-comm`. Declared empty (upstream fn-dsa 0.3.0 does the same), `cargo check -p
# lib-q-fn-dsa-kgen --features shake256x4` fails with E0433 — the call sites flip to a type
# that was never compiled. Guarded by tests/feature_forwarding.rs.
shake256x4 = ["lib-q-fn-dsa-comm/shake256x4"]
Loading