#36028 miniscript: make typing rule match BIP-379 exactly
https://github.com/bitcoin/bitcoin/pull/36028 · · +4/-6 in 1 files, 1 commits · labels: Descriptors · draft
Goal
- Align Miniscript typing rules with the BIP-379 specification to match test vectors
- Resolve edge-case discrepancies without altering descriptor acceptance or spendability
Aligns the typing rules in Bitcoin Core's Miniscript implementation (`src/script/miniscript.cpp`) with the exact text of BIP-379. Specifically, it simplifies type properties for `WRAP_D`, `OR_B`, and `THRESH` so that the 'e' (uniquely dissatisfiable) property matches the written specification even when the expression is already malleable.
Problem: Bitcoin Core's Miniscript type computation diverged in edge cases from the BIP-379 text for malleable expressions. While mathematically equivalent for validity and malleability checking, this divergence caused discrepancies when comparing against proposed BIP-379 test vectors.
Category: Wallet (#80 of 84)
P4 · cleanup
- P4 because it has zero user-visible impact on descriptor parsing or wallet spendability
- Benefit is strictly matching BIP-379 test vectors exactly in malleable edge cases
P4 because the change has zero user-visible impact on descriptor parsing or wallet spendability. As explained by the author and corroborated by guggero, 'for all cases where it matters, "always e" and "e when children have e" are equivalent' and descriptor acceptance is unchanged. Its value is strictly in matching BIP-379 test vectors exactly.
Membership: Touches descriptor Miniscript type checking under src/script/miniscript.cpp.
Factors: security/stability 0, bug 0, performance 0, user value 0, leverage 1
Reviewability: Paused: Waiting on BIP agreement
- Author kept the PR in draft pending approach agreement on BIP PR 2240
The author explicitly requested to keep the PR in draft until approach agreement is reached on BIP PR 2240.
Author status: Silent since creation on 2026-08-19; marked PR draft pending approach consensus on bitcoin/bips#2240.
Open concerns:
- Specification discussions in bitcoin/bips#2267 and rust-miniscript#1037 may suggest amending the BIP description rather than or in addition to this typing rule.
Resolved concerns:
- Confirmed that the changes cannot alter descriptor acceptance or valid witness generation in Core.
Agreement: Positive
- Concept approval confirming descriptor acceptance remains unchanged (guggero)
- Noted that discussions on specification wording may suggest amending the BIP instead (guggero)
Concept ACK from guggero, who also noted alternative spec clarifications in bip PR 2267.
guggero Concept ACKed the PR and aligned btcd and bip-0379 test vectors, though noted that discussions on spec wording are still evolving.
- guggero Concept ACKed commit 2631ece and confirmed no descriptor acceptance behavior changes.
- guggero shared an alternate LLM-generated commit following discussion on rust-miniscript#1037 and bitcoin/bips#2267.
Review verdicts (DrahtBot): 0
- Concept ACK: guggero
Dependencies
Enables:
Files
0 lines under test/bench/ci.
- src/script/miniscript.cpp +4/-6
Card
Sipa aligns Bitcoin Core's Miniscript typing rules with the exact wording of BIP-379 for expressions involving the uniquely dissatisfiable property. The change does not alter descriptor acceptance or spendability in practice, but aligns intermediate type evaluation with proposed BIP-379 test vectors. Guggero provided a Concept ACK while noting ongoing spec clarifications in BIP PR 2267 and rust-miniscript. The PR is paused in draft status waiting for agreement on the upstream BIP test vector PR.