Looking at the coverage report for master on https://corecheck.dev, a number of error branches in descriptor.cpp are never exercised by any test. This PR adds CheckUnparsable vectors for each reachable one, plus one
positive boundary check:
musig()
- unterminated expression:
tr(musig(00)→ "Invalid musig() expression" - invalid participant key
- trailing garbage after a participant key:
tr(musig(KEY}{))→ "musig(): expected ',', got '}'" (the}closes the level opened by the(ofmusig(and the{re-opens it, so the final)stays inside the expression span; thanks to @151henry151 for the counterexample showing this branch is reachable) - invalid derivation path element (the
musig():-prefixed wrapping of the keypath error; the underlyingParseKeyPatherrors were already covered viapkh()/wpkh()) - participants with multipath derivations of mismatched lengths (
/<0;1>vs/<0;1;2>; themulti()and Miniscript variants of this error were covered, themusig()one was not)
Context restrictions
multi()insidetr(),multi_a()at top level, andaddr()/tr()/rawtr()/raw()insidesh()
Taptree structure errors
- exceeding the 128 nesting level limit (129
{s, built withstd::string(129, '{')) - missing
'}'after a right branch, missing','after a left branch, trailing garbage after a script expression and after the internal key - a positive check that a taptree of exactly 128 nesting levels parses and expands successfully, so the limit is verified on both sides (suggested by @Herb-ops)
rawtr()
- invalid key.
00is used (rather than the truncated-valid-key pattern used elsewhere in this file) because in Taproot contexts a 32-byte string would parse as a valid x-only key.
Since CheckUnparsable asserts on the exact error message and each targeted branch produces a distinct one, a passing vector proves the corresponding branch executed.
Note that replaying the qa-assets descriptor_parse/mocked_descriptor_parse fuzz corpora already reaches these branches, so the value of these vectors is deterministic coverage in the unit tests with the exact error messages pinned.