Don't reexport bigint from util

This commit is contained in:
Fredrik
2017-09-04 16:36:49 +02:00
parent 56f46edab8
commit 308f36a532
285 changed files with 675 additions and 332 deletions

View File

@@ -18,12 +18,13 @@
extern crate test;
extern crate ethcore_util;
extern crate ethcore_bigint;
#[macro_use]
extern crate log;
extern crate hash;
use test::{Bencher, black_box};
use ethcore_util::hash::*;
use ethcore_bigint::hash::*;
use ethcore_util::bytes::*;
use ethcore_util::trie::*;
use ethcore_util::memorydb::*;

View File

@@ -24,6 +24,7 @@ rustc-hex = "1.0"
rustc-serialize = "0.3"
ethcore-io = { path = "../io" }
ethcore-util = { path = ".." }
ethcore-bigint = { path = "../bigint" }
ethcore-devtools = { path = "../../devtools" }
ethkey = { path = "../../ethkey" }
ethcrypto = { path = "../../ethcrypto" }

View File

@@ -22,7 +22,7 @@ use hash::{keccak, write_keccak};
use mio::{Token, Ready, PollOpt};
use mio::deprecated::{Handler, EventLoop, TryRead, TryWrite};
use mio::tcp::*;
use util::hash::*;
use bigint::hash::*;
use util::bytes::*;
use rlp::*;
use std::io::{self, Cursor, Read, Write};
@@ -481,7 +481,7 @@ impl EncryptedConnection {
#[test]
pub fn test_encryption() {
use util::hash::*;
use bigint::hash::*;
use std::str::FromStr;
let key = H256::from_str("2212767d793a7a3d66f869ae324dd11bd17044b82c9f463b8a541a4d089efec5").unwrap();
let before = H128::from_str("12532abaec065082a3cf1da7d0136f15").unwrap();

View File

@@ -24,7 +24,7 @@ use mio::deprecated::{Handler, EventLoop};
use mio::udp::*;
use hash::keccak;
use time;
use util::hash::*;
use bigint::hash::*;
use rlp::*;
use node_table::*;
use error::NetworkError;

View File

@@ -18,7 +18,7 @@ use std::sync::Arc;
use rand::random;
use hash::write_keccak;
use mio::tcp::*;
use util::hash::*;
use bigint::hash::*;
use util::bytes::Bytes;
use rlp::*;
use connection::{Connection};
@@ -333,7 +333,7 @@ mod test {
use std::sync::Arc;
use rustc_hex::FromHex;
use super::*;
use util::hash::H256;
use bigint::hash::H256;
use io::*;
use mio::tcp::TcpStream;
use stats::NetworkStats;

View File

@@ -29,7 +29,7 @@ use hash::keccak;
use mio::*;
use mio::deprecated::{EventLoop};
use mio::tcp::*;
use util::hash::*;
use bigint::hash::*;
use util::version;
use rlp::*;
use session::{Session, SessionInfo, SessionData};

View File

@@ -59,6 +59,7 @@
extern crate ethcore_io as io;
extern crate ethcore_util as util;
extern crate ethcore_bigint as bigint;
extern crate parking_lot;
extern crate mio;
extern crate tiny_keccak;

View File

@@ -25,7 +25,7 @@ use std::path::{PathBuf};
use std::fmt;
use std::fs;
use std::io::{Read, Write};
use util::hash::*;
use bigint::hash::*;
use util::UtilError;
use rlp::*;
use time::Tm;
@@ -58,7 +58,7 @@ impl NodeEndpoint {
pub fn is_allowed(&self, filter: &IpFilter) -> bool {
(self.is_allowed_by_predefined(&filter.predefined) || filter.custom_allow.iter().any(|ipnet| {
self.address.ip().is_within(ipnet)
}))
}))
&& !filter.custom_block.iter().any(|ipnet| {
self.address.ip().is_within(ipnet)
})
@@ -373,7 +373,7 @@ pub fn is_valid_node_url(url: &str) -> bool {
mod tests {
use super::*;
use std::net::{SocketAddr, SocketAddrV4, Ipv4Addr};
use util::H512;
use bigint::hash::H512;
use std::str::FromStr;
use devtools::*;
use ipnetwork::IpNetwork;

View File

@@ -23,7 +23,7 @@ use std::collections::HashMap;
use mio::*;
use mio::deprecated::{Handler, EventLoop};
use mio::tcp::*;
use util::hash::*;
use bigint::hash::*;
use rlp::*;
use connection::{EncryptedConnection, Packet, Connection};
use handshake::Handshake;

View File

@@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Database of byte-slices keyed to their Keccak hash.
use hash::*;
use bigint::hash::*;
use std::collections::HashMap;
use elastic_array::ElasticArray128;
@@ -72,9 +72,10 @@ pub trait HashDB: AsHashDB + Send + Sync {
/// # Examples
/// ```rust
/// extern crate ethcore_util;
/// extern crate ethcore_bigint;
/// use ethcore_util::hashdb::*;
/// use ethcore_util::memorydb::*;
/// use ethcore_util::hash::*;
/// use ethcore_bigint::hash::*;
/// fn main() {
/// let mut m = MemoryDB::new();
/// let key = m.insert("Hello world!".as_bytes());

View File

@@ -25,7 +25,8 @@ use memorydb::*;
use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
use super::traits::JournalDB;
use kvdb::{KeyValueDB, DBTransaction};
use {Bytes, H256, BaseDataError, UtilError};
use bigint::hash::H256;
use {Bytes, BaseDataError, UtilError};
/// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay
/// and latent-removal semantics.
@@ -210,7 +211,7 @@ mod tests {
use super::*;
use journaldb::traits::JournalDB;
use kvdb::Database;
use {H32};
use bigint::hash::H32;
#[test]
fn insert_same_in_fork() {

View File

@@ -28,7 +28,8 @@ use memorydb::*;
use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
use super::traits::JournalDB;
use kvdb::{KeyValueDB, DBTransaction};
use {H256, BaseDataError, UtilError, Bytes};
use bigint::hash::H256;
use { BaseDataError, UtilError, Bytes};
#[derive(Clone, PartialEq, Eq)]
struct RefInfo {
@@ -583,7 +584,7 @@ mod tests {
use super::super::traits::JournalDB;
use ethcore_logger::init_log;
use kvdb::{DatabaseConfig};
use {H32};
use bigint::hash::H32;
#[test]
fn insert_same_in_fork() {

View File

@@ -27,7 +27,8 @@ use memorydb::*;
use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
use kvdb::{KeyValueDB, DBTransaction};
use super::JournalDB;
use {H256, BaseDataError, UtilError, Bytes, H256FastMap};
use bigint::hash::{H256, H256FastMap};
use {BaseDataError, UtilError, Bytes};
/// Implementation of the `JournalDB` trait for a disk-backed database with a memory overlay
/// and, possibly, latent-removal semantics.
@@ -467,7 +468,7 @@ mod tests {
use ethcore_logger::init_log;
use journaldb::JournalDB;
use kvdb::Database;
use {H32};
use bigint::hash::H32;
fn new_db(path: &Path) -> OverlayRecentDB {
let backing = Arc::new(Database::open_default(path.to_str().unwrap()).unwrap());

View File

@@ -26,7 +26,8 @@ use memorydb::MemoryDB;
use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
use super::traits::JournalDB;
use kvdb::{KeyValueDB, DBTransaction};
use {UtilError, H256, Bytes};
use bigint::hash::H256;
use {UtilError, Bytes};
/// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay
/// and latent-removal semantics.

View File

@@ -19,7 +19,8 @@
use std::sync::Arc;
use hashdb::*;
use kvdb::{self, DBTransaction};
use {Bytes, H256, UtilError};
use bigint::hash::H256;
use {Bytes, UtilError};
/// A `HashDB` which can manage a short-term journal potentially containing many forks of mutually
/// exclusive actions.

View File

@@ -902,7 +902,7 @@ impl Drop for Database {
#[cfg(test)]
mod tests {
use hash::H256;
use bigint::hash::H256;
use super::*;
use devtools::*;
use std::str::FromStr;

View File

@@ -146,11 +146,9 @@ pub use timer::*;
pub use error::*;
pub use bytes::*;
pub use vector::*;
pub use bigint::prelude::*;
pub use bigint::hash;
pub use ansi_term::{Colour, Style};
pub use parking_lot::{Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard};
/// 160-bit integer representing account address
pub type Address = H160;
pub type Address = bigint::hash::H160;

View File

@@ -20,7 +20,7 @@ use std::mem;
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use heapsize::HeapSizeOf;
use hash::{H256FastMap, H256};
use bigint::hash::{H256FastMap, H256};
use rlp::NULL_RLP;
use keccak::{KECCAK_NULL_RLP, keccak};
use hashdb::*;

View File

@@ -20,7 +20,7 @@ use std::sync::Arc;
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use error::*;
use hash::*;
use bigint::hash::*;
use rlp::*;
use hashdb::*;
use memorydb::*;

View File

@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use hash::H256;
use bigint::hash::H256;
use keccak::keccak;
use hashdb::HashDB;
use super::{TrieDB, Trie, TrieDBIterator, TrieItem, TrieIterator, Query};

View File

@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use hash::H256;
use bigint::hash::H256;
use keccak::keccak;
use hashdb::{HashDB, DBValue};
use super::{TrieDBMut, TrieMut};

View File

@@ -19,7 +19,7 @@
use hashdb::HashDB;
use nibbleslice::NibbleSlice;
use rlp::Rlp;
use ::{H256};
use bigint::hash::H256;
use super::{TrieError, Query};
use super::node::Node;

View File

@@ -17,7 +17,7 @@
//! Trie interface and implementation.
use std::fmt;
use hash::H256;
use bigint::hash::H256;
use keccak::KECCAK_NULL_RLP;
use hashdb::{HashDB, DBValue};

View File

@@ -17,7 +17,8 @@
//! Trie query recorder.
use keccak::keccak;
use {Bytes, H256};
use bigint::hash::H256;
use Bytes;
/// A record of a visited node.
#[derive(PartialEq, Eq, Debug, Clone)]
@@ -82,7 +83,7 @@ impl Recorder {
#[cfg(test)]
mod tests {
use super::*;
use ::H256;
use bigint::hash::H256;
#[test]
fn basic_recorder() {

View File

@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use hash::H256;
use bigint::hash::H256;
use keccak::keccak;
use hashdb::HashDB;
use super::triedb::TrieDB;

View File

@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use hash::H256;
use bigint::hash::H256;
use keccak::keccak;
use hashdb::{HashDB, DBValue};
use super::triedbmut::TrieDBMut;

View File

@@ -19,7 +19,7 @@ extern crate rand;
use keccak::keccak;
use bytes::*;
use hash::*;
use bigint::hash::*;
use rlp::encode;
/// Alphabet to use when creating words for insertion into tries.

View File

@@ -21,7 +21,8 @@ use rlp::*;
use super::node::{Node, OwnedNode};
use super::lookup::Lookup;
use super::{Trie, TrieItem, TrieError, TrieIterator, Query};
use {ToPretty, Bytes, H256};
use bigint::hash::H256;
use {ToPretty, Bytes};
/// A `Trie` implementation using a generic `HashDB` backing database.
///
@@ -31,11 +32,12 @@ use {ToPretty, Bytes, H256};
/// # Example
/// ```
/// extern crate ethcore_util as util;
/// extern crate ethcore_bigint as bigint;
///
/// use util::trie::*;
/// use util::hashdb::*;
/// use util::memorydb::*;
/// use util::hash::*;
/// use bigint::hash::*;
///
/// fn main() {
/// let mut memdb = MemoryDB::new();

View File

@@ -21,7 +21,7 @@ use super::lookup::Lookup;
use super::node::Node as RlpNode;
use super::node::NodeKey;
use ::{HashDB, H256};
use ::HashDB;
use ::bytes::ToPretty;
use ::nibbleslice::NibbleSlice;
use ::rlp::{Rlp, RlpStream};
@@ -30,6 +30,7 @@ use hashdb::DBValue;
use std::collections::{HashSet, VecDeque};
use std::mem;
use std::ops::Index;
use bigint::hash::H256;
use elastic_array::ElasticArray1024;
use keccak::{KECCAK_NULL_RLP};
@@ -261,13 +262,14 @@ impl<'a> Index<&'a StorageHandle> for NodeStorage {
/// # Example
/// ```
/// extern crate ethcore_util as util;
/// extern crate ethcore_bigint as bigint;
/// extern crate hash;
///
/// use hash::KECCAK_NULL_RLP;
/// use util::trie::*;
/// use util::hashdb::*;
/// use util::memorydb::*;
/// use util::hash::*;
/// use bigint::hash::*;
///
/// fn main() {
/// let mut memdb = MemoryDB::new();

View File

@@ -20,7 +20,7 @@
use std::collections::BTreeMap;
use std::cmp;
use hash::*;
use bigint::hash::*;
use keccak::keccak;
use rlp;
use rlp::RlpStream;
@@ -30,9 +30,10 @@ use vector::SharedPrefix;
///
/// ```rust
/// extern crate ethcore_util as util;
/// extern crate ethcore_bigint as bigint;
/// use std::str::FromStr;
/// use util::triehash::*;
/// use util::hash::*;
/// use bigint::hash::*;
///
/// fn main() {
/// let v = vec![From::from("doe"), From::from("reindeer")];
@@ -62,9 +63,10 @@ pub fn ordered_trie_root<I>(input: I) -> H256
///
/// ```rust
/// extern crate ethcore_util as util;
/// extern crate ethcore_bigint as bigint;
/// use std::str::FromStr;
/// use util::triehash::*;
/// use util::hash::*;
/// use bigint::hash::*;
///
/// fn main() {
/// let v = vec![
@@ -96,9 +98,10 @@ pub fn trie_root<I>(input: I) -> H256
///
/// ```rust
/// extern crate ethcore_util as util;
/// extern crate ethcore_bigint as bigint;
/// use std::str::FromStr;
/// use util::triehash::*;
/// use util::hash::*;
/// use bigint::hash::*;
///
/// fn main() {
/// let v = vec![
@@ -324,7 +327,7 @@ fn test_hex_prefix_encode() {
#[cfg(test)]
mod tests {
use std::str::FromStr;
use hash::H256;
use bigint::hash::H256;
use super::trie_root;
#[test]