descriptor: Expose key expression parsing #35918

Open
pseudoramdom wants to merge 3 commits from parse-key-expression-v2 into master AGit
pseudoramdom commented 2026-08-06 18:44:09 +00:00 (Migrated from github.com)

This PR exposes a utility function to parse and validate a standalone descriptor key expression.
This is particularly useful in GUI multisig setup flows where the UI accepts a pasted key expression. The GUI can use this parser to validate input, inspect the parsed key, and apply setup-specific policy i.e. reject private keys, uncompressed keys etc. (Multisig Wizard tracking issue: https://github.com/bitcoin/bitcoin/issues/35645)

PubkeyProvider is the existing internal representation of a parsed key expression. This PR exposes its interface in descriptor.h and adds a public ParsePubkey() overload that returns the providers produced by the existing parser.

Key changes

  • public overload uses P2TR key rules, permitting compressed, x-only, extended, and MuSig key expressions while rejecting uncompressed keys.
  • Add GetOriginInfo() for retrieving explicitly provided key origin information.

Also, while I'm here, I noticed that musig parser accepted trailing characters apart from /.

  • Add a fix & test to reject unexpected trailing characters after a musig() expression
This PR exposes a utility function to parse and validate a standalone descriptor key expression. This is particularly useful in GUI multisig setup flows where the UI accepts a pasted key expression. The GUI can use this parser to validate input, inspect the parsed key, and apply setup-specific policy i.e. reject private keys, uncompressed keys etc. (Multisig Wizard tracking issue: https://github.com/bitcoin/bitcoin/issues/35645) `PubkeyProvider` is the existing internal representation of a parsed key expression. This PR exposes its interface in `descriptor.h` and adds a public `ParsePubkey()` overload that returns the providers produced by the existing parser. Key changes - public overload uses P2TR key rules, permitting compressed, x-only, extended, and MuSig key expressions while rejecting uncompressed keys. - Add `GetOriginInfo()` for retrieving explicitly provided key origin information. --- Also, while I'm here, I noticed that `musig` parser accepted trailing characters apart from `/`. - Add a fix & test to reject unexpected trailing characters after a `musig()` expression
DrahtBot commented 2026-08-06 18:44:17 +00:00 (Migrated from github.com)

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK w0xlt, pablomartin4btc, polespinasa
Approach NACK rkrux
Stale ACK murchandamus

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #36885 (wallet, rpc: Add analyzedescriptor for multisig setups by pablomartin4btc)
  • #36648 (descriptor, rpc, wallet: do not echo key material in error messages by fametrano)
  • #36154 (wallet: fill PSBT_GLOBAL_XPUB by jeanpablojp)
  • #36143 (descriptor: add CreateMultisigDescriptor() by rxbryan)
  • #36122 (BIP460: CISA for Taproot key path spends by fjahr)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/35918 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/35918.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/35918#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [w0xlt](https://github.com/bitcoin/bitcoin/pull/35918#pullrequestreview-6161468858), [pablomartin4btc](https://github.com/bitcoin/bitcoin/pull/35918#pullrequestreview-6162283953), [polespinasa](https://github.com/bitcoin/bitcoin/pull/35918#pullrequestreview-6165325529) | | Approach NACK | [rkrux](https://github.com/bitcoin/bitcoin/pull/35918#pullrequestreview-6152930319) | | Stale ACK | [murchandamus](https://github.com/bitcoin/bitcoin/pull/35918#pullrequestreview-5985712293) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts Reviewers, this pull request conflicts with the following ones: * [#36885](https://github.com/bitcoin/bitcoin/pull/36885) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36885.svg"></sub> (wallet, rpc: Add analyzedescriptor for multisig setups by pablomartin4btc) * [#36648](https://github.com/bitcoin/bitcoin/pull/36648) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36648.svg"></sub> (descriptor, rpc, wallet: do not echo key material in error messages by fametrano) * [#36154](https://github.com/bitcoin/bitcoin/pull/36154) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36154.svg"></sub> (wallet: fill PSBT_GLOBAL_XPUB by jeanpablojp) * [#36143](https://github.com/bitcoin/bitcoin/pull/36143) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36143.svg"></sub> (descriptor: add CreateMultisigDescriptor() by rxbryan) * [#36122](https://github.com/bitcoin/bitcoin/pull/36122) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36122.svg"></sub> (BIP460: CISA for Taproot key path spends by fjahr) If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. <!--5faf32d7da4f0f540f40219e4f7537a3-->
DrahtBot commented 2026-08-11 11:55:21 +00:00 (Migrated from github.com)

🐙 This pull request conflicts with the target branch and needs rebase.

<!--cf906140f33d8803c4a75a2196329ecb--> 🐙 This pull request conflicts with the target branch and [needs rebase](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#rebasing-changes).
w0xlt (Migrated from github.com) reviewed 2026-08-13 20:32:32 +00:00
w0xlt (Migrated from github.com) left a comment

ACK 93600f9f0360bf48a1f616f0f5db3c9ce985ce4b

ACK 93600f9f0360bf48a1f616f0f5db3c9ce985ce4b
DrahtBot commented 2026-08-24 11:29:10 +00:00 (Migrated from github.com)

🐙 This pull request conflicts with the target branch and needs rebase.

<!--cf906140f33d8803c4a75a2196329ecb--> 🐙 This pull request conflicts with the target branch and [needs rebase](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#rebasing-changes).
uqlidi (Migrated from github.com) reviewed 2026-08-28 17:10:28 +00:00
Lines 2871-2876
uqlidi (Migrated from github.com) commented 2026-08-28 17:05:22 +00:00
std::vector<std::unique_ptr<PubkeyProvider>> ParsePubkey(std::string_view key_expression, ParseScriptContext ctx, FlatSigningProvider& out, std::string& error)
{
    uint32_t key_exp_index{0};
    const std::span<const char> expression{key_expression};
    return ParsePubkey(key_exp_index, expression, ctx, out, error);
}

I see you hardcoded it for p2tr. shouldn't be for all script types? Why are you making the overload follow the p2tr rules only?

```suggestion std::vector<std::unique_ptr<PubkeyProvider>> ParsePubkey(std::string_view key_expression, ParseScriptContext ctx, FlatSigningProvider& out, std::string& error) { uint32_t key_exp_index{0}; const std::span<const char> expression{key_expression}; return ParsePubkey(key_exp_index, expression, ctx, out, error); } ``` I see you hardcoded it for p2tr. shouldn't be for all script types? Why are you making the overload follow the p2tr rules only?
sedited (Migrated from github.com) reviewed 2026-10-13 07:02:19 +00:00
Lines 2871-2876
sedited (Migrated from github.com) commented 2026-10-13 07:02:19 +00:00

@pseudoramdom can you follow up here?

@pseudoramdom can you follow up here?
First-time contributor

Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive linked from the Review report for their assessments.

🔵 Suggestion · Failed musig() parsing leaves out partially populated without an explicit contract

The new ParsePubkey() API can fail after adding participant private keys to out, but its failure contract and tests do not describe this; no current production caller was found.

Location: src/script/descriptor.cpp:2930 (head).

🔵 Suggestion · Standalone PubkeyProvider results lack an explicit cache-isolation contract

Separately parsed BIP32 keys reuse cache indices, so sharing a DescriptorCache can return another key's derived public key; no current caller doing this was found.

Location: src/script/descriptor.h:94 (head).

🔵 Suggestion · HavePrivateKeys() leaves its all-participant MuSig semantics undocumented

For musig(), HavePrivateKeys() requires all participants' private keys, making it unsuitable for rejecting any private material; no current caller using it for that policy was found.

Location: src/script/descriptor.h:143 (head).

Review coverage was incomplete.


Reviewed: fdad1e48e855 · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:e1a29e5e677c47d383756f0fcf8f3760725c91d1104dd3ccb2f333b6217eba26:47880f5569fd2047d249266f337c4f2a509adf7d96c3ccb1c7644c2c2a650bff --> <!-- ralph-base:0bc1e88dd332476e143eaee3c74911f4ce91f0a1 --> <!-- ralph-head:fdad1e48e8554d17cba3a151bed57ab35d769d11 --> <!-- ralph-case:8ad89400538e1bd9e9d0a37c682588a55dd01078cf4e3b508a0a00a5dfbf78a5 --> Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive linked from the Review report for their assessments. **🔵 Suggestion · Failed `musig()` parsing leaves `out` partially populated without an explicit contract** The new `ParsePubkey()` API can fail after adding participant private keys to `out`, but its failure contract and tests do not describe this; no current production caller was found. Location: [`src/script/descriptor.cpp:2930`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/fdad1e48e8554d17cba3a151bed57ab35d769d11/src/script/descriptor.cpp#L2930>) (head). **🔵 Suggestion · Standalone `PubkeyProvider` results lack an explicit cache-isolation contract** Separately parsed BIP32 keys reuse cache indices, so sharing a `DescriptorCache` can return another key's derived public key; no current caller doing this was found. Location: [`src/script/descriptor.h:94`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/fdad1e48e8554d17cba3a151bed57ab35d769d11/src/script/descriptor.h#L94>) (head). **🔵 Suggestion · `HavePrivateKeys()` leaves its all-participant MuSig semantics undocumented** For `musig()`, `HavePrivateKeys()` requires all participants' private keys, making it unsuitable for rejecting any private material; no current caller using it for that policy was found. Location: [`src/script/descriptor.h:143`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/fdad1e48e8554d17cba3a151bed57ab35d769d11/src/script/descriptor.h#L143>) (head). Review coverage was incomplete. <!-- Review tier: sensitive --> --- Reviewed: [`fdad1e48e855`](<https://git.fish.foo/bitcoin/bitcoin/commit/fdad1e48e8554d17cba3a151bed57ab35d769d11>) · [Review report](<https://review.fish.foo/report/35918-fdad1e48e8554d17cba3a151bed57ab35d769d11-3459-6.html>) · [Previous reports](<https://review.fish.foo/traces/35918/>) [permalink](<https://review.fish.foo/report/35918-fdad1e48e8554d17cba3a151bed57ab35d769d11-3459-6.html>)
sedited commented 2026-10-14 05:53:51 +00:00 (Migrated from github.com)

Ping for rebase @pseudoramdom

Ping for rebase @pseudoramdom
pseudoramdom (Migrated from github.com) reviewed 2026-10-14 07:30:25 +00:00
Lines 2921-2926
pseudoramdom (Migrated from github.com) commented 2026-10-14 07:30:25 +00:00

Using P2TR here is intentional, as mentioned in the PR description. Its key parsing rules match what we want for standalone key expressions: accept compressed, x-only, extended, and musig() expressions, while rejecting uncompressed keys.

Using P2TR here is intentional, as mentioned in the PR description. Its key parsing rules match what we want for standalone key expressions: accept compressed, x-only, extended, and musig() expressions, while rejecting uncompressed keys.
pseudoramdom commented 2026-10-14 07:35:25 +00:00 (Migrated from github.com)
Rebased & force-pushed to https://github.com/bitcoin/bitcoin/pull/35918/commits/17ddfdc0edc3ac35b1a87c884d61db2a58941bce. No other changes.
fametrano commented 2026-10-18 06:25:22 +00:00 (Migrated from github.com)

The first commit, 7835e0ef70, fixes a bug I also found on v31.1: tr(musig(X)xyz) is accepted and xyz is dropped. The worse case is a typo such as tr(musig(X)0/*), missing the /, which v31.1 turns into a non-ranged tr(musig(X)) without an error. Since it is a parser fix and the rest of the PR adds a new API, would you split it into its own PR? It could then be reviewed and backported on its own.

The first commit, 7835e0ef70, fixes a bug I also found on v31.1: `tr(musig(X)xyz)` is accepted and `xyz` is dropped. The worse case is a typo such as `tr(musig(X)0/*)`, missing the `/`, which v31.1 turns into a non-ranged `tr(musig(X))` without an error. Since it is a parser fix and the rest of the PR adds a new API, would you split it into its own PR? It could then be reviewed and backported on its own.
w0xlt (Migrated from github.com) reviewed 2026-10-20 18:05:53 +00:00
w0xlt (Migrated from github.com) left a comment

reACK 17ddfdc0ed

reACK 17ddfdc0edc3ac35b1a87c884d61db2a58941bce
pablomartin4btc (Migrated from github.com) reviewed 2026-10-31 02:57:20 +00:00
pablomartin4btc (Migrated from github.com) left a comment

Concept ACK

A couple of nits in commits:

  • In 2nd commit (c17a6ab) message body, it mentions "Mostly a move-only commit. Implementation of operator< is retained in descriptor.cpp" but there's no operator< in descriptor.cpp or descriptor.h. What remains in the .cpp are the implementations of HavePrivateKeys() and DetermineApostropheUse(). Perhaps a leftover of a previous version of this change?

  • In 3rd commit (17ddfdc), tiny nit: the title specifies ParsePubKey but the function name is ParsePubkey.

Please keep in mind that #36442 changes the internal ParsePubkey to return a single provider for multipath expressions, so the new public overload may need to follow, depending on which one gets merged first.

I left another couple of non-blocking nits inline.

Concept ACK A couple of nits in commits: - In 2nd commit (c17a6ab) message body, it mentions "Mostly a move-only commit. Implementation of operator< is retained in descriptor.cpp" but there's no operator< in `descriptor.cpp` or `descriptor.h`. What remains in the .cpp are the implementations of `HavePrivateKeys()` and `DetermineApostropheUse()`. Perhaps a leftover of a previous version of this change? - In 3rd commit (17ddfdc), tiny nit: the title specifies ParsePubKey but the function name is `ParsePubkey`. Please keep in mind that #36442 changes the internal `ParsePubkey` to return a single provider for multipath expressions, so the new public overload may need to follow, depending on which one gets merged first. I left another couple of non-blocking nits inline.
pablomartin4btc (Migrated from github.com) commented 2026-10-30 22:46:10 +00:00

nit: maybe worth noting that it only covers the key's own origin, e.g. a musig() returns none even when its participants have one (there's no test for this yet; I'll suggest one later with some other test cases):

    /** Return explicitly provided key origin information, if any. For musig(), this
     *  does not include its participants' origins. */
nit: maybe worth noting that it only covers the key's own origin, e.g. a musig() returns none even when its participants have one (there's no test for this yet; I'll suggest one later with some other test cases): ```suggestion /** Return explicitly provided key origin information, if any. For musig(), this * does not include its participants' origins. */ ```
pablomartin4btc (Migrated from github.com) commented 2026-10-30 22:37:29 +00:00

nit: "P2TR key rules" may not be obvious to callers, so perhaps spell out what it means, and that multipath returns more than one provider (?):

/** Parse a key expression using P2TR key rules: compressed, x-only, extended and
* musig() key expressions are accepted, uncompressed keys are rejected, and
* WIF private keys are serialized as x-only.
nit: "P2TR key rules" may not be obvious to callers, so perhaps spell out what it means, and that multipath returns more than one provider (?): ```suggestion /** Parse a key expression using P2TR key rules: compressed, x-only, extended and * musig() key expressions are accepted, uncompressed keys are rejected, and * WIF private keys are serialized as x-only. ```
pseudoramdom (Migrated from github.com) reviewed 2026-11-06 00:03:15 +00:00
pseudoramdom (Migrated from github.com) commented 2026-11-06 00:03:15 +00:00

Fixed

Fixed
pseudoramdom (Migrated from github.com) reviewed 2026-11-06 00:03:33 +00:00
pseudoramdom (Migrated from github.com) commented 2026-11-06 00:03:33 +00:00

Fixed in b0f139d512

Fixed in b0f139d5126eeba66d8434a0b43057f3b592669f
pseudoramdom commented 2026-11-06 00:04:38 +00:00 (Migrated from github.com)

Force-pushed to b0f139d512 to address @pablomartin4btc's feedback. Cleaned up commit messages and the code comments.

Force-pushed to b0f139d5126eeba66d8434a0b43057f3b592669f to address @pablomartin4btc's feedback. Cleaned up commit messages and the code comments.
w0xlt (Migrated from github.com) reviewed 2026-11-06 01:29:25 +00:00
w0xlt (Migrated from github.com) left a comment

reACK b0f139d512

reACK b0f139d5126eeba66d8434a0b43057f3b592669f
pablomartin4btc (Migrated from github.com) reviewed 2026-11-14 04:18:49 +00:00
pablomartin4btc (Migrated from github.com) commented 2026-11-14 04:18:49 +00:00

Thanks! Here's the test I mentioned, the musig() case at the end of parse_pubkey_origin_info, together with a few other GetOriginInfo() cases (github.com/pablomartin4btc/bitcoin@9eea6bf07d):

    // musig() has no origin of its own, even when its participants have one.
    providers = ParsePubkey("musig([aabbccdd/87h]" + xpub + "," + xpub2 + ")/0/*", keys, error);
    BOOST_REQUIRE_MESSAGE(providers.size() == 1, error);
    BOOST_CHECK(providers.front()->IsRange());
    BOOST_CHECK(!providers.front()->GetOriginInfo().has_value());
Thanks! Here's the test I mentioned, the musig() case at the end of `parse_pubkey_origin_info`, together with a few other `GetOriginInfo()` cases (https://github.com/pablomartin4btc/bitcoin/commit/9eea6bf07d2d98d3963066d4a8fb6e35d9538b16): ```cpp // musig() has no origin of its own, even when its participants have one. providers = ParsePubkey("musig([aabbccdd/87h]" + xpub + "," + xpub2 + ")/0/*", keys, error); BOOST_REQUIRE_MESSAGE(providers.size() == 1, error); BOOST_CHECK(providers.front()->IsRange()); BOOST_CHECK(!providers.front()->GetOriginInfo().has_value()); ```
pablomartin4btc (Migrated from github.com) reviewed 2026-11-14 04:26:54 +00:00
pablomartin4btc (Migrated from github.com) left a comment

ACK b0f139d512

Thanks for addressing the nits.

I added some extra test cases for the new API in pablomartin4btc@ pr35918-tests (on top of b0f139d), feel free to cherry-pick any of them (non-blocking):

  • 9eea6bf07d2d98d3963066d4a8fb6e35d9538b16 parse_pubkey_origin_info: GetOriginInfo() on each multipath expansion, with a fingerprint and no path, on a constant key, and on a musig() whose participant has an origin.
  • 959f099f3731bb3e8af206bf12807f7acc6c1751 parse_pubkey_invalid_expressions: input a "paste a key" field could receive (empty, leading whitespace, a whole descriptor, musig(...)0/*) is rejected without adding private keys. It doesn't assert messages that quote the input, so it won't conflict with #36648.
  • 32e2bcf9c05193d9baf6e665003b0927e331ce45 parse_pubkey_hardened_after_xpub: xpub/0h/* parses but CanSelfExpand() is false, so callers validating a cosigner key know what to check.
ACK b0f139d5126eeba66d8434a0b43057f3b592669f Thanks for addressing the nits. I added some extra test cases for the new API in [pablomartin4btc@ pr35918-tests](https://github.com/pablomartin4btc/bitcoin/tree/pr35918-tests) (on top of b0f139d), feel free to cherry-pick any of them (non-blocking): - 9eea6bf07d2d98d3963066d4a8fb6e35d9538b16 `parse_pubkey_origin_info`: `GetOriginInfo()` on each multipath expansion, with a fingerprint and no path, on a constant key, and on a musig() whose participant has an origin. - 959f099f3731bb3e8af206bf12807f7acc6c1751 `parse_pubkey_invalid_expressions`: input a "paste a key" field could receive (empty, leading whitespace, a whole descriptor, musig(...)0/*) is rejected without adding private keys. It doesn't assert messages that quote the input, so it won't conflict with [#36648](https://github.com/bitcoin/bitcoin/pull/36648). - 32e2bcf9c05193d9baf6e665003b0927e331ce45 `parse_pubkey_hardened_after_xpub`: xpub/0h/* parses but `CanSelfExpand()` is false, so callers validating a cosigner key know what to check.
murchandamus (Migrated from github.com) reviewed 2026-11-20 00:35:21 +00:00
murchandamus (Migrated from github.com) left a comment

Mostly note to self: I got through the first two commits so far.

crACK 086b0cd0b0

Mostly note to self: I got through the first two commits so far. crACK 086b0cd0b02397d5badf7a30da010406acd85528
achow101 (Migrated from github.com) reviewed 2026-11-20 23:54:37 +00:00
achow101 (Migrated from github.com) commented 2026-11-20 23:54:33 +00:00

In b0f139d512 "descriptor: Add public ParsePubkey overload"

This is a lot of boilerplate. Can this be deduplicated in a way similar to how descriptor tests use Check?

In b0f139d5126eeba66d8434a0b43057f3b592669f "descriptor: Add public ParsePubkey overload" This is a lot of boilerplate. Can this be deduplicated in a way similar to how descriptor tests use `Check`?
polespinasa (Migrated from github.com) reviewed 2026-11-26 16:52:35 +00:00
polespinasa (Migrated from github.com) left a comment
ACK b0f139d5126eeba66d8434a0b43057f3b592669f
rkrux (Migrated from github.com) reviewed 2026-12-02 14:37:44 +00:00
rkrux (Migrated from github.com) left a comment

Concept ACK but Approach NACK

The first commit 7a81907c34 descriptor: Reject trailing text after musig() should be a separate PR. It's a bug fix unrelated to the goal of this PR and can be reviewed, merged, and back-ported separately.

Concept ACK but Approach NACK The first commit 7a81907c34a9b4b624fd5f51f19ab522bfd31b28 [descriptor: Reject trailing text after musig()](https://github.com/bitcoin/bitcoin/pull/35918/changes/7a81907c34a9b4b624fd5f51f19ab522bfd31b28) should be a separate PR. It's a bug fix unrelated to the goal of this PR and can be reviewed, merged, and back-ported separately.
pseudoramdom commented 2026-12-02 18:32:48 +00:00 (Migrated from github.com)

The first commit 7a81907 descriptor: Reject trailing text after musig() should be a separate PR. It's a bug fix unrelated to the goal of this PR and can be reviewed, merged, and back-ported separately.

Thanks for the review. While I agree that the musig() fix stands on its own, I kept it here because it's in the same parser this PR exposes through the new ParsePubkey() overload. A key expression pasted into the GUI goes through this path, so musig(A,B)garbage would otherwise be accepted. So the fix is not unrelated.
If it should be backported, I'm happy to split it into its own PR.

Approach NACK

Apart from the first commit, is there any concern with the rest of the approach?

> The first commit [7a81907](https://github.com/bitcoin/bitcoin/commit/7a81907c34a9b4b624fd5f51f19ab522bfd31b28) [descriptor: Reject trailing text after musig()](https://github.com/bitcoin/bitcoin/pull/35918/changes/7a81907c34a9b4b624fd5f51f19ab522bfd31b28) should be a separate PR. It's a bug fix unrelated to the goal of this PR and can be reviewed, merged, and back-ported separately. Thanks for the review. While I agree that the musig() fix stands on its own, I kept it here because it's in the same parser this PR exposes through the new `ParsePubkey()` overload. A key expression pasted into the GUI goes through this path, so `musig(A,B)garbage` would otherwise be accepted. So the fix is not unrelated. If it should be backported, I'm happy to split it into its own PR. > Approach NACK Apart from the first commit, is there any concern with the rest of the approach?
pseudoramdom (Migrated from github.com) reviewed 2026-12-02 23:14:20 +00:00
pseudoramdom (Migrated from github.com) commented 2026-12-02 23:14:20 +00:00

Done in fdad1e48e8. Added two helpers, CheckParsePubkey() and CheckUnparsablePubkey(), similar to Check/CheckUnparsable.

Done in fdad1e48e8. Added two helpers, `CheckParsePubkey()` and `CheckUnparsablePubkey()`, similar to `Check`/`CheckUnparsable`.
pseudoramdom commented 2026-12-02 23:16:59 +00:00 (Migrated from github.com)

Force-pushed to github.com/bitcoin/bitcoin@fdad1e48e8
Deduplicated the ParsePubkey() tests to use CheckParsePubkey()/CheckUnparsablePubkey() helpers, following the Check/CheckUnparsable pattern.

Force-pushed to https://github.com/bitcoin/bitcoin/commit/fdad1e48e8554d17cba3a151bed57ab35d769d11 Deduplicated the `ParsePubkey()` tests to use `CheckParsePubkey()`/`CheckUnparsablePubkey()` helpers, following the `Check`/`CheckUnparsable` pattern.
w0xlt (Migrated from github.com) reviewed 2026-12-03 00:20:16 +00:00
w0xlt (Migrated from github.com) left a comment

reACK fdad1e48e8

reACK fdad1e48e8554d17cba3a151bed57ab35d769d11
pablomartin4btc (Migrated from github.com) reviewed 2026-12-03 01:46:15 +00:00
pablomartin4btc (Migrated from github.com) left a comment

re-ACK fdad1e48e8

Since my last review, @achow101 feedback was addressed.

re-ACK fdad1e48e8554d17cba3a151bed57ab35d769d11 Since my last review, @achow101 [feedback](https://github.com/bitcoin/bitcoin/pull/35918#discussion_r4649060037) was addressed.
polespinasa (Migrated from github.com) reviewed 2026-12-03 07:24:07 +00:00
polespinasa (Migrated from github.com) left a comment

reACK fdad1e48e8

reACK fdad1e48e8554d17cba3a151bed57ab35d769d11
rkrux (Migrated from github.com) reviewed 2026-12-03 08:42:37 +00:00
rkrux (Migrated from github.com) left a comment

Apart from the first commit, is there any concern with the rest of the approach?

Rest all is pretty straightforward.

> Apart from the first commit, is there any concern with the rest of the approach? Rest all is pretty straightforward.
rkrux (Migrated from github.com) commented 2026-12-03 08:41:05 +00:00

In 48ad4dfb96 "descriptor: Reject trailing text after musig()"

While this is fine, a more realistic test case would read more appropriately. Like the one mentioned in https://github.com/bitcoin/bitcoin/pull/35918#issuecomment-6246540048.

+ CheckUnparsable("tr(musig(xprvA1RpRA33e1JQ7ifknakTFpgNXPmW2YvmhqLQYMmrj4xJXXWYpDPS3xz7iAxn8L39njGVyuoseXzU6rcxFLJ8HFsTjSyQbLYnMpCqE2VbFWc,xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi)0/*)","tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL,xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8)0/*)","tr(): Unexpected characters after musig() expression");
In 48ad4dfb9694ce122aef4e9605e2429906baa922 "descriptor: Reject trailing text after musig()" While this is fine, a more realistic test case would read more appropriately. Like the one mentioned in https://github.com/bitcoin/bitcoin/pull/35918#issuecomment-6246540048. ```diff + CheckUnparsable("tr(musig(xprvA1RpRA33e1JQ7ifknakTFpgNXPmW2YvmhqLQYMmrj4xJXXWYpDPS3xz7iAxn8L39njGVyuoseXzU6rcxFLJ8HFsTjSyQbLYnMpCqE2VbFWc,xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi)0/*)","tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL,xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8)0/*)","tr(): Unexpected characters after musig() expression"); ```
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!35918
No description provided.