Merge pull request #196 from sgeisler/separate-fuzzing

Move fuzzing code out of utils
This commit is contained in:
Andrew Poelstra 2018-12-09 16:33:21 +00:00 committed by GitHub
commit bb7ca63776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 7 deletions

View File

@ -38,7 +38,7 @@ use util::hash::Hash160;
#[cfg(feature="bitcoinconsensus")] use std::convert;
#[cfg(feature="bitcoinconsensus")] use util::hash::Sha256dHash;
#[cfg(feature="fuzztarget")] use util::sha2::Sha256;
#[cfg(feature="fuzztarget")] use fuzz_util::sha2::Sha256;
#[cfg(not(feature="fuzztarget"))] use crypto::sha2::Sha256;
#[derive(Clone, Default, PartialOrd, Ord, PartialEq, Eq, Hash)]

4
src/fuzz_util/mod.rs Normal file
View File

@ -0,0 +1,4 @@
//! This module contains all mocks that are used for fuzz testing. Never use anything from this
//! module in production.
pub mod sha2;

View File

@ -80,3 +80,6 @@ pub use util::hash::BitcoinHash;
pub use util::privkey::Privkey;
pub use util::decimal::Decimal;
pub use util::decimal::UDecimal;
#[cfg(feature = "fuzztarget")]
pub mod fuzz_util;

View File

@ -33,7 +33,7 @@ use secp256k1::{self, Secp256k1};
use network::constants::Network;
use util::base58;
#[cfg(feature="fuzztarget")] use util::sha2::{Sha256, Sha512};
#[cfg(feature="fuzztarget")] use fuzz_util::sha2::{Sha256, Sha512};
#[cfg(not(feature="fuzztarget"))] use crypto::sha2::{Sha256, Sha512};
/// A chain code

View File

@ -29,7 +29,7 @@ use std::{error, fmt};
use network::constants::Network;
use util::{address, hash};
#[cfg(feature="fuzztarget")] use util::sha2;
#[cfg(feature="fuzztarget")] use fuzz_util::sha2;
#[cfg(not(feature="fuzztarget"))] use crypto::sha2;
/// Encoding of "pubkey here" in script; from bitcoin core `src/script/script.h`

View File

@ -30,7 +30,7 @@ use crypto::ripemd160::Ripemd160;
use consensus::encode::{Encodable, Decodable};
use util::uint::Uint256;
#[cfg(feature="fuzztarget")] use util::sha2::Sha256;
#[cfg(feature="fuzztarget")] use fuzz_util::sha2::Sha256;
#[cfg(not(feature="fuzztarget"))] use crypto::sha2::Sha256;
use std::str::FromStr;

View File

@ -28,9 +28,6 @@ pub mod iter;
pub mod misc;
pub mod uint;
#[cfg(feature = "fuzztarget")]
pub mod sha2;
use std::{error, fmt};
use secp256k1;