Skip to content

Commit

Permalink
Upgrade to secp256k1 0.21
Browse files Browse the repository at this point in the history
Release 0.21 includes a module restructure which we can now make use of.
This simplifies some imports.
  • Loading branch information
thomaseizinger committed Jan 7, 2022
1 parent fae5f1c commit ce66406
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use-serde = ["serde", "secp256k1/serde"]
use-rand = ["rand", "secp256k1/rand"]

[dependencies]
secp256k1 = "0.20.0"
secp256k1 = "0.21.0"
secp256k1-zkp-sys = { version = "0.5.0", default-features = false, path = "./secp256k1-zkp-sys" }
rand = { version = "0.6", default-features = false, optional = true }
serde = { version = "1.0", default-features = false, optional = true }
Expand Down
4 changes: 0 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ pub use secp256k1_zkp_sys as ffi;

extern crate secp256k1;

#[cfg(feature = "bitcoin_hashes")]
pub use secp256k1::bitcoin_hashes as hashes;
#[cfg(any(test, feature = "std"))]
extern crate core;
#[cfg(any(test, feature = "rand"))]
Expand All @@ -65,8 +63,6 @@ use core::{fmt, str};

pub use secp256k1::*;

pub use key::{PublicKey, SecretKey};

#[cfg(feature = "serde")]
mod serde_util;
mod zkp;
Expand Down
8 changes: 5 additions & 3 deletions src/zkp/ecdsa_adaptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ use ffi::{self, CPtr, ECDSA_ADAPTOR_SIGNATURE_LENGTH};
use rand::thread_rng;
#[cfg(any(test, feature = "rand"))]
use rand::{CryptoRng, Rng};
use {constants, PublicKey, Secp256k1, SecretKey};
use secp256k1::ecdsa::Signature;
use secp256k1::{PublicKey, SecretKey};
use Verification;
use {constants, Secp256k1};
use {from_hex, Error};
use {Message, Signing};
use {Signature, Verification};

/// Represents an adaptor signature and dleq proof.
#[derive(Debug, PartialEq, Clone, Copy, Eq)]
Expand Down Expand Up @@ -309,7 +311,7 @@ mod tests {
.decrypt(&adaptor_secret)
.expect("to be able to decrypt using the correct secret");
SECP256K1
.verify(&msg, &sig, &pubkey)
.verify_ecdsa(&msg, &sig, &pubkey)
.expect("signature to be valid");
let recovered = adaptor_sig
.recover(&SECP256K1, &sig, &adaptor)
Expand Down
5 changes: 3 additions & 2 deletions src/zkp/rangeproof.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use ffi::RANGEPROOF_MAX_LENGTH;
use from_hex;
use secp256k1::SecretKey;
use std::ops::Range;
use std::str;
use Error;
use Generator;
use PedersenCommitment;
use Verification;
use {ffi, Secp256k1, SecretKey, Signing, Tweak};
use {ffi, Secp256k1, Signing, Tweak};

/// Represents a range proof.
///
Expand Down Expand Up @@ -203,7 +204,7 @@ impl RangeProof {
#[cfg(feature = "bitcoin_hashes")]
impl ::core::fmt::Display for RangeProof {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
use bitcoin_hashes::hex::format_hex;
use hashes::hex::format_hex;

format_hex(self.serialize().as_slice(), f)
}
Expand Down
2 changes: 1 addition & 1 deletion src/zkp/surjection_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl SurjectionProof {
#[cfg(feature = "bitcoin_hashes")]
impl ::core::fmt::Display for SurjectionProof {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
use bitcoin_hashes::hex::format_hex;
use hashes::hex::format_hex;

format_hex(self.serialize().as_slice(), f)
}
Expand Down
3 changes: 2 additions & 1 deletion src/zkp/whitelist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use core::ptr;
use ffi::CPtr;
#[cfg(feature = "std")]
use from_hex;
use {ffi, secp256k1, Error, PublicKey, Secp256k1, SecretKey, Signing, Verification};
use secp256k1::{PublicKey, SecretKey};
use {ffi, secp256k1, Error, Secp256k1, Signing, Verification};

/// A whitelist ring signature.
#[derive(Clone, PartialEq, Eq, Hash)]
Expand Down

0 comments on commit ce66406

Please sign in to comment.