Skip to content
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

Add checksum to getdescriptorinfo #15986

Merged
merged 2 commits into from Aug 16, 2019
Merged

Conversation

sipa
Copy link
Member

@sipa sipa commented May 8, 2019

No description provided.

@gwillen
Copy link
Contributor

gwillen commented May 8, 2019

So the only reason I didn't write it this way, is that people have said they don't want private keys to be echoed in the output.

Personally I think this is fine -- the only way to get a private key in the output, is if you include it in the input. And in fact, there has to be SOME way to get private keys echoed back, if you want to be able to get checksums for descriptors with private keys included.

So I'd advocate for this PR the way it is, but if people aren't comfortable with it, I'd suggest adding a flag, and not echoing descriptors with private keys unless the flag is set.

Thanks!

(Tagging #15740 for the record.)

@meshcollider
Copy link
Contributor

utACK 15c482e

@Sjors
Copy link
Member

Sjors commented May 12, 2019

Concept ACK.

Light preference for returning only the checksum rather than echoing a private key. But I do agree with @gwillen's point:

the only way to get a private key in the output, is if you include it in the input.

I find the extra with_checksum confusing. Maybe we can add an argument keep_private_keys which defaults to false. I would also prefer sticking to canonical form (but with private keys). An additional argument canonical can be true by default. I know it makes the change a bit more complicated, but it seems more robust in the long run.

@DrahtBot
Copy link
Contributor

DrahtBot commented May 30, 2019

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #16542 (Return more specific errors about invalid descriptors by achow101)

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.

@jb55
Copy link
Contributor

jb55 commented May 30, 2019

I'm confused by this, getdescriptorinfo already adds a checksum if it's missing?

@sipa
Copy link
Member Author

sipa commented May 30, 2019

@jb55 It also normalizes the descriptor (which among other things turns WIP into pubkey, and xprv into xpub)

@jb55
Copy link
Contributor

jb55 commented May 31, 2019 via email

@promag
Copy link
Member

promag commented Jun 12, 2019

ACK 15c482e, only reviewed code change. Looks like returning only the checksum, like @Sjors suggested, is a simple solution to not echo back private key. A small release note could be added.

Refactor commit best viewed with git show --color-words 7976dd65f6503082370a40ac189b925322c29918.

@fanquake fanquake requested a review from achow101 July 30, 2019 07:57
@achow101
Copy link
Member

Code Review ACK 15c482e

I would prefer if there were also a test where the descriptor were slightly modified (e.g. replacing ' with h in origin info) and that the result of getdescriptorinfo gives the correct canonical form and the modified form with the checksum.

@Sjors
Copy link
Member

Sjors commented Aug 2, 2019

Tested ACK 15c482e

@sipa
Copy link
Member Author

sipa commented Aug 2, 2019

I like the suggestion of instead just reporting the checksum for the unmodified descriptor, and not echoing anything back. Since this has been reviewed already, I'm happy to go either way. What do reviewers think?

@achow101
Copy link
Member

achow101 commented Aug 2, 2019

I like the suggestion of instead just reporting the checksum for the unmodified descriptor, and not echoing anything back. Since this has been reviewed already, I'm happy to go either way. What do reviewers think?

I prefer this because it is unambiguous as to what the checksum belongs to and what the descriptor with with checksum will look like.

@sipa sipa changed the title Add unmodified-descriptor-with-checksum to getdescriptorinfo Add checksum to getdescriptorinfo Aug 7, 2019
@sipa
Copy link
Member Author

sipa commented Aug 7, 2019

Updated to instead add a "checksum" to getdescriptorinfo that returns the checksum for the (unmodified) descriptor input.

Copy link
Member

@Sjors Sjors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 26d3fad

@@ -136,6 +136,7 @@ UniValue getdescriptorinfo(const JSONRPCRequest& request)
RPCResult{
"{\n"
" \"descriptor\" : \"desc\", (string) The descriptor in canonical form, without private keys\n"
" \"checksum\" : \"chksum\", (string) The checksum for the input descriptor\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: did you really mean chksum?

@achow101
Copy link
Member

achow101 commented Aug 7, 2019

Code Review ACK 26d3fad

@fanquake
Copy link
Member

Two wallet reviewer ACKs here; @meshcollider want to take a final look? I've compiled to check that there aren't any silent merge conflicts etc.

@meshcollider
Copy link
Contributor

re-Code Review ACK 26d3fad

meshcollider added a commit that referenced this pull request Aug 16, 2019
26d3fad Add unmodified-but-with-checksum to getdescriptorinfo (Pieter Wuille)
104b3a5 Factor out checksum checking from descriptor parsing (Pieter Wuille)

Pull request description:

ACKs for top commit:
  achow101:
    Code Review ACK 26d3fad
  meshcollider:
    re-Code Review ACK 26d3fad
  Sjors:
    ACK 26d3fad

Tree-SHA512: b7a7f89b64a184927d6f9a0c183a087609983f0c5d5593f78e12db4714e930a4af655db9da4b0c407ea2e24d3b926cef6e1f2a15de502d0d1290a6e046826b99
@meshcollider meshcollider merged commit 26d3fad into bitcoin:master Aug 16, 2019
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 17, 2019
26d3fad Add unmodified-but-with-checksum to getdescriptorinfo (Pieter Wuille)
104b3a5 Factor out checksum checking from descriptor parsing (Pieter Wuille)

Pull request description:

ACKs for top commit:
  achow101:
    Code Review ACK 26d3fad
  meshcollider:
    re-Code Review ACK 26d3fad
  Sjors:
    ACK 26d3fad

Tree-SHA512: b7a7f89b64a184927d6f9a0c183a087609983f0c5d5593f78e12db4714e930a4af655db9da4b0c407ea2e24d3b926cef6e1f2a15de502d0d1290a6e046826b99
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Sep 3, 2019
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Sep 3, 2019
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jun 18, 2020
Summary:
bitcoin/bitcoin@104b3a5

---

Partial backport of Core [[bitcoin/bitcoin#15986 | PR15986]]

Test Plan:
  ninja check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D6622
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jun 18, 2020
Summary:
bitcoin/bitcoin@26d3fad

---

Depends on D6622

Concludes backport of Core [[bitcoin/bitcoin#15986 | PR15986]]

Test Plan:
  ninja check
  ninja
  test_runner.py wallet_address_types

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D6623
kwvg added a commit to kwvg/dash that referenced this pull request Oct 25, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Oct 25, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Oct 25, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Oct 26, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Oct 26, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Oct 26, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Oct 28, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Oct 28, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Oct 28, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Oct 28, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Oct 29, 2021
pravblockc pushed a commit to pravblockc/dash that referenced this pull request Nov 18, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants