test: expand offline descriptor test coverage to include all BIP descriptor constructors
还没有人认领这个 Issue。
评估
调研方向
从 tests/test_offline_descriptor.py 和现有的 test_descriptor_bip86 测试开始,遵循其 fixed-mnemonic 和 full-descriptor-string 模式。为列出的 BIP44、BIP49、BIP84、BIP86、new_wsh_sortedmulti 和 new_sh_sortedmulti 构造函数添加覆盖,然后运行离线 descriptor 测试;在无需网络访问的情况下,所有预期的 descriptor 字符串和校验和都通过后即完成。
由索引模型根据 Issue 内容生成。
描述
What is missing
tests/test_offline_descriptor.py currently contains a single test:
test_descriptor_bip86 — tests Descriptor.new_bip86() for the external keychain only
bdkpython exposes 8 BIP descriptor template constructors (from bdk_wallet::template)
across 4 standards, each with a private key variant (DescriptorSecretKey) and a
watch-only public key variant (DescriptorPublicKey), plus 3 miniscript multisig
constructors. None of the following have test coverage today:
| Constructor | Standard | Script type | Tested? |
|---|---|---|---|
Descriptor.new_bip44() |
BIP44 | pkh(...) |
No |
Descriptor.new_bip44_public() |
BIP44 | pkh(...) |
No |
Descriptor.new_bip49() |
BIP49 | sh(wpkh(...)) |
No |
Descriptor.new_bip49_public() |
BIP49 | sh(wpkh(...)) |
No |
Descriptor.new_bip84() |
BIP84 | wpkh(...) |
No |
Descriptor.new_bip84_public() |
BIP84 | wpkh(...) |
No |
Descriptor.new_bip86() internal |
BIP86 | tr(...) |
No |
Descriptor.new_bip86_public() |
BIP86 | tr(...) |
No |
Descriptor.new_wsh_sortedmulti() |
miniscript | wsh(sortedmulti(...)) |
No |
Descriptor.new_sh_sortedmulti() |
miniscript | sh(sortedmulti(...)) |
No |
Descriptor.new_sh_wsh_sortedmulti() |
miniscript | sh(wsh(sortedmulti(...))) |
No |
What I propose to add
13 new tests in tests/test_offline_descriptor.py covering:
- BIP44 — external keychain, internal keychain, and watch-only (
new_bip44_public) variant - BIP49 — external keychain, internal keychain, and watch-only (
new_bip49_public) variant - BIP84 — external keychain, internal keychain, and watch-only (
new_bip84_public) variant - BIP86 — internal keychain and watch-only (
new_bip86_public) variant (external already exists) - Multisig —
new_wsh_sortedmultiandnew_sh_sortedmulti2-of-3
I am intentionally leaving new_sh_wsh_sortedmulti out of this PR to keep the scope
focused, and can follow up with a separate issue if the maintainers consider it worthwhile.
All tests will be:
- Fully offline — no network access required
- Deterministic — fixed test mnemonic so expected outputs are independently verifiable
with any compatible BIP32/BIP44/BIP49/BIP84/BIP86 implementation - Following the same pattern as the existing test: fixed mnemonic → derive key → assert full descriptor string including checksum
Why this matters
Descriptor construction is the first thing every bdkpython user does — it is required
to create a Wallet. Without test coverage for these constructors, a regression in the
FFI layer (e.g. wrong derivation path, wrong script type, wrong network prefix, wrong
checksum) would go undetected until a user reports it in production.
Each test pins the full descriptor output string to a known-correct value, which means
any future change to the FFI type conversion or the bdk_wallet::template behavior
that silently produces wrong output will immediately fail CI.
This is a pure Python addition — no changes to the Rust layer.
Checklist before I open a PR
- Maintainer confirms this contribution is welcome
- I will follow the existing file structure in
tests/test_offline_descriptor.py - I will verify all expected values against the fixed mnemonic before submitting
- 主要语言
- Python
- 星标
- 11
- 派生
- 12
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 2
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bitcoindevkit/bdk-python 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
bitcoindevkit/bdk-python#31 · 3 条评论 ·
查看 bitcoindevkit/bdk-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 74/100