Repository navigation
Conversation
TapLeaf never called verify(), so tr() accepted leaves that Bitcoin Core rejects, such as and_v(pk(B),1), and so did a TapLeaf built in code. Verify the miniscript when the leaf is built and require its type to be B, as Descriptor.__init__ does for wsh.
Descriptor.__init__ raises DescriptorError when a wsh script is not of type B. Raise the same error for a tapscript leaf.
Multi.__init__ already rejects multi in tr(), before the leaf is type-checked, and test_multi_variants covers it. Keep only the cases the leaf check catches.
The tests/unittest.py shim, which run_tests.py uses, has no subTest. Use plain loops instead.
A tr() leaf of type B could still be satisfied without a signature, as older(10) or sha256(H) are, or repeat a key. Bitcoin Core rejects both. The miniscript fragments now compute the s property, which BIP 379 defines as "satisfying this expression always requires a signature", and TapLeaf requires it. Parsing a leaf rejects a repeated key, comparing keys at index 0 of their first branch, as Core does. A whole-leaf multi_a() or sortedmulti_a() is not checked, since Core parses it outside miniscript and accepts repeated keys there. TapLeaf also refuses a miniscript parsed without taproot=True, which would otherwise accept multi() in a leaf. The literals 0 and 1 now keep the taproot flag they are parsed with.
This branch has not been deployed
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.
tr()still accepts leaves that Bitcoin Core rejects as not sane:tr(A,1),tr(A,older(10))andtr(A,sha256(H))are spendable on the script path without a signature, andtr(A,and_v(v:pk(B),pk(B)))repeats a key. The miniscript fragments now compute thesproperty, which BIP 379 defines as "satisfying this expression always requires a signature", and a leaf must have it. A leaf that repeats a key is rejected. As in Core, keys are compared at index 0, and only a whole-leafmulti_a()orsortedmulti_a()may repeat one.TapLeafalso refuses a miniscript built withouttaproot=True, which letmulti()into a leaf. Core v32.1.0 (getdescriptorinfo) accepts and rejects the sametr()descriptors as the tests.Built on #169: the branch carries its commits until #169 reaches master, and only the last commit is new. It applies notTanveer's review of #169, except the multipath length mismatch, which is on master too.