Skip to content

Conversation

leo-aa88
Copy link
Contributor

@leo-aa88 leo-aa88 commented Feb 7, 2024

This pull request introduces enhancements to the getdescriptorinfo RPC command, specifically by incorporating the functionality to return the normalized_descriptor alongside the original descriptor information. This improvement addresses the need for a standardized format that facilitates the use of descriptors in public key operations, especially important for scenarios requiring the derivation of addresses without access to private keys.

Related issue: #29320

@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 7, 2024

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

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK S3RK
Stale ACK epiccurious

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #22838 (descriptors: Be able to specify change and receiving in a single descriptor string 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.

@brunoerg
Copy link
Contributor

brunoerg commented Feb 7, 2024

test  2024-02-07T08:26:22.085000Z TestFramework (ERROR): JSONRPC error 
                                 Traceback (most recent call last):
                                   File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 131, in main
                                     self.run_test()
                                   File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/wallet_bumpfee.py", line 100, in run_test
                                     test_watchonly_psbt(self, peer_node, rbf_node, dest_address)
                                   File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/wallet_bumpfee.py", line 575, in test_watchonly_psbt
                                     pub_rec_desc = rbf_node.getdescriptorinfo(priv_rec_desc)["descriptor"]
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                   File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/coverage.py", line 50, in __call__
                                     return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                   File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/authproxy.py", line 129, in __call__
                                     raise JSONRPCException(response['error'], status)
                                 test_framework.authproxy.JSONRPCException: Internal bug detected: RPC call "getdescriptorinfo" returned incorrect type:
                                 {
                                     "normalized_descriptor": "key returned that was not in doc"
                                 }
                                 Bitcoin Core v26.99.0-504d50bfa3bb-dirty
                                 Please report this issue here: https://github.com/bitcoin/bitcoin/issues
                                  (-1)

@S3RK
Copy link
Contributor

S3RK commented Feb 8, 2024

Concept ACK. To fix the error you need to declare new response field. (see around line no. 183)

@leo-aa88 leo-aa88 force-pushed the rpc/getdescriptorinfo-also-returns-normalized-descriptor branch from 53d47c0 to 9cf7092 Compare February 8, 2024 21:44
@leo-aa88
Copy link
Contributor Author

leo-aa88 commented Feb 9, 2024

I'm getting an error in one the functional tests cases in test/functional/rpc_getdescriptorinfo.py.

A fix would be changing the derivation path from 1/2h (hardened) to 1/2 (non-hardened):

-        self.test_desc("pkh(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1h/2)", isrange=False, issolvable=True, hasprivatekeys=False)
+        self.test_desc("pkh(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/2)", isrange=False, issolvable=True, hasprivatekeys=False)

I'm not sure if this change would go against the objectives of the test.

@achow101
Copy link
Member

achow101 commented Feb 9, 2024

I'm getting an error in one the functional tests cases in test/functional/rpc_getdescriptorinfo.py.

A fix would be changing the derivation path from 1/2h (hardened) to 1/2 (non-hardened):

-        self.test_desc("pkh(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1h/2)", isrange=False, issolvable=True, hasprivatekeys=False)
+        self.test_desc("pkh(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/2)", isrange=False, issolvable=True, hasprivatekeys=False)

I'm not sure if this change would go against the objectives of the test.

You are adding a new field, existing tests should not fail. That means either your test changes to test the new field are incorrect, or your code is incorrect.

@leo-aa88
Copy link
Contributor Author

leo-aa88 commented Feb 9, 2024

I'm getting an error in one the functional tests cases in test/functional/rpc_getdescriptorinfo.py.
A fix would be changing the derivation path from 1/2h (hardened) to 1/2 (non-hardened):

-        self.test_desc("pkh(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1h/2)", isrange=False, issolvable=True, hasprivatekeys=False)
+        self.test_desc("pkh(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/2)", isrange=False, issolvable=True, hasprivatekeys=False)

I'm not sure if this change would go against the objectives of the test.

You are adding a new field, existing tests should not fail. That means either your test changes to test the new field are incorrect, or your code is incorrect.

For the case of hardened derivation path, I guess that instead of throwing a JSONRPCError exception, it could simply leave the normalized descriptor field as empty?

@epiccurious
Copy link
Contributor

utACK 9cf7092.

@DrahtBot DrahtBot requested a review from S3RK February 11, 2024 02:05
@luke-jr
Copy link
Member

luke-jr commented Feb 22, 2024

For the case of hardened derivation path...

...it's documented herein as working :\

@leo-aa88
Copy link
Contributor Author

For the case of hardened derivation path...

...it's documented herein as working :\

I'm not sure on how to handle this case. I've looked through the docs but it remains unclear if I should adapt the test suite to encompass the new functionality or if the issue is within the new code itself.

@leo-aa88 leo-aa88 force-pushed the rpc/getdescriptorinfo-also-returns-normalized-descriptor branch from 62e7e78 to 21f1d55 Compare February 26, 2024 03:15
info = self.nodes[0].getdescriptorinfo(desc)
assert_equal(info, self.nodes[0].getdescriptorinfo(descsum_create(desc)))
assert_equal(info['descriptor'], descsum_create(desc))
assert_equal(info['normalizeddescriptor'], expected_normalized_desc_with_checksum)
Copy link
Contributor

Choose a reason for hiding this comment

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

This test is never called with a hardened path derivation, so it actually never checks the new logic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't this a hardened path derivation?

self.test_desc("pkh(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1h/2)", isrange=False, issolvable=True, hasprivatekeys=False)

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, yes. Missed that. Still "descriptor" and "normalizeddescriptor" are always the same, so it's still not clear why the new field is needed.

@DrahtBot
Copy link
Contributor

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

@achow101
Copy link
Member

Are you still working on this?

@DrahtBot
Copy link
Contributor

⌛ There hasn't been much activity lately and the patch still needs rebase. What is the status here?

  • Is it still relevant? ➡️ Please solve the conflicts to make it ready for review and to ensure the CI passes.
  • Is it no longer relevant? ➡️ Please close.
  • Did the author lose interest or time to work on this? ➡️ Please close it and mark it 'Up for grabs' with the label, so that it can be picked up in the future.

@maflcko
Copy link
Member

maflcko commented Jan 13, 2025

Closing for now. The issue remains open (#29320) and discussion can continue there. This can also be picked up again, a fresh pull can be created, or it can be re-opened.

@maflcko maflcko closed this Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants