From 158ff819d9fb61a15634130f296b0c0e423c2552 Mon Sep 17 00:00:00 2001 From: Sanket Kanjalkar Date: Sat, 6 Jan 2024 12:52:44 -0800 Subject: [PATCH] fix warning --- src/zkp/musig.rs | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/zkp/musig.rs b/src/zkp/musig.rs index d2092a5..1d23bb6 100644 --- a/src/zkp/musig.rs +++ b/src/zkp/musig.rs @@ -13,7 +13,7 @@ use {core, std}; use crate::ffi::{self, CPtr}; use crate::ZERO_TWEAK; -use crate::{schnorr, KeyPair, XOnlyPublicKey}; +use crate::{schnorr, Keypair, XOnlyPublicKey}; use crate::{Message, PublicKey, Secp256k1, SecretKey, Tweak}; use crate::{Signing, Verification}; use secp256k1::Parity; @@ -114,7 +114,7 @@ impl MusigKeyAggCache { /// ```rust /// # # [cfg(any(test, feature = "rand-std"))] { /// # use secp256k1_zkp::rand::{thread_rng, RngCore}; - /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair, PublicKey}; + /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey}; /// # let secp = Secp256k1::new(); /// # let sk1 = SecretKey::new(&mut thread_rng()); /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1); @@ -177,7 +177,7 @@ impl MusigKeyAggCache { /// ```rust /// # # [cfg(any(test, feature = "rand-std"))] { /// # use secp256k1_zkp::rand::{thread_rng, RngCore}; - /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair, PublicKey}; + /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey}; /// # let secp = Secp256k1::new(); /// # let sk1 = SecretKey::new(&mut thread_rng()); /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1); @@ -234,7 +234,7 @@ impl MusigKeyAggCache { /// ```rust /// # # [cfg(any(test, feature = "rand-std"))] { /// # use secp256k1_zkp::rand::{thread_rng, RngCore}; - /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair, PublicKey}; + /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey}; /// # let secp = Secp256k1::new(); /// # let sk1 = SecretKey::new(&mut thread_rng()); /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1); @@ -308,7 +308,7 @@ impl MusigKeyAggCache { /// ```rust /// # # [cfg(any(test, feature = "rand-std"))] { /// # use secp256k1_zkp::rand::{thread_rng, RngCore}; - /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair, PublicKey, MusigSessionId, Message}; + /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, MusigSessionId, Message}; /// # let secp = Secp256k1::new(); /// # let sk1 = SecretKey::new(&mut thread_rng()); /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1); @@ -319,7 +319,7 @@ impl MusigKeyAggCache { /// // The session id must be sampled at random. Read documentation for more details. /// let session_id = MusigSessionId::new(&mut thread_rng()); /// - /// let msg = Message::from_slice(b"Public Message we want to sign!!").unwrap(); + /// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap(); /// /// // Provide the current time for mis-use resistance /// let extra_rand : Option<[u8; 32]> = None; @@ -678,7 +678,7 @@ pub fn adapt( /// ```rust /// # # [cfg(any(test, feature = "rand-std"))] { /// # use secp256k1_zkp::rand::{thread_rng, RngCore}; -/// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair, PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession, adapt, extract_adaptor, Tweak}; +/// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession, adapt, extract_adaptor, Tweak}; /// # let secp = Secp256k1::new(); /// # let sk1 = SecretKey::new(&mut thread_rng()); /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1); @@ -688,7 +688,7 @@ pub fn adapt( /// let key_agg_cache = MusigKeyAggCache::new(&secp, &[pub_key1, pub_key2]); /// // The session id must be sampled at random. Read documentation for more details. /// -/// let msg = Message::from_slice(b"Public Message we want to sign!!").unwrap(); +/// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap(); /// /// // Provide the current time for mis-use resistance /// let session_id1 = MusigSessionId::new(&mut thread_rng()); @@ -718,7 +718,7 @@ pub fn adapt( /// let partial_sig1 = session.partial_sign( /// &secp, /// sec_nonce1, -/// &KeyPair::from_secret_key(&secp, &sk1), +/// &Keypair::from_secret_key(&secp, &sk1), /// &key_agg_cache, /// ).unwrap(); /// @@ -726,7 +726,7 @@ pub fn adapt( /// let partial_sig2 = session.partial_sign( /// &secp, /// sec_nonce2, -/// &KeyPair::from_secret_key(&secp, &sk2), +/// &Keypair::from_secret_key(&secp, &sk2), /// &key_agg_cache, /// ).unwrap(); /// @@ -916,7 +916,7 @@ impl MusigAggNonce { /// ```rust /// # # [cfg(any(test, feature = "rand-std"))] { /// # use secp256k1_zkp::rand::{thread_rng, RngCore}; - /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair, PublicKey, MusigSessionId, Message, MusigAggNonce}; + /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, MusigSessionId, Message, MusigAggNonce}; /// # let secp = Secp256k1::new(); /// # let sk1 = SecretKey::new(&mut thread_rng()); /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1); @@ -926,7 +926,7 @@ impl MusigAggNonce { /// # let key_agg_cache = MusigKeyAggCache::new(&secp, &[pub_key1, pub_key2]); /// // The session id must be sampled at random. Read documentation for more details. /// - /// let msg = Message::from_slice(b"Public Message we want to sign!!").unwrap(); + /// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap(); /// /// let session_id1 = MusigSessionId::new(&mut thread_rng()); /// let (_sec_nonce1, pub_nonce1) = key_agg_cache.nonce_gen(&secp, session_id1, pub_key1, msg, None) @@ -1059,7 +1059,7 @@ impl MusigSession { /// ```rust /// # # [cfg(any(test, feature = "rand-std"))] { /// # use secp256k1_zkp::rand::{thread_rng, RngCore}; - /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair, PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession}; + /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession}; /// # let secp = Secp256k1::new(); /// # let sk1 = SecretKey::new(&mut thread_rng()); /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1); @@ -1069,7 +1069,7 @@ impl MusigSession { /// # let key_agg_cache = MusigKeyAggCache::new(&secp, &[pub_key1, pub_key2]); /// // The session id must be sampled at random. Read documentation for more details. /// - /// let msg = Message::from_slice(b"Public Message we want to sign!!").unwrap(); + /// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap(); /// /// // Provide the current time for mis-use resistance /// let session_id1 = MusigSessionId::new(&mut thread_rng()); @@ -1164,7 +1164,7 @@ impl MusigSession { /// * `sec_nonce`: [`MusigSecNonce`] to be used for this session that has never /// been used before. For mis-use resistance, this API takes a mutable reference /// to `sec_nonce` and sets it to zero even if the partial signing fails. - /// * `key_pair`: The [`KeyPair`] to sign the message + /// * `key_pair`: The [`Keypair`] to sign the message /// * `key_agg_cache`: [`MusigKeyAggCache`] containing the aggregate pubkey used in /// the creation of this session /// @@ -1176,7 +1176,7 @@ impl MusigSession { &self, secp: &Secp256k1, mut secnonce: MusigSecNonce, - keypair: &KeyPair, + keypair: &Keypair, key_agg_cache: &MusigKeyAggCache, ) -> Result { unsafe { @@ -1228,7 +1228,7 @@ impl MusigSession { /// ```rust /// # # [cfg(any(test, feature = "rand-std"))] { /// # use secp256k1_zkp::rand::{thread_rng, RngCore}; - /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair, PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession}; + /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession}; /// # let secp = Secp256k1::new(); /// # let sk1 = SecretKey::new(&mut thread_rng()); /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1); @@ -1238,7 +1238,7 @@ impl MusigSession { /// # let key_agg_cache = MusigKeyAggCache::new(&secp, &[pub_key1, pub_key2]); /// // The session id must be sampled at random. Read documentation for more details. /// - /// let msg = Message::from_slice(b"Public Message we want to sign!!").unwrap(); + /// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap(); /// /// // Provide the current time for mis-use resistance /// let session_id1 = MusigSessionId::new(&mut thread_rng()); @@ -1259,7 +1259,7 @@ impl MusigSession { /// msg, /// ); /// - /// let keypair = KeyPair::from_secret_key(&secp, &sk1); + /// let keypair = Keypair::from_secret_key(&secp, &sk1); /// let partial_sig1 = session.partial_sign( /// &secp, /// sec_nonce1, @@ -1311,7 +1311,7 @@ impl MusigSession { /// ```rust /// # # [cfg(any(test, feature = "rand-std"))] { /// # use secp256k1_zkp::rand::{thread_rng, RngCore}; - /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair, PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession}; + /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession}; /// # let secp = Secp256k1::new(); /// # let sk1 = SecretKey::new(&mut thread_rng()); /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1); @@ -1321,7 +1321,7 @@ impl MusigSession { /// let key_agg_cache = MusigKeyAggCache::new(&secp, &[pub_key1, pub_key2]); /// // The session id must be sampled at random. Read documentation for more details. /// - /// let msg = Message::from_slice(b"Public Message we want to sign!!").unwrap(); + /// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap(); /// /// // Provide the current time for mis-use resistance /// let session_id1 = MusigSessionId::new(&mut thread_rng()); @@ -1345,7 +1345,7 @@ impl MusigSession { /// let partial_sig1 = session.partial_sign( /// &secp, /// sec_nonce1, - /// &KeyPair::from_secret_key(&secp, &sk1), + /// &Keypair::from_secret_key(&secp, &sk1), /// &key_agg_cache, /// ).unwrap(); /// @@ -1353,7 +1353,7 @@ impl MusigSession { /// let partial_sig2 = session.partial_sign( /// &secp, /// sec_nonce2, - /// &KeyPair::from_secret_key(&secp, &sk2), + /// &Keypair::from_secret_key(&secp, &sk2), /// &key_agg_cache, /// ).unwrap(); /// @@ -1462,7 +1462,7 @@ mod tests { let pub_key = PublicKey::from_secret_key(&secp, &sec_key); let key_agg_cache = MusigKeyAggCache::new(&secp, &[pub_key, pub_key]); - let msg = Message::from_slice(&[3; 32]).unwrap(); + let msg = Message::from_digest_slice(&[3; 32]).unwrap(); let session_id = MusigSessionId::assume_unique_per_nonce_gen([1; 32]); let (_secnonce, pubnonce) = key_agg_cache .nonce_gen(&secp, session_id, pub_key, msg, None)