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

tests: improve wallet multisig descriptor test and docs #29154

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mjdietzx
Copy link
Contributor

It is best to store all key origin information
(master key fingerprint and all derivation steps)
in the multisig descriptor. Being explicit with
this information should be beneficial if this approach is used with other wallets/signers (whether hardware or software). There is no harm including all of this with xpubs (if anything it simplifies the test code) and makes this example/docs more complete and safer incase it is referenced by others.

@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 29, 2023

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
ACK S3RK
Stale ACK rkrux

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:

  • #29156 (tests: add functional test for miniscript decaying multisig by mjdietzx)

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.

Copy link

@rkrux rkrux left a comment

Choose a reason for hiding this comment

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

tACK 8a2021c

I am in favour of this change because it adds verbosity that makes it easier to go through the code. As mentioned in the PR description, I, too, don't see a harm in including key origin information.

Comment on lines -61 to +57
external = multisig.getdescriptorinfo(f"wsh(sortedmulti({self.M},{f'/0/*,'.join(xpubs)}/0/*))")
internal = multisig.getdescriptorinfo(f"wsh(sortedmulti({self.M},{f'/1/*,'.join(xpubs)}/1/*))")
external = multisig.getdescriptorinfo(f"wsh(sortedmulti({self.M},{f','.join(external_xpubs)}))")
internal = multisig.getdescriptorinfo(f"wsh(sortedmulti({self.M},{f','.join(internal_xpubs)}))")
Copy link

Choose a reason for hiding this comment

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

+1 for getting rid of the /1/* hardcodings!

@@ -139,12 +143,12 @@ def run_test(self):

self.log.info("Send another transaction from the multisig, this time with a daisy chained signing flow (one after another in series)!")
psbt = participants["multisigs"][0].walletcreatefundedpsbt(inputs=[], outputs={to: value}, feeRate=0.00010)
for m in range(self.M):
for i, m in enumerate(random.sample(range(self.M), self.M)):
Copy link

@rkrux rkrux Apr 13, 2024

Choose a reason for hiding this comment

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

m could be different in each test run because it uses random.sample as I found out while debugging this test. For thoroughness, would it be more robust to cover all the orderings instead? In this case it's going to be 2 only because self.M = 2.

Copy link
Contributor

Choose a reason for hiding this comment

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

In this case random.sample shuffles the order of participants, but I don't see how it matters since all participants are equivalent anyway

Copy link
Contributor Author

@mjdietzx mjdietzx May 9, 2024

Choose a reason for hiding this comment

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

EDIT: ugh I mixed up PRs. not used to comments on individual commit and thought this was related to my other open PR (decaying multisig). I will address this feedback and respond, I lost track of these comments

but I don't see how it matters since all participants are equivalent anyway

exactly, all participants are equivalent, and the intention of this random.sample is to prove that. maybe it's a little extra to even have this random.sample, but participants being equivalent is critical to the intention of this multisig so I thought the randomness was a nice to have

doc/descriptors.md Outdated Show resolved Hide resolved
test/functional/wallet_multisig_descriptor_psbt.py Outdated Show resolved Hide resolved
@S3RK
Copy link
Contributor

S3RK commented May 8, 2024

The change looks good to me modulo addressing comments from achow101.

@mjdietzx mjdietzx force-pushed the multisig_descriptor_improvement branch from 8a2021c to 2255b12 Compare May 20, 2024 00:57
It is best to store all key origin information
(master key fingerprint and all derivation steps)
in the multisig descriptor. Being explicit with
this information should be beneficial if this approach
is used with other wallets/signers (whether hardware
or software). There is no harm including all of this
with xpubs (if anything it simplifies the test code)
and makes this example/docs more complete and safer
incase it is referenced by others.
@mjdietzx mjdietzx force-pushed the multisig_descriptor_improvement branch from 2255b12 to d93b794 Compare May 20, 2024 00:59
@mjdietzx
Copy link
Contributor Author

I addressed @achow101 's comments:

  • re this comment, I removed random.sample. it's unnecessary
  • re this comment, I removed the unnecessary explanation of where descriptor came from

Thank you all for your reviews and patience

@S3RK
Copy link
Contributor

S3RK commented May 27, 2024

Code Review ACK d93b794

@DrahtBot DrahtBot requested a review from rkrux May 27, 2024 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants