From 3b339dd9c6dc43f971f66955021db5dd0c55fcd8 Mon Sep 17 00:00:00 2001 From: Odysseas Gabrielides Date: Sun, 6 Oct 2024 22:31:34 +0300 Subject: [PATCH] bump bls dashpay repo --- Cargo.lock | 2 ++ dash-spv-masternode-processor/Cargo.toml | 4 +--- dash-spv-masternode-processor/src/keys/bls_key.rs | 14 +------------- .../src/tests/keys/bls.rs | 13 ++----------- 4 files changed, 6 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5943728e..ed5d9746 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -234,6 +234,7 @@ dependencies = [ [[package]] name = "bls-dash-sys" version = "1.2.5" +source = "git+https://github.com/dashpay/bls-signatures?rev=3ffa7fa2b62aecf3943c142508de4b7ec6005bb5#3ffa7fa2b62aecf3943c142508de4b7ec6005bb5" dependencies = [ "bindgen", "cc", @@ -243,6 +244,7 @@ dependencies = [ [[package]] name = "bls-signatures" version = "1.2.5" +source = "git+https://github.com/dashpay/bls-signatures?rev=3ffa7fa2b62aecf3943c142508de4b7ec6005bb5#3ffa7fa2b62aecf3943c142508de4b7ec6005bb5" dependencies = [ "bls-dash-sys", "hex", diff --git a/dash-spv-masternode-processor/Cargo.toml b/dash-spv-masternode-processor/Cargo.toml index d3071e44..5bc61af8 100644 --- a/dash-spv-masternode-processor/Cargo.toml +++ b/dash-spv-masternode-processor/Cargo.toml @@ -29,9 +29,7 @@ bip38 = { git = "https://github.com/pankcuf/bip38", rev = "87abd21" } bitcoin_hashes = { version = "0.11.0", default-features = false } bitcoinconsensus = { version = "0.19.0-3", optional = true } blake3 = "1.3.2" -#bls-signatures = { git = "https://github.com/knst/bls-signatures", rev = "cc50aa28e60b134b1eaf493c08970fda0d224b7d", features = ["legacy", "bip32", "apple", "use_serde"] } -bls-signatures = { git = "https://github.com/dashpay/bls-signatures", rev = "4a11186d078be8560b448d16a2bea16473dc1806", features = ["legacy", "bip32", "apple", "use_serde" ] } -#bls-signatures = { path = "../../bls-signatures/rust-bindings/bls-signatures", features = ["legacy", "bip32", "apple", "use_serde"] } +bls-signatures = { git = "https://github.com/dashpay/bls-signatures", rev = "3ffa7fa2b62aecf3943c142508de4b7ec6005bb5", features = ["legacy", "bip32", "apple", "use_serde" ] } byte = "0.2" core2 = { version = "0.4.0", optional = true, default-features = false } dirs-next = "2.0.0" diff --git a/dash-spv-masternode-processor/src/keys/bls_key.rs b/dash-spv-masternode-processor/src/keys/bls_key.rs index 5591f301..940819c1 100644 --- a/dash-spv-masternode-processor/src/keys/bls_key.rs +++ b/dash-spv-masternode-processor/src/keys/bls_key.rs @@ -177,20 +177,8 @@ impl BLSKey { pub fn key_with_seed_data(seed: &[u8], use_legacy: bool) -> Self { let bls_private_key = PrivateKey::from_bip32_seed(seed); let bls_public_key = bls_private_key.g1_element().unwrap(); - let seckey = UInt256::from(bls_private_key); - let sec_key_s = format!("{}", seckey); - + let seckey = UInt256::from(&*bls_private_key.to_bytes()); let pubkey = UInt384(g1_element_serialized(&bls_public_key, use_legacy)); - let pubkey_s = format!("{}", pubkey); - - - let pub_key_legacy = UInt384(g1_element_serialized(&bls_public_key, true)); - let pub_key_legacy_s = format!("{}", pub_key_legacy); - let pub_key_basic = UInt384(g1_element_serialized(&bls_public_key, false)); - let pub_key_basic_s = format!("{}", pub_key_basic); - - println!("pri_key:{} pub_key_leg:{} pub_key_basic:{}\n", seckey, pub_key_legacy_s, pub_key_basic_s); - Self { seckey, pubkey, use_legacy, ..Default::default() } } diff --git a/dash-spv-masternode-processor/src/tests/keys/bls.rs b/dash-spv-masternode-processor/src/tests/keys/bls.rs index a72bb513..982d7d3a 100644 --- a/dash-spv-masternode-processor/src/tests/keys/bls.rs +++ b/dash-spv-masternode-processor/src/tests/keys/bls.rs @@ -69,9 +69,7 @@ fn bls_pub() { #[test] fn test_bls_from_bip32_short_seed() { let private_key = PrivateKey::from_bip32_seed(&[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); - - //println!("{:?}", &*private_key.serialize()); - //println!("{:?}", &*private_key.serialize().as_slice()); + println!("{:?}", &*private_key.to_bytes().as_slice()); assert_eq!( private_key.to_bytes().as_slice(), Vec::from_hex("46891c2cec49593c81921e473db7480029e0fc1eb933c6b93d81f5370eb19fbd").unwrap().as_slice(), @@ -87,14 +85,7 @@ fn test_bls_from_bip32_long_seed() { // let seed = [50, 67, 148, 112, 207, 6, 210, 118, 137, 125, 27, 144, 105, 189, 214, 228, 68, 83, 144, 205, 80, 105, 133, 222, 14, 26, 28, 136, 167, 111, 241, 118]; // let secret = let private_key = PrivateKey::from_bip32_seed(&seed); - println!("private_key:{}", UInt256::from(private_key.to_bytes().as_slice())); - let public_key = private_key.g1_element().unwrap(); - let pub_key_legacy = UInt384(crate::keys::bls_key::g1_element_serialized(&public_key, true)); - println!("pub_key_legacy:{}", pub_key_legacy); - let pub_key_basic = UInt384(crate::keys::bls_key::g1_element_serialized(&public_key, false)); - println!("pub_key_basic:{}", pub_key_basic); - //println!("{:?}", &*private_key.serialize()); - //println!("{:?}", &*private_key.serialize().as_slice()); + println!("{:?}", &*private_key.to_bytes().as_slice()); assert_eq!( private_key.to_bytes().as_slice(), private_key_test_data.as_slice(),