Skip to content

Commit 8c7c5e7

Browse files
committed
Remove deprecated code
We are currently on version 0.24.1 (i.e., next release is 0.25.0), we can comfortably remove any code deprecated in 0.23.x or earlier.
1 parent e779e5d commit 8c7c5e7

File tree

6 files changed

+0
-265
lines changed

6 files changed

+0
-265
lines changed

src/constants.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,9 @@ pub const COMPACT_SIGNATURE_SIZE: usize = 64;
3737
/// The size of a Schnorr signature.
3838
pub const SCHNORR_SIGNATURE_SIZE: usize = 64;
3939

40-
/// The size of a Schnorr signature.
41-
#[deprecated(since = "0.22.0", note = "Use SCHNORR_SIGNATURE_SIZE instead.")]
42-
pub const SCHNORRSIG_SIGNATURE_SIZE: usize = SCHNORR_SIGNATURE_SIZE;
43-
4440
/// The size of a Schnorr public key.
4541
pub const SCHNORR_PUBLIC_KEY_SIZE: usize = 32;
4642

47-
/// The size of a Schnorr public key.
48-
#[deprecated(since = "0.22.0", note = "Use SCHNORR_PUBLIC_KEY_SIZE instead.")]
49-
pub const SCHNORRSIG_PUBLIC_KEY_SIZE: usize = SCHNORR_PUBLIC_KEY_SIZE;
50-
5143
/// The size of a key pair.
5244
pub const KEY_PAIR_SIZE: usize = 96;
5345

src/ecdsa/mod.rs

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,6 @@ impl<'de> serde::Deserialize<'de> for Signature {
245245
}
246246

247247
impl<C: Signing> Secp256k1<C> {
248-
249-
/// Constructs a signature for `msg` using the secret key `sk` and RFC6979 nonce
250-
/// Requires a signing-capable context.
251-
#[deprecated(since = "0.21.0", note = "Use sign_ecdsa instead.")]
252-
pub fn sign(&self, msg: &Message, sk: &SecretKey) -> Signature {
253-
self.sign_ecdsa(msg, sk)
254-
}
255-
256248
fn sign_ecdsa_with_noncedata_pointer(
257249
&self,
258250
msg: &Message,
@@ -324,17 +316,6 @@ impl<C: Signing> Secp256k1<C> {
324316
}
325317
}
326318

327-
/// Constructs a signature for `msg` using the secret key `sk`, RFC6979 nonce
328-
/// and "grinds" the nonce by passing extra entropy if necessary to produce
329-
/// a signature that is less than 71 - `bytes_to_grind` bytes. The number
330-
/// of signing operation performed by this function is exponential in the
331-
/// number of bytes grinded.
332-
/// Requires a signing capable context.
333-
#[deprecated(since = "0.21.0", note = "Use sign_ecdsa_grind_r instead.")]
334-
pub fn sign_grind_r(&self, msg: &Message, sk: &SecretKey, bytes_to_grind: usize) -> Signature {
335-
self.sign_ecdsa_grind_r(msg, sk, bytes_to_grind)
336-
}
337-
338319
/// Constructs a signature for `msg` using the secret key `sk`, RFC6979 nonce
339320
/// and "grinds" the nonce by passing extra entropy if necessary to produce
340321
/// a signature that is less than 71 - `bytes_to_grind` bytes. The number
@@ -346,17 +327,6 @@ impl<C: Signing> Secp256k1<C> {
346327
self.sign_grind_with_check(msg, sk, len_check)
347328
}
348329

349-
/// Constructs a signature for `msg` using the secret key `sk`, RFC6979 nonce
350-
/// and "grinds" the nonce by passing extra entropy if necessary to produce
351-
/// a signature that is less than 71 bytes and compatible with the low r
352-
/// signature implementation of bitcoin core. In average, this function
353-
/// will perform two signing operations.
354-
/// Requires a signing capable context.
355-
#[deprecated(since = "0.21.0", note = "Use sign_ecdsa_low_r instead.")]
356-
pub fn sign_low_r(&self, msg: &Message, sk: &SecretKey) -> Signature {
357-
self.sign_grind_with_check(msg, sk, compact_sig_has_zero_first_bit)
358-
}
359-
360330
/// Constructs a signature for `msg` using the secret key `sk`, RFC6979 nonce
361331
/// and "grinds" the nonce by passing extra entropy if necessary to produce
362332
/// a signature that is less than 71 bytes and compatible with the low r
@@ -369,34 +339,6 @@ impl<C: Signing> Secp256k1<C> {
369339
}
370340

371341
impl<C: Verification> Secp256k1<C> {
372-
/// Checks that `sig` is a valid ECDSA signature for `msg` using the public
373-
/// key `pubkey`. Returns `Ok(())` on success. Note that this function cannot
374-
/// be used for Bitcoin consensus checking since there may exist signatures
375-
/// which OpenSSL would verify but not libsecp256k1, or vice-versa. Requires a
376-
/// verify-capable context.
377-
///
378-
/// ```rust
379-
/// # #[cfg(all(feature = "std", feature = "rand-std"))] {
380-
/// # use secp256k1::rand::thread_rng;
381-
/// # use secp256k1::{Secp256k1, Message, Error};
382-
/// #
383-
/// # let secp = Secp256k1::new();
384-
/// # let (secret_key, public_key) = secp.generate_keypair(&mut thread_rng());
385-
/// #
386-
/// let message = Message::from_slice(&[0xab; 32]).expect("32 bytes");
387-
/// let sig = secp.sign(&message, &secret_key);
388-
/// assert_eq!(secp.verify(&message, &sig, &public_key), Ok(()));
389-
///
390-
/// let message = Message::from_slice(&[0xcd; 32]).expect("32 bytes");
391-
/// assert_eq!(secp.verify(&message, &sig, &public_key), Err(Error::IncorrectSignature));
392-
/// # }
393-
/// ```
394-
#[inline]
395-
#[deprecated(since = "0.21.0", note = "Use verify_ecdsa instead")]
396-
pub fn verify(&self, msg: &Message, sig: &Signature, pk: &PublicKey) -> Result<(), Error> {
397-
self.verify_ecdsa(msg, sig, pk)
398-
}
399-
400342
/// Checks that `sig` is a valid ECDSA signature for `msg` using the public
401343
/// key `pubkey`. Returns `Ok(())` on success. Note that this function cannot
402344
/// be used for Bitcoin consensus checking since there may exist signatures

src/ecdsa/recovery.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,6 @@ impl From<ffi::RecoverableSignature> for RecoverableSignature {
150150
}
151151

152152
impl<C: Signing> Secp256k1<C> {
153-
/// Constructs a signature for `msg` using the secret key `sk` and RFC6979 nonce.
154-
/// Requires a signing-capable context.
155-
#[deprecated(since = "0.21.0", note = "Use sign_ecdsa_recoverable instead.")]
156-
pub fn sign_recoverable(&self, msg: &Message, sk: &key::SecretKey) -> RecoverableSignature {
157-
self.sign_ecdsa_recoverable(msg, sk)
158-
}
159-
160153
fn sign_ecdsa_recoverable_with_noncedata_pointer(
161154
&self,
162155
msg: &Message,
@@ -206,13 +199,6 @@ impl<C: Signing> Secp256k1<C> {
206199
}
207200

208201
impl<C: Verification> Secp256k1<C> {
209-
/// Determines the public key for which `sig` is a valid signature for
210-
/// `msg`. Requires a verify-capable context.
211-
#[deprecated(since = "0.21.0", note = "Use recover_ecdsa instead.")]
212-
pub fn recover(&self, msg: &Message, sig: &RecoverableSignature) -> Result<key::PublicKey, Error> {
213-
self.recover_ecdsa(msg, sig)
214-
}
215-
216202
/// Determines the public key for which `sig` is a valid signature for
217203
/// `msg`. Requires a verify-capable context.
218204
pub fn recover_ecdsa(&self, msg: &Message, sig: &RecoverableSignature)

src/key.rs

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,6 @@ impl SecretKey {
259259
self.0
260260
}
261261

262-
/// Negates the secret key.
263-
#[inline]
264-
#[deprecated(since = "0.23.0", note = "Use negate instead")]
265-
pub fn negate_assign(&mut self) {
266-
*self = self.negate()
267-
}
268-
269262
/// Negates the secret key.
270263
#[inline]
271264
#[must_use = "you forgot to use the negated secret key"]
@@ -280,18 +273,6 @@ impl SecretKey {
280273
self
281274
}
282275

283-
/// Adds one secret key to another, modulo the curve order.
284-
///
285-
/// # Errors
286-
///
287-
/// Returns an error if the resulting key would be invalid.
288-
#[inline]
289-
#[deprecated(since = "0.23.0", note = "Use add_tweak instead")]
290-
pub fn add_assign(&mut self, other: &Scalar) -> Result<(), Error> {
291-
*self = self.add_tweak(other)?;
292-
Ok(())
293-
}
294-
295276
/// Tweaks a [`SecretKey`] by adding `tweak` modulo the curve order.
296277
///
297278
/// # Errors
@@ -313,15 +294,6 @@ impl SecretKey {
313294
}
314295
}
315296

316-
/// Multiplies one secret key by another, modulo the curve order. Will
317-
/// return an error if the resulting key would be invalid.
318-
#[inline]
319-
#[deprecated(since = "0.23.0", note = "Use mul_tweak instead")]
320-
pub fn mul_assign(&mut self, other: &Scalar) -> Result<(), Error> {
321-
*self = self.mul_tweak(other)?;
322-
Ok(())
323-
}
324-
325297
/// Tweaks a [`SecretKey`] by multiplying by `tweak` modulo the curve order.
326298
///
327299
/// # Errors
@@ -561,13 +533,6 @@ impl PublicKey {
561533
debug_assert_eq!(ret_len, ret.len());
562534
}
563535

564-
/// Negates the public key in place.
565-
#[inline]
566-
#[deprecated(since = "0.23.0", note = "Use negate instead")]
567-
pub fn negate_assign<C: Verification>(&mut self, secp: &Secp256k1<C>) {
568-
*self = self.negate(secp)
569-
}
570-
571536
/// Negates the public key.
572537
#[inline]
573538
#[must_use = "you forgot to use the negated public key"]
@@ -579,22 +544,6 @@ impl PublicKey {
579544
self
580545
}
581546

582-
/// Adds `other * G` to `self` in place.
583-
///
584-
/// # Errors
585-
///
586-
/// Returns an error if the resulting key would be invalid.
587-
#[inline]
588-
#[deprecated(since = "0.23.0", note = "Use add_exp_tweak instead")]
589-
pub fn add_exp_assign<C: Verification>(
590-
&mut self,
591-
secp: &Secp256k1<C>,
592-
other: &Scalar
593-
) -> Result<(), Error> {
594-
*self = self.add_exp_tweak(secp, other)?;
595-
Ok(())
596-
}
597-
598547
/// Tweaks a [`PublicKey`] by adding `tweak * G` modulo the curve order.
599548
///
600549
/// # Errors
@@ -615,22 +564,6 @@ impl PublicKey {
615564
}
616565
}
617566

618-
/// Muliplies the public key in place by the scalar `other`.
619-
///
620-
/// # Errors
621-
///
622-
/// Returns an error if the resulting key would be invalid.
623-
#[deprecated(since = "0.23.0", note = "Use mul_tweak instead")]
624-
#[inline]
625-
pub fn mul_assign<C: Verification>(
626-
&mut self,
627-
secp: &Secp256k1<C>,
628-
other: &Scalar,
629-
) -> Result<(), Error> {
630-
*self = self.mul_tweak(secp, other)?;
631-
Ok(())
632-
}
633-
634567
/// Tweaks a [`PublicKey`] by multiplying by `tweak` modulo the curve order.
635568
///
636569
/// # Errors
@@ -968,19 +901,6 @@ impl KeyPair {
968901
*SecretKey::from_keypair(self).as_ref()
969902
}
970903

971-
/// Tweaks a keypair by adding the given tweak to the secret key and updating the public key
972-
/// accordingly.
973-
#[inline]
974-
#[deprecated(since = "0.23.0", note = "Use add_xonly_tweak instead")]
975-
pub fn tweak_add_assign<C: Verification>(
976-
&mut self,
977-
secp: &Secp256k1<C>,
978-
tweak: &Scalar,
979-
) -> Result<(), Error> {
980-
*self = self.add_xonly_tweak(secp, tweak)?;
981-
Ok(())
982-
}
983-
984904
/// Tweaks a keypair by first converting the public key to an xonly key and tweaking it.
985905
///
986906
/// # Errors
@@ -1282,18 +1202,6 @@ impl XOnlyPublicKey {
12821202
ret
12831203
}
12841204

1285-
/// Tweaks an x-only PublicKey by adding the generator multiplied with the given tweak to it.
1286-
#[deprecated(since = "0.23.0", note = "Use add_tweak instead")]
1287-
pub fn tweak_add_assign<V: Verification>(
1288-
&mut self,
1289-
secp: &Secp256k1<V>,
1290-
tweak: &Scalar,
1291-
) -> Result<Parity, Error> {
1292-
let (tweaked, parity) = self.add_tweak(secp, tweak)?;
1293-
*self = tweaked;
1294-
Ok(parity)
1295-
}
1296-
12971205
/// Tweaks an [`XOnlyPublicKey`] by adding the generator multiplied with the given tweak to it.
12981206
///
12991207
/// # Returns

src/lib.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -206,25 +206,6 @@ use crate::ffi::{CPtr, impl_array_newtype, types::AlignedType};
206206
#[cfg(feature = "bitcoin_hashes")]
207207
use crate::hashes::Hash;
208208

209-
// Backwards compatible changes
210-
/// Schnorr Signature related methods.
211-
#[deprecated(since = "0.21.0", note = "Use schnorr instead.")]
212-
pub mod schnorrsig {
213-
#[deprecated(since = "0.21.0", note = "Use crate::XOnlyPublicKey instead.")]
214-
/// backwards compatible re-export of xonly key
215-
pub type PublicKey = crate::key::XOnlyPublicKey;
216-
/// backwards compatible re-export of keypair
217-
#[deprecated(since = "0.21.0", note = "Use crate::KeyPair instead.")]
218-
pub type KeyPair = crate::key::KeyPair;
219-
/// backwards compatible re-export of schnorr signatures
220-
#[deprecated(since = "0.21.0", note = "Use schnorr::Signature instead.")]
221-
pub type Signature = crate::schnorr::Signature;
222-
}
223-
224-
#[deprecated(since = "0.21.0", note = "Use ecdsa::Signature instead.")]
225-
/// backwards compatible re-export of ecdsa signatures
226-
pub type Signature = ecdsa::Signature;
227-
228209
/// Trait describing something that promises to be a 32-byte random number; in particular,
229210
/// it has negligible probability of being zero or overflowing the group order. Such objects
230211
/// may be converted to `Message`s without any error paths.

0 commit comments

Comments
 (0)