-
Notifications
You must be signed in to change notification settings - Fork 38.7k
doc/descriptors.md tweaks #14161
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
doc/descriptors.md tweaks #14161
Conversation
Add some implementation details, and tweak phrasing in examples section to be more explicit about how script expressions are used for matching.
b27f440 to
bce4db1
Compare
|
Concept ACK |
doc/descriptors.md
Outdated
|
|
||
| ### Output Descriptors vs. Addresses | ||
|
|
||
| Like a bitcoin address, a bitcoin output descriptor can be used as a human |
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.
I think this is not a similarity but a difference: an address does not (generally) convey information on how to spend it; a descriptor does (unless raw or addr are used).
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.
Yeah, this sentence would probably be clearer dropping "that a given wallet knows how to spend" from the end. The difference you are describing is basically difference #1 in the list below.
But I think it might be a good idea to drop this section entirely. Basically I was trying to describe the properties of descriptors by contrasting them with addresses. But I think it might be better to have a section just describing some ways descriptors can be used (internally or externally), since this is something actually I'm fuzzy on.
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.
I suspect this will clear itself up when more uses for descriptors appear.
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.
Ok, just dropped this section. Pushed to ryanofsky@9592a1b for reference.
doc/descriptors.md
Outdated
| - `pk(xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8)` refers to a single P2PK output, using the public key part from the specified xpub. | ||
| - `pkh(xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw/1'/2)` refers to a single P2PKH output, using child key *1'/2* of the specified xpub. | ||
| - `wsh(multi(1,xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB/1/0/*,xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH/1/0/*))` refers to a chain of *1-of-2* P2WSH multisig outputs, using public keys taken from two HD chains with corresponding derivation paths. | ||
| - `pk(0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798)` matches a P2PK output with the specified public key. |
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.
I haven't really thought of descriptors as "filters" that match certain sPK, more as compact descriptions for specifically instantiated scripts.
Perhaps it makes sense to describe it this way (especially in the context of scantxoutset), but perhaps it is also confusing. It may make people wonder why a range needs to be explicitly specified, or why an addr(1...) can't match a P2PK output.
What do you think?
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.
Well, these edits are just suggestions. I'm happy to revert anything or change it however you'd like.
But I guess I don't really get the point about BIP32 ranges and addr() with P2PK, because it seems like you have to document the behavior either way. And in theory if we wanted to match P2PK keys & hashes, it wouldn't actually complicate the current implementation very much.
I like saying "matches" here just because "matches" is concrete. It seems clearer to say that a descriptor either "matches" or "doesn't match" a script than to say that it "represents," or "refers," or sometimes "constructs" one. But if you wanted to replace "matches" with a different concrete term like "generates" or "constructs" everywhere, I think that would be good, too.
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.
Ah, perhaps this isn't clear from the current implementation yet.
One of the original goals was to have an explicit representation for the actual set of scriptPubKeys that match the wallet. This would permit much faster rescans, as it avoids the need to feed every scriptPubKey seen in the chain through the IsMine machinery, and instead just test for inclusion in a set. Alternatively, it permits even faster structures such as using a bloom filter for the wallet, or using the BIP158 filters for blocks.
Having functionality in the descriptors language which just specifies a pubkey hash but encompasses P2PK outputs is not compatible with that intended feature.
Does that clear things up? If you think using the term 'matches' doesn't convey the wrong meaning taking that into account I'm fine with it.
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.
Replaced "matches" with a "describes" in a followup commit.
After hearing about plans for the wallet, I think I now agree "matches scriptingPubKeys" is too narrow, since we're not only going to use descriptors as a way of matching tx outputs, but also as a way of generating outputs and addresses (by replacing keypools in the wallet, and serving as a bridge between wallet and the "policy language" you described at coredev).
Having functionality in the descriptors language which just specifies a pubkey hash but encompasses P2PK outputs is not compatible with that intended feature.
I didn't know about the bloom filtering idea, and I see how this does impose constraints on the types of scriptPubKeys that could be matched efficiently. I think it doesn't really have bearing on how you document the descriptor language, though. For example, we talk about matching regexes despite the fact that regex languages are limited and won't match many string patterns.
doc/descriptors.md
Outdated
| multisig policy, where any *k* out of the *n* provided public keys must | ||
| sign. | ||
|
|
||
| Key order is significant. A `multi()` expression will only match multisig |
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.
Big +1 on this section; that information was really missing.
|
Is this for 0.17.0? It seems it still needs some more work or feedback addressed? |
|
@ryanofsky Ping, what do you think about my comments above? |
ryanofsky
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.
doc/descriptors.md
Outdated
| - `pk(xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8)` refers to a single P2PK output, using the public key part from the specified xpub. | ||
| - `pkh(xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw/1'/2)` refers to a single P2PKH output, using child key *1'/2* of the specified xpub. | ||
| - `wsh(multi(1,xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB/1/0/*,xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH/1/0/*))` refers to a chain of *1-of-2* P2WSH multisig outputs, using public keys taken from two HD chains with corresponding derivation paths. | ||
| - `pk(0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798)` matches a P2PK output with the specified public key. |
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.
Replaced "matches" with a "describes" in a followup commit.
After hearing about plans for the wallet, I think I now agree "matches scriptingPubKeys" is too narrow, since we're not only going to use descriptors as a way of matching tx outputs, but also as a way of generating outputs and addresses (by replacing keypools in the wallet, and serving as a bridge between wallet and the "policy language" you described at coredev).
Having functionality in the descriptors language which just specifies a pubkey hash but encompasses P2PK outputs is not compatible with that intended feature.
I didn't know about the bloom filtering idea, and I see how this does impose constraints on the types of scriptPubKeys that could be matched efficiently. I think it doesn't really have bearing on how you document the descriptor language, though. For example, we talk about matching regexes despite the fact that regex languages are limited and won't match many string patterns.
doc/descriptors.md
Outdated
|
|
||
| ### Output Descriptors vs. Addresses | ||
|
|
||
| Like a bitcoin address, a bitcoin output descriptor can be used as a human |
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.
Ok, just dropped this section. Pushed to ryanofsky@9592a1b for reference.
|
utACK |
|
utACK eeeaa29 |
Reviewers, 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. |
eeeaa29 descriptors.md: Refer to descriptors as describing instead of matching (Russell Yanofsky) eb49412 doc/descriptors.md tweaks (Russell Yanofsky) Pull request description: Add some implementation details, and tweak phrasing in examples section to be more explicit about how expressions are used for matching. Tree-SHA512: a9dc7bc0fc370548189a789f31c04bd11103cdd2a99bcb909fa1b1dfa4e78509813dad5d5c9e3db98d66929f45cb5704f5c46ab4cbd800fef22cd8465f80ef33
Add some implementation details, and tweak phrasing in examples section to be more explicit about how script expressions are used for matching. Github-Pull: bitcoin#14161 Rebased-From: eb49412
Github-Pull: bitcoin#14161 Rebased-From: eeeaa29
Add some implementation details, and tweak phrasing in examples section to be more explicit about how script expressions are used for matching. Github-Pull: bitcoin#14161 Rebased-From: eb49412
Github-Pull: bitcoin#14161 Rebased-From: eeeaa29
Summary: eeeaa29214 descriptors.md: Refer to descriptors as describing instead of matching (Russell Yanofsky) eb49412562 doc/descriptors.md tweaks (Russell Yanofsky) Pull request description: Add some implementation details, and tweak phrasing in examples section to be more explicit about how expressions are used for matching. --- Backport of Core [[bitcoin/bitcoin#14161 | PR14161]] Test Plan: read it Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D7828
Add some implementation details, and tweak phrasing in examples section to be more explicit about how expressions are used for matching.