Skip to content

chore(key-wallet): drop no-std supp for key-wallet#518

Draft
ZocoLini wants to merge 1 commit intov0.42-devfrom
chore/drop-nostd-supp-key-wallet
Draft

chore(key-wallet): drop no-std supp for key-wallet#518
ZocoLini wants to merge 1 commit intov0.42-devfrom
chore/drop-nostd-supp-key-wallet

Conversation

@ZocoLini
Copy link
Collaborator

@ZocoLini ZocoLini commented Mar 11, 2026

maybe is better to wait for key-wallet-manager to get merged into key-wallet

Summary by CodeRabbit

  • Breaking Changes
    • The library now requires the Rust standard library and no longer supports no_std environments. Previously optional error trait implementations are now always available, and some conditional functionality is now unconditionally compiled.

@ZocoLini ZocoLini marked this pull request as draft March 11, 2026 20:40
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2026

📝 Walkthrough

Walkthrough

This pull request systematically migrates the key-wallet crate family from alloc-based imports and no_std-compatible conditional compilation to unconditional std imports. It removes the std feature alias from Cargo configuration, inlines default feature dependencies, eliminates #[cfg(feature = "std")] guards from error and trait implementations, and replaces scattered alloc::* imports with std::* equivalents throughout the codebase.

Changes

Cohort / File(s) Summary
Cargo Feature Configuration
key-wallet/Cargo.toml, key-wallet-ffi/Cargo.toml, key-wallet-manager/Cargo.toml
Updated feature flags: key-wallet removes the std feature and inlines its dependencies into default. Dependents (ffi, manager) now rely on default features instead of explicit default-features = false + features = ["std"].
Core Library Setup
key-wallet/src/lib.rs
Removed #![cfg_attr(not(feature = "std"), no_std)], extern crate alloc, extern crate core, and conditional extern crate std declarations.
Error Trait Implementations
key-wallet/src/error.rs, key-wallet/src/bip32.rs, key-wallet/src/derivation_bls_bip32.rs, key-wallet/src/derivation_slip10.rs, key-wallet/src/psbt/error.rs, key-wallet/src/wallet/managed_wallet_info/coin_selection.rs, key-wallet/src/wallet/managed_wallet_info/transaction_builder.rs, key-wallet/src/psbt/mod.rs
Removed #[cfg(feature = "std")] gating from impl std::error::Error for Error blocks, making error trait implementations unconditional.
Account Module Imports
key-wallet/src/account/account_collection.rs, key-wallet/src/account/account_trait.rs, key-wallet/src/account/bls_account.rs, key-wallet/src/account/eddsa_account.rs
Switched BTreeMap and Vec imports from alloc::* to std::*, and removed unused alloc::vec::Vec imports.
BIP32 and Derivation Modules
key-wallet/src/bip32.rs, key-wallet/src/derivation_bls_bip32.rs, key-wallet/src/derivation_slip10.rs
Removed conditional std error imports, made error trait implementations unconditional, and removed unused alloc::{string::String, vec::Vec} imports.
BIP38 and Related
key-wallet/src/bip38.rs, key-wallet/src/derivation.rs
Removed unused alloc::{string::String, vec::Vec} imports.
Mnemonic Generation
key-wallet/src/mnemonic.rs
Removed feature gating from pub fn generate_using_rng() and pub fn generate_with_seed(), making RNG-based mnemonic generation functions unconditional. Removed alloc::{String, Vec} imports and #[cfg(feature = "std")] guards.
Managed Account Core
key-wallet/src/managed_account/mod.rs, key-wallet/src/managed_account/managed_platform_account.rs
Switched BTreeMap from alloc::collections to std::collections. Changed current_timestamp() from conditional std/no_std behavior to always use std::time::SystemTime::now() with unwrap_or_default().
Managed Account Collections
key-wallet/src/managed_account/managed_account_collection.rs, key-wallet/src/managed_account/managed_account_trait.rs, key-wallet/src/managed_account/address_pool.rs, key-wallet/src/managed_account/metadata.rs, key-wallet/src/managed_account/transaction_record.rs
Switched BTreeMap from alloc to std. Removed unused alloc::{string::String, vec::Vec} imports.
PSBT Module
key-wallet/src/psbt/mod.rs, key-wallet/src/psbt/map/global.rs, key-wallet/src/psbt/map/input.rs, key-wallet/src/psbt/map/output.rs, key-wallet/src/psbt/map/mod.rs, key-wallet/src/psbt/raw.rs, key-wallet/src/psbt/serialize.rs, key-wallet/src/psbt/error.rs
Consolidated imports from alloc::* to std::collections and removed unused alloc::{string::String, vec::Vec} imports. Simplified GetKey implementations by removing #[cfg(feature = "std")] gating. Updated test module imports.
Wallet Metadata and Config
key-wallet/src/wallet/metadata.rs, key-wallet/src/wallet/root_extended_keys.rs, key-wallet/src/wallet/initialization.rs
Switched collection and string types from alloc::{borrow::Cow, collections::BTreeMap, string::String} to std equivalents.
Wallet Info Submodules
key-wallet/src/wallet/managed_wallet_info/mod.rs, key-wallet/src/wallet/managed_wallet_info/wallet_info_interface.rs, key-wallet/src/wallet/managed_wallet_info/coin_selection.rs, key-wallet/src/wallet/managed_wallet_info/transaction_builder.rs, key-wallet/src/wallet/managed_wallet_info/helpers.rs
Removed unused alloc::{string::String, vec::Vec} imports. Switched BTreeSet from alloc to std. Removed feature gating from error trait implementations.
Wallet Core and Misc
key-wallet/src/wallet/mod.rs, key-wallet/src/wallet/helper.rs, key-wallet/src/wallet/bip38.rs, key-wallet/src/seed.rs, key-wallet/src/transaction_checking/account_checker.rs, key-wallet/src/tests/wallet_tests.rs, key-wallet-manager/src/wallet_manager/mod.rs, key-wallet-manager/src/wallet_manager/process_block.rs
Removed unused alloc::{string::String, vec::Vec, ToString} imports. Updated collection type sources from alloc to std.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~55 minutes

Poem

🐰 From alloc we hop to std, a grand migration,
No features to gate, just one configuration,
Error traits now shine unconditionally bright,
The wallet is standard, our systems feel light!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main objective of the PR: removing no-std support from the key-wallet crate, which aligns with the extensive changes across the codebase.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/drop-nostd-supp-key-wallet
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.11%. Comparing base (665bb7b) to head (eb5b21b).
⚠️ Report is 1 commits behind head on v0.42-dev.

Additional details and impacted files
@@              Coverage Diff              @@
##           v0.42-dev     #518      +/-   ##
=============================================
- Coverage      66.35%   66.11%   -0.25%     
=============================================
  Files            311      311              
  Lines          64979    64988       +9     
=============================================
- Hits           43116    42964     -152     
- Misses         21863    22024     +161     
Flag Coverage Δ
core 75.13% <ø> (ø)
ffi 35.95% <ø> (-1.59%) ⬇️
rpc 28.28% <ø> (ø)
spv 81.15% <ø> (+0.07%) ⬆️
wallet 65.90% <100.00%> (-0.04%) ⬇️
Files with missing lines Coverage Δ
key-wallet-manager/src/wallet_manager/mod.rs 49.00% <ø> (ø)
...wallet-manager/src/wallet_manager/process_block.rs 48.97% <ø> (ø)
key-wallet/src/account/account_collection.rs 57.17% <ø> (ø)
key-wallet/src/account/account_trait.rs 21.42% <ø> (ø)
key-wallet/src/account/bls_account.rs 53.82% <ø> (ø)
key-wallet/src/account/eddsa_account.rs 56.48% <ø> (ø)
key-wallet/src/bip32.rs 80.19% <ø> (-0.45%) ⬇️
key-wallet/src/bip38.rs 1.46% <ø> (ø)
key-wallet/src/derivation.rs 75.75% <ø> (ø)
key-wallet/src/derivation_bls_bip32.rs 91.54% <ø> (ø)
... and 30 more

... and 18 files with indirect coverage changes

@github-actions
Copy link

This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them.

@github-actions github-actions bot added the merge-conflict The PR conflicts with the target branch. label Mar 13, 2026
@ZocoLini ZocoLini force-pushed the chore/drop-nostd-supp-key-wallet branch from 18273b0 to b2ff339 Compare March 20, 2026 00:18
@github-actions github-actions bot removed the merge-conflict The PR conflicts with the target branch. label Mar 20, 2026
@ZocoLini ZocoLini force-pushed the chore/drop-nostd-supp-key-wallet branch from b2ff339 to eb5b21b Compare March 20, 2026 00:20
@ZocoLini ZocoLini marked this pull request as ready for review March 20, 2026 00:21
@github-actions github-actions bot added the ready-for-review CodeRabbit has approved this PR label Mar 20, 2026
@ZocoLini ZocoLini requested a review from xdustinface March 20, 2026 00:37
@ZocoLini ZocoLini marked this pull request as draft March 20, 2026 00:39
@github-actions github-actions bot added the merge-conflict The PR conflicts with the target branch. label Mar 20, 2026
@github-actions
Copy link

This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-conflict The PR conflicts with the target branch. ready-for-review CodeRabbit has approved this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant