Skip to content

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

Merged
xdustinface merged 1 commit into
v0.42-devfrom
chore/drop-nostd-supp-key-wallet
Mar 27, 2026
Merged

chore(key-wallet): drop no-std supp for key-wallet#518
xdustinface merged 1 commit into
v0.42-devfrom
chore/drop-nostd-supp-key-wallet

Conversation

@ZocoLini

@ZocoLini ZocoLini commented Mar 11, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Mnemonic generation functions are always available.
    • Wallet timestamps now consistently reflect system time.
    • Wallet event subscription and event sender are available unconditionally.
  • Chores

    • Consolidated the codebase onto the standard library (removed no-std variants).
    • Simplified error trait availability by removing feature-gated conditions.
    • Unified collection and core imports across the project.

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

coderabbitai Bot commented Mar 11, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR removes conditional std/no_std feature gating across the key-wallet crates, replacing many alloc::* imports with std::*, and unconditionalizing error trait impls, mnemonic RNG APIs, timestamp logic, and the Tokio broadcast event bus.

Changes

Cohort / File(s) Summary
Cargo Feature Configuration
key-wallet-ffi/Cargo.toml, key-wallet/Cargo.toml
Removed default-features = false / explicit std feature usage; key-wallet default features updated to directly include std-dependent deps and manager.
Crate root / no_std removal
key-wallet/src/lib.rs
Deleted crate-level #![cfg_attr(not(feature = "std"), no_std)] and related extern crate alloc/core/std declarations.
Unconditional Error impls
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/manager/mod.rs
Removed #[cfg(feature = "std")] guards from impl std::error::Error and made use std::error unconditional.
Mnemonic RNG APIs
key-wallet/src/mnemonic.rs
Removed #[cfg(feature = "std")] gating from generate_using_rng and generate_with_seed; rand imports are now unconditional.
Collections: alloc → std
key-wallet/src/account/..., key-wallet/src/managed_account/..., key-wallet/src/psbt/..., key-wallet/src/wallet/..., key-wallet/src/manager/..., key-wallet/src/transaction_checking/...
Replaced numerous alloc::collections::*, alloc::borrow::Cow, and other alloc::* imports with std::collections::* / std::borrow::Cow or relied on Prelude types (Vec, String).
Timestamp behavior made std-based
key-wallet/src/managed_account/managed_platform_account.rs, key-wallet/src/managed_account/mod.rs, key-wallet/src/manager/mod.rs
current_timestamp() now always uses std::time::SystemTime::now().duration_since(UNIX_EPOCH) instead of returning 0 in non-std builds.
Event bus / Manager API unconditionalized
key-wallet/src/manager/mod.rs
Tokio broadcast::Sender<WalletEvent> and methods subscribe_events() / event_sender() are now unconditional; transaction event emission no longer std-gated.
Trait signature normalization
key-wallet/src/manager/wallet_interface.rs
Changed signature to use Prelude types: Option<(i64, Vec<String>)> replaces Option<(i64, alloc::vec::Vec<alloc::string::String>)>.
PSBT module updates
key-wallet/src/psbt/mod.rs, key-wallet/src/psbt/map/*, key-wallet/src/psbt/*
Unconditionalized GetKey impl macros for HashSet/HashMap, consolidated std::collections imports, removed several alloc imports and unused test imports.
Alloc import cleanup (many files)
multiple key-wallet/src/... files (see diff) e.g. account_trait.rs, bls_account.rs, eddsa_account.rs, bip38.rs, derivation.rs, seed.rs, tests, helpers, etc.
Removed numerous explicit alloc::{string::String, vec::Vec, collections::*, borrow::Cow} imports where types now resolve via std or the prelude; no API/logic changes beyond imports.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 I hopped through code to change the tune,

dropped no_std beneath the moon.
std now springs where carrots grow,
errors, clocks, and buses flow.
Happy hops — compile and go! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 73.68% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removing no_std support from the key-wallet crate by eliminating feature gates and switching from alloc to std imports.

✏️ 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

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

codecov Bot commented Mar 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 67.25%. Comparing base (88eacdf) to head (9e10a8f).
⚠️ Report is 1 commits behind head on v0.42-dev.

Files with missing lines Patch % Lines
key-wallet/src/manager/wallet_interface.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           v0.42-dev     #518      +/-   ##
=============================================
- Coverage      67.44%   67.25%   -0.20%     
=============================================
  Files            318      318              
  Lines          67020    67025       +5     
=============================================
- Hits           45204    45079     -125     
- Misses         21816    21946     +130     
Flag Coverage Δ
core 75.21% <ø> (ø)
ffi 35.52% <ø> (-1.38%) ⬇️
rpc 19.92% <ø> (ø)
spv 83.79% <ø> (+0.11%) ⬆️
wallet 66.98% <90.90%> (-0.05%) ⬇️
Files with missing lines Coverage Δ
key-wallet/src/account/account_collection.rs 58.98% <ø> (ø)
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.83% <ø> (ø)
key-wallet/src/derivation_slip10.rs 45.06% <ø> (ø)
key-wallet/src/error.rs 10.81% <ø> (ø)
... and 33 more

... and 14 files with indirect coverage changes

@github-actions

Copy link
Copy Markdown
Contributor

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
coderabbitai[bot]
coderabbitai Bot previously approved these changes Mar 20, 2026
@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
Copy Markdown
Contributor

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

@xdustinface xdustinface removed the ready-for-review CodeRabbit has approved this PR label Mar 23, 2026
@ZocoLini
ZocoLini force-pushed the chore/drop-nostd-supp-key-wallet branch from eb5b21b to 2f9145a Compare March 25, 2026 17:28
@ZocoLini
ZocoLini marked this pull request as ready for review March 25, 2026 17:31
@github-actions github-actions Bot removed the merge-conflict The PR conflicts with the target branch. label Mar 25, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@key-wallet/Cargo.toml`:
- Around line 11-12: The PR title prefix is too weak for the change that removes
a previously supported build feature in the Cargo.toml default features list
(the default = ["secp256k1/std", "bip39/std", "getrandom", "rand"] line); update
the PR title to a user-visible prefix such as feat: or breaking: (and adjust the
PR description) to reflect that a public build-mode/feature was dropped, and
ensure any release notes or changelog mention the changed default features so
consumers are aware of the compatibility impact.
- Around line 11-12: The crate removed the public feature alias "std" causing
downstream breakage; restore a named feature "std" that expands to the component
features (e.g., "dashcore_hashes/std", "secp256k1/std", "bip39/std",
"getrandom", "rand") and then make default = ["std"] so the default still
enables those components while preserving compatibility for manifests that
explicitly request the "std" feature.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 521ce552-357b-4ce4-8098-726376c2bf7e

📥 Commits

Reviewing files that changed from the base of the PR and between eb5b21b and 2f9145a.

📒 Files selected for processing (48)
  • key-wallet-ffi/Cargo.toml
  • key-wallet/Cargo.toml
  • 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
  • key-wallet/src/bip32.rs
  • key-wallet/src/bip38.rs
  • key-wallet/src/derivation.rs
  • key-wallet/src/derivation_bls_bip32.rs
  • key-wallet/src/derivation_slip10.rs
  • key-wallet/src/error.rs
  • key-wallet/src/lib.rs
  • key-wallet/src/managed_account/address_pool.rs
  • key-wallet/src/managed_account/managed_account_collection.rs
  • key-wallet/src/managed_account/managed_account_trait.rs
  • key-wallet/src/managed_account/managed_platform_account.rs
  • key-wallet/src/managed_account/metadata.rs
  • key-wallet/src/managed_account/mod.rs
  • key-wallet/src/managed_account/transaction_record.rs
  • key-wallet/src/manager/events.rs
  • key-wallet/src/manager/matching.rs
  • key-wallet/src/manager/mod.rs
  • key-wallet/src/manager/process_block.rs
  • key-wallet/src/manager/wallet_interface.rs
  • key-wallet/src/mnemonic.rs
  • key-wallet/src/psbt/error.rs
  • key-wallet/src/psbt/map/global.rs
  • key-wallet/src/psbt/map/input.rs
  • key-wallet/src/psbt/map/mod.rs
  • key-wallet/src/psbt/map/output.rs
  • key-wallet/src/psbt/mod.rs
  • key-wallet/src/psbt/raw.rs
  • key-wallet/src/psbt/serialize.rs
  • key-wallet/src/seed.rs
  • key-wallet/src/tests/wallet_tests.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/wallet/bip38.rs
  • key-wallet/src/wallet/helper.rs
  • key-wallet/src/wallet/initialization.rs
  • key-wallet/src/wallet/managed_wallet_info/coin_selection.rs
  • key-wallet/src/wallet/managed_wallet_info/helpers.rs
  • key-wallet/src/wallet/managed_wallet_info/mod.rs
  • key-wallet/src/wallet/managed_wallet_info/transaction_builder.rs
  • key-wallet/src/wallet/managed_wallet_info/wallet_info_interface.rs
  • key-wallet/src/wallet/metadata.rs
  • key-wallet/src/wallet/mod.rs
  • key-wallet/src/wallet/root_extended_keys.rs
💤 Files with no reviewable changes (28)
  • key-wallet/src/account/bls_account.rs
  • key-wallet/src/account/account_trait.rs
  • key-wallet/src/wallet/helper.rs
  • key-wallet/src/manager/matching.rs
  • key-wallet/src/managed_account/address_pool.rs
  • key-wallet/src/wallet/bip38.rs
  • key-wallet/src/bip38.rs
  • key-wallet/src/derivation.rs
  • key-wallet/src/wallet/mod.rs
  • key-wallet/src/manager/events.rs
  • key-wallet/src/wallet/initialization.rs
  • key-wallet/src/wallet/managed_wallet_info/helpers.rs
  • key-wallet/src/lib.rs
  • key-wallet/src/tests/wallet_tests.rs
  • key-wallet/src/psbt/serialize.rs
  • key-wallet/src/account/eddsa_account.rs
  • key-wallet/src/managed_account/transaction_record.rs
  • key-wallet/src/psbt/raw.rs
  • key-wallet/src/psbt/map/mod.rs
  • key-wallet/src/managed_account/metadata.rs
  • key-wallet/src/wallet/managed_wallet_info/coin_selection.rs
  • key-wallet/src/wallet/managed_wallet_info/transaction_builder.rs
  • key-wallet/src/seed.rs
  • key-wallet/src/psbt/error.rs
  • key-wallet/src/error.rs
  • key-wallet/src/bip32.rs
  • key-wallet/src/mnemonic.rs
  • key-wallet/src/wallet/managed_wallet_info/mod.rs
✅ Files skipped from review due to trivial changes (12)
  • key-wallet/src/managed_account/managed_account_collection.rs
  • key-wallet/src/psbt/map/global.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/account/account_collection.rs
  • key-wallet/src/manager/process_block.rs
  • key-wallet/src/psbt/map/input.rs
  • key-wallet/src/managed_account/managed_account_trait.rs
  • key-wallet/src/wallet/managed_wallet_info/wallet_info_interface.rs
  • key-wallet-ffi/Cargo.toml
  • key-wallet/src/psbt/map/output.rs
  • key-wallet/src/wallet/root_extended_keys.rs
  • key-wallet/src/wallet/metadata.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • key-wallet/src/managed_account/managed_platform_account.rs
  • key-wallet/src/managed_account/mod.rs

Comment thread key-wallet/Cargo.toml Outdated
@github-actions

Copy link
Copy Markdown
Contributor

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 25, 2026
@xdustinface
xdustinface force-pushed the chore/drop-nostd-supp-key-wallet branch from 2f9145a to 9e10a8f Compare March 27, 2026 07:53
@github-actions github-actions Bot removed the merge-conflict The PR conflicts with the target branch. label Mar 27, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
key-wallet/src/psbt/mod.rs (1)

576-577: Add smoke tests for the unconditional HashMap/HashSet GetKey impls.

This PR makes those impls part of the always-on API surface, but this file still only exercises BTreeMap. A small pair of tests would catch accidental cfg regressions or trait-bound breakage.

As per coding guidelines, "Write unit tests for new functionality in Rust code".

Also applies to: 596-597

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@key-wallet/src/psbt/mod.rs` around lines 576 - 577, Add two small unit tests
that exercise the unconditional GetKey implementations generated by
impl_get_key_for_set! (and the corresponding HashMap impl at the other site) to
prevent cfg/trait regressions: create a test that constructs a HashSet, inserts
a value and asserts that GetKey::get_key (or the public helper used in this
module) returns the expected key, and a second test that does the same for a
HashMap (insert a (key,value) pair and assert get_key returns the stored key or
lookup behaves as expected). Place these tests in the same mod.rs test module
alongside the existing BTreeMap tests so they run under normal builds and
validate the always-on API surface.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@key-wallet/src/psbt/mod.rs`:
- Around line 576-577: Add two small unit tests that exercise the unconditional
GetKey implementations generated by impl_get_key_for_set! (and the corresponding
HashMap impl at the other site) to prevent cfg/trait regressions: create a test
that constructs a HashSet, inserts a value and asserts that GetKey::get_key (or
the public helper used in this module) returns the expected key, and a second
test that does the same for a HashMap (insert a (key,value) pair and assert
get_key returns the stored key or lookup behaves as expected). Place these tests
in the same mod.rs test module alongside the existing BTreeMap tests so they run
under normal builds and validate the always-on API surface.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 15b4c72f-90a9-412d-a9e9-4ad34924a7a8

📥 Commits

Reviewing files that changed from the base of the PR and between 2f9145a and 9e10a8f.

📒 Files selected for processing (48)
  • key-wallet-ffi/Cargo.toml
  • key-wallet/Cargo.toml
  • 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
  • key-wallet/src/bip32.rs
  • key-wallet/src/bip38.rs
  • key-wallet/src/derivation.rs
  • key-wallet/src/derivation_bls_bip32.rs
  • key-wallet/src/derivation_slip10.rs
  • key-wallet/src/error.rs
  • key-wallet/src/lib.rs
  • key-wallet/src/managed_account/address_pool.rs
  • key-wallet/src/managed_account/managed_account_collection.rs
  • key-wallet/src/managed_account/managed_account_trait.rs
  • key-wallet/src/managed_account/managed_platform_account.rs
  • key-wallet/src/managed_account/metadata.rs
  • key-wallet/src/managed_account/mod.rs
  • key-wallet/src/managed_account/transaction_record.rs
  • key-wallet/src/manager/events.rs
  • key-wallet/src/manager/matching.rs
  • key-wallet/src/manager/mod.rs
  • key-wallet/src/manager/process_block.rs
  • key-wallet/src/manager/wallet_interface.rs
  • key-wallet/src/mnemonic.rs
  • key-wallet/src/psbt/error.rs
  • key-wallet/src/psbt/map/global.rs
  • key-wallet/src/psbt/map/input.rs
  • key-wallet/src/psbt/map/mod.rs
  • key-wallet/src/psbt/map/output.rs
  • key-wallet/src/psbt/mod.rs
  • key-wallet/src/psbt/raw.rs
  • key-wallet/src/psbt/serialize.rs
  • key-wallet/src/seed.rs
  • key-wallet/src/tests/wallet_tests.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/wallet/bip38.rs
  • key-wallet/src/wallet/helper.rs
  • key-wallet/src/wallet/initialization.rs
  • key-wallet/src/wallet/managed_wallet_info/coin_selection.rs
  • key-wallet/src/wallet/managed_wallet_info/helpers.rs
  • key-wallet/src/wallet/managed_wallet_info/mod.rs
  • key-wallet/src/wallet/managed_wallet_info/transaction_builder.rs
  • key-wallet/src/wallet/managed_wallet_info/wallet_info_interface.rs
  • key-wallet/src/wallet/metadata.rs
  • key-wallet/src/wallet/mod.rs
  • key-wallet/src/wallet/root_extended_keys.rs
💤 Files with no reviewable changes (28)
  • key-wallet/src/account/account_trait.rs
  • key-wallet/src/managed_account/transaction_record.rs
  • key-wallet/src/wallet/bip38.rs
  • key-wallet/src/wallet/helper.rs
  • key-wallet/src/psbt/serialize.rs
  • key-wallet/src/wallet/managed_wallet_info/helpers.rs
  • key-wallet/src/wallet/initialization.rs
  • key-wallet/src/account/eddsa_account.rs
  • key-wallet/src/psbt/raw.rs
  • key-wallet/src/bip38.rs
  • key-wallet/src/wallet/managed_wallet_info/mod.rs
  • key-wallet/src/lib.rs
  • key-wallet/src/managed_account/address_pool.rs
  • key-wallet/src/manager/matching.rs
  • key-wallet/src/psbt/map/mod.rs
  • key-wallet/src/wallet/mod.rs
  • key-wallet/src/derivation.rs
  • key-wallet/src/managed_account/metadata.rs
  • key-wallet/src/manager/events.rs
  • key-wallet/src/tests/wallet_tests.rs
  • key-wallet/src/seed.rs
  • key-wallet/src/wallet/managed_wallet_info/coin_selection.rs
  • key-wallet/src/error.rs
  • key-wallet/src/psbt/error.rs
  • key-wallet/src/account/bls_account.rs
  • key-wallet/src/bip32.rs
  • key-wallet/src/mnemonic.rs
  • key-wallet/src/wallet/managed_wallet_info/transaction_builder.rs
✅ Files skipped from review due to trivial changes (11)
  • key-wallet/src/managed_account/managed_account_trait.rs
  • key-wallet/src/wallet/root_extended_keys.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/psbt/map/global.rs
  • key-wallet/src/managed_account/managed_account_collection.rs
  • key-wallet/src/wallet/managed_wallet_info/wallet_info_interface.rs
  • key-wallet/src/psbt/map/input.rs
  • key-wallet/src/psbt/map/output.rs
  • key-wallet/src/wallet/metadata.rs
  • key-wallet/src/manager/process_block.rs
  • key-wallet/src/account/account_collection.rs
🚧 Files skipped from review as they are similar to previous changes (6)
  • key-wallet-ffi/Cargo.toml
  • key-wallet/src/managed_account/mod.rs
  • key-wallet/src/manager/wallet_interface.rs
  • key-wallet/src/derivation_bls_bip32.rs
  • key-wallet/src/managed_account/managed_platform_account.rs
  • key-wallet/Cargo.toml

@github-actions github-actions Bot added the ready-for-review CodeRabbit has approved this PR label Mar 27, 2026
@xdustinface
xdustinface merged commit 2f5494f into v0.42-dev Mar 27, 2026
39 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review CodeRabbit has approved this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants