From 5a03c186d73007a29fd67905ee1844385aceeb67 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Thu, 11 May 2023 19:30:50 +0200 Subject: [PATCH] chore: update secp256k1-zkp dependency --- Cargo.lock | 39 ++++++++++----------------------------- Cargo.toml | 2 +- src/contract/fungible.rs | 4 +++- 3 files changed, 14 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e97797df..891252fa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -220,7 +220,7 @@ dependencies = [ "baid58", "bp-primitives", "commit_verify", - "secp256k1 0.27.0", + "secp256k1", "serde", "strict_encoding", ] @@ -233,7 +233,7 @@ checksum = "fbfea68e7cf2a2962b609d4de56b8e855ecfe7ca5c2e6deac5ac02289fb5b656" dependencies = [ "amplify", "commit_verify", - "secp256k1 0.27.0", + "secp256k1", "serde", "strict_encoding", ] @@ -744,17 +744,6 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" -[[package]] -name = "secp256k1" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" -dependencies = [ - "rand", - "secp256k1-sys 0.6.1", - "serde", -] - [[package]] name = "secp256k1" version = "0.27.0" @@ -762,19 +751,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" dependencies = [ "rand", - "secp256k1-sys 0.8.1", + "secp256k1-sys", "serde", ] -[[package]] -name = "secp256k1-sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" -dependencies = [ - "cc", -] - [[package]] name = "secp256k1-sys" version = "0.8.1" @@ -786,24 +766,25 @@ dependencies = [ [[package]] name = "secp256k1-zkp" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd403e9f0569b4131ab3fc9fa24a17775331b39382efd2cde851fdca655e3520" +checksum = "3c07a95044ad86d2bfde4bb9bc99728aad3b311aa4fabea9db3b670846224186" dependencies = [ + "bitcoin-private", "rand", - "secp256k1 0.24.3", + "secp256k1", "secp256k1-zkp-sys", "serde", ] [[package]] name = "secp256k1-zkp-sys" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e7a2beac087c1da2d21018a3b7f043fe2f138654ad9c1518d409061a4a0034" +checksum = "4237cd927cb5b153fb764b766ced70a7df76d0dacdbaabb49e75bdab03b49c26" dependencies = [ "cc", - "secp256k1-sys 0.6.1", + "secp256k1-sys", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 2dce165f..d8722773 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ aluvm = { version = "~0.10.1", features = ["std"] } commit_verify = { version = "~0.10.1", features = ["rand", "derive"] } single_use_seals = "~0.10.0" bp-core = { version = "~0.10.2" } -secp256k1-zkp = { version = "~0.7.0", features = ["use-rand", "rand-std", "global-context"] } +secp256k1-zkp = { version = "0.8.0", features = ["use-rand", "rand-std", "global-context"] } baid58 = "~0.3.1" mime = "~0.3.16" serde_crate = { package = "serde", version = "1", features = ["derive"], optional = true } diff --git a/src/contract/fungible.rs b/src/contract/fungible.rs index bd5b6aaa..7a86f2b5 100644 --- a/src/contract/fungible.rs +++ b/src/contract/fungible.rs @@ -293,7 +293,9 @@ impl CommitVerify for PedersenCommitment { let FungibleState::Bits64(value) = revealed.value; // TODO: Check that we create correct generator value. - let g = secp256k1_zkp::PublicKey::from_secret_key(SECP256K1, &secp256k1_zkp::ONE_KEY); + let one_key = secp256k1_zkp::SecretKey::from_slice(&secp256k1_zkp::constants::ONE) + .expect("secret key from a constant"); + let g = secp256k1_zkp::PublicKey::from_secret_key(SECP256K1, &one_key); let h = Sha256::digest(&g.serialize_uncompressed()); let tag = Tag::from(h); let generator = Generator::new_unblinded(SECP256K1, tag);