Skip to content

refactor!: harmonize workspace crates behind hex-conservative 1.x - #1115

Merged
ZocoLini merged 6 commits into
dashpay:devfrom
kwvg:switch_hex
Oct 7, 2026
Merged

ZocoLini merged 6 commits into
dashpay:devfrom
kwvg:switch_hex

Conversation

@kwvg

@kwvg kwvg commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

The Rust ecosystem provides a plethora of hex encoding crates, each of them with different APIs, encoding/decoding behaviours and semantics. hex-conservative, the crate published by rust-bitcoin is one of them but it only one of many. The problem with using these crates interchangeably is that differences in semantics can result in parsing bugs due to mismatched assumptions and invariants between crates.

Furthermore, portions of rust-dashcore already have inline parsing routines mixed with ownership of a hex module in dashcore-internal and some unused serde utility macros on top of using two different dependencies, hex and hex_lit in different workspace crates.

While rust-dashcore#1108 does forward the hex module from bitcoin-hashes 0.14, that in effect propagates hex-conservative 0.2 throughout the codebase. To front load the effort of having to migrate to hex-conservative 1.x through rust-bitcoin#5710 and rust-bitcoin#6148, this pull request also replaces the export from bitcoin-hashes with hex-conservative 1.x. See rust-dashcore#1110.

Additional Information

PR Hygiene · a4be8ac

  • Bots — coderabbitai ✓
  • Self-review — posted; again after any push
  • Build green
  • Approvals
    • files with no dedicated owner (CHANGELOG.md, Cargo.toml, crypto/Cargo.toml and 35 more) — QuantumExplorer or ZocoLini or xdustinface
    • dash-spv (dash-spv/Cargo.toml, dash-spv/src/chain/chain_work.rs, dash-spv/src/chain/checkpoints.rs and 3 more) — QuantumExplorer or ZocoLini or xdustinface
    • key-wallet-manager (key-wallet-manager/Cargo.toml, key-wallet-manager/examples/wallet_creation.rs, key-wallet-manager/tests/test_serialized_wallets.rs) — QuantumExplorer or ZocoLini or xdustinface
    • key-wallet (key-wallet/Cargo.toml, key-wallet/README.md, key-wallet/examples/basic_usage.rs and 13 more) — QuantumExplorer or ZocoLini or xdustinface

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: dashpay/rust-dashcore/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 95c3b38d-8d2b-4ac4-855b-a6979c69d2fe
📥 Commits

Reviewing files that changed from the base of the PR and between fc4e10b and a4be8ac.

📒 Files selected for processing (8)
  • dash-spv/src/client/queries.rs
  • dash-spv/src/validation/chainlock.rs
  • dash-spv/src/validation/instantlock.rs
  • dash/Cargo.toml
  • dash/src/sml/masternode_list/apply_diff.rs
  • key-wallet-ffi/Cargo.toml
  • key-wallet/Cargo.toml
  • key-wallet/README.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • key-wallet/README.md
  • dash-spv/src/client/queries.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The workspace replaces hex and hex_lit with hex-conservative for hexadecimal decoding, formatting, and Serde support. BLS parsing and RPC JSON error types change. Other summarized conversions retain the existing output formats, fixtures, and assertions.

Changes

Hexadecimal conversion migration

Layer / File(s) Summary
Workspace dependency and BLS decoding
Cargo.toml, crypto/Cargo.toml, crypto/src/bls.rs, CHANGELOG.md
The workspace adds hex-conservative and removes hex and hex_lit. BLS public-key and signature parsing use fixed-length decoding and return DecodeFixedLengthBytesError.
RPC JSON hex adapter
rpc-json/Cargo.toml, rpc-json/src/lib.rs
RPC JSON byte fields use a private Serde adapter backed by hex-conservative. HexError wraps DecodeVariableLengthBytesError, and a round-trip test checks lowercase hex serialization and deserialization.
Dash and SPV conversion sites
dash-spv/..., dash/...
Dash and SPV decoding and formatting calls use hex-conservative. The summarized changes retain existing hash lengths, error handling, fixtures, and assertions.
Wallet conversion sites
key-wallet/..., key-wallet-ffi/..., key-wallet-manager/...
Wallet crates, examples, documentation, and tests use hex-conservative for hexadecimal decoding and lowercase formatting. The summarized derivation vectors and expected values remain unchanged.
FFI and RPC conversions
dash-spv-ffi/..., rpc-client/..., rpc-integration-test/...
FFI output, RPC client conversions, and integration tests use hex-conservative. The described output remains lowercase hexadecimal.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to a4be8

The reviewed migration preserves the identified length checks, byte ordering, and RPC JSON hex format. No actionable merge-blocking regression is established; malformed-input compatibility remains unverified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 76.26% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 139 functions across 53 files. (4 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: standardizing workspace crates on hex-conservative 1.x. The refactor! marker also communicates the breaking nature of the change.
Full details: Docstring Coverage

Explanation

Docstring coverage is 76.26% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 139 functions across 53 files. (4 skipped: 4 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Oct 7, 2026
@kwvg

kwvg commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator Author

/self-reviewed

@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.00000% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.92%. Comparing base (c5a9b94) to head (a4be8ac).

Files with missing lines Patch % Lines
dash-spv-ffi/src/bin/ffi_cli.rs 0.00% 9 Missing ⚠️
dash/src/network/constants.rs 25.00% 9 Missing ⚠️
dash/src/sml/masternode_list/debug_helpers.rs 0.00% 5 Missing ⚠️
key-wallet-ffi/src/account_derivation.rs 25.00% 3 Missing ⚠️
dash-spv-ffi/src/callbacks.rs 77.77% 2 Missing ⚠️
dash-spv/src/chain/chain_work.rs 0.00% 2 Missing ⚠️
key-wallet-ffi/src/account.rs 0.00% 2 Missing ⚠️
rpc-client/src/client.rs 33.33% 2 Missing ⚠️
dash-spv/src/client/queries.rs 0.00% 1 Missing ⚠️
key-wallet-ffi/src/keys.rs 0.00% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1115      +/-   ##
==========================================
- Coverage   77.96%   77.92%   -0.05%     
==========================================
  Files         302      302              
  Lines       79049    79108      +59     
==========================================
+ Hits        61634    61647      +13     
- Misses      17415    17461      +46     
Flag Coverage Δ
core 74.96% <85.26%> (+0.01%) ⬆️
ffi 51.15% <32.00%> (-0.54%) ⬇️
rpc 48.95% <88.00%> (+0.25%) ⬆️
spv 92.41% <86.36%> (+0.06%) ⬆️
wallet 81.99% <97.84%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
dash-spv/src/chain/checkpoints.rs 98.21% <100.00%> (ø)
dash-spv/src/validation/chainlock.rs 100.00% <100.00%> (ø)
dash-spv/src/validation/instantlock.rs 94.30% <100.00%> (+0.09%) ⬆️
dash/src/address.rs 57.07% <ø> (+0.04%) ⬆️
dash/src/blockdata/constants.rs 100.00% <ø> (ø)
dash/src/blockdata/transaction/mod.rs 86.91% <100.00%> (ø)
...transaction/asset_unlock/qualified_asset_unlock.rs 91.72% <100.00%> (ø)
...n/special_transaction/provider_update_registrar.rs 86.79% <100.00%> (+0.51%) ⬆️
...ion/special_transaction/provider_update_service.rs 82.69% <100.00%> (ø)
...ansaction/special_transaction/quorum_commitment.rs 72.02% <100.00%> (ø)
... and 28 more

... and 20 files with indirect coverage changes

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Ready for review — files with no dedicated owner: QuantumExplorer or ZocoLini or xdustinface · dash-spv: QuantumExplorer or ZocoLini or xdustinface · key-wallet-manager: QuantumExplorer or ZocoLini or xdustinface · key-wallet: QuantumExplorer or ZocoLini or xdustinface.
Full checklist in the description.

@github-actions github-actions Bot added ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. and removed waiting-self-review Waiting for the author to post /self-reviewed labels Oct 7, 2026
@github-actions github-actions Bot added the merge-conflict The PR conflicts with the target branch. label Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

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 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. merge-conflict The PR conflicts with the target branch. labels Oct 7, 2026
@kwvg

kwvg commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator Author

/self-reviewed

@github-actions github-actions Bot removed the waiting-self-review Waiting for the author to post /self-reviewed label Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Ready for review — files with no dedicated owner: QuantumExplorer or ZocoLini or xdustinface · dash-spv: QuantumExplorer or ZocoLini or xdustinface · key-wallet-manager: QuantumExplorer or ZocoLini or xdustinface · key-wallet: QuantumExplorer or ZocoLini or xdustinface.
Full checklist in the description.

@github-actions github-actions Bot added the ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. label Oct 7, 2026

@ZocoLini ZocoLini left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One thing I'd change: I don't think hex belongs in dashcore_hashes. Re-exporting it
there comes from bitcoin_hashes, which needs hex for its own Display/FromStr, but in
our code hex is a general utility (RPC JSON, FFI, wallet, tests) with nothing to do
with hashing. Pointing dashcore_hashes::hex at hex-conservative 1.x keeps that
coupling in place.

Proposal: a small dedicated crate, e.g. dashcore-hex that:

  • re-exports hex_conservative::*
  • adds a serde module for Vec/[u8; N] (the serde_hex helper from #1115 moves
    here, since 1.x dropped the upstream one)
  • replaces internals::hex, so we end up with exactly one hex module in the workspace

Workspace crates would depend on it directly, and dashcore_hashes would stop exposing
hex. For parsing hash types we keep using FromStr/.parse(), which doesn't need our
crate.

Optionally, dashcore could also re-export it as dashcore::hex, like bitcoin::hex, for
downstream convenience. I'd lean towards not doing that and having consumers depend
on dashcore-hex explicitly, but I'm fine either way.

Do you think you can do this here or you rather prefer to do it in #1110 or in a different PR??

@ZocoLini
ZocoLini merged commit 67b307c into dashpay:dev Oct 7, 2026
43 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants