Skip to content

Commit 1ad3107

Browse files
committed
Merge rust-bitcoin#595: Bump MSRV to 1.48
7bba2bc secp256k1-sys: Remove custom implementations of Eq, Ord and friends (Tobin C. Harding) a815272 secp256k1: Remove custom implementations of Eq, Ord and friends (Tobin C. Harding) ee83c3a Bump MSRV to 1.48 (Tobin C. Harding) 0e2579f Fix release date in changelogs (Tobin C. Harding) Pull request description: As per ecosystem wide change, bump the MSRV of both crates to 1.48 Patch 1 is a typo fix to the changelog, I don't see changelogs cached on crates.io in any way so this fix should be able to quietly go in. Note before this is applied there is no mention of the MSRV in secp256k1-sys, was that intentional? If not, with this applied, we have a mention in the readme. CI needs some more fixes (wasm job) but because patching CI often leads to me doing 300 pushes I'm leaving it to a separate PR. ACKs for top commit: apoelstra: ACK 7bba2bc Tree-SHA512: 4e575c7e4f7d4a36e024eee407f8a757ad35be7225d8b8de71d57248c40801b05aeb12abf27ea9ce63215561527c8edb4d1807b09388b9d1dcdb52f453cd0981
2 parents 11b8786 + 7bba2bc commit 1ad3107

File tree

13 files changed

+25
-73
lines changed

13 files changed

+25
-73
lines changed

.github/workflows/rust.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
runs-on: ubuntu-latest
4141
strategy:
4242
matrix:
43-
rust: [stable, beta, nightly, 1.41.1]
43+
rust: [stable, beta, nightly, 1.48.0]
4444
steps:
4545
- name: Checkout Crate
4646
uses: actions/checkout@v2

CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
# 0.27.0 - 2023-13-15
1+
# Unreleased
2+
3+
* Bump MSRV to 1.48
4+
* Remove implementations of `PartialEq`, `Eq`, `PartialOrd`, `Ord`, and `Hash` from the
5+
`impl_array_newtype` macro. Users will now need to derive these traits if they are wanted.
6+
7+
# 0.27.0 - 2023-03-15
28

39
* [Depend on newly release `bitcoin_hashes` v0.12](https://github.com/rust-bitcoin/rust-secp256k1/pull/588).
410
* [Implement `Debug` trait for `Scalar` type](https://github.com/rust-bitcoin/rust-secp256k1/pull/578).

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Contributions to this library are welcome. A few guidelines:
2020
* Any breaking changes must have an accompanied entry in CHANGELOG.md
2121
* No new dependencies, please.
2222
* No crypto should be implemented in Rust, with the possible exception of hash functions. Cryptographic contributions should be directed upstream to libsecp256k1.
23-
* This library should always compile with any combination of features on **Rust 1.41.1**.
23+
* This library should always compile with any combination of features on **Rust 1.48.0**.
2424

2525
### Githooks
2626

clippy.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
msrv = "1.41.1"
1+
msrv = "1.48.0"

contrib/test.sh

-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ if cargo --version | grep nightly; then
1313
NIGHTLY=true
1414
fi
1515

16-
if cargo --version | grep "1\.41"; then
17-
# 1.8.x uses constfns which aren't supported in 1.41
18-
cargo update -p half --precise 1.7.0
19-
fi
20-
2116
# Test if panic in C code aborts the process (either with a real panic or with SIGILL)
2217
cargo test -- --ignored --exact 'tests::test_panic_raw_ctx_should_terminate_abnormally' 2>&1 | tee /dev/stderr | grep "SIGILL\\|panicked at '\[libsecp256k1\]"
2318

secp256k1-sys/CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# 0.8.1 - 2023-13-16
1+
# Unreleased
2+
3+
* Bump MSRV to 1.48
4+
5+
# 0.8.1 - 2023-03-16
26

37
* [Implement `insecure-erase`](https://github.com/rust-bitcoin/rust-secp256k1/pull/582).
48

secp256k1-sys/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ If you want to compile this library without using the bundled symbols (which may
3333
be required for integration into other build systems), you can do so by adding
3434
`--cfg=rust_secp_no_symbol_renaming'` to your `RUSTFLAGS` variable.
3535

36+
## Minimum Supported Rust Version
37+
38+
This library should always compile with any combination of features on **Rust 1.48.0**.

secp256k1-sys/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ impl SchnorrSigExtraParams {
133133
/// Library-internal representation of a Secp256k1 public key
134134
#[repr(C)]
135135
#[derive(Copy, Clone)]
136+
#[cfg_attr(fuzzing, derive(PartialEq, Eq, PartialOrd, Ord, Hash))]
136137
pub struct PublicKey([c_uchar; 64]);
137138
impl_array_newtype!(PublicKey, c_uchar, 64);
138139
impl_raw_debug!(PublicKey);
@@ -227,6 +228,7 @@ impl core::hash::Hash for PublicKey {
227228
/// Library-internal representation of a Secp256k1 signature
228229
#[repr(C)]
229230
#[derive(Copy, Clone)]
231+
#[cfg_attr(fuzzing, derive(PartialEq, Eq, PartialOrd, Ord, Hash))]
230232
pub struct Signature([c_uchar; 64]);
231233
impl_array_newtype!(Signature, c_uchar, 64);
232234
impl_raw_debug!(Signature);
@@ -315,6 +317,7 @@ impl core::hash::Hash for Signature {
315317

316318
#[repr(C)]
317319
#[derive(Copy, Clone)]
320+
#[cfg_attr(fuzzing, derive(PartialEq, Eq, PartialOrd, Ord, Hash))]
318321
pub struct XOnlyPublicKey([c_uchar; 64]);
319322
impl_array_newtype!(XOnlyPublicKey, c_uchar, 64);
320323
impl_raw_debug!(XOnlyPublicKey);
@@ -404,6 +407,7 @@ impl core::hash::Hash for XOnlyPublicKey {
404407

405408
#[repr(C)]
406409
#[derive(Copy, Clone)]
410+
#[cfg_attr(fuzzing, derive(PartialEq, Eq, PartialOrd, Ord, Hash))]
407411
pub struct KeyPair([c_uchar; 96]);
408412
impl_array_newtype!(KeyPair, c_uchar, 96);
409413
impl_raw_debug!(KeyPair);

secp256k1-sys/src/macros.rs

-36
Original file line numberDiff line numberDiff line change
@@ -45,42 +45,6 @@ macro_rules! impl_array_newtype {
4545
}
4646
}
4747

48-
// We cannot derive these traits because Rust 1.41.1 requires `std::array::LengthAtMost32`.
49-
50-
#[cfg(fuzzing)]
51-
impl PartialEq for $thing {
52-
#[inline]
53-
fn eq(&self, other: &$thing) -> bool {
54-
&self[..] == &other[..]
55-
}
56-
}
57-
58-
#[cfg(fuzzing)]
59-
impl Eq for $thing {}
60-
61-
#[cfg(fuzzing)]
62-
impl core::hash::Hash for $thing {
63-
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
64-
(&self[..]).hash(state)
65-
}
66-
}
67-
68-
#[cfg(fuzzing)]
69-
impl PartialOrd for $thing {
70-
#[inline]
71-
fn partial_cmp(&self, other: &$thing) -> Option<core::cmp::Ordering> {
72-
self[..].partial_cmp(&other[..])
73-
}
74-
}
75-
76-
#[cfg(fuzzing)]
77-
impl Ord for $thing {
78-
#[inline]
79-
fn cmp(&self, other: &$thing) -> core::cmp::Ordering {
80-
self[..].cmp(&other[..])
81-
}
82-
}
83-
8448
impl AsRef<[$ty; $len]> for $thing {
8549
#[inline]
8650
/// Gets a reference to the underlying array

secp256k1-sys/src/recovery.rs

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use core::fmt;
2222
/// Library-internal representation of a Secp256k1 signature + recovery ID
2323
#[repr(C)]
2424
#[derive(Copy, Clone)]
25+
#[cfg_attr(fuzzing, derive(PartialEq, Eq, PartialOrd, Ord, Hash))]
2526
pub struct RecoverableSignature([c_uchar; 65]);
2627
impl_array_newtype!(RecoverableSignature, c_uchar, 65);
2728

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ impl<T: hashes::sha256t::Tag> ThirtyTwoByteHash for hashes::sha256t::Hash<T> {
232232
}
233233

234234
/// A (hashed) message input to an ECDSA signature.
235-
#[derive(Copy, Clone)]
235+
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
236236
pub struct Message([u8; constants::MESSAGE_SIZE]);
237237
impl_array_newtype!(Message, u8, constants::MESSAGE_SIZE);
238238
impl_pretty_debug!(Message);

src/macros.rs

-25
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,6 @@
1717
#[macro_export]
1818
macro_rules! impl_array_newtype {
1919
($thing:ident, $ty:ty, $len:expr) => {
20-
// We cannot derive these traits because Rust 1.41.1 requires `std::array::LengthAtMost32`.
21-
22-
impl PartialEq for $thing {
23-
#[inline]
24-
fn eq(&self, other: &$thing) -> bool { &self[..] == &other[..] }
25-
}
26-
27-
impl Eq for $thing {}
28-
29-
impl core::hash::Hash for $thing {
30-
fn hash<H: core::hash::Hasher>(&self, state: &mut H) { (&self[..]).hash(state) }
31-
}
32-
33-
impl PartialOrd for $thing {
34-
#[inline]
35-
fn partial_cmp(&self, other: &$thing) -> Option<core::cmp::Ordering> {
36-
self[..].partial_cmp(&other[..])
37-
}
38-
}
39-
40-
impl Ord for $thing {
41-
#[inline]
42-
fn cmp(&self, other: &$thing) -> core::cmp::Ordering { self[..].cmp(&other[..]) }
43-
}
44-
4520
impl AsRef<[$ty; $len]> for $thing {
4621
#[inline]
4722
/// Gets a reference to the underlying array

src/schnorr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::{
1515
};
1616

1717
/// Represents a schnorr signature.
18-
#[derive(Copy, Clone)]
18+
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1919
pub struct Signature([u8; constants::SCHNORR_SIGNATURE_SIZE]);
2020
impl_array_newtype!(Signature, u8, constants::SCHNORR_SIGNATURE_SIZE);
2121
impl_pretty_debug!(Signature);

0 commit comments

Comments
 (0)