Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ test-utils = []
# The no-std feature doesn't disable std - you need to turn off the std feature for that by disabling default.
# Instead no-std enables additional features required for this crate to be usable without std.
# As a result, both can be enabled without conflict.
std = ["secp256k1/std", "dashcore_hashes/std", "bech32/std", "internals/std"]
no-std = ["core2", "dashcore_hashes/alloc", "dashcore_hashes/core2", "secp256k1/alloc"]
std = ["secp256k1/std", "bech32/std", "internals/std"]
no-std = ["core2", "secp256k1/alloc"]

[package.metadata.docs.rs]
all-features = true
Expand All @@ -50,7 +50,7 @@ rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
internals = { path = "../internals", package = "dashcore-private" }
bech32 = { version = "0.9.1", default-features = false }
dashcore_hashes = { path = "../hashes", default-features = false }
dashcore_hashes = { path = "../hashes" }
secp256k1 = { default-features = false, features = ["hashes"], version= "0.30.0" }
core2 = { version = "0.4.0", optional = true, features = ["alloc"], default-features = false }
rustversion = { version="1.0.20"}
Expand Down
5 changes: 1 addition & 4 deletions hashes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ edition = "2021"
exclude = ["tests", "contrib"]

[features]
default = ["std"]
std = ["alloc", "internals/std"]
alloc = ["internals/alloc"]
default = ["internals/alloc"]
schemars = ["actual-schemars"]
serde-std = ["serde/std"]
x11 = ["rs-x11-hash"]
Expand All @@ -27,7 +25,6 @@ rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
internals = { path = "../internals", package = "dashcore-private" }

core2 = { version = "0.4.0", default-features = false, optional = true }
# Only enable this if you explicitly do not want to use "std", otherwise enable "serde-std".
serde = { version = "1.0.219", default-features = false, optional = true }
# Do NOT use this as a feature! Use the `schemars` feature instead. Can only be used with "std" enabled.
Expand Down
1 change: 0 additions & 1 deletion hashes/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ impl fmt::Display for Error {
}
}

#[cfg(feature = "std")]
impl std::error::Error for Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
use self::Error::*;
Expand Down
2 changes: 0 additions & 2 deletions hashes/src/hash160.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ fn from_engine(e: HashEngine) -> Hash {
#[cfg(test)]
mod tests {
#[test]
#[cfg(feature = "alloc")]
fn test() {
use crate::{hash160, Hash, HashEngine};

#[derive(Clone)]
#[cfg(feature = "alloc")]
struct Test {
input: Vec<u8>,
output: Vec<u8>,
Expand Down
7 changes: 0 additions & 7 deletions hashes/src/hash_x11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,9 @@
use core::ops::Index;
use core::slice::SliceIndex;
use core::str;
#[cfg(feature = "std")]
use std::io;
#[cfg(feature = "std")]
use std::vec::Vec;

#[cfg(all(feature = "core2", not(feature = "std")))]
use core2::io;

#[cfg(all(feature = "alloc", not(feature = "std")))]
use crate::alloc::vec::Vec;
use crate::{hex, Error, HashEngine as _};

crate::internal_macros::hash_type! {
Expand Down
11 changes: 0 additions & 11 deletions hashes/src/hex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,8 @@
//!

use core::{fmt, str};
#[cfg(feature = "std")]
use std::io;

#[cfg(all(feature = "core2", not(feature = "std")))]
use core2::io;

#[cfg(all(feature = "alloc", not(feature = "std")))]
use crate::alloc::vec::Vec;

/// Hex decoding error.
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Error {
Expand All @@ -48,7 +41,6 @@ impl fmt::Display for Error {
}
}

#[cfg(feature = "std")]
impl std::error::Error for Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
use self::Error::*;
Expand Down Expand Up @@ -119,7 +111,6 @@ impl<'a> Iterator for HexIterator<'a> {
}
}

#[cfg(any(feature = "std", feature = "core2"))]
impl<'a> io::Read for HexIterator<'a> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
let mut bytes_read = 0usize;
Expand All @@ -146,7 +137,6 @@ impl<'a> DoubleEndedIterator for HexIterator<'a> {

impl<'a> ExactSizeIterator for HexIterator<'a> {}

#[cfg(any(test, feature = "std", feature = "alloc"))]
impl FromHex for Vec<u8> {
fn from_byte_iter<I>(iter: I) -> Result<Self, Error>
where
Expand Down Expand Up @@ -200,7 +190,6 @@ impl_fromhex_array!(384);
impl_fromhex_array!(512);

#[cfg(test)]
#[cfg(feature = "alloc")]
mod tests {
use internals::hex::exts::DisplayHex;

Expand Down
1 change: 0 additions & 1 deletion hashes/src/hmac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ impl<'de, T: Hash + Deserialize<'de>> Deserialize<'de> for Hmac<T> {
#[cfg(test)]
mod tests {
#[test]
#[cfg(feature = "alloc")]
fn test() {
use crate::{sha256, Hash, HashEngine, Hmac, HmacEngine};

Expand Down
9 changes: 0 additions & 9 deletions hashes/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,8 @@
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
//

//! `std` / `core2` Impls.
//!
//! Implementations of traits defined in `std` / `core2` and not in `core`.
//!

#[cfg(feature = "std")]
use std::io;

#[cfg(not(feature = "std"))]
use core2::io;

use crate::{hmac, ripemd160, sha1, sha256, sha512, siphash24, HashEngine};

impl io::Write for sha1::HashEngine {
Expand Down
8 changes: 0 additions & 8 deletions hashes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,9 @@
// that don't do anything but annoy us and cant actually ever be resolved.
#![allow(bare_trait_objects)]
#![allow(ellipsis_inclusive_range_patterns)]
#![cfg_attr(all(not(test), not(feature = "std")), no_std)]
// Instead of littering the codebase for non-fuzzing code just globally allow.
#![cfg_attr(fuzzing, allow(dead_code, unused_imports))]

#[cfg(all(feature = "alloc", not(feature = "std")))]
extern crate alloc;
#[cfg(any(test, feature = "std"))]
extern crate core;
#[cfg(feature = "core2")]
extern crate core2;
#[cfg(feature = "serde")]
pub extern crate serde;
#[cfg(all(test, feature = "serde"))]
Expand Down Expand Up @@ -129,7 +122,6 @@ pub mod hash160;
pub mod hash_x11;
pub mod hex;
pub mod hmac;
#[cfg(any(feature = "std", feature = "core2"))]
mod impls;
pub mod ripemd160;
pub mod sha1;
Expand Down
1 change: 0 additions & 1 deletion hashes/src/ripemd160.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ impl HashEngine {
#[cfg(test)]
mod tests {
#[test]
#[cfg(feature = "alloc")]
fn test() {
use std::convert::TryFrom;

Expand Down
1 change: 0 additions & 1 deletion hashes/src/sha1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ impl HashEngine {
#[cfg(test)]
mod tests {
#[test]
#[cfg(feature = "alloc")]
fn test() {
use crate::{sha1, Hash, HashEngine};

Expand Down
1 change: 0 additions & 1 deletion hashes/src/sha256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,6 @@ mod tests {
use crate::{sha256, Hash, HashEngine};

#[test]
#[cfg(feature = "alloc")]
fn test() {
#[derive(Clone)]
struct Test {
Expand Down
1 change: 0 additions & 1 deletion hashes/src/sha256d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ fn from_engine(e: sha256::HashEngine) -> Hash {
#[cfg(test)]
mod tests {
#[test]
#[cfg(feature = "alloc")]
fn test() {
use crate::{sha256, sha256d, Hash, HashEngine};

Expand Down
3 changes: 0 additions & 3 deletions hashes/src/sha256t.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ macro_rules! sha256t_hash_newtype_tag_constructor {

#[cfg(test)]
mod tests {
#[cfg(feature = "alloc")]
use crate::Hash;
use crate::{sha256, sha256t};

Expand All @@ -206,7 +205,6 @@ mod tests {
}

/// A hash tagged with `$name`.
#[cfg(feature = "alloc")]
pub type TestHash = sha256t::Hash<TestHashTag>;

sha256t_hash_newtype! {
Expand All @@ -219,7 +217,6 @@ mod tests {
}

#[test]
#[cfg(feature = "alloc")]
fn test_sha256t() {
assert_eq!(
TestHash::hash(&[0]).to_string(),
Expand Down
1 change: 0 additions & 1 deletion hashes/src/sha512.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ impl HashEngine {
#[cfg(test)]
mod tests {
#[test]
#[cfg(feature = "alloc")]
fn test() {
use crate::{sha512, Hash, HashEngine};

Expand Down
1 change: 0 additions & 1 deletion hashes/src/sha512_256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ fn from_engine(e: HashEngine) -> Hash {
#[cfg(test)]
mod tests {
#[test]
#[cfg(feature = "alloc")]
fn test() {
use crate::{sha512_256, Hash, HashEngine};

Expand Down
4 changes: 2 additions & 2 deletions key-wallet-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "CC0-1.0"

[features]
default = ["std", "bincode"]
std = ["key-wallet/std", "dashcore/std", "dashcore_hashes/std", "secp256k1/std"]
std = ["key-wallet/std", "dashcore/std", "secp256k1/std"]
serde = ["dep:serde", "key-wallet/serde", "dashcore/serde"]
getrandom = ["key-wallet/getrandom"]
bincode = ["dep:bincode", "key-wallet/bincode"]
Expand All @@ -19,7 +19,7 @@ test-utils = []
[dependencies]
key-wallet = { path = "../key-wallet", default-features = false }
dashcore = { path = "../dash", default-features = false }
dashcore_hashes = { path = "../hashes", default-features = false }
dashcore_hashes = { path = "../hashes" }
secp256k1 = { version = "0.30.0", default-features = false, features = ["recovery"] }
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
async-trait = "0.1"
Expand Down
4 changes: 2 additions & 2 deletions key-wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "CC0-1.0"

[features]
default = ["std"]
std = ["dashcore_hashes/std", "secp256k1/std", "bip39/std", "getrandom", "rand"]
std = ["secp256k1/std", "bip39/std", "getrandom", "rand"]
serde = ["dep:serde", "dep:serde_json", "dashcore_hashes/serde", "secp256k1/serde", "dashcore/serde"]
bincode = ["serde", "dep:bincode", "dep:bincode_derive", "dashcore_hashes/bincode", "dashcore/bincode"]
bip38 = ["scrypt", "aes", "bs58", "rand"]
Expand All @@ -20,7 +20,7 @@ test-utils = ["dashcore/test-utils"]

[dependencies]
internals = { path = "../internals", package = "dashcore-private" }
dashcore_hashes = { path = "../hashes", default-features = false }
dashcore_hashes = { path = "../hashes" }
dashcore = { path="../dash" }
secp256k1 = { version = "0.30.0", default-features = false, features = ["hashes", "recovery"] }
bip39 = { version = "2.2.0", default-features = false, features = ["chinese-simplified", "chinese-traditional", "czech", "french", "italian", "japanese", "korean", "portuguese", "spanish", "zeroize"] }
Expand Down
Loading