Skip to content

musig: Add warning to SecretNonce::dangerous_into_bytes about encoding instability #805

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

Merged

Conversation

Ademan
Copy link
Contributor

@Ademan Ademan commented Jun 19, 2025

Addresses #804 by documenting the potential issues. I think it's an ok-ish first pass, but I'm totally open to rewording it if anyone is inclined.

…ing instability

libsecp256k1 states that the byte format
`SecretNonce::dangerous_into_bytes` returns is not guaranteed to be
stable, and therefore rust-secp256k1 users must be careful to only pass
the result of `dangerous_into_bytes` to a compatible
`dangerous_from_bytes`, according to version and platform. The simplest
and most conservative strategy is to only consider same-versioned and
same-platform bytes as compatible. In practice, the format is unlikely
to change much if at all between most versions, so more permissive
strategies can be employed with research and great care by the user.
@apoelstra
Copy link
Member

I think this text is good.

Copy link
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

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

ACK 8fd68a7

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 8fd68a7; successfully ran local tests

@apoelstra apoelstra merged commit 4045eb8 into rust-bitcoin:master Jun 20, 2025
28 checks passed
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.

3 participants