Repository navigation
rpc, descriptor: warn when multipath expansion clones single-path key expressions - #36005
pythcoiner wants to merge 4 commits into
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
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. |
5c1d615 to
3628dcc
Compare
3628dcc to
cf98aaa
Compare
cf98aaa to
13ef865
Compare
|
🚧 At least one of the CI tasks failed. Edit: Looks like the ICE was due to a corrupt VM/hardware |
jeanpablojp
left a comment
There was a problem hiding this comment.
tACK 13ef865
Built and ran the unit tests plus rpc_getdescriptorinfo.py and wallet_importdescriptors.py. I dropped each of the four multipath_cloned = true lines one at a time and each one fails on a different descriptor in the new unit test, and reverting only the PushWarnings dedup fails both functional tests.
| for (const auto& d : descs) { | ||
| const auto warnings = d->Warnings(); | ||
| if (expect_warning) { | ||
| BOOST_REQUIRE_MESSAGE(warnings.size() == 1U, desc); |
There was a problem hiding this comment.
nit: this only allows one warning. I hit both with wsh(and_v(v:pk(A/<0;1>/*),and_v(v:pk(B/0/*),older(65536)))), which nothing covers at the moment. Worth adding one?
|
Ping @pythcoiner this has been in need of a rebase for a while. Are you still working on this change? |
|
@sedited, this is still on my todo-list (but not at the top atm tbh) |
13ef865 to
9367321
Compare
|
rebased on master @jeanpablojp thanks for the review, added your descriptor to the test, and modified the check to count only expected warnings |
fametrano
left a comment
There was a problem hiding this comment.
tACK 9367321
I compared the new warning with key reuse computed outside Core. bip32-descriptors, a library I maintain, expanded 291 multipath descriptors. They cover multi, sortedmulti, multi_a, tr() trees, miniscript and musig(), with ranged, fixed and plain single-path keys. For each expansion it collected the keys in its scripts plus the taproot internal key, at indexes 0 to 2 where the descriptor is ranged. In 272 descriptors two expansions share a key. The warning fires on 270 of them and on none of the other 19. The two it misses clone no single-path key: each shared key comes from two multipath expressions on the same xpub. deriveaddresses matches the library's addresses on all 291. importdescriptors warns exactly where getdescriptorinfo does. With the tr() internal-key flag removed, 17 more descriptors disagree, so the comparison catches a missing flag.

This PR:
PushWarningsin RPC callsimportdescriptorsand by a newwarningsfield ongetdescriptorinfo(which also exposes the existing miniscriptolder()warnings)Cloning internal to musig() is not warned: both
musig(A,B)/<0;1>/*andmusig(A/<1;2>,B)derive a distinct aggregate key per branch, so nothing observable is reused.closes #35985