-
Notifications
You must be signed in to change notification settings - Fork 38.8k
A few descriptor improvements to prepare for Taproot support #21238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A few descriptor improvements to prepare for Taproot support #21238
Conversation
RiccardoMasutti
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, seems good to me. Waiting for squash and will review again.
|
I don't intend to squash. They're all independent improvements. |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. 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. |
Sjors
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review 45bc0c04e0f2ea6dcce734652f45cabc6d10d7d5 looks good, but I got confused in one place...
|
Partial ACK. Same questions as Sjors. |
45bc0c0 to
19ecc8e
Compare
|
@achow101 @Sjors Good that you raise that point. The original reason why this behavior of MakeScripts-is-invoked-once-per-evaluation existed was to support things like This is all silly, because we don't ever need it. |
|
Thanks, I'll review again after rebase. |
19ecc8e to
05c633e
Compare
|
Rebased. |
|
ACK 05c633e Conceptually I find it marginally simpler if you reverse the first and second commit, so the first step is to remove the unused loop: if (m_subdescriptor_arg) {
const auto& subscript = subscripts[0];
out.scripts.emplace(CScriptID(subscript), subscript);
output_scripts = MakeScripts(pubkeys, &subscript, out);
} else {
output_scripts = MakeScripts(pubkeys, nullptr, out);
}And then the second commit drops To sanity check my understanding: |
|
ACK 05c633e0efaf300aa3353303f77c0a622647a588 |
05c633e to
35cbef1
Compare
Ok, done.
I think you skipped the 1, but otherwise: exactly. |
|
re-ACK 35cbef1c483ac9905331f8035d32600e105baab4 Only change was commit reordering. |
Sjors
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-ACK 35cbef1c483ac9905331f8035d32600e105baab4 modulo unused constructor
35cbef1 to
394e387
Compare
S3RK
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review ACK 394e387. Nice and clear improvements!
…ipts There are currently two DescriptorImpl subclasses that rely on the functionality that ExpandHelper automatically adds subscripts to the output SigningProvider. Taproot descriptors will have subscripts, but we don't want them in the SigningProvider's bare script field. To avoid them ending up there, move this functionality into the specific classes' MakeScripts implementation.
So far, no descriptor exists that supports more than one sub-script descriptor. This will change with taproot, so prepare for this by changing the m_subdescriptor_arg from a unique_ptr to a vector of unique_ptr's.
This has no effect for now, as the only fragments with sub-script expressions (sh, wsh) only allow one, and don't have key expressions in them. A future Taproot descriptor will however violate both, and we want the keys in different sub-scripts to be assigned non-overlapping cache indices.
This will allow subclasses to overwrite the serialization of subscript arguments without needing to reimplement all the rest of the ToString logic.
This is a preparation for parsing xonly pubkeys, which will complicate this logic. It's cleaner to put the decision logic close to the public key parsing itself.
This changes all context dependent checks in the parser to be disjunctions of equality checks, rather than also including inequalities. This makes sure that adding a new context enum in the future won't change semantics for existing checks. The error messages are also made a bit more consistent.
394e387 to
0b188b7
Compare
|
Rebased, and addressed all comments I think. |
|
reACK 0b188b7 |
|
re-ACK 0b188b7 |
|
re-ACK 0b188b7 |
|
@instagibbs what do you think? |
|
Seems like 3 ACKs is enough? not familiar enough with this code anymore to give a proper ACK |
| auto bytes = ParseHex(str); | ||
| return std::make_unique<RawDescriptor>(CScript(bytes.begin(), bytes.end())); | ||
| } else if (Func("raw", expr)) { | ||
| error = "Can only have raw() at top level"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is there no new test for this and for addr()?
It looks like bitcoin#21238 introduced a silent merge conflict in the documentation, which fails with `-Wdocumentation` in the CI.
…iptor.cpp e5faec6 doc: Fix doxygen comment silent merge conflict in descriptor.cpp (W. J. van der Laan) Pull request description: It looks like #21238 introduced a silent merge conflict in the documentation, which fails with `-Wdocumentation` in the CI. (please merge only if CI passes) ACKs for top commit: ajtowns: ACK e5faec6 -- fixed it for me meshcollider: ACK e5faec6 modulo CI Tree-SHA512: b07d50fd12aa7c239a92aad8ef29f4e88583c3ce701ebedba7c426aac4981c79113adc4670b7d055ab9535a28bdc3f9a30e6ca1b1ed0d7b9a333a3d9c4b40d8a
…n descriptor.cpp e5faec6 doc: Fix doxygen comment silent merge conflict in descriptor.cpp (W. J. van der Laan) Pull request description: It looks like bitcoin#21238 introduced a silent merge conflict in the documentation, which fails with `-Wdocumentation` in the CI. (please merge only if CI passes) ACKs for top commit: ajtowns: ACK e5faec6 -- fixed it for me meshcollider: ACK e5faec6 modulo CI Tree-SHA512: b07d50fd12aa7c239a92aad8ef29f4e88583c3ce701ebedba7c426aac4981c79113adc4670b7d055ab9535a28bdc3f9a30e6ca1b1ed0d7b9a333a3d9c4b40d8a
It looks like bitcoin#21238 introduced a silent merge conflict in the documentation, which fails with `-Wdocumentation` in the CI.
These are a few refactors and non-invasive improvements to the descriptors code to prepare for adding Taproot descriptors.
None of the commits change behavior in any way, except the last one which improves error reporting a bit.