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

musig2: export SignOptions members #2058

Closed

Conversation

ellemouton
Copy link
Contributor

@ellemouton ellemouton commented Nov 9, 2023

Export the members of the SignOptions struct so that they can be inspected elsewhere.

To see how this is used, see the RPCKeyRing.SignMuSig2 method here

Export the members of the SignOptions struct so that they can be
inspected elsewhere.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 6810111343

  • 25 of 29 (86.21%) changed or added relevant lines in 1 file are covered.
  • 3 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.002%) to 55.707%

Changes Missing Coverage Covered Lines Changed/Added Lines %
btcec/schnorr/musig2/sign.go 25 29 86.21%
Files with Coverage Reduction New Missed Lines %
mempool/mempool.go 1 66.75%
btcec/schnorr/musig2/sign.go 2 90.91%
Totals Coverage Status
Change from base Build 6776433285: -0.002%
Covered Lines: 27144
Relevant Lines: 48726

💛 - Coveralls


// taprootTweak specifies a taproot specific tweak. of the tweaks
// TaprootTweak specifies a taproot specific tweak of the tweaks
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good eye!

@kcalvinalvin
Copy link
Collaborator

ACK 35e0f57

Looked at the git diffs, built & tested locally.

// the method used to generate the musig2 partial signature.
type signOptions struct {
// fastSign determines if we'll skip the check at the end of the
type SignOptions struct {
Copy link
Member

Choose a reason for hiding this comment

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

Why does any of this need to be exported here? Having these fields be private enables a type of encapsulation and information hiding here.

API design here is that new options are added to the package, as they're a bit more "curated", and exported via the functions like WithFastSign.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

check out the link in the PR description. It is used in the RPCKeyRing.SignMuSig2 method here.

We cant pass the options as is over gRPC, so if we want to be able to do MuSig2 signing over the signer client, then we need to be able to inspect the signing options

Copy link
Member

Choose a reason for hiding this comment

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

Ah, in the past, what I ended up doing there was to just sorta replicate the option types in an unrolled manner, then you map then to SignOption at the latest stage. We had to do this for the musig2 options as well.

@ellemouton
Copy link
Contributor Author

Ok yeah this isnt needed 🙃 thanks for the insights @Roasbeef 🙏

@ellemouton ellemouton closed this Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants