Skip to content

Commit

Permalink
fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
sanket1729 committed Jan 6, 2024
1 parent 7a5d78c commit 158ff81
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/zkp/musig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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());
Expand Down Expand Up @@ -718,15 +718,15 @@ 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();
///
/// // Other party creates the other partial signature
/// 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();
///
Expand Down Expand Up @@ -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);
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand All @@ -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());
Expand Down Expand Up @@ -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
///
Expand All @@ -1176,7 +1176,7 @@ impl MusigSession {
&self,
secp: &Secp256k1<C>,
mut secnonce: MusigSecNonce,
keypair: &KeyPair,
keypair: &Keypair,
key_agg_cache: &MusigKeyAggCache,
) -> Result<MusigPartialSignature, MusigSignError> {
unsafe {
Expand Down Expand Up @@ -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);
Expand All @@ -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());
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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());
Expand All @@ -1345,15 +1345,15 @@ 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();
///
/// // Other party creates the other partial signature
/// 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();
///
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 158ff81

Please sign in to comment.