Skip to content

chore(hashes): drop no-std supp for hashes#520

Open
ZocoLini wants to merge 1 commit intov0.42-devfrom
chore/drop-nostd-hashes
Open

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

Conversation

@ZocoLini
Copy link
Collaborator

@ZocoLini ZocoLini commented Mar 12, 2026

Summary by CodeRabbit

  • Refactor

    • Streamlined feature flags across crates to reduce enabled surface and improve cross-configuration compatibility.
    • Simplified dependency declarations to rely on default behaviors.
    • Removed numerous conditional compilation guards to unify compilation paths.
  • Tests

    • Broadened test compilation so tests run in more build configurations.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 258d5fe4-3623-414a-bc48-a61df44c05aa

📥 Commits

Reviewing files that changed from the base of the PR and between ccecf56 and 32dd94c.

📒 Files selected for processing (18)
  • dash/Cargo.toml
  • hashes/Cargo.toml
  • hashes/src/error.rs
  • hashes/src/hash160.rs
  • hashes/src/hash_x11.rs
  • hashes/src/hex.rs
  • hashes/src/hmac.rs
  • hashes/src/impls.rs
  • hashes/src/lib.rs
  • hashes/src/ripemd160.rs
  • hashes/src/sha1.rs
  • hashes/src/sha256.rs
  • hashes/src/sha256d.rs
  • hashes/src/sha256t.rs
  • hashes/src/sha512.rs
  • hashes/src/sha512_256.rs
  • key-wallet-manager/Cargo.toml
  • key-wallet/Cargo.toml
💤 Files with no reviewable changes (14)
  • hashes/src/sha512.rs
  • hashes/src/sha512_256.rs
  • hashes/src/hash_x11.rs
  • hashes/src/impls.rs
  • hashes/src/error.rs
  • hashes/src/hmac.rs
  • hashes/src/hash160.rs
  • hashes/src/sha256t.rs
  • hashes/src/hex.rs
  • hashes/src/ripemd160.rs
  • hashes/src/sha256.rs
  • hashes/src/sha1.rs
  • hashes/src/sha256d.rs
  • hashes/src/lib.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • key-wallet/Cargo.toml
  • hashes/Cargo.toml

📝 Walkthrough

Walkthrough

Updated Cargo feature sets and dependency declarations across crates; many cfg guards removed from the hashes crate (including std/core2/alloc gates and some trait impls), and several tests had their feature gating removed.

Changes

Cohort / File(s) Summary
Dash manifest
dash/Cargo.toml
Adjusted std/no-std feature lists (removed dashcore_hashes/std from std; changed no-std sub-features). dashcore_hashes dependency now declared without default-features = false.
Key-wallet manifests
key-wallet-manager/Cargo.toml, key-wallet/Cargo.toml
Removed dashcore_hashes/std from std features and removed default-features = false from dashcore_hashes dependency declarations.
Hashes manifest
hashes/Cargo.toml
Changed default features from ["std"] to ["internals/alloc"]; removed std/alloc feature aliases; removed core2 public exposure; added actual-schemars = { package = "schemars", version = "1.0", optional = true }.
Removed/modified cfg and externs
hashes/src/lib.rs, hashes/src/impls.rs, hashes/src/hash_x11.rs
Removed crate-level no_std gating, conditional extern crate/alloc/core2 declarations, and multiple #[cfg(...)] imports/guards (std/core2/alloc) and related doc lines.
Error and IO impls
hashes/src/error.rs, hashes/src/hex.rs
Removed impl std::error::Error for Error (std-gated) and conditional io::Read impl for HexIterator; moved FromHex for Vec<u8> to be unconditional (removed prior feature gating).
Tests unconditionally enabled
hashes/src/hash160.rs, hashes/src/hmac.rs, hashes/src/ripemd160.rs, hashes/src/sha1.rs, hashes/src/sha256.rs, hashes/src/sha256d.rs, hashes/src/sha256t.rs, hashes/src/sha512.rs, hashes/src/sha512_256.rs
Removed #[cfg(feature = "alloc")] (and similar) from test functions/modules so tests compile under #[cfg(test)] without alloc/std gating.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nudged the flags and hopped about,
Gates fell down and tests came out,
Less guarding now on every trail,
Simpler crates and lighter mail,
A tiny hop — a carrot's shout! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore(hashes): drop no-std supp for hashes' accurately describes the main objective of the PR, which is to remove no-std support from the hashes crate by simplifying feature flags and dependency declarations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/drop-nostd-hashes
📝 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@hashes/Cargo.toml`:
- Around line 15-18: The workspace removed no-std support causing dashcore's
no-std builds to fail because hashes' hex.rs and impls.rs use std::io and
std::error::Error unconditionally; restore a no-std-compatible contract by
either re-introducing a "std" feature in hashes' Cargo.toml (e.g., add a feature
like std = ["alloc/std"] or similar) and gate std-only imports behind
cfg(feature = "std") in hex.rs and impls.rs, or keep the removed no-std surface
but then update dash/Cargo.toml/dash/src/lib.rs to drop the no-std feature; if
you choose to keep no-std support, replace uses of std::io and std::error::Error
with cfg-gated alternatives and use core2 equivalents where dash/src/lib.rs
expects core2 compatibility so no-std builds of dashcore can compile against
hashes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c04f5d5a-3de8-43d4-bfa6-1d80f0a0f5c1

📥 Commits

Reviewing files that changed from the base of the PR and between 33cefc9 and e42aad7.

📒 Files selected for processing (18)
  • dash/Cargo.toml
  • hashes/Cargo.toml
  • hashes/src/error.rs
  • hashes/src/hash160.rs
  • hashes/src/hash_x11.rs
  • hashes/src/hex.rs
  • hashes/src/hmac.rs
  • hashes/src/impls.rs
  • hashes/src/lib.rs
  • hashes/src/ripemd160.rs
  • hashes/src/sha1.rs
  • hashes/src/sha256.rs
  • hashes/src/sha256d.rs
  • hashes/src/sha256t.rs
  • hashes/src/sha512.rs
  • hashes/src/sha512_256.rs
  • key-wallet-manager/Cargo.toml
  • key-wallet/Cargo.toml
💤 Files with no reviewable changes (14)
  • hashes/src/sha256.rs
  • hashes/src/error.rs
  • hashes/src/sha512_256.rs
  • hashes/src/sha256d.rs
  • hashes/src/hmac.rs
  • hashes/src/ripemd160.rs
  • hashes/src/sha512.rs
  • hashes/src/sha256t.rs
  • hashes/src/sha1.rs
  • hashes/src/lib.rs
  • hashes/src/hash160.rs
  • hashes/src/hash_x11.rs
  • hashes/src/hex.rs
  • hashes/src/impls.rs

@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.90%. Comparing base (b946271) to head (32dd94c).

Additional details and impacted files
@@            Coverage Diff             @@
##           v0.42-dev     #520   +/-   ##
==========================================
  Coverage      66.89%   66.90%           
==========================================
  Files            313      313           
  Lines          64753    64753           
==========================================
+ Hits           43317    43323    +6     
+ Misses         21436    21430    -6     
Flag Coverage Δ *Carryforward flag
core 75.02% <ø> (ø)
dash-network 75.00% <ø> (ø) Carriedforward from b946271
dash-network-ffi 34.76% <ø> (ø) Carriedforward from b946271
dash-spv 68.26% <ø> (ø) Carriedforward from b946271
dash-spv-ffi 34.76% <ø> (ø) Carriedforward from b946271
dashcore 75.00% <ø> (ø) Carriedforward from b946271
dashcore-private 75.00% <ø> (ø) Carriedforward from b946271
dashcore-rpc 19.92% <ø> (ø) Carriedforward from b946271
dashcore-rpc-json 19.92% <ø> (ø) Carriedforward from b946271
dashcore_hashes 75.00% <ø> (ø) Carriedforward from b946271
ffi 35.67% <ø> (-0.93%) ⬇️
key-wallet 65.64% <ø> (ø) Carriedforward from b946271
key-wallet-ffi 34.76% <ø> (ø) Carriedforward from b946271
key-wallet-manager 65.64% <ø> (ø) Carriedforward from b946271
rpc 19.92% <ø> (ø)
spv 81.01% <ø> (-0.08%) ⬇️
wallet 65.67% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
hashes/src/error.rs 0.00% <ø> (ø)
hashes/src/hash160.rs 100.00% <ø> (ø)
hashes/src/hash_x11.rs 34.78% <ø> (ø)
hashes/src/hex.rs 76.84% <ø> (ø)
hashes/src/hmac.rs 76.68% <ø> (ø)
hashes/src/impls.rs 73.13% <ø> (ø)
hashes/src/lib.rs 81.25% <ø> (ø)
hashes/src/ripemd160.rs 98.89% <ø> (ø)
hashes/src/sha1.rs 95.68% <ø> (ø)
hashes/src/sha256.rs 95.37% <ø> (ø)
... and 4 more

... and 17 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ZocoLini ZocoLini force-pushed the chore/drop-nostd-hashes branch from e42aad7 to ccecf56 Compare March 13, 2026 19:57
@ZocoLini ZocoLini force-pushed the chore/drop-nostd-hashes branch from ccecf56 to 32dd94c Compare March 13, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant