Conversation
There was a problem hiding this comment.
Pull request overview
Adds initial no_std compatibility knobs to the keetanetwork-crypto and keetanetwork-utils crates by introducing std feature flags, switching to alloc types, and adjusting dependency feature sets to support no_std builds.
Changes:
- Add
#![no_std]undercfg_attr+allocusage acrosskeetanetwork-cryptomodules. - Introduce
stdfeature defaults forkeetanetwork-utilsandkeetanetwork-crypto, and adjust dependencies todefault-features = falsewhere needed. - Update lockfile to reflect dependency feature/version resolution changes.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| keetanetwork-utils/src/lib.rs | Adds no_std cfg gating at crate level. |
| keetanetwork-utils/Cargo.toml | Adds std feature + changes defaults; modifies [lib] configuration. |
| keetanetwork-crypto/src/lib.rs | Adds no_std gating and extern crate alloc for alloc-backed types/macros. |
| keetanetwork-crypto/src/utils.rs | Switches String/Vec imports to alloc equivalents. |
| keetanetwork-crypto/src/operations/signature.rs | Uses alloc::vec::Vec for no_std. |
| keetanetwork-crypto/src/operations/encryption.rs | Uses alloc::vec::Vec for no_std. |
| keetanetwork-crypto/src/kdf.rs | Uses alloc::vec::Vec for no_std. |
| keetanetwork-crypto/src/hash.rs | Uses alloc::vec::Vec for no_std. |
| keetanetwork-crypto/src/error.rs | Switches error strings to alloc::string::String. |
| keetanetwork-crypto/src/algorithms/mod.rs | Uses alloc::vec::Vec and adjusts signature encoding import for no_std. |
| keetanetwork-crypto/src/algorithms/secp256r1.rs | Uses alloc::vec::Vec for no_std. |
| keetanetwork-crypto/src/algorithms/secp256k1.rs | Uses alloc::vec::Vec for no_std. |
| keetanetwork-crypto/src/algorithms/ed25519.rs | Uses alloc::vec::Vec for no_std. |
| keetanetwork-crypto/src/algorithms/ecies.rs | Uses alloc::vec::Vec for no_std. |
| keetanetwork-crypto/src/algorithms/aes_gcm.rs | Uses alloc::vec::Vec for no_std. |
| keetanetwork-crypto/src/algorithms/aes_ctr.rs | Uses alloc::vec::Vec for no_std. |
| keetanetwork-crypto/src/algorithms/aes_cbc.rs | Uses alloc::vec::Vec for no_std. |
| keetanetwork-crypto/Cargo.toml | Reworks dependency features for no_std and introduces std/alloc features. |
| Cargo.lock | Updates resolved dependencies per feature/version changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| [dependencies.snafu] | ||
| workspace = true | ||
| version = "0.8.7" |
There was a problem hiding this comment.
snafu is specified here with an explicit version even though the workspace already defines snafu under [workspace.dependencies] (Cargo.toml:70-73) and other crates depend on it via snafu.workspace = true. Consider switching back to workspace = true and overriding default-features/features locally (e.g., default-features = false and enabling snafu/std via this crate’s std feature) to keep dependency versions centralized and consistent across the workspace.
| version = "0.8.7" | |
| workspace = true |
|
|
||
| #![cfg_attr(not(feature = "std"), no_std)] | ||
|
|
||
| pub mod errors; |
There was a problem hiding this comment.
keetanetwork-utils is now no_std when std feature is disabled, but it still unconditionally compiles and exports pub mod testing;. testing.rs uses Box, String, and format!/std::..., which will fail to compile for downstream crates building keetanetwork-utils with default-features = false (e.g., keetanetwork-crypto in no_std mode). Gate the testing module behind feature = "std" (or a dedicated testing feature), or refactor it to use alloc + alloc::format! so the crate actually builds in no_std.
| pub mod errors; | |
| pub mod errors; | |
| #[cfg(feature = "std")] |
| [lib] | ||
| crate-type = ["staticlib", "rlib"] | ||
| path = "src/lib.rs" |
There was a problem hiding this comment.
This PR removes the [lib].crate-type = ["staticlib", "rlib"] configuration. That changes the produced artifacts (no staticlib by default) and isn’t mentioned in the PR description about no_std support. If staticlib outputs are still required (consistent with other workspace crates like keetanetwork-account, keetanetwork-error, etc.), re-add crate-type or document why it’s safe to drop.
| [lib] | ||
| crate-type = ["staticlib", "rlib"] | ||
| path = "src/lib.rs" |
There was a problem hiding this comment.
This PR removes the [lib].crate-type = ["staticlib", "rlib"] configuration. That changes the produced artifacts (no staticlib by default) and isn’t mentioned in the PR description about no_std support. If staticlib outputs are still required/expected (most other workspace crates keep them), re-add crate-type or document why it’s safe to drop for keetanetwork-crypto.
|



Summary
no_stdsupport for the crypto crateno_stdsupport for the utils crate