Add Taproot miniscript (tr()) support#111
Merged
Merged
Conversation
7918a39 to
e767f0e
Compare
Bump the libwally submodule to the BUILD_STANDARD_SECP-aware amalgamation and pass -DBUILD_STANDARD_SECP=1 from every build (firmware, simulator, host tests) so MuSig2 and the unused ecdsa-s2c/anti-exfil layers are compiled out. Taproot (schnorr/bip341) is unaffected.
Open the registration gate so miniscript wrapped in tr() (taproot script-path) is accepted alongside wsh(); signing and classification were already taproot-aware. Route every descriptor parse through a new wallet_descriptor_parse() wrapper that caps recursion at KERN_DESCRIPTOR_MAX_DEPTH (32), bounding the one unbounded-recursion path on the 16KB LVGL task stack.
The miniscript script-type dropdown now offers Taproot alongside Native SegWit. Selecting it seeds the BIP48-style default path subscript 3h (tr) vs 2h (wsh); the Path button still overrides. Only the suggested origin string changes — key material is identical.
Classify a tr() descriptor's internal (key-path) key as ours / NUMS / external. NUMS detection matches BIP341 H against both bare pubkeys and the xpub form coordinators use (base key == H), mirroring Krux. A bare no-origin non-NUMS internal key is neither provably unspendable nor attributable to a participant and is rejected outright (VALIDATION_TR_INTERNAL_NOT_UNSPENDABLE). The info dialog shows a reassuring NUMS note / discourage-colored external note and skips blank xpub rows for raw keys.
psbt_trim() copied the key-path sig but not taproot_leaf_signatures, so script-path (tapscript) spends exported with no signature.
e767f0e to
bb07065
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enables registering, displaying Taproot miniscript descriptors and signing both key-path (BIP86) and script-path (tr(KEY, )) alongside the existing wsh() miniscript support.
Requires a custom libwally branch, crafted by @pythcoiner, followed by some tweaks.