Skip to content

Commit

Permalink
chore(dpp): fix feature build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Nov 14, 2024
1 parent 5859848 commit b86245e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/rs-dpp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dashcore = { git = "https://github.com/dashpay/rust-dashcore", features = [
"secp-recovery",
"rand",
"signer",
"serde"
"serde",
], default-features = false, tag = "0.33.1" }
env_logger = { version = "0.11" }
getrandom = { version = "0.2", features = ["js"] }
Expand Down
14 changes: 6 additions & 8 deletions packages/rs-dpp/src/identity/identity_public_key/key_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use dashcore::Network;
use itertools::Itertools;
use lazy_static::lazy_static;

#[cfg(feature = "bls-signatures")]
use crate::bls_signatures::{self as bls_signatures, Bls12381G2Impl, BlsError};
use crate::fee::Credits;
use crate::version::PlatformVersion;
use crate::ProtocolError;
Expand All @@ -22,11 +24,6 @@ use rand::Rng;
use serde_repr::{Deserialize_repr, Serialize_repr};
use std::collections::HashMap;
use std::convert::TryFrom;
#[cfg(feature = "bls-signatures")]
use {
crate::bls_signatures::{self as bls_signatures, Bls12381G2Impl, BlsError},
dashcore::{blsful, ed25519_dalek},
};

#[allow(non_camel_case_types)]
#[repr(u8)]
Expand Down Expand Up @@ -249,7 +246,8 @@ impl KeyType {
KeyType::EDDSA_25519_HASH160 => {
#[cfg(feature = "ed25519-dalek")]
{
let key_pair = ed25519_dalek::SigningKey::from_bytes(private_key_bytes);
let key_pair =
dashcore::ed25519_dalek::SigningKey::from_bytes(private_key_bytes);
Ok(ripemd160_sha256(key_pair.verifying_key().to_bytes().as_slice()).to_vec())
}
#[cfg(not(feature = "ed25519-dalek"))]
Expand Down Expand Up @@ -278,7 +276,7 @@ impl KeyType {
)
}
KeyType::BLS12_381 => {
let private_key = blsful::SecretKey::<Bls12381G2Impl>::random(rng);
let private_key = dashcore::blsful::SecretKey::<Bls12381G2Impl>::random(rng);
let public_key_bytes = private_key.public_key().0.to_compressed().to_vec();
(public_key_bytes, private_key.0.to_be_bytes())
}
Expand All @@ -293,7 +291,7 @@ impl KeyType {
)
}
KeyType::EDDSA_25519_HASH160 => {
let key_pair = ed25519_dalek::SigningKey::generate(rng);
let key_pair = dashcore::ed25519_dalek::SigningKey::generate(rng);
(
ripemd160_sha256(key_pair.verifying_key().to_bytes().as_slice()).to_vec(),
key_pair.to_bytes(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ use crate::identity::KeyType;
use crate::util::hash::ripemd160_sha256;
use crate::ProtocolError;
use anyhow::anyhow;
#[cfg(feature = "ed25519-dalek")]
use dashcore::ed25519_dalek;
use dashcore::hashes::Hash;
use dashcore::key::Secp256k1;
use dashcore::secp256k1::SecretKey;
use dashcore::{Network, PublicKey as ECDSAPublicKey};
use platform_value::Bytes20;
#[cfg(feature = "bls-signatures")]
use {
crate::bls_signatures,
dashcore::{blsful::Bls12381G2Impl, ed25519_dalek},
};

use {crate::bls_signatures, dashcore::blsful::Bls12381G2Impl};
impl IdentityPublicKeyHashMethodsV0 for IdentityPublicKeyV0 {
/// Get the original public key hash
fn public_key_hash(&self) -> Result<[u8; 20], ProtocolError> {
Expand Down

0 comments on commit b86245e

Please sign in to comment.