-
Notifications
You must be signed in to change notification settings - Fork 271
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
Deprecate ThirtyTwoByteHash
#686
Deprecate ThirtyTwoByteHash
#686
Conversation
63e737f
to
659926c
Compare
concept ACK, but looks like this breaks some tests. |
hmm, the test show that we forgot about |
It is a bit pointless, yes. The idea now is that users can implement And it is a regression to lose the impl for the sha2 hash types, but we (rust-bitcoin) no longer use those impls, and the impls make the upgrade process harder for users.. But the trait is easier to implement and provides a bit of documentation "I promise that this is actually a hash of some data", so the value isn't zero. |
659926c
to
9d43945
Compare
Process question please: when a PR changes after review and the description gets re-written it can make the conversation thread go stale. For later reviewers this may be confusing so I"ve been looking for a way to flag that situation. I've tried explicitly saying "discussion thread is now stale", instead here I tried another method - please see PR description and tell me if that is clear - or if this is a non-issue. |
I do not think it's clear (from the PR description) that you've changed something, or when you changed it. |
Ok, I'll keep iterating as the situation arises. |
ACK 9d43945 but I think we should deprecate Also, what if we changed |
Does it make sense to deprecate while we remove the generic, any user of this code will break anyway and if they are using a hash that is not sha256 its the same as if we took it away - perhaps we should just delete it? |
Hmm, yeah, I think you're right. Let's just delete it. Also let's deprecate the trait. The more I think about this, I think Then I think the right approach to type-safing this stuff is to improve the |
9d43945
to
5749e13
Compare
I've deprecated Leaving the |
4467f2b
to
00b66df
Compare
@@ -372,14 +346,6 @@ impl SecretKey { | |||
} | |||
} | |||
|
|||
#[cfg(feature = "hashes")] | |||
impl<T: ThirtyTwoByteHash> From<T> for SecretKey { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 00b66df:
We should wait til after the deprecation cycle to drop these From impls. If we drop them now that has the same effect as just deleting the crate -- sudden compilation failures without a clear path forward.
src/lib.rs
Outdated
@@ -198,34 +196,20 @@ pub use crate::scalar::Scalar; | |||
/// Trait describing something that promises to be a 32-byte random number; in particular, | |||
/// it has negligible probability of being zero or overflowing the group order. Such objects | |||
/// may be converted to `Message`s without any error paths. | |||
#[deprecated(since = "0.29.0", note = "this will be removed soon")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 00b66df:
Not sure if we can easily put a multi-line message here, but let's suggest that users directly implement From<T> for Message
for their type if their goal is to have easy convertibility to messages, and explain that sign_ecdsa
and sign_schnorr
can now directly take such types rather than requiring a manual conversion to Message
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, ok, we can drop the "no need for manual conversion" since we still need a manual conversion for now. We should suggest people write Message::from
though. Later clippy will tell them that they can drop the Message::from
If they just do .into()
this will work today but break when we change our signing functions to take generics, because Rust won't know the target type to convert to.
00b66df
to
4663198
Compare
hashes
typesThirtyTwoByteHash
4663198
to
c371561
Compare
Had another go, please re-review the whole thing. |
b372bba
to
0f247f4
Compare
Recent rustc upgrade introduced some new warnings for incorrect imports, fix them.
The implementations of `ThirtyTwoByteHash` for types from the `hashes` crate are problematic during upgrades because both `bitcoin` and `secp256k1` depend on `hashes` and when the versions of `hashes` get out of sync usage of the trait breaks. Deprecate the `ThirtyTwoByteHash` trait and remove the impls for types from `bitcoin_hashes`. Add an explanation in the changelog because its too long to go in the deprecation message.
0f247f4
to
9f28cf6
Compare
Usage of this PR is shown in rust-bitcoin/rust-bitcoin#2636 (ie., using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 9f28cf6
Let's go! |
Now that I'm reading this, this was a great change because people won't accidentally sign silly hashes such as |
The implementations of
ThirtyTwoByteHash
for types from thehashes
crate are problematic during upgrades because bothbitcoin
andsecp256k1
depend onhashes
and when the versions ofhashes
get out of sync usage of the trait breaks.Deprecate the
ThirtyTwoByteHash
trait and remove the impls for types frombitcoin_hashes
.Add an explanation in the changelog because its too long to go in the deprecation message.
Close: #673