Skip to content

Commit

Permalink
upgraded library secp256k1 to 0.28.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lorbax committed Feb 12, 2024
1 parent 3eb04d0 commit 146c945
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 67 deletions.
6 changes: 3 additions & 3 deletions protocols/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion protocols/v2/noise-sv2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
secp256k1 = { version = "0.28.1", default-features = false, features =["hashes", "alloc","rand","rand-std"] }
secp256k1 = { version = "0.28.2", default-features = false, features =["hashes", "alloc","rand","rand-std"] }
rand = {version = "0.8.5", default-features = false, features = ["std","std_rng"] }
aes-gcm = "0.10.2"
chacha20poly1305 = "0.10.1"
Expand Down
34 changes: 7 additions & 27 deletions roles/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion roles/jd-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ tracing-subscriber = { version = "0.3" }
error_handling = { version = "0.1", path = "../../utils/error-handling" }
nohash-hasher = "0.2.0"
key-utils = { version = "^1.0.0", path = "../../utils/key-utils" }
secp256k1 = { version = "0.27.0", default-features = false, features =["bitcoin_hashes","alloc","rand","rand-std"] }
secp256k1 = { version = "0.28.2", default-features = false, features =["alloc","rand","rand-std"] }
2 changes: 1 addition & 1 deletion roles/jd-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ serde_json = { version = "1.0", default-features = false, features = ["alloc","r
serde = { version = "1.0.89", features = ["derive", "alloc"], default-features = false }
hashbrown = { version = "0.11", default-features = false, features = ["ahash", "serde"] }
key-utils = { version = "^1.0.0", path = "../../utils/key-utils" }
secp256k1 = { version = "0.27.0", default-features = false, features =["bitcoin_hashes","alloc","rand","rand-std"] }
secp256k1 = { version = "0.28.2", default-features = false, features =["alloc","rand","rand-std"] }
siphasher = "1"
hex = "0.4.3"

6 changes: 3 additions & 3 deletions roles/jd-server/src/lib/job_declarator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use roles_logic_sv2::{
parsers::PoolMessages as JdsMessages,
utils::{Id, Mutex},
};
use secp256k1::{KeyPair, Message as SecpMessage, Secp256k1};
use secp256k1::{Keypair, Message as SecpMessage, Secp256k1};
use std::{collections::HashMap, convert::TryInto, sync::Arc};
use tokio::net::TcpListener;
use tracing::{error, info};
Expand Down Expand Up @@ -131,11 +131,11 @@ pub fn signed_token(

// Create the SecretKey and PublicKey instances
let secret_key = prv_key.0;
let kp = KeyPair::from_secret_key(&secp, &secret_key);
let kp = Keypair::from_secret_key(&secp, &secret_key);

let message: Vec<u8> = tx_hash_list_hash.to_vec();

let signature = secp.sign_schnorr(&SecpMessage::from_slice(&message).unwrap(), &kp);
let signature = secp.sign_schnorr(&SecpMessage::from_digest_slice(&message).unwrap(), &kp);

// Sign message
signature.as_ref().to_vec().try_into().unwrap()
Expand Down
2 changes: 1 addition & 1 deletion roles/pool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async-recursion = "1.0.0"
error_handling = { version = "0.1", path = "../../utils/error-handling" }
nohash-hasher = "0.2.0"
key-utils = { version = "^1.0.0", path = "../../utils/key-utils" }
secp256k1 = { version = "0.27.0", default-features = false, features =["bitcoin_hashes","alloc","rand","rand-std"] }
secp256k1 = { version = "0.28.2", default-features = false, features =["alloc","rand","rand-std"] }

[dev-dependencies]
hex = "0.4.3"
Expand Down
2 changes: 1 addition & 1 deletion roles/pool/src/lib/mining_pool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ pub fn verify_token(
// Verify signature
let is_verified = secp.verify_schnorr(
&signature,
&secp256k1::Message::from_slice(&message)?,
&secp256k1::Message::from_digest_slice(&message)?,
&x_only_public_key,
);

Expand Down
30 changes: 5 additions & 25 deletions utils/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion utils/key-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ path = "src/main.rs"

[dependencies]
bs58 = { version ="0.4.0", features = ["check"] }
secp256k1 = { version = "0.27.0", default-features = false, features =["bitcoin_hashes","alloc","rand","rand-std"] }
secp256k1 = { version = "0.28.2", default-features = false, features =["alloc","rand","rand-std"] }
serde = { version = "1.0.89", features = ["derive","alloc"], default-features = false }

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions utils/key-utils/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use ::key_utils::{Secp256k1PublicKey, Secp256k1SecretKey};
use secp256k1::{rand, KeyPair, Secp256k1};
use secp256k1::{rand, Keypair, Secp256k1};

fn generate_key() -> (Secp256k1SecretKey, Secp256k1PublicKey) {
let secp = Secp256k1::new();
let (secret_key, _) = secp.generate_keypair(&mut rand::thread_rng());
let kp = KeyPair::from_secret_key(&secp, &secret_key);
let kp = Keypair::from_secret_key(&secp, &secret_key);
if kp.x_only_public_key().1 == secp256k1::Parity::Even {
(
Secp256k1SecretKey(kp.secret_key()),
Expand Down
2 changes: 1 addition & 1 deletion utils/message-generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
tokio = { version = "1", features = ["full"] }
arbitrary = { version = "1", features = ["derive"] }
rand = "0.8.5"
secp256k1 = "0.27.0"
secp256k1 = "0.28.2"
key-utils = { path = "../key-utils" }
tracing = { version = "0.1" }
tracing-subscriber = {version = "0.3", features = ["env-filter"]}
Expand Down

0 comments on commit 146c945

Please sign in to comment.