test: expand offline descriptor test coverage to include all BIP descriptor constructors

Đang mở
#51 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
84/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
testing

Hướng nghiên cứu

Bắt đầu với tests/test_offline_descriptor.py và test_descriptor_bip86 hiện có để làm theo mẫu fixed-mnemonic và full-descriptor-string của nó. Bổ sung coverage cho các constructor BIP44, BIP49, BIP84, BIP86, new_wsh_sortedmulti và new_sh_sortedmulti được liệt kê, sau đó chạy các bài kiểm thử descriptor offline; hoàn tất khi tất cả các chuỗi descriptor và checksum mong đợi đều vượt qua mà không cần truy cập mạng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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)
  • Multisignew_wsh_sortedmulti and new_sh_sortedmulti 2-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

Ngôn ngữ chính
Python
Star
11
Fork
12
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
2

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của bitcoindevkit/bdk-python

Tất cả issue của bitcoindevkit/bdk-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.