Skip to content

fix(key-wallet)!: check child indexes in the dip9 path builders - #1323

Merged
xdustinface merged 1 commit into
devfrom
fix/dip9-child-index-check
Nov 5, 2026
Merged

xdustinface merged 1 commit into
devfrom
fix/dip9-child-index-check

Conversation

@ZocoLini

@ZocoLini ZocoLini commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

The DerivationPath builders in dip9.rs built ChildNumber::Hardened and ChildNumber::Normal straight from caller u32s, skipping the 31-bit check. An account of 0x8000_0000 built the same path as account 0, and an address index of 0x8000_0000 or more built a non-canonical normal child, while DerivationPath::from_str and AccountType::derivation_path reject both.

The builders now go through from_hardened_idx / from_normal_idx and return the error, like application_encryption_path already did. A test covers 0x7fff_ffff against 0x8000_0000 for the account and address index of bip_44_payment_path.

Breaking: the dip9 DerivationPath builders that take indexes return Result<DerivationPath, Error>.

Closes #1297

PR Hygiene · df51f3f

  • Bots — coderabbitai skipped after its own rate limit
  • Self-review — post /self-reviewed
  • Build green
  • Approvals
    • key-wallet (key-wallet/src/bip32.rs, key-wallet/src/dip9.rs) — QuantumExplorer 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.

The `DerivationPath` builders in `dip9.rs` built `ChildNumber::Hardened`
and `ChildNumber::Normal` straight from caller `u32`s, skipping the
31-bit check. An account of `0x8000_0000` built the same path as account
0, and an address index of `0x8000_0000` or more built a non-canonical
normal child, while `DerivationPath::from_str` and
`AccountType::derivation_path` reject both.

The builders now go through `from_hardened_idx` / `from_normal_idx` and
return the error, like `application_encryption_path` already did.

BREAKING CHANGE: the `dip9` `DerivationPath` builders that take indexes
return `Result<DerivationPath, Error>`.

Closes #1297
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 35 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between a319c0a and df51f3f.

Files selected for processing: 2
  • key-wallet/src/bip32.rs
  • key-wallet/src/dip9.rs
  • Autofix · 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

@github-actions

github-actions Bot commented Nov 4, 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 Nov 4, 2026
@codecov

codecov Bot commented Nov 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.75362% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.99%. Comparing base (a319c0a) to head (df51f3f).

Files with missing lines Patch % Lines
key-wallet/src/dip9.rs 86.11% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1323      +/-   ##
==========================================
- Coverage   85.00%   84.99%   -0.01%     
==========================================
  Files         267      267              
  Lines       67675    67671       -4     
==========================================
- Hits        57525    57518       -7     
- Misses      10150    10153       +3     
Flag Coverage Δ
core 82.03% <ø> (ø)
rpc 52.10% <ø> (ø)
spv 93.89% <ø> (-0.01%) ⬇️
wallet 83.12% <92.75%> (-0.01%) ⬇️
Files with missing lines Coverage Δ
key-wallet/src/bip32.rs 85.78% <100.00%> (+0.13%) ⬆️
key-wallet/src/dip9.rs 74.77% <86.11%> (-2.45%) ⬇️

... and 3 files with indirect coverage changes

@github-actions

github-actions Bot commented Nov 4, 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 bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. and removed waiting-bots Waiting for the review bots to report on this head labels Nov 4, 2026
@xdustinface
xdustinface merged commit 64be3a1 into dev Nov 5, 2026
35 of 36 checks passed
@xdustinface
xdustinface deleted the fix/dip9-child-index-check branch November 5, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. waiting-self-review Waiting for the author to post /self-reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(key-wallet): check child indexes in the dip9 path builders

2 participants