diff --git a/Cargo.lock b/Cargo.lock index 15d841103..e45417647 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,6 +3,7 @@ name = "wasm" version = "0.1.0" dependencies = [ "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethcore-bigint 0.1.3", "ethcore-logger 1.8.0", "ethcore-util 1.8.0", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -299,6 +300,7 @@ name = "common-types" version = "0.1.0" dependencies = [ "bloomable 0.1.0", + "ethcore-bigint 0.1.3", "ethcore-util 1.8.0", "ethjson 0.1.0", "hash 0.1.0", @@ -503,6 +505,7 @@ dependencies = [ "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethash 1.8.0", + "ethcore-bigint 0.1.3", "ethcore-bloom-journal 0.1.0", "ethcore-devtools 1.8.0", "ethcore-io 1.8.0", @@ -586,6 +589,7 @@ dependencies = [ name = "ethcore-ipc" version = "1.8.0" dependencies = [ + "ethcore-bigint 0.1.3", "ethcore-devtools 1.8.0", "ethcore-util 1.8.0", "nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)", @@ -648,6 +652,7 @@ version = "1.8.0" dependencies = [ "bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.8.0", + "ethcore-bigint 0.1.3", "ethcore-devtools 1.8.0", "ethcore-io 1.8.0", "ethcore-ipc 1.8.0", @@ -693,6 +698,7 @@ dependencies = [ "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", + "ethcore-bigint 0.1.3", "ethcore-devtools 1.8.0", "ethcore-io 1.8.0", "ethcore-logger 1.8.0", @@ -724,6 +730,7 @@ dependencies = [ "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.8.0", + "ethcore-bigint 0.1.3", "ethcore-devtools 1.8.0", "ethcore-ipc 1.8.0", "ethcore-ipc-codegen 1.8.0", @@ -756,6 +763,7 @@ name = "ethcore-stratum" version = "1.8.0" dependencies = [ "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ethcore-bigint 0.1.3", "ethcore-devtools 1.8.0", "ethcore-ipc 1.8.0", "ethcore-ipc-codegen 1.8.0", @@ -898,6 +906,7 @@ dependencies = [ "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.8.0", + "ethcore-bigint 0.1.3", "ethcore-devtools 1.8.0", "ethcore-io 1.8.0", "ethcore-ipc 1.8.0", @@ -926,6 +935,7 @@ dependencies = [ "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "common-types 0.1.0", + "ethcore-bigint 0.1.3", "ethcore-logger 1.8.0", "ethcore-util 1.8.0", "ethjson 0.1.0", @@ -947,6 +957,7 @@ version = "0.1.0" dependencies = [ "docopt 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.8.0", + "ethcore-bigint 0.1.3", "ethcore-util 1.8.0", "ethjson 0.1.0", "evm 0.1.0", @@ -1207,6 +1218,7 @@ dependencies = [ name = "ipc-common-types" version = "1.8.0" dependencies = [ + "ethcore-bigint 0.1.3", "ethcore-ipc 1.8.0", "ethcore-ipc-codegen 1.8.0", "ethcore-util 1.8.0", @@ -1642,6 +1654,7 @@ name = "node-filter" version = "1.8.0" dependencies = [ "ethcore 1.8.0", + "ethcore-bigint 0.1.3", "ethcore-io 1.8.0", "ethcore-network 1.8.0", "ethcore-util 1.8.0", @@ -1852,6 +1865,7 @@ dependencies = [ "docopt 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.8.0", + "ethcore-bigint 0.1.3", "ethcore-devtools 1.8.0", "ethcore-io 1.8.0", "ethcore-ipc 1.8.0", @@ -1913,6 +1927,7 @@ dependencies = [ "base32 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ethcore-bigint 0.1.3", "ethcore-devtools 1.8.0", "ethcore-util 1.8.0", "fetch 0.1.0", @@ -1960,6 +1975,7 @@ name = "parity-hash-fetch" version = "1.8.0" dependencies = [ "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethcore-bigint 0.1.3", "ethcore-util 1.8.0", "fetch 0.1.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1979,6 +1995,7 @@ version = "1.8.0" dependencies = [ "cid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.8.0", + "ethcore-bigint 0.1.3", "ethcore-util 1.8.0", "jsonrpc-http-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2017,6 +2034,7 @@ dependencies = [ "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "ethash 1.8.0", "ethcore 1.8.0", + "ethcore-bigint 0.1.3", "ethcore-devtools 1.8.0", "ethcore-io 1.8.0", "ethcore-ipc 1.8.0", @@ -2128,6 +2146,7 @@ version = "1.8.0" dependencies = [ "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.8.0", + "ethcore-bigint 0.1.3", "ethcore-ipc 1.8.0", "ethcore-ipc-codegen 1.8.0", "ethcore-util 1.8.0", @@ -3198,6 +3217,7 @@ version = "0.1.0" dependencies = [ "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "common-types 0.1.0", + "ethcore-bigint 0.1.3", "ethcore-util 1.8.0", "ethjson 0.1.0", "evmjit 1.8.0", diff --git a/Cargo.toml b/Cargo.toml index 9f6dd9ccb..73517eb91 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,6 +33,7 @@ jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "pa ethsync = { path = "sync" } ethcore = { path = "ethcore" } ethcore-util = { path = "util" } +ethcore-bigint = { path = "util/bigint" } ethcore-io = { path = "util/io" } ethcore-devtools = { path = "devtools" } ethcore-ipc = { path = "ipc/rpc" } diff --git a/dapps/Cargo.toml b/dapps/Cargo.toml index 76b026c9a..39fcaf2bd 100644 --- a/dapps/Cargo.toml +++ b/dapps/Cargo.toml @@ -30,6 +30,7 @@ jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "pa jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" } ethcore-util = { path = "../util" } +ethcore-bigint = { path = "../util/bigint" } fetch = { path = "../util/fetch" } node-health = { path = "./node-health" } parity-hash-fetch = { path = "../hash-fetch" } diff --git a/dapps/src/apps/fetcher/installers.rs b/dapps/src/apps/fetcher/installers.rs index 9c220b057..cb7fa1671 100644 --- a/dapps/src/apps/fetcher/installers.rs +++ b/dapps/src/apps/fetcher/installers.rs @@ -20,7 +20,7 @@ use std::io::{self, Read, Write}; use std::path::PathBuf; use fetch::{self, Mime}; use hash::keccak_buffer; -use util::H256; +use bigint::hash::H256; use page::{LocalPageEndpoint, PageCache}; use handlers::{ContentValidator, ValidatorResponse}; diff --git a/dapps/src/lib.rs b/dapps/src/lib.rs index f5670c959..c4534e220 100644 --- a/dapps/src/lib.rs +++ b/dapps/src/lib.rs @@ -37,6 +37,7 @@ extern crate jsonrpc_core; extern crate jsonrpc_http_server; extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; extern crate fetch; extern crate node_health; extern crate parity_dapps_glue as parity_dapps; diff --git a/dapps/src/tests/helpers/registrar.rs b/dapps/src/tests/helpers/registrar.rs index d7890675b..c85a38aef 100644 --- a/dapps/src/tests/helpers/registrar.rs +++ b/dapps/src/tests/helpers/registrar.rs @@ -20,7 +20,8 @@ use std::collections::HashMap; use rustc_hex::FromHex; use hash_fetch::urlhint::ContractClient; -use util::{Bytes, Address, Mutex, H256, ToPretty}; +use bigint::hash::H256; +use util::{Bytes, Address, Mutex, ToPretty}; const REGISTRAR: &'static str = "8e4e9b13d4b45cb0befc93c3061b1408f67316b2"; const URLHINT: &'static str = "deadbeefcafe0000000000000000000000000000"; diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 6ee332c99..23c2bb03f 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -29,6 +29,7 @@ ethcore-ipc-nano = { path = "../ipc/nano" } ethcore-logger = { path = "../logger" } ethcore-stratum = { path = "../stratum" } ethcore-util = { path = "../util" } +ethcore-bigint = { path = "../util/bigint" } ethjson = { path = "../json" } ethkey = { path = "../ethkey" } ethstore = { path = "../ethstore" } diff --git a/ethcore/evm/Cargo.toml b/ethcore/evm/Cargo.toml index 7d323d622..57d2bd33e 100644 --- a/ethcore/evm/Cargo.toml +++ b/ethcore/evm/Cargo.toml @@ -8,6 +8,7 @@ bit-set = "0.4" byteorder = "1.0" common-types = { path = "../types" } ethcore-util = { path = "../../util" } +ethcore-bigint = { path = "../../util/bigint" } evmjit = { path = "../../evmjit", optional = true } ethjson = { path = "../../json" } heapsize = "0.4" diff --git a/ethcore/evm/src/benches/mod.rs b/ethcore/evm/src/benches/mod.rs index ecb7d379a..c87fda7bb 100644 --- a/ethcore/evm/src/benches/mod.rs +++ b/ethcore/evm/src/benches/mod.rs @@ -24,6 +24,8 @@ extern crate test; use self::test::{Bencher, black_box}; +use bigint::prelude::U256; +use bigint::hash::H256; use util::*; use vm::ActionParams; use evm::{self, Factory, VMType}; diff --git a/ethcore/evm/src/evm.rs b/ethcore/evm/src/evm.rs index d593143a6..9eedb3c51 100644 --- a/ethcore/evm/src/evm.rs +++ b/ethcore/evm/src/evm.rs @@ -17,7 +17,8 @@ //! Evm interface. use std::{ops, cmp, fmt}; -use util::{U128, U256, U512}; + +use bigint::prelude::{U128, U256, U512}; use vm::{Ext, Result, ReturnData, GasLeft, Error}; /// Finalization result. Gas Left: either it is a known value, or it needs to be computed by processing @@ -149,7 +150,7 @@ impl CostType for usize { #[cfg(test)] mod tests { - use util::U256; + use bigint::prelude::U256; use super::CostType; #[test] diff --git a/ethcore/evm/src/factory.rs b/ethcore/evm/src/factory.rs index 20275dbff..3e9ee0e37 100644 --- a/ethcore/evm/src/factory.rs +++ b/ethcore/evm/src/factory.rs @@ -18,7 +18,7 @@ //! use std::sync::Arc; use vm::Vm; -use util::U256; +use bigint::prelude::U256; use super::interpreter::SharedCache; use super::vmtype::VMType; diff --git a/ethcore/evm/src/interpreter/gasometer.rs b/ethcore/evm/src/interpreter/gasometer.rs index 161c7db39..082868b95 100644 --- a/ethcore/evm/src/interpreter/gasometer.rs +++ b/ethcore/evm/src/interpreter/gasometer.rs @@ -15,7 +15,8 @@ // along with Parity. If not, see . use std::cmp; -use util::*; +use bigint::prelude::U256; +use bigint::hash::H256; use super::u256_to_address; use {evm, vm}; diff --git a/ethcore/evm/src/interpreter/memory.rs b/ethcore/evm/src/interpreter/memory.rs index 9aa9babc7..0369992cb 100644 --- a/ethcore/evm/src/interpreter/memory.rs +++ b/ethcore/evm/src/interpreter/memory.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use util::U256; +use bigint::prelude::U256; use vm::ReturnData; const MAX_RETURN_WASTE_BYTES: usize = 16384; @@ -134,7 +134,7 @@ impl Memory for Vec { #[cfg(test)] mod tests { - use util::U256; + use bigint::prelude::U256; use super::Memory; #[test] diff --git a/ethcore/evm/src/interpreter/mod.rs b/ethcore/evm/src/interpreter/mod.rs index edf8bc3f5..a59a37db0 100644 --- a/ethcore/evm/src/interpreter/mod.rs +++ b/ethcore/evm/src/interpreter/mod.rs @@ -27,6 +27,8 @@ use std::marker::PhantomData; use std::{cmp, mem}; use std::sync::Arc; use hash::keccak; +use bigint::prelude::{U256, U512}; +use bigint::hash::H256; use vm::{ self, ActionParams, ActionValue, CallType, MessageCallResult, diff --git a/ethcore/evm/src/interpreter/shared_cache.rs b/ethcore/evm/src/interpreter/shared_cache.rs index 4f70044dd..2cb4608b5 100644 --- a/ethcore/evm/src/interpreter/shared_cache.rs +++ b/ethcore/evm/src/interpreter/shared_cache.rs @@ -17,7 +17,8 @@ use std::sync::Arc; use hash::KECCAK_EMPTY; use heapsize::HeapSizeOf; -use util::{H256, Mutex}; +use bigint::hash::H256; +use util::Mutex; use util::cache::MemoryLruCache; use bit_set::BitSet; use super::super::instructions; diff --git a/ethcore/evm/src/jit.rs b/ethcore/evm/src/jit.rs index 22262cbb6..d94bb7b8e 100644 --- a/ethcore/evm/src/jit.rs +++ b/ethcore/evm/src/jit.rs @@ -15,6 +15,8 @@ // along with Parity. If not, see . //! Just in time compiler execution environment. +use bigint::prelude::U256; +use bigint::hash::H256; use util::*; use evmjit; use evm::{self, GasLeft}; diff --git a/ethcore/evm/src/lib.rs b/ethcore/evm/src/lib.rs index d5b08c8d8..92bab3a1f 100644 --- a/ethcore/evm/src/lib.rs +++ b/ethcore/evm/src/lib.rs @@ -20,6 +20,7 @@ extern crate byteorder; extern crate bit_set; extern crate common_types as types; extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; extern crate ethjson; extern crate rlp; extern crate parity_wasm; diff --git a/ethcore/evm/src/tests.rs b/ethcore/evm/src/tests.rs index 7263d1779..3eb10bc6a 100644 --- a/ethcore/evm/src/tests.rs +++ b/ethcore/evm/src/tests.rs @@ -20,6 +20,8 @@ use std::hash::Hash; use std::sync::Arc; use std::collections::{HashMap, HashSet}; use rustc_hex::FromHex; +use bigint::prelude::U256; +use bigint::hash::H256; use util::*; use vm::{self, ActionParams, ActionValue}; use vm::tests::{FakeExt, FakeCall, FakeCallType, test_finalize}; diff --git a/ethcore/light/Cargo.toml b/ethcore/light/Cargo.toml index 4e7b3523d..bcebe489d 100644 --- a/ethcore/light/Cargo.toml +++ b/ethcore/light/Cargo.toml @@ -14,6 +14,7 @@ build = "build.rs" log = "0.3" ethcore = { path = ".."} ethcore-util = { path = "../../util" } +ethcore-bigint = { path = "../../util/bigint" } ethcore-network = { path = "../../util/network" } ethcore-io = { path = "../../util/io" } ethcore-ipc = { path = "../../ipc/rpc", optional = true } diff --git a/ethcore/light/src/cache.rs b/ethcore/light/src/cache.rs index ab416e9b3..65c3a4d0f 100644 --- a/ethcore/light/src/cache.rs +++ b/ethcore/light/src/cache.rs @@ -27,7 +27,8 @@ use ethcore::receipt::Receipt; use stats::Corpus; use time::{SteadyTime, Duration}; use heapsize::HeapSizeOf; -use util::{U256, H256}; +use bigint::prelude::U256; +use bigint::hash::H256; use util::cache::MemoryLruCache; /// Configuration for how much data to cache. diff --git a/ethcore/light/src/cht.rs b/ethcore/light/src/cht.rs index 7f2ccc3a8..3b9d9d5e6 100644 --- a/ethcore/light/src/cht.rs +++ b/ethcore/light/src/cht.rs @@ -21,7 +21,9 @@ //! we discarded. use ethcore::ids::BlockId; -use util::{Bytes, H256, U256, HashDB, MemoryDB}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{Bytes, HashDB, MemoryDB}; use util::trie::{self, TrieMut, TrieDBMut, Trie, TrieDB, Recorder}; use rlp::{RlpStream, UntrustedRlp}; diff --git a/ethcore/light/src/client/header_chain.rs b/ethcore/light/src/client/header_chain.rs index a16cb0c85..615734915 100644 --- a/ethcore/light/src/client/header_chain.rs +++ b/ethcore/light/src/client/header_chain.rs @@ -37,7 +37,9 @@ use ethcore::ids::BlockId; use rlp::{Encodable, Decodable, DecoderError, RlpStream, Rlp, UntrustedRlp}; use heapsize::HeapSizeOf; -use util::{H256, U256, RwLock}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::RwLock; use util::kvdb::{DBTransaction, KeyValueDB}; use cache::Cache; diff --git a/ethcore/light/src/client/mod.rs b/ethcore/light/src/client/mod.rs index ee270c977..882ef3ede 100644 --- a/ethcore/light/src/client/mod.rs +++ b/ethcore/light/src/client/mod.rs @@ -31,7 +31,9 @@ use ethcore::service::ClientIoMessage; use ethcore::encoded; use io::IoChannel; -use util::{H256, U256, Mutex, RwLock}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{Mutex, RwLock}; use util::kvdb::{KeyValueDB, CompactionProfile}; use self::header_chain::{AncestryIter, HeaderChain}; diff --git a/ethcore/light/src/lib.rs b/ethcore/light/src/lib.rs index 37de03205..97a3330c9 100644 --- a/ethcore/light/src/lib.rs +++ b/ethcore/light/src/lib.rs @@ -70,6 +70,7 @@ extern crate bincode; extern crate ethcore_io as io; extern crate ethcore_network as network; extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; extern crate ethcore; extern crate evm; extern crate heapsize; diff --git a/ethcore/light/src/net/mod.rs b/ethcore/light/src/net/mod.rs index 046dc68bd..232b8f478 100644 --- a/ethcore/light/src/net/mod.rs +++ b/ethcore/light/src/net/mod.rs @@ -23,8 +23,9 @@ use ethcore::transaction::UnverifiedTransaction; use io::TimerToken; use network::{HostInfo, NetworkProtocolHandler, NetworkContext, PeerId}; use rlp::{RlpStream, UntrustedRlp}; -use util::hash::H256; -use util::{DBValue, Mutex, RwLock, U256}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{DBValue, Mutex, RwLock}; use time::{Duration, SteadyTime}; use std::collections::{HashMap, HashSet}; diff --git a/ethcore/light/src/net/request_credits.rs b/ethcore/light/src/net/request_credits.rs index 950fa24d8..39eb33106 100644 --- a/ethcore/light/src/net/request_credits.rs +++ b/ethcore/light/src/net/request_credits.rs @@ -30,7 +30,7 @@ use request::{self, Request}; use super::error::Error; use rlp::*; -use util::U256; +use bigint::prelude::U256; use time::{Duration, SteadyTime}; /// Credits value. diff --git a/ethcore/light/src/net/request_set.rs b/ethcore/light/src/net/request_set.rs index 35182f0bf..e83c33bff 100644 --- a/ethcore/light/src/net/request_set.rs +++ b/ethcore/light/src/net/request_set.rs @@ -27,7 +27,7 @@ use std::iter::FromIterator; use request::Request; use request::NetworkRequests as Requests; use net::{timeout, ReqId}; -use util::U256; +use bigint::prelude::U256; use time::{Duration, SteadyTime}; diff --git a/ethcore/light/src/net/status.rs b/ethcore/light/src/net/status.rs index 732826430..b83b831da 100644 --- a/ethcore/light/src/net/status.rs +++ b/ethcore/light/src/net/status.rs @@ -17,7 +17,8 @@ //! Peer status and capabilities. use rlp::{DecoderError, Encodable, Decodable, RlpStream, UntrustedRlp}; -use util::{H256, U256}; +use bigint::prelude::U256; +use bigint::hash::H256; use super::request_credits::FlowParams; @@ -373,7 +374,8 @@ pub fn write_announcement(announcement: &Announcement) -> Vec { mod tests { use super::*; use super::super::request_credits::FlowParams; - use util::{U256, H256}; + use bigint::prelude::U256; + use bigint::hash::H256; use rlp::{RlpStream, UntrustedRlp}; #[test] diff --git a/ethcore/light/src/net/tests/mod.rs b/ethcore/light/src/net/tests/mod.rs index ef86c08f5..643f365a8 100644 --- a/ethcore/light/src/net/tests/mod.rs +++ b/ethcore/light/src/net/tests/mod.rs @@ -32,7 +32,9 @@ use request; use request::*; use rlp::*; -use util::{Address, H256, U256}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::Address; use std::sync::Arc; diff --git a/ethcore/light/src/on_demand/request.rs b/ethcore/light/src/on_demand/request.rs index 8ee41437b..f55302229 100644 --- a/ethcore/light/src/on_demand/request.rs +++ b/ethcore/light/src/on_demand/request.rs @@ -30,7 +30,9 @@ use hash::{KECCAK_NULL_RLP, KECCAK_EMPTY, KECCAK_EMPTY_LIST_RLP, keccak}; use request::{self as net_request, IncompleteRequest, CompleteRequest, Output, OutputKind, Field}; use rlp::{RlpStream, UntrustedRlp}; -use util::{Address, Bytes, DBValue, HashDB, Mutex, H256, U256}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{Address, Bytes, DBValue, HashDB, Mutex}; use util::memorydb::MemoryDB; use util::trie::{Trie, TrieDB, TrieError}; @@ -850,7 +852,8 @@ impl TransactionProof { #[cfg(test)] mod tests { use super::*; - use util::{MemoryDB, Address, Mutex, H256}; + use bigint::hash::H256; + use util::{MemoryDB, Address, Mutex}; use util::trie::{Trie, TrieMut, SecTrieDB, SecTrieDBMut}; use util::trie::recorder::Recorder; use hash::keccak; diff --git a/ethcore/light/src/on_demand/tests.rs b/ethcore/light/src/on_demand/tests.rs index 10c4ceae5..48f60766d 100644 --- a/ethcore/light/src/on_demand/tests.rs +++ b/ethcore/light/src/on_demand/tests.rs @@ -22,7 +22,8 @@ use ethcore::header::{Header, Seal}; use futures::Future; use network::{PeerId, NodeId}; use net::*; -use util::{H256, Mutex}; +use bigint::hash::H256; +use util::Mutex; use time::Duration; use ::request::{self as basic_request, Response}; diff --git a/ethcore/light/src/provider.rs b/ethcore/light/src/provider.rs index 3632783ca..d4f82d331 100644 --- a/ethcore/light/src/provider.rs +++ b/ethcore/light/src/provider.rs @@ -24,7 +24,8 @@ use ethcore::client::{BlockChainClient, ProvingBlockChainClient}; use ethcore::transaction::PendingTransaction; use ethcore::ids::BlockId; use ethcore::encoded; -use util::{RwLock, H256}; +use bigint::hash::H256; +use util::RwLock; use cht::{self, BlockInfo}; use client::{LightChainClient, AsLightClient}; diff --git a/ethcore/light/src/transaction_queue.rs b/ethcore/light/src/transaction_queue.rs index b0e7483a3..090919245 100644 --- a/ethcore/light/src/transaction_queue.rs +++ b/ethcore/light/src/transaction_queue.rs @@ -28,7 +28,9 @@ use std::collections::hash_map::Entry; use ethcore::error::{TransactionError, TransactionImportResult}; use ethcore::transaction::{Condition, PendingTransaction, SignedTransaction}; -use util::{Address, U256, H256, H256FastMap}; +use bigint::prelude::U256; +use bigint::hash::{H256, H256FastMap}; +use util::Address; // Knowledge of an account's current nonce. #[derive(Debug, Clone, PartialEq, Eq)] diff --git a/ethcore/light/src/types/request/builder.rs b/ethcore/light/src/types/request/builder.rs index 0b413677d..74503f54f 100644 --- a/ethcore/light/src/types/request/builder.rs +++ b/ethcore/light/src/types/request/builder.rs @@ -211,7 +211,7 @@ impl DerefMut for Requests { mod tests { use request::*; use super::RequestBuilder; - use util::H256; + use bigint::hash::H256; #[test] fn all_scalar() { diff --git a/ethcore/light/src/types/request/mod.rs b/ethcore/light/src/types/request/mod.rs index 51f916b15..534a20de6 100644 --- a/ethcore/light/src/types/request/mod.rs +++ b/ethcore/light/src/types/request/mod.rs @@ -17,7 +17,7 @@ //! Light protocol request types. use rlp::{Encodable, Decodable, DecoderError, RlpStream, UntrustedRlp}; -use util::H256; +use bigint::hash::H256; mod builder; @@ -760,7 +760,9 @@ pub mod header { pub mod header_proof { use super::{Field, NoSuchOutput, OutputKind, Output}; use rlp::{Encodable, Decodable, DecoderError, RlpStream, UntrustedRlp}; - use util::{Bytes, U256, H256}; + use bigint::prelude::U256; + use bigint::hash::H256; + use util::Bytes; /// Potentially incomplete header proof request. #[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] @@ -854,7 +856,7 @@ pub mod header_proof { /// Request and response for transaction index. pub mod transaction_index { use super::{Field, NoSuchOutput, OutputKind, Output}; - use util::H256; + use bigint::hash::H256; /// Potentially incomplete transaction index request. #[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] @@ -932,7 +934,7 @@ pub mod transaction_index { pub mod block_receipts { use super::{Field, NoSuchOutput, OutputKind, Output}; use ethcore::receipt::Receipt; - use util::H256; + use bigint::hash::H256; /// Potentially incomplete block receipts request. #[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] @@ -1001,7 +1003,7 @@ pub mod block_body { use super::{Field, NoSuchOutput, OutputKind, Output}; use ethcore::encoded; use rlp::{Encodable, Decodable, DecoderError, RlpStream, UntrustedRlp}; - use util::H256; + use bigint::hash::H256; /// Potentially incomplete block body request. #[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] @@ -1089,7 +1091,9 @@ pub mod block_body { /// A request for an account proof. pub mod account { use super::{Field, NoSuchOutput, OutputKind, Output}; - use util::{Bytes, U256, H256}; + use bigint::prelude::U256; + use bigint::hash::H256; + use util::Bytes; /// Potentially incomplete request for an account proof. #[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] @@ -1188,7 +1192,8 @@ pub mod account { /// A request for a storage proof. pub mod storage { use super::{Field, NoSuchOutput, OutputKind, Output}; - use util::{Bytes, H256}; + use bigint::hash::H256; + use util::Bytes; /// Potentially incomplete request for an storage proof. #[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] @@ -1296,7 +1301,8 @@ pub mod storage { /// A request for contract code. pub mod contract_code { use super::{Field, NoSuchOutput, OutputKind, Output}; - use util::{Bytes, H256}; + use bigint::hash::H256; + use util::Bytes; /// Potentially incomplete contract code request. #[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] @@ -1382,7 +1388,9 @@ pub mod execution { use super::{Field, NoSuchOutput, OutputKind, Output}; use ethcore::transaction::Action; use rlp::{Encodable, Decodable, DecoderError, RlpStream, UntrustedRlp}; - use util::{Bytes, Address, U256, H256, DBValue}; + use bigint::prelude::U256; + use bigint::hash::H256; + use util::{Bytes, Address, DBValue}; /// Potentially incomplete execution proof request. #[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] @@ -1591,7 +1599,7 @@ mod tests { let full_req = Request::TransactionIndex(req.clone()); let res = TransactionIndexResponse { num: 1000, - hash: ::util::H256::random(), + hash: ::bigint::hash::H256::random(), index: 4, }; let full_res = Response::TransactionIndex(res.clone()); diff --git a/ethcore/node_filter/Cargo.toml b/ethcore/node_filter/Cargo.toml index e885ef1d1..d28975d3a 100644 --- a/ethcore/node_filter/Cargo.toml +++ b/ethcore/node_filter/Cargo.toml @@ -9,6 +9,7 @@ authors = ["Parity Technologies "] [dependencies] ethcore = { path = ".."} ethcore-util = { path = "../../util" } +ethcore-bigint = { path = "../../util/bigint" } ethcore-io = { path = "../../util/io" } ethcore-network = { path = "../../util/network" } native-contracts = { path = "../native_contracts" } diff --git a/ethcore/node_filter/src/lib.rs b/ethcore/node_filter/src/lib.rs index d3dcbaa3b..5365aa3d0 100644 --- a/ethcore/node_filter/src/lib.rs +++ b/ethcore/node_filter/src/lib.rs @@ -18,6 +18,7 @@ extern crate ethcore; extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; extern crate ethcore_network as network; extern crate native_contracts; extern crate futures; @@ -29,7 +30,8 @@ use std::collections::HashMap; use native_contracts::PeerSet as Contract; use network::{NodeId, ConnectionFilter, ConnectionDirection}; use ethcore::client::{BlockChainClient, BlockId, ChainNotify}; -use util::{Mutex, Address, H256, Bytes}; +use bigint::hash::H256; +use util::{Mutex, Address, Bytes}; use futures::Future; const MAX_CACHE_SIZE: usize = 4096; diff --git a/ethcore/src/account_db.rs b/ethcore/src/account_db.rs index 48bb448dd..5ebf3f47a 100644 --- a/ethcore/src/account_db.rs +++ b/ethcore/src/account_db.rs @@ -17,6 +17,7 @@ //! DB backend wrapper for Account trie use std::collections::HashMap; use hash::{KECCAK_NULL_RLP, keccak}; +use bigint::hash::H256; use util::*; use rlp::NULL_RLP; diff --git a/ethcore/src/account_provider/mod.rs b/ethcore/src/account_provider/mod.rs index 752cec964..fd03e420f 100755 --- a/ethcore/src/account_provider/mod.rs +++ b/ethcore/src/account_provider/mod.rs @@ -794,7 +794,7 @@ mod tests { use std::time::Instant; use ethstore::ethkey::{Generator, Random, Address}; use ethstore::{StoreAccountRef, Derivation}; - use util::H256; + use bigint::hash::H256; #[test] fn unlock_account_temp() { diff --git a/ethcore/src/basic_types.rs b/ethcore/src/basic_types.rs index 1f07e748f..838834eea 100644 --- a/ethcore/src/basic_types.rs +++ b/ethcore/src/basic_types.rs @@ -20,7 +20,7 @@ pub type LogBloom = ::log_entry::LogBloom; /// Constant 2048-bit datum for 0. Often used as a default. -pub static ZERO_LOGBLOOM: LogBloom = ::util::hash::H2048([0x00; 256]); +pub static ZERO_LOGBLOOM: LogBloom = ::bigint::hash::H2048([0x00; 256]); #[cfg_attr(feature="dev", allow(enum_variant_names))] /// Semantic boolean for when a seal/signature is included. diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index 5181dff1f..229b322ca 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -22,7 +22,9 @@ use std::collections::HashSet; use hash::{keccak, KECCAK_NULL_RLP, KECCAK_EMPTY_LIST_RLP}; use rlp::{UntrustedRlp, RlpStream, Encodable, Decodable, DecoderError}; -use util::{Bytes, Address, U256, H256, ordered_trie_root}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{Bytes, Address, ordered_trie_root}; use util::error::{Mismatch, OutOfBounds}; use basic_types::{LogBloom, Seal}; diff --git a/ethcore/src/blockchain/best_block.rs b/ethcore/src/blockchain/best_block.rs index e857a99b6..fd41f71e8 100644 --- a/ethcore/src/blockchain/best_block.rs +++ b/ethcore/src/blockchain/best_block.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use util::{Bytes, U256, H256}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::Bytes; use header::BlockNumber; /// Best block info. diff --git a/ethcore/src/blockchain/block_info.rs b/ethcore/src/blockchain/block_info.rs index e9e02de60..d1e643792 100644 --- a/ethcore/src/blockchain/block_info.rs +++ b/ethcore/src/blockchain/block_info.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use util::{U256,H256}; +use bigint::prelude::U256; +use bigint::hash::H256; use header::BlockNumber; /// Brief info about inserted block. diff --git a/ethcore/src/blockchain/blockchain.rs b/ethcore/src/blockchain/blockchain.rs index 022c93b8f..a3ed9e359 100644 --- a/ethcore/src/blockchain/blockchain.rs +++ b/ethcore/src/blockchain/blockchain.rs @@ -22,6 +22,8 @@ use std::mem; use itertools::Itertools; use bloomchain as bc; use heapsize::HeapSizeOf; +use bigint::prelude::U256; +use bigint::hash::{H256, H2048}; use util::*; use rlp::*; use header::*; @@ -622,7 +624,7 @@ impl BlockChain { return None; } if let Some(extras) = self.db.read(db::COL_EXTRA, &best_block_hash) as Option { - type DetailsKey = Key; + type DetailsKey = Key; batch.delete(db::COL_EXTRA, &(DetailsKey::key(&best_block_hash))); let hash = extras.parent; let range = extras.number as bc::Number .. extras.number as bc::Number; @@ -1468,7 +1470,7 @@ mod tests { use rustc_hex::FromHex; use hash::keccak; use util::kvdb::KeyValueDB; - use util::hash::*; + use bigint::hash::*; use receipt::Receipt; use blockchain::{BlockProvider, BlockChain, Config, ImportRoute}; use tests::helpers::*; diff --git a/ethcore/src/blockchain/extras.rs b/ethcore/src/blockchain/extras.rs index 69e623a1f..109038ef2 100644 --- a/ethcore/src/blockchain/extras.rs +++ b/ethcore/src/blockchain/extras.rs @@ -26,7 +26,8 @@ use header::BlockNumber; use receipt::Receipt; use heapsize::HeapSizeOf; -use util::{H256, H264, U256}; +use bigint::prelude::U256; +use bigint::hash::{H256, H264}; use util::kvdb::PREFIX_LEN as DB_PREFIX_LEN; /// Represents index of extra data in database diff --git a/ethcore/src/blockchain/generator/block.rs b/ethcore/src/blockchain/generator/block.rs index 05fd15031..d5243dc66 100644 --- a/ethcore/src/blockchain/generator/block.rs +++ b/ethcore/src/blockchain/generator/block.rs @@ -15,7 +15,7 @@ // along with Parity. If not, see . use rlp::*; -use util::{H256, H2048}; +use bigint::hash::{H256, H2048}; use util::bytes::Bytes; use header::Header; use transaction::SignedTransaction; diff --git a/ethcore/src/blockchain/generator/bloom.rs b/ethcore/src/blockchain/generator/bloom.rs index 5f39a49b8..bb83ff1af 100644 --- a/ethcore/src/blockchain/generator/bloom.rs +++ b/ethcore/src/blockchain/generator/bloom.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use util::hash::H2048; +use bigint::hash::H2048; pub trait WithBloom { fn with_bloom(self, bloom: H2048) -> Self where Self: Sized; diff --git a/ethcore/src/blockchain/generator/complete.rs b/ethcore/src/blockchain/generator/complete.rs index 4cdda3f47..be5695d36 100644 --- a/ethcore/src/blockchain/generator/complete.rs +++ b/ethcore/src/blockchain/generator/complete.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use util::hash::H256; +use bigint::hash::H256; use util::bytes::Bytes; use views::BlockView; diff --git a/ethcore/src/blockchain/generator/generator.rs b/ethcore/src/blockchain/generator/generator.rs index be9378268..a32e37942 100644 --- a/ethcore/src/blockchain/generator/generator.rs +++ b/ethcore/src/blockchain/generator/generator.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use util::{U256, H2048, Bytes}; +use bigint::prelude::U256; +use bigint::hash::H2048; +use util::Bytes; use header::BlockNumber; use transaction::SignedTransaction; use super::fork::Fork; @@ -110,7 +112,7 @@ impl Iterator for ChainGenerator { } mod tests { - use util::hash::{H256, H2048}; + use bigint::hash::{H256, H2048}; use views::BlockView; use blockchain::generator::{ChainIterator, ChainGenerator, BlockFinalizer}; diff --git a/ethcore/src/blockchain/import_route.rs b/ethcore/src/blockchain/import_route.rs index e86639e73..ebd1454b4 100644 --- a/ethcore/src/blockchain/import_route.rs +++ b/ethcore/src/blockchain/import_route.rs @@ -16,7 +16,7 @@ //! Import route. -use util::H256; +use bigint::hash::H256; use blockchain::block_info::{BlockInfo, BlockLocation}; /// Import route for newly inserted block. @@ -67,7 +67,8 @@ impl From for ImportRoute { #[cfg(test)] mod tests { - use util::{U256, H256}; + use bigint::prelude::U256; + use bigint::hash::H256; use blockchain::block_info::{BlockInfo, BlockLocation, BranchBecomingCanonChainData}; use blockchain::ImportRoute; diff --git a/ethcore/src/blockchain/update.rs b/ethcore/src/blockchain/update.rs index 914b8aa99..10a6fcd06 100644 --- a/ethcore/src/blockchain/update.rs +++ b/ethcore/src/blockchain/update.rs @@ -1,5 +1,5 @@ use std::collections::HashMap; -use util::H256; +use bigint::hash::H256; use header::BlockNumber; use blockchain::block_info::BlockInfo; use blooms::BloomGroup; diff --git a/ethcore/src/builtin.rs b/ethcore/src/builtin.rs index b6d7064eb..a98f81076 100644 --- a/ethcore/src/builtin.rs +++ b/ethcore/src/builtin.rs @@ -24,7 +24,9 @@ use crypto::digest::Digest; use num::{BigUint, Zero, One}; use hash::keccak; -use util::{U256, H256, BytesRef}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::BytesRef; use ethkey::{Signature, recover as ec_recover}; use ethjson; @@ -506,7 +508,8 @@ impl Impl for Bn128PairingImpl { mod tests { use super::{Builtin, Linear, ethereum_builtin, Pricer, Modexp}; use ethjson; - use util::{U256, BytesRef}; + use bigint::prelude::U256; + use util::BytesRef; use rustc_hex::FromHex; #[test] diff --git a/ethcore/src/client/chain_notify.rs b/ethcore/src/client/chain_notify.rs index 0a9bff8d7..977e7b435 100644 --- a/ethcore/src/client/chain_notify.rs +++ b/ethcore/src/client/chain_notify.rs @@ -15,7 +15,8 @@ // along with Parity. If not, see . use ipc::IpcConfig; -use util::{H256, Bytes}; +use bigint::hash::H256; +use util::Bytes; /// Represents what has to be handled by actor listening to chain events #[ipc] diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 9d5465593..dbaac2307 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -26,11 +26,13 @@ use itertools::Itertools; use hash::keccak; use util::{Bytes, PerfTimer, Mutex, RwLock, MutexGuard}; use util::{journaldb, DBValue, TrieFactory, Trie}; -use util::{U256, H256, Address, H2048}; +use util::Address; use util::trie::TrieSpec; use util::kvdb::*; // other +use bigint::prelude::U256; +use bigint::hash::{H256, H2048}; use basic_types::Seal; use block::*; use blockchain::{BlockChain, BlockProvider, TreeRoute, ImportRoute}; diff --git a/ethcore/src/client/evm_test_client.rs b/ethcore/src/client/evm_test_client.rs index a455a3724..e6f5e4675 100644 --- a/ethcore/src/client/evm_test_client.rs +++ b/ethcore/src/client/evm_test_client.rs @@ -18,7 +18,9 @@ use std::fmt; use std::sync::Arc; -use util::{self, U256, H256, journaldb, trie}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{self, journaldb, trie}; use util::kvdb::{self, KeyValueDB}; use {state, state_db, client, executive, trace, transaction, db, spec, pod_state}; use factory::Factories; @@ -166,7 +168,7 @@ impl<'a> EvmTestClient<'a> { author: *genesis.author(), timestamp: genesis.timestamp(), difficulty: *genesis.difficulty(), - last_hashes: Arc::new([util::H256::default(); 256].to_vec()), + last_hashes: Arc::new([H256::default(); 256].to_vec()), gas_used: 0.into(), gas_limit: *genesis.gas_limit(), }; diff --git a/ethcore/src/client/test_client.rs b/ethcore/src/client/test_client.rs index 256d7953d..635711fc7 100644 --- a/ethcore/src/client/test_client.rs +++ b/ethcore/src/client/test_client.rs @@ -23,6 +23,8 @@ use std::mem; use itertools::Itertools; use rustc_hex::FromHex; use hash::keccak; +use bigint::prelude::U256; +use bigint::hash::{H256, H2048}; use util::*; use rlp::*; use ethkey::{Generator, Random}; diff --git a/ethcore/src/client/trace.rs b/ethcore/src/client/trace.rs index 3ab01757e..dfe8e30b7 100644 --- a/ethcore/src/client/trace.rs +++ b/ethcore/src/client/trace.rs @@ -1,7 +1,7 @@ //! Bridge between Tracedb and Blockchain. -use util::{H256}; +use bigint::hash::H256; use header::BlockNumber; use trace::DatabaseExtras as TraceDatabaseExtras; use blockchain::{BlockChain, BlockProvider}; diff --git a/ethcore/src/client/traits.rs b/ethcore/src/client/traits.rs index d7b7bba44..09eefb22b 100644 --- a/ethcore/src/client/traits.rs +++ b/ethcore/src/client/traits.rs @@ -34,7 +34,9 @@ use trace::LocalizedTrace; use transaction::{LocalizedTransaction, PendingTransaction, SignedTransaction}; use verification::queue::QueueInfo as BlockQueueInfo; -use util::{U256, Address, H256, H2048, Bytes}; +use bigint::prelude::U256; +use bigint::hash::{H256, H2048}; +use util::{Address, Bytes}; use util::hashdb::DBValue; use types::ids::*; diff --git a/ethcore/src/encoded.rs b/ethcore/src/encoded.rs index e1601d965..1f7ee98b5 100644 --- a/ethcore/src/encoded.rs +++ b/ethcore/src/encoded.rs @@ -30,7 +30,9 @@ use views; use hash::keccak; use heapsize::HeapSizeOf; -use util::{Address, H256, H2048, U256}; +use bigint::prelude::U256; +use bigint::hash::{H256, H2048}; +use util::Address; use rlp::Rlp; /// Owning header view. diff --git a/ethcore/src/engines/authority_round/finality.rs b/ethcore/src/engines/authority_round/finality.rs index 4e1bdf6a3..72ff5af92 100644 --- a/ethcore/src/engines/authority_round/finality.rs +++ b/ethcore/src/engines/authority_round/finality.rs @@ -19,7 +19,8 @@ use std::collections::{VecDeque}; use std::collections::hash_map::{HashMap, Entry}; -use util::{Address, H256}; +use bigint::hash::H256; +use util::Address; use engines::validator_set::SimpleList; @@ -149,7 +150,8 @@ impl<'a> Iterator for Iter<'a> { #[cfg(test)] mod tests { - use util::{Address, H256}; + use bigint::hash::H256; + use util::Address; use super::RollingFinality; #[test] diff --git a/ethcore/src/engines/authority_round/mod.rs b/ethcore/src/engines/authority_round/mod.rs index 776aca320..23abb3a9f 100644 --- a/ethcore/src/engines/authority_round/mod.rs +++ b/ethcore/src/engines/authority_round/mod.rs @@ -42,6 +42,8 @@ use ethkey::{verify_address, Signature}; use io::{IoContext, IoHandler, TimerToken, IoService}; use itertools::{self, Itertools}; use rlp::{UntrustedRlp, encode}; +use bigint::prelude::{U256, U128}; +use bigint::hash::{H256, H520}; use util::*; mod finality; @@ -831,7 +833,8 @@ mod tests { use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering}; use hash::keccak; - use util::*; + use bigint::prelude::U256; + use bigint::hash::H520; use header::Header; use error::{Error, BlockError}; use rlp::encode; diff --git a/ethcore/src/engines/basic_authority.rs b/ethcore/src/engines/basic_authority.rs index c22e66dfd..3e5198e44 100644 --- a/ethcore/src/engines/basic_authority.rs +++ b/ethcore/src/engines/basic_authority.rs @@ -19,6 +19,8 @@ use std::sync::{Weak, Arc}; use std::collections::BTreeMap; use std::cmp; +use bigint::prelude::U256; +use bigint::hash::{H256, H520}; use util::*; use ethkey::{recover, public_to_address, Signature}; use account_provider::AccountProvider; @@ -253,7 +255,7 @@ impl Engine for BasicAuthority { mod tests { use std::sync::Arc; use hash::keccak; - use util::*; + use bigint::hash::H520; use block::*; use error::{BlockError, Error}; use tests::helpers::*; diff --git a/ethcore/src/engines/epoch.rs b/ethcore/src/engines/epoch.rs index 586059e83..fb0eaa267 100644 --- a/ethcore/src/engines/epoch.rs +++ b/ethcore/src/engines/epoch.rs @@ -16,7 +16,7 @@ //! Epoch verifiers and transitions. -use util::H256; +use bigint::hash::H256; use error::Error; use header::Header; diff --git a/ethcore/src/engines/instant_seal.rs b/ethcore/src/engines/instant_seal.rs index 976f815e0..8a2d369c1 100644 --- a/ethcore/src/engines/instant_seal.rs +++ b/ethcore/src/engines/instant_seal.rs @@ -64,6 +64,7 @@ impl Engine for InstantSeal { #[cfg(test)] mod tests { use std::sync::Arc; + use bigint::hash::H520; use util::*; use tests::helpers::*; use spec::Spec; diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index cb13c984a..e23a038df 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -54,6 +54,8 @@ use spec::CommonParams; use transaction::{UnverifiedTransaction, SignedTransaction}; use ethkey::Signature; +use bigint::prelude::U256; +use bigint::hash::H256; use util::*; /// Default EIP-210 contrat code. @@ -403,6 +405,8 @@ pub mod common { use state::Substate; use state::CleanupMode; + use bigint::prelude::U256; + use bigint::hash::H256; use util::*; use super::Engine; diff --git a/ethcore/src/engines/null_engine.rs b/ethcore/src/engines/null_engine.rs index a52342c59..a07952ee3 100644 --- a/ethcore/src/engines/null_engine.rs +++ b/ethcore/src/engines/null_engine.rs @@ -18,7 +18,7 @@ use std::collections::BTreeMap; use util::Address; use builtin::Builtin; use block::{ExecutedBlock, IsBlock}; -use util::U256; +use bigint::prelude::U256; use engines::Engine; use spec::CommonParams; use evm::Schedule; diff --git a/ethcore/src/engines/signer.rs b/ethcore/src/engines/signer.rs index 4069488ab..ae673cb84 100644 --- a/ethcore/src/engines/signer.rs +++ b/ethcore/src/engines/signer.rs @@ -17,7 +17,8 @@ //! A signer used by Engines which need to sign messages. use std::sync::Arc; -use util::{H256, Address}; +use bigint::hash::H256; +use util::Address; use ethkey::Signature; use account_provider::{self, AccountProvider}; diff --git a/ethcore/src/engines/tendermint/message.rs b/ethcore/src/engines/tendermint/message.rs index ae0050bbb..baaf94601 100644 --- a/ethcore/src/engines/tendermint/message.rs +++ b/ethcore/src/engines/tendermint/message.rs @@ -18,6 +18,7 @@ use std::cmp; use hash::keccak; +use bigint::hash::{H256, H520}; use util::*; use super::{Height, View, BlockHash, Step}; use error::Error; @@ -202,7 +203,6 @@ pub fn message_hash(vote_step: VoteStep, block_hash: H256) -> H256 { mod tests { use std::sync::Arc; use hash::keccak; - use util::*; use rlp::*; use account_provider::AccountProvider; use header::Header; diff --git a/ethcore/src/engines/tendermint/mod.rs b/ethcore/src/engines/tendermint/mod.rs index f6981c210..f1164dcb7 100644 --- a/ethcore/src/engines/tendermint/mod.rs +++ b/ethcore/src/engines/tendermint/mod.rs @@ -30,6 +30,8 @@ use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering}; use std::collections::{HashSet, BTreeMap, HashMap}; use hash::keccak; use std::cmp; +use bigint::prelude::{U128, U256}; +use bigint::hash::{H256, H520}; use util::*; use client::{Client, EngineClient}; use error::{Error, BlockError}; diff --git a/ethcore/src/engines/validator_set/contract.rs b/ethcore/src/engines/validator_set/contract.rs index ff16eb1d2..271249631 100644 --- a/ethcore/src/engines/validator_set/contract.rs +++ b/ethcore/src/engines/validator_set/contract.rs @@ -18,6 +18,7 @@ /// It can also report validators for misbehaviour with two levels: `reportMalicious` and `reportBenign`. use std::sync::Weak; +use bigint::hash::H256; use util::*; use futures::Future; @@ -129,6 +130,7 @@ mod tests { use std::sync::Arc; use rustc_hex::FromHex; use hash::keccak; + use bigint::hash::H520; use util::*; use rlp::encode; use spec::Spec; diff --git a/ethcore/src/engines/validator_set/mod.rs b/ethcore/src/engines/validator_set/mod.rs index 56cff365f..d60518c45 100644 --- a/ethcore/src/engines/validator_set/mod.rs +++ b/ethcore/src/engines/validator_set/mod.rs @@ -25,7 +25,8 @@ mod multi; use std::sync::Weak; use ids::BlockId; -use util::{Bytes, Address, H256}; +use bigint::hash::H256; +use util::{Bytes, Address}; use ethjson::spec::ValidatorSet as ValidatorSpec; use client::Client; use header::{Header, BlockNumber}; diff --git a/ethcore/src/engines/validator_set/multi.rs b/ethcore/src/engines/validator_set/multi.rs index 477a453b2..e427701bd 100644 --- a/ethcore/src/engines/validator_set/multi.rs +++ b/ethcore/src/engines/validator_set/multi.rs @@ -19,7 +19,8 @@ use std::collections::BTreeMap; use std::sync::Weak; use engines::{Call, Engine}; -use util::{Bytes, H256, Address, RwLock}; +use bigint::hash::H256; +use util::{Bytes, Address, RwLock}; use ids::BlockId; use header::{BlockNumber, Header}; use client::{Client, BlockChainClient}; diff --git a/ethcore/src/engines/validator_set/safe_contract.rs b/ethcore/src/engines/validator_set/safe_contract.rs index 6480a298e..da558174f 100644 --- a/ethcore/src/engines/validator_set/safe_contract.rs +++ b/ethcore/src/engines/validator_set/safe_contract.rs @@ -21,6 +21,8 @@ use futures::Future; use native_contracts::ValidatorSet as Provider; use hash::keccak; +use bigint::prelude::U256; +use bigint::hash::{H160, H256}; use util::*; use util::cache::MemoryLruCache; use rlp::{UntrustedRlp, RlpStream}; diff --git a/ethcore/src/engines/validator_set/simple_list.rs b/ethcore/src/engines/validator_set/simple_list.rs index 40cbe4e93..eeeb4cb80 100644 --- a/ethcore/src/engines/validator_set/simple_list.rs +++ b/ethcore/src/engines/validator_set/simple_list.rs @@ -17,7 +17,8 @@ /// Preconfigured validator list. use heapsize::HeapSizeOf; -use util::{H256, Address}; +use bigint::hash::H256; +use util::Address; use engines::{Call, Engine}; use header::{BlockNumber, Header}; diff --git a/ethcore/src/engines/validator_set/test.rs b/ethcore/src/engines/validator_set/test.rs index 92472d743..da89880ca 100644 --- a/ethcore/src/engines/validator_set/test.rs +++ b/ethcore/src/engines/validator_set/test.rs @@ -20,7 +20,8 @@ use std::str::FromStr; use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering}; use heapsize::HeapSizeOf; -use util::{Bytes, H256, Address}; +use bigint::hash::H256; +use util::{Bytes, Address}; use engines::{Call, Engine}; use header::{Header, BlockNumber}; diff --git a/ethcore/src/engines/vote_collector.rs b/ethcore/src/engines/vote_collector.rs index 387715a03..4a42b8adb 100644 --- a/ethcore/src/engines/vote_collector.rs +++ b/ethcore/src/engines/vote_collector.rs @@ -19,6 +19,7 @@ use std::fmt::Debug; use std::collections::{BTreeMap, HashSet, HashMap}; use std::hash::Hash; +use bigint::hash::{H256, H520}; use util::*; use rlp::{Encodable, RlpStream}; @@ -207,6 +208,7 @@ impl VoteCollector { #[cfg(test)] mod tests { use hash::keccak; + use bigint::hash::H160; use util::*; use rlp::*; use super::*; diff --git a/ethcore/src/error.rs b/ethcore/src/error.rs index 172323c0d..87d77feaa 100644 --- a/ethcore/src/error.rs +++ b/ethcore/src/error.rs @@ -17,6 +17,8 @@ //! General error types for use in ethcore. use std::fmt; +use bigint::prelude::U256; +use bigint::hash::H256; use util::*; use io::*; use header::BlockNumber; diff --git a/ethcore/src/ethereum/denominations.rs b/ethcore/src/ethereum/denominations.rs index 789c803b9..4364b0296 100644 --- a/ethcore/src/ethereum/denominations.rs +++ b/ethcore/src/ethereum/denominations.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use util::*; +use bigint::prelude::U256; #[inline] /// 1 Ether in Wei diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index abb77aefc..6682e07e4 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -20,6 +20,8 @@ use std::collections::{BTreeMap, HashMap}; use std::sync::Arc; use hash::{KECCAK_EMPTY_LIST_RLP}; use ethash::{quick_get_difficulty, slow_get_seedhash, EthashManager}; +use bigint::prelude::U256; +use bigint::hash::{H256, H64}; use util::*; use block::*; use builtin::Builtin; @@ -587,6 +589,8 @@ mod tests { use std::str::FromStr; use std::collections::BTreeMap; use std::sync::Arc; + use bigint::prelude::U256; + use bigint::hash::{H64, H256}; use util::*; use block::*; use tests::helpers::*; diff --git a/ethcore/src/ethereum/mod.rs b/ethcore/src/ethereum/mod.rs index 0b2b1ec3e..8cc9446a6 100644 --- a/ethcore/src/ethereum/mod.rs +++ b/ethcore/src/ethereum/mod.rs @@ -92,7 +92,7 @@ pub fn new_metropolis_test() -> Spec { load(None, include_bytes!("../../res/ethe #[cfg(test)] mod tests { - use util::*; + use bigint::prelude::U256; use state::*; use super::*; use tests::helpers::*; diff --git a/ethcore/src/executed.rs b/ethcore/src/executed.rs index 3154903ca..909e1b6cb 100644 --- a/ethcore/src/executed.rs +++ b/ethcore/src/executed.rs @@ -16,7 +16,8 @@ //! Transaction execution format module. -use util::{Bytes, U256, Address, U512, trie}; +use bigint::prelude::{U256, U512}; +use util::{Bytes, Address, trie}; use vm; use trace::{VMTrace, FlatTrace}; use log_entry::LogEntry; diff --git a/ethcore/src/executive.rs b/ethcore/src/executive.rs index 7ac35945b..4da8568c2 100644 --- a/ethcore/src/executive.rs +++ b/ethcore/src/executive.rs @@ -18,6 +18,8 @@ use std::cmp; use std::sync::Arc; use hash::keccak; +use bigint::prelude::{U256, U512}; +use bigint::hash::H256; use util::*; use state::{Backend as StateBackend, State, Substate, CleanupMode}; use engines::Engine; @@ -659,7 +661,9 @@ mod tests { use rustc_hex::FromHex; use ethkey::{Generator, Random}; use super::*; - use util::{H256, U256, U512, Address}; + use bigint::prelude::{U256, U512}; + use bigint::hash::H256; + use util::Address; use util::bytes::BytesRef; use vm::{ActionParams, ActionValue, CallType, EnvInfo, CreateContractAddress}; use evm::{Factory, VMType}; diff --git a/ethcore/src/externalities.rs b/ethcore/src/externalities.rs index eae981f1b..5054d4c08 100644 --- a/ethcore/src/externalities.rs +++ b/ethcore/src/externalities.rs @@ -17,6 +17,8 @@ //! Transaction Execution environment. use std::cmp; use std::sync::Arc; +use bigint::prelude::U256; +use bigint::hash::H256; use util::*; use state::{Backend as StateBackend, State, Substate, CleanupMode}; use engines::Engine; diff --git a/ethcore/src/header.rs b/ethcore/src/header.rs index 0a804a6af..aa94db036 100644 --- a/ethcore/src/header.rs +++ b/ethcore/src/header.rs @@ -20,6 +20,8 @@ use std::cmp; use std::cell::RefCell; use hash::{KECCAK_NULL_RLP, KECCAK_EMPTY_LIST_RLP, keccak}; use heapsize::HeapSizeOf; +use bigint::prelude::U256; +use bigint::hash::H256; use util::*; use basic_types::{LogBloom, ZERO_LOGBLOOM}; use time::get_time; diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index daab42acf..16af4163e 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -85,6 +85,7 @@ extern crate ethcore_bloom_journal as bloom_journal; extern crate ethcore_devtools as devtools; extern crate ethcore_io as io; extern crate ethcore_ipc_nano as nanoipc; +extern crate ethcore_bigint as bigint; extern crate ethcore_logger; extern crate ethcore_stratum; extern crate ethjson; diff --git a/ethcore/src/migrations/state/v7.rs b/ethcore/src/migrations/state/v7.rs index 5a5a92764..64fa5b272 100644 --- a/ethcore/src/migrations/state/v7.rs +++ b/ethcore/src/migrations/state/v7.rs @@ -19,8 +19,8 @@ use std::collections::HashMap; -use util::Bytes; -use util::{Address, H256}; +use bigint::hash::H256; +use util::{Address, Bytes}; use util::kvdb::Database; use util::migration::{Batch, Config, Error, Migration, SimpleMigration, Progress}; use hash::keccak; diff --git a/ethcore/src/migrations/v10.rs b/ethcore/src/migrations/v10.rs index 7982279cf..dd6968bbb 100644 --- a/ethcore/src/migrations/v10.rs +++ b/ethcore/src/migrations/v10.rs @@ -24,7 +24,8 @@ use views::HeaderView; use bloom_journal::Bloom; use util::migration::{Error, Migration, Progress, Batch, Config}; use util::journaldb; -use util::{H256, Trie}; +use bigint::hash::H256; +use util::Trie; use util::{Database, DBTransaction}; /// Account bloom upgrade routine. If bloom already present, does nothing. diff --git a/ethcore/src/miner/banning_queue.rs b/ethcore/src/miner/banning_queue.rs index 82de8a747..a446da29e 100644 --- a/ethcore/src/miner/banning_queue.rs +++ b/ethcore/src/miner/banning_queue.rs @@ -24,7 +24,9 @@ use transient_hashmap::TransientHashMap; use miner::{TransactionQueue, TransactionQueueDetailsProvider, TransactionImportResult, TransactionOrigin}; use miner::transaction_queue::QueuingInstant; use error::{Error, TransactionError}; -use util::{U256, H256, Address}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::Address; use hash::keccak; type Count = u16; @@ -218,7 +220,8 @@ mod tests { use error::{Error, TransactionError}; use client::TransactionImportResult; use miner::{TransactionQueue, TransactionOrigin}; - use util::{U256, Address}; + use bigint::prelude::U256; + use util::Address; use miner::transaction_queue::test::DummyTransactionDetailsProvider; fn queue() -> BanningTransactionQueue { diff --git a/ethcore/src/miner/external.rs b/ethcore/src/miner/external.rs index 65f8ee8cc..21f16476a 100644 --- a/ethcore/src/miner/external.rs +++ b/ethcore/src/miner/external.rs @@ -17,7 +17,9 @@ use std::collections::HashMap; use std::sync::Arc; use std::time::{Instant, Duration}; -use util::{Mutex, U256, H256}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::Mutex; /// External miner interface. pub trait ExternalMinerService: Send + Sync { @@ -70,7 +72,8 @@ mod tests { use super::*; use std::thread::sleep; use std::time::Duration; - use util::{H256, U256}; + use bigint::prelude::U256; + use bigint::hash::H256; fn miner() -> ExternalMiner { ExternalMiner::default() diff --git a/ethcore/src/miner/local_transactions.rs b/ethcore/src/miner/local_transactions.rs index 59137c3f4..12e14294a 100644 --- a/ethcore/src/miner/local_transactions.rs +++ b/ethcore/src/miner/local_transactions.rs @@ -19,7 +19,8 @@ use linked_hash_map::LinkedHashMap; use transaction::{SignedTransaction, PendingTransaction}; use error::TransactionError; -use util::{U256, H256}; +use bigint::prelude::U256; +use bigint::hash::H256; /// Status of local transaction. /// Can indicate that the transaction is currently part of the queue (`Pending/Future`) @@ -152,7 +153,7 @@ impl LocalTransactionsList { #[cfg(test)] mod tests { - use util::U256; + use bigint::prelude::U256; use ethkey::{Random, Generator}; use transaction::{Action, Transaction, SignedTransaction}; use super::{LocalTransactionsList, Status}; diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index 2fa4a76e2..e178ccb11 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -18,6 +18,8 @@ use std::time::{Instant, Duration}; use std::collections::{BTreeMap, HashSet}; use std::sync::Arc; +use bigint::prelude::U256; +use bigint::hash::H256; use util::*; use using_queue::{UsingQueue, GetAction}; use account_provider::{AccountProvider, SignError as AccountError}; @@ -1239,7 +1241,7 @@ mod tests { use super::super::{MinerService, PrioritizationStrategy}; use super::*; use block::IsBlock; - use util::U256; + use bigint::prelude::U256; use ethkey::{Generator, Random}; use client::{BlockChainClient, TestBlockChainClient, EachBlockWith, TransactionImportResult}; use header::BlockNumber; diff --git a/ethcore/src/miner/mod.rs b/ethcore/src/miner/mod.rs index b4cb065fd..b9bf7859e 100644 --- a/ethcore/src/miner/mod.rs +++ b/ethcore/src/miner/mod.rs @@ -61,7 +61,9 @@ pub use self::work_notify::NotifyWork; pub use self::stratum::{Stratum, Error as StratumError, Options as StratumOptions}; use std::collections::BTreeMap; -use util::{H256, U256, Address, Bytes}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{Address, Bytes}; use client::{MiningBlockChainClient}; use block::ClosedBlock; use header::BlockNumber; diff --git a/ethcore/src/miner/service_transaction_checker.rs b/ethcore/src/miner/service_transaction_checker.rs index d21643772..e7013b008 100644 --- a/ethcore/src/miner/service_transaction_checker.rs +++ b/ethcore/src/miner/service_transaction_checker.rs @@ -20,7 +20,8 @@ use types::ids::BlockId; use futures::{future, Future}; use native_contracts::ServiceTransactionChecker as Contract; -use util::{U256, Mutex}; +use bigint::prelude::U256; +use util::Mutex; const SERVICE_TRANSACTION_CONTRACT_REGISTRY_NAME: &'static str = "service_transaction_checker"; diff --git a/ethcore/src/miner/stratum.rs b/ethcore/src/miner/stratum.rs index 0031bb715..39aaa785e 100644 --- a/ethcore/src/miner/stratum.rs +++ b/ethcore/src/miner/stratum.rs @@ -25,7 +25,8 @@ use std::sync::{Arc, Weak}; use std::net::{SocketAddr, AddrParseError}; use std::fmt; -use util::{H256, U256, H64, clean_0x}; +use bigint::prelude::U256; +use bigint::hash::{H64, H256, clean_0x}; use ethereum::ethash::Ethash; use ethash::SeedHashCompute; use util::Mutex; diff --git a/ethcore/src/miner/transaction_queue.rs b/ethcore/src/miner/transaction_queue.rs index 5b29a1607..0234af068 100644 --- a/ethcore/src/miner/transaction_queue.rs +++ b/ethcore/src/miner/transaction_queue.rs @@ -25,11 +25,13 @@ //! //! ```rust //! extern crate ethcore_util as util; +//! extern crate ethcore_bigint as bigint; //! extern crate ethcore; //! extern crate ethkey; //! extern crate rustc_hex; //! -//! use util::{U256, Address}; +//! use bigint::prelude::U256; +//! use util::Address; //! use ethkey::{Random, Generator}; //! use ethcore::miner::{TransactionQueue, RemovalReason, TransactionQueueDetailsProvider, AccountDetails, TransactionOrigin}; //! use ethcore::transaction::*; @@ -106,7 +108,9 @@ use std::cmp; use std::collections::{HashSet, HashMap, BTreeSet, BTreeMap}; use linked_hash_map::LinkedHashMap; use heapsize::HeapSizeOf; -use util::{Address, H256, U256}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::Address; use table::Table; use transaction::*; use error::{Error, TransactionError}; diff --git a/ethcore/src/miner/work_notify.rs b/ethcore/src/miner/work_notify.rs index ff330d30c..dbe63cc26 100644 --- a/ethcore/src/miner/work_notify.rs +++ b/ethcore/src/miner/work_notify.rs @@ -24,6 +24,8 @@ use hyper::{Next}; use hyper::net::HttpStream; use ethash::SeedHashCompute; use hyper::Url; +use bigint::prelude::U256; +use bigint::hash::H256; use util::*; use ethereum::ethash::Ethash; diff --git a/ethcore/src/pod_account.rs b/ethcore/src/pod_account.rs index b8606008c..885abea39 100644 --- a/ethcore/src/pod_account.rs +++ b/ethcore/src/pod_account.rs @@ -18,6 +18,8 @@ use std::fmt; use std::collections::BTreeMap; use itertools::Itertools; use hash::{keccak}; +use bigint::prelude::U256; +use bigint::hash::H256; use util::*; use state::Account; use ethjson; diff --git a/ethcore/src/pod_state.rs b/ethcore/src/pod_state.rs index 5a0265dc1..974d3d94e 100644 --- a/ethcore/src/pod_state.rs +++ b/ethcore/src/pod_state.rs @@ -19,6 +19,7 @@ use std::fmt; use std::collections::BTreeMap; use itertools::Itertools; +use bigint::hash::H256; use util::*; use pod_account::{self, PodAccount}; use types::state_diff::StateDiff; diff --git a/ethcore/src/service.rs b/ethcore/src/service.rs index 5e65a4de8..fbdf92171 100644 --- a/ethcore/src/service.rs +++ b/ethcore/src/service.rs @@ -18,6 +18,7 @@ use std::sync::Arc; use std::path::Path; +use bigint::hash::H256; use util::*; use io::*; use spec::Spec; diff --git a/ethcore/src/snapshot/account.rs b/ethcore/src/snapshot/account.rs index 2df29989b..47598c86e 100644 --- a/ethcore/src/snapshot/account.rs +++ b/ethcore/src/snapshot/account.rs @@ -21,7 +21,9 @@ use basic_account::BasicAccount; use snapshot::Error; use hash::{KECCAK_EMPTY, KECCAK_NULL_RLP}; -use util::{U256, H256, Bytes, HashDB}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{Bytes, HashDB}; use util::trie::{TrieDB, Trie}; use rlp::{RlpStream, UntrustedRlp}; @@ -212,7 +214,8 @@ mod tests { use snapshot::tests::helpers::fill_storage; use hash::{KECCAK_EMPTY, KECCAK_NULL_RLP, keccak}; - use util::{Address, H256, HashDB, DBValue}; + use bigint::hash::H256; + use util::{Address, HashDB, DBValue}; use rlp::UntrustedRlp; use std::collections::HashSet; diff --git a/ethcore/src/snapshot/block.rs b/ethcore/src/snapshot/block.rs index fa4b3c19f..4615ebf15 100644 --- a/ethcore/src/snapshot/block.rs +++ b/ethcore/src/snapshot/block.rs @@ -22,7 +22,8 @@ use hash::keccak; use views::BlockView; use rlp::{DecoderError, RlpStream, UntrustedRlp}; -use util::{Bytes, H256}; +use bigint::hash::H256; +use util::Bytes; use util::triehash::ordered_trie_root; const HEADER_FIELDS: usize = 8; @@ -137,7 +138,9 @@ mod tests { use super::AbridgedBlock; use transaction::{Action, Transaction}; - use util::{Address, H256, U256, Bytes}; + use bigint::prelude::U256; + use bigint::hash::H256; + use util::{Address, Bytes}; fn encode_block(b: &Block) -> Bytes { b.rlp_bytes(::basic_types::Seal::With) diff --git a/ethcore/src/snapshot/consensus/authority.rs b/ethcore/src/snapshot/consensus/authority.rs index 1a1215522..28222bfb5 100644 --- a/ethcore/src/snapshot/consensus/authority.rs +++ b/ethcore/src/snapshot/consensus/authority.rs @@ -33,7 +33,8 @@ use snapshot::{Error, ManifestData}; use itertools::{Position, Itertools}; use rlp::{RlpStream, UntrustedRlp}; -use util::{Bytes, H256, KeyValueDB}; +use bigint::hash::H256; +use util::{Bytes, KeyValueDB}; /// Snapshot creation and restoration for PoA chains. /// Chunk format: @@ -332,7 +333,7 @@ impl Rebuilder for ChunkRebuilder { } } - let parent_td: ::util::U256 = last_rlp.val_at(4)?; + let parent_td: ::bigint::prelude::U256 = last_rlp.val_at(4)?; let mut batch = self.db.transaction(); self.chain.insert_unordered_block(&mut batch, &block_data, receipts, Some(parent_td), true, false); diff --git a/ethcore/src/snapshot/consensus/mod.rs b/ethcore/src/snapshot/consensus/mod.rs index 3f583893b..b24c67be2 100644 --- a/ethcore/src/snapshot/consensus/mod.rs +++ b/ethcore/src/snapshot/consensus/mod.rs @@ -24,7 +24,7 @@ use blockchain::BlockChain; use engines::Engine; use snapshot::{Error, ManifestData}; -use util::H256; +use bigint::hash::H256; use util::kvdb::KeyValueDB; mod authority; diff --git a/ethcore/src/snapshot/consensus/work.rs b/ethcore/src/snapshot/consensus/work.rs index 2bf154fc4..95aec8e5b 100644 --- a/ethcore/src/snapshot/consensus/work.rs +++ b/ethcore/src/snapshot/consensus/work.rs @@ -30,7 +30,8 @@ use blockchain::{BlockChain, BlockProvider}; use engines::Engine; use snapshot::{Error, ManifestData}; use snapshot::block::AbridgedBlock; -use util::{Bytes, H256, KeyValueDB}; +use bigint::hash::H256; +use util::{Bytes, KeyValueDB}; use rlp::{RlpStream, UntrustedRlp}; use rand::OsRng; @@ -221,7 +222,7 @@ impl Rebuilder for PowRebuilder { use basic_types::Seal::With; use views::BlockView; use snapshot::verify_old_block; - use util::U256; + use bigint::prelude::U256; use util::triehash::ordered_trie_root; let rlp = UntrustedRlp::new(chunk); diff --git a/ethcore/src/snapshot/error.rs b/ethcore/src/snapshot/error.rs index 56be84c96..b7a310c0d 100644 --- a/ethcore/src/snapshot/error.rs +++ b/ethcore/src/snapshot/error.rs @@ -20,7 +20,7 @@ use std::fmt; use ids::BlockId; -use util::H256; +use bigint::hash::H256; use util::trie::TrieError; use rlp::DecoderError; diff --git a/ethcore/src/snapshot/io.rs b/ethcore/src/snapshot/io.rs index fc3962e73..dabb86283 100644 --- a/ethcore/src/snapshot/io.rs +++ b/ethcore/src/snapshot/io.rs @@ -26,7 +26,7 @@ use std::fs::{self, File}; use std::path::{Path, PathBuf}; use util::Bytes; -use util::hash::H256; +use bigint::hash::H256; use rlp::{RlpStream, UntrustedRlp}; use super::ManifestData; diff --git a/ethcore/src/snapshot/mod.rs b/ethcore/src/snapshot/mod.rs index 974b074cf..db9510b0c 100644 --- a/ethcore/src/snapshot/mod.rs +++ b/ethcore/src/snapshot/mod.rs @@ -30,9 +30,10 @@ use engines::Engine; use header::Header; use ids::BlockId; -use util::{Bytes, HashDB, DBValue, snappy, U256}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{Bytes, HashDB, DBValue, snappy}; use util::Mutex; -use util::hash::{H256}; use util::journaldb::{self, Algorithm, JournalDB}; use util::kvdb::KeyValueDB; use util::trie::{TrieDB, TrieDBMut, Trie, TrieMut}; diff --git a/ethcore/src/snapshot/service.rs b/ethcore/src/snapshot/service.rs index 47bbb5997..2ea2f851e 100644 --- a/ethcore/src/snapshot/service.rs +++ b/ethcore/src/snapshot/service.rs @@ -35,7 +35,8 @@ use service::ClientIoMessage; use io::IoChannel; -use util::{Bytes, H256, Mutex, RwLock, RwLockReadGuard, UtilError}; +use bigint::hash::H256; +use util::{Bytes, Mutex, RwLock, RwLockReadGuard, UtilError}; use util::journaldb::Algorithm; use util::kvdb::{Database, DatabaseConfig}; use util::snappy; @@ -678,7 +679,7 @@ mod tests { #[test] fn cannot_finish_with_invalid_chunks() { - use util::H256; + use bigint::hash::H256; use util::kvdb::DatabaseConfig; let spec = get_test_spec(); diff --git a/ethcore/src/snapshot/snapshot_service_trait.rs b/ethcore/src/snapshot/snapshot_service_trait.rs index 9df366250..9ef7706b4 100644 --- a/ethcore/src/snapshot/snapshot_service_trait.rs +++ b/ethcore/src/snapshot/snapshot_service_trait.rs @@ -15,7 +15,8 @@ // along with Parity. If not, see . use super::{ManifestData, RestorationStatus}; -use util::{Bytes, H256}; +use bigint::hash::H256; +use util::Bytes; use ipc::IpcConfig; /// The interface for a snapshot network service. diff --git a/ethcore/src/snapshot/tests/helpers.rs b/ethcore/src/snapshot/tests/helpers.rs index bfc9db92a..c93409c51 100644 --- a/ethcore/src/snapshot/tests/helpers.rs +++ b/ethcore/src/snapshot/tests/helpers.rs @@ -32,7 +32,7 @@ use devtools::{RandomTempPath, GuardedTempResult}; use rand::Rng; use util::{DBValue, KeyValueDB}; -use util::hash::H256; +use bigint::hash::H256; use util::hashdb::HashDB; use util::journaldb; use util::trie::{Alphabet, StandardMap, SecTrieDBMut, TrieMut, ValueMode}; diff --git a/ethcore/src/snapshot/tests/proof_of_work.rs b/ethcore/src/snapshot/tests/proof_of_work.rs index 907fcead8..623ea378f 100644 --- a/ethcore/src/snapshot/tests/proof_of_work.rs +++ b/ethcore/src/snapshot/tests/proof_of_work.rs @@ -108,7 +108,7 @@ fn chunk_and_restore_40k() { chunk_and_restore(40000) } #[test] fn checks_flag() { use rlp::RlpStream; - use util::H256; + use bigint::hash::H256; let mut stream = RlpStream::new_list(5); diff --git a/ethcore/src/snapshot/tests/state.rs b/ethcore/src/snapshot/tests/state.rs index 9a98af5ff..852344c4b 100644 --- a/ethcore/src/snapshot/tests/state.rs +++ b/ethcore/src/snapshot/tests/state.rs @@ -25,7 +25,7 @@ use super::helpers::{compare_dbs, StateProducer}; use error::Error; use rand::{XorShiftRng, SeedableRng}; -use util::hash::H256; +use bigint::hash::H256; use util::journaldb::{self, Algorithm}; use util::kvdb::{Database, DatabaseConfig}; use util::memorydb::MemoryDB; @@ -97,7 +97,9 @@ fn snap_and_restore() { fn get_code_from_prev_chunk() { use std::collections::HashSet; use rlp::RlpStream; - use util::{HashDB, H256, U256}; + use bigint::prelude::U256; + use bigint::hash::H256; + use util::HashDB; use account_db::{AccountDBMut, AccountDB}; diff --git a/ethcore/src/snapshot/watcher.rs b/ethcore/src/snapshot/watcher.rs index cff9be18c..b99ab5163 100644 --- a/ethcore/src/snapshot/watcher.rs +++ b/ethcore/src/snapshot/watcher.rs @@ -22,7 +22,8 @@ use ids::BlockId; use service::ClientIoMessage; use io::IoChannel; -use util::{H256, Bytes}; +use bigint::hash::H256; +use util::Bytes; use std::sync::Arc; @@ -133,7 +134,8 @@ mod tests { use client::ChainNotify; - use util::{H256, U256}; + use bigint::prelude::U256; + use bigint::hash::H256; use std::collections::HashMap; diff --git a/ethcore/src/spec/genesis.rs b/ethcore/src/spec/genesis.rs index 159320291..0e810f29c 100644 --- a/ethcore/src/spec/genesis.rs +++ b/ethcore/src/spec/genesis.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use util::{Address, H256, U256}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::Address; use hash::KECCAK_NULL_RLP; use ethjson; use super::seal::Seal; diff --git a/ethcore/src/spec/seal.rs b/ethcore/src/spec/seal.rs index a1e929604..7dac32983 100644 --- a/ethcore/src/spec/seal.rs +++ b/ethcore/src/spec/seal.rs @@ -17,7 +17,7 @@ //! Spec seal. use rlp::*; -use util::hash::{H64, H256, H520}; +use bigint::hash::{H64, H256, H520}; use ethjson; /// Classic ethereum seal. diff --git a/ethcore/src/spec/spec.rs b/ethcore/src/spec/spec.rs index e93703871..f69608432 100644 --- a/ethcore/src/spec/spec.rs +++ b/ethcore/src/spec/spec.rs @@ -40,6 +40,8 @@ use state_db::StateDB; use state::{Backend, State, Substate}; use state::backend::Basic as BasicBackend; use trace::{NoopTracer, NoopVMTracer}; +use bigint::prelude::U256; +use bigint::hash::{H256, H2048}; use util::*; /// Parameters common to ethereum-like blockchains. diff --git a/ethcore/src/state/account.rs b/ethcore/src/state/account.rs index e5d8b3814..b46b5ec4c 100644 --- a/ethcore/src/state/account.rs +++ b/ethcore/src/state/account.rs @@ -20,6 +20,8 @@ use std::fmt; use std::sync::Arc; use std::collections::HashMap; use hash::{KECCAK_EMPTY, KECCAK_NULL_RLP, keccak}; +use bigint::prelude::U256; +use bigint::hash::H256; use util::*; use pod_account::*; use rlp::*; diff --git a/ethcore/src/state/backend.rs b/ethcore/src/state/backend.rs index ea172b5af..503d852aa 100644 --- a/ethcore/src/state/backend.rs +++ b/ethcore/src/state/backend.rs @@ -25,7 +25,8 @@ use std::collections::{HashSet, HashMap}; use std::sync::Arc; use state::Account; -use util::{Address, MemoryDB, Mutex, H256}; +use bigint::hash::H256; +use util::{Address, MemoryDB, Mutex}; use util::hashdb::{AsHashDB, HashDB, DBValue}; /// State backend. See module docs for more details. diff --git a/ethcore/src/state/mod.rs b/ethcore/src/state/mod.rs index e7b0cb228..3bc20508a 100644 --- a/ethcore/src/state/mod.rs +++ b/ethcore/src/state/mod.rs @@ -42,6 +42,8 @@ use transaction::SignedTransaction; use state_db::StateDB; use evm::{Factory as EvmFactory}; +use bigint::prelude::U256; +use bigint::hash::H256; use util::*; use util::trie; @@ -1015,7 +1017,9 @@ mod tests { use hash::keccak; use super::*; use ethkey::Secret; - use util::{U256, H256, Address}; + use bigint::prelude::U256; + use bigint::hash::H256; + use util::Address; use tests::helpers::*; use vm::EnvInfo; use spec::*; diff --git a/ethcore/src/state/substate.rs b/ethcore/src/state/substate.rs index 76f6eaed7..4acc54114 100644 --- a/ethcore/src/state/substate.rs +++ b/ethcore/src/state/substate.rs @@ -16,7 +16,8 @@ //! Execution environment substate. use std::collections::HashSet; -use util::{Address, U256}; +use bigint::prelude::U256; +use util::Address; use log_entry::LogEntry; use evm::{Schedule, CleanDustMode}; use super::CleanupMode; diff --git a/ethcore/src/state_db.rs b/ethcore/src/state_db.rs index ce96dc4fc..02bdbad4c 100644 --- a/ethcore/src/state_db.rs +++ b/ethcore/src/state_db.rs @@ -20,7 +20,7 @@ use lru_cache::LruCache; use util::cache::MemoryLruCache; use util::journaldb::JournalDB; use util::kvdb::KeyValueDB; -use util::hash::{H256}; +use bigint::hash::H256; use util::hashdb::HashDB; use state::{self, Account}; use header::BlockNumber; @@ -457,7 +457,9 @@ impl state::Backend for StateDB { #[cfg(test)] mod tests { - use util::{U256, H256, Address, DBTransaction}; + use bigint::prelude::U256; + use bigint::hash::H256; + use util::{Address, DBTransaction}; use tests::helpers::*; use state::{Account, Backend}; use ethcore_logger::init_log; diff --git a/ethcore/src/tests/client.rs b/ethcore/src/tests/client.rs index 6176e53bb..25955679c 100644 --- a/ethcore/src/tests/client.rs +++ b/ethcore/src/tests/client.rs @@ -25,6 +25,7 @@ use ethereum; use block::IsBlock; use tests::helpers::*; use types::filter::Filter; +use bigint::prelude::U256; use util::*; use devtools::*; use miner::Miner; diff --git a/ethcore/src/tests/evm.rs b/ethcore/src/tests/evm.rs index 69351d587..8b51c3487 100644 --- a/ethcore/src/tests/evm.rs +++ b/ethcore/src/tests/evm.rs @@ -12,6 +12,7 @@ use transaction::SYSTEM_ADDRESS; use rustc_hex::FromHex; +use bigint::hash::H256; use util::*; evm_test!{test_blockhash_eip210: test_blockhash_eip210_jit, test_blockhash_eip210_int} diff --git a/ethcore/src/tests/helpers.rs b/ethcore/src/tests/helpers.rs index 3d4a4b336..ac5669da7 100644 --- a/ethcore/src/tests/helpers.rs +++ b/ethcore/src/tests/helpers.rs @@ -20,6 +20,8 @@ use hash::keccak; use ethkey::KeyPair; use io::*; use client::{BlockChainClient, Client, ClientConfig}; +use bigint::prelude::U256; +use bigint::hash::H256; use util::*; use spec::*; use account_provider::AccountProvider; diff --git a/ethcore/src/tests/trace.rs b/ethcore/src/tests/trace.rs index 0429054fb..ed434d8e8 100644 --- a/ethcore/src/tests/trace.rs +++ b/ethcore/src/tests/trace.rs @@ -19,6 +19,7 @@ use ethkey::KeyPair; use hash::keccak; use block::*; +use bigint::prelude::U256; use util::*; use io::*; use spec::*; diff --git a/ethcore/src/trace/db.rs b/ethcore/src/trace/db.rs index 0fe057a64..5427fc34a 100644 --- a/ethcore/src/trace/db.rs +++ b/ethcore/src/trace/db.rs @@ -21,7 +21,8 @@ use std::sync::Arc; use bloomchain::{Number, Config as BloomConfig}; use bloomchain::group::{BloomGroupDatabase, BloomGroupChain, GroupPosition, BloomGroup}; use heapsize::HeapSizeOf; -use util::{H256, H264, KeyValueDB, DBTransaction, RwLock}; +use bigint::hash::{H256, H264}; +use util::{KeyValueDB, DBTransaction, RwLock}; use header::BlockNumber; use trace::{LocalizedTrace, Config, Filter, Database as TraceDatabase, ImportRequest, DatabaseExtras}; use db::{self, Key, Writable, Readable, CacheUpdatePolicy}; @@ -411,7 +412,9 @@ impl TraceDatabase for TraceDB where T: DatabaseExtras { mod tests { use std::collections::HashMap; use std::sync::Arc; - use util::{Address, U256, H256, DBTransaction}; + use bigint::prelude::U256; + use bigint::hash::H256; + use util::{Address, DBTransaction}; use header::BlockNumber; use trace::{Config, TraceDB, Database as TraceDatabase, DatabaseExtras, ImportRequest}; use trace::{Filter, LocalizedTrace, AddressesFilter, TraceError}; diff --git a/ethcore/src/trace/executive_tracer.rs b/ethcore/src/trace/executive_tracer.rs index 57e8eabb8..fbc8eaee1 100644 --- a/ethcore/src/trace/executive_tracer.rs +++ b/ethcore/src/trace/executive_tracer.rs @@ -16,7 +16,8 @@ //! Simple executive tracer. -use util::{Bytes, Address, U256}; +use bigint::prelude::U256; +use util::{Bytes, Address}; use vm::ActionParams; use trace::trace::{Call, Create, Action, Res, CreateResult, CallResult, VMTrace, VMOperation, VMExecutedOperation, MemoryDiff, StorageDiff, Suicide, Reward, RewardType}; use trace::{Tracer, VMTracer, FlatTrace, TraceError}; @@ -158,7 +159,7 @@ impl Tracer for ExecutiveTracer { debug!(target: "trace", "Traced suicide {:?}", trace); self.traces.push(trace); } - + fn trace_reward(&mut self, author: Address, value: U256, reward_type: RewardType) { let trace = FlatTrace { subtraces: 0, diff --git a/ethcore/src/trace/import.rs b/ethcore/src/trace/import.rs index 4bcc376f9..e74e03eea 100644 --- a/ethcore/src/trace/import.rs +++ b/ethcore/src/trace/import.rs @@ -15,7 +15,7 @@ // along with Parity. If not, see . //! Traces import request. -use util::H256; +use bigint::hash::H256; use header::BlockNumber; use trace::FlatBlockTraces; diff --git a/ethcore/src/trace/mod.rs b/ethcore/src/trace/mod.rs index cbec8a149..06f1afb0b 100644 --- a/ethcore/src/trace/mod.rs +++ b/ethcore/src/trace/mod.rs @@ -37,7 +37,9 @@ pub use self::types::trace::{VMTrace, VMOperation, VMExecutedOperation, MemoryDi pub use self::types::flat::{FlatTrace, FlatTransactionTraces, FlatBlockTraces}; pub use self::types::filter::{Filter, AddressesFilter}; -use util::{Bytes, Address, U256, H256, DBTransaction}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{Bytes, Address, DBTransaction}; use self::trace::{Call, Create}; use vm::ActionParams; use header::BlockNumber; diff --git a/ethcore/src/trace/noop_tracer.rs b/ethcore/src/trace/noop_tracer.rs index c9bd5f2e8..c39c805fb 100644 --- a/ethcore/src/trace/noop_tracer.rs +++ b/ethcore/src/trace/noop_tracer.rs @@ -16,7 +16,8 @@ //! Nonoperative tracer. -use util::{Bytes, Address, U256}; +use bigint::prelude::U256; +use util::{Bytes, Address}; use vm::ActionParams; use trace::{Tracer, VMTracer, FlatTrace, TraceError}; use trace::trace::{Call, Create, VMTrace, RewardType}; diff --git a/ethcore/src/trace/types/localized.rs b/ethcore/src/trace/types/localized.rs index 2d4850a8a..f82d710c1 100644 --- a/ethcore/src/trace/types/localized.rs +++ b/ethcore/src/trace/types/localized.rs @@ -16,7 +16,7 @@ //! Localized traces type definitions -use util::H256; +use bigint::hash::H256; use super::trace::{Action, Res}; use header::BlockNumber; diff --git a/ethcore/src/trace/types/trace.rs b/ethcore/src/trace/types/trace.rs index 6a4345adb..a4efcee0e 100644 --- a/ethcore/src/trace/types/trace.rs +++ b/ethcore/src/trace/types/trace.rs @@ -16,7 +16,8 @@ //! Tracing datatypes. -use util::{U256, Bytes, Address}; +use bigint::prelude::U256; +use util::{Bytes, Address}; use hash::keccak; use bloomable::Bloomable; use rlp::*; diff --git a/ethcore/src/transaction.rs b/ethcore/src/transaction.rs index 6e3302f0a..5971a9bdb 100644 --- a/ethcore/src/transaction.rs +++ b/ethcore/src/transaction.rs @@ -20,7 +20,9 @@ use std::ops::Deref; use rlp::*; use hash::keccak; use heapsize::HeapSizeOf; -use util::{H256, Address, U256, Bytes}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{Address, Bytes}; use ethkey::{Signature, Secret, Public, recover, public_to_address, Error as EthkeyError}; use error::*; use evm::Schedule; @@ -28,10 +30,10 @@ use header::BlockNumber; use ethjson; /// Fake address for unsigned transactions as defined by EIP-86. -pub const UNSIGNED_SENDER: Address = ::util::H160([0xff; 20]); +pub const UNSIGNED_SENDER: Address = ::bigint::hash::H160([0xff; 20]); /// System sender address for internal state updates. -pub const SYSTEM_ADDRESS: Address = ::util::H160([0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xff, 0xfe]); +pub const SYSTEM_ADDRESS: Address = ::bigint::hash::H160([0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xff, 0xfe]); /// Transaction action type. #[derive(Debug, Clone, PartialEq, Eq)] @@ -545,7 +547,7 @@ impl From for PendingTransaction { #[cfg(test)] mod tests { use super::*; - use util::{U256}; + use bigint::prelude::U256; use hash::keccak; #[test] diff --git a/ethcore/src/verification/queue/kind.rs b/ethcore/src/verification/queue/kind.rs index 4b547c1b7..686311579 100644 --- a/ethcore/src/verification/queue/kind.rs +++ b/ethcore/src/verification/queue/kind.rs @@ -20,7 +20,8 @@ use engines::Engine; use error::Error; use heapsize::HeapSizeOf; -use util::{H256, U256}; +use bigint::prelude::U256; +use bigint::hash::H256; pub use self::blocks::Blocks; pub use self::headers::Headers; @@ -74,7 +75,9 @@ pub mod blocks { use verification::{PreverifiedBlock, verify_block_basic, verify_block_unordered}; use heapsize::HeapSizeOf; - use util::{Bytes, H256, U256}; + use bigint::prelude::U256; + use bigint::hash::H256; + use util::Bytes; /// A mode for verifying blocks. pub struct Blocks; @@ -169,8 +172,8 @@ pub mod headers { use header::Header; use verification::verify_header_params; - use util::hash::H256; - use util::U256; + use bigint::prelude::U256; + use bigint::hash::H256; impl BlockLike for Header { fn hash(&self) -> H256 { self.hash() } diff --git a/ethcore/src/verification/queue/mod.rs b/ethcore/src/verification/queue/mod.rs index 8fc4a5919..b6ba386d4 100644 --- a/ethcore/src/verification/queue/mod.rs +++ b/ethcore/src/verification/queue/mod.rs @@ -23,6 +23,8 @@ use std::sync::{Condvar as SCondvar, Mutex as SMutex, Arc}; use std::cmp; use std::collections::{VecDeque, HashSet, HashMap}; use heapsize::HeapSizeOf; +use bigint::prelude::U256; +use bigint::hash::H256; use util::*; use io::*; use error::*; diff --git a/ethcore/src/verification/verification.rs b/ethcore/src/verification/verification.rs index f9290309c..18c400c86 100644 --- a/ethcore/src/verification/verification.rs +++ b/ethcore/src/verification/verification.rs @@ -24,6 +24,7 @@ use std::collections::HashSet; use hash::keccak; use heapsize::HeapSizeOf; +use bigint::hash::H256; use util::*; use engines::Engine; use error::{BlockError, Error}; @@ -269,6 +270,8 @@ fn verify_block_integrity(block: &[u8], transactions_root: &H256, uncles_hash: & mod tests { use std::collections::{BTreeMap, HashMap}; use hash::keccak; + use bigint::prelude::U256; + use bigint::hash::{H256, H2048}; use util::*; use ethkey::{Random, Generator}; use header::*; diff --git a/ethcore/src/views/block.rs b/ethcore/src/views/block.rs index 723a9f1b8..27906c6c5 100644 --- a/ethcore/src/views/block.rs +++ b/ethcore/src/views/block.rs @@ -17,6 +17,7 @@ //! View onto block rlp. use hash::keccak; +use bigint::hash::H256; use util::*; use header::*; use transaction::*; @@ -159,7 +160,7 @@ impl<'a> BlockView<'a> { mod tests { use std::str::FromStr; use rustc_hex::FromHex; - use util::H256; + use bigint::hash::H256; use super::BlockView; #[test] diff --git a/ethcore/src/views/body.rs b/ethcore/src/views/body.rs index d7509af82..c9f78fc1c 100644 --- a/ethcore/src/views/body.rs +++ b/ethcore/src/views/body.rs @@ -17,6 +17,7 @@ //! View onto block body rlp. use hash::keccak; +use bigint::hash::H256; use util::*; use header::*; use transaction::*; diff --git a/ethcore/src/views/header.rs b/ethcore/src/views/header.rs index 977aaa9a2..c3c446e19 100644 --- a/ethcore/src/views/header.rs +++ b/ethcore/src/views/header.rs @@ -17,7 +17,9 @@ //! View onto block header rlp use hash::keccak; -use util::{U256, Bytes, H256, Address, H2048}; +use bigint::prelude::U256; +use bigint::hash::{H256, H2048}; +use util::{Bytes, Address}; use rlp::Rlp; use header::BlockNumber; @@ -102,7 +104,9 @@ impl<'a> HeaderView<'a> { mod tests { use std::str::FromStr; use rustc_hex::FromHex; - use util::{H256, Address, H2048, U256}; + use bigint::prelude::U256; + use bigint::hash::{H256, H2048}; + use util::Address; use super::HeaderView; #[test] diff --git a/ethcore/src/views/transaction.rs b/ethcore/src/views/transaction.rs index e19dfd952..25a6fde3a 100644 --- a/ethcore/src/views/transaction.rs +++ b/ethcore/src/views/transaction.rs @@ -15,7 +15,9 @@ // along with Parity. If not, see . //! View onto transaction rlp -use util::{U256, Bytes, H256}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::Bytes; use hash::keccak; use rlp::Rlp; @@ -78,7 +80,7 @@ impl<'a> TransactionView<'a> { mod tests { use std::str::FromStr; use rustc_hex::FromHex; - use util::U256; + use bigint::prelude::U256; use super::TransactionView; #[test] diff --git a/ethcore/types/Cargo.toml b/ethcore/types/Cargo.toml index 458d4d54e..8e156f416 100644 --- a/ethcore/types/Cargo.toml +++ b/ethcore/types/Cargo.toml @@ -8,6 +8,7 @@ authors = ["Parity Technologies "] rlp = { path = "../../util/rlp" } rlp_derive = { path = "../../util/rlp_derive" } ethcore-util = { path = "../../util" } +ethcore-bigint = { path = "../../util/bigint" } ethjson = { path = "../../json" } bloomable = { path = "../../util/bloomable" } hash = { path = "../../util/hash" } diff --git a/ethcore/types/src/account_diff.rs b/ethcore/types/src/account_diff.rs index 337c5df1b..b862fb220 100644 --- a/ethcore/types/src/account_diff.rs +++ b/ethcore/types/src/account_diff.rs @@ -19,7 +19,9 @@ use std::cmp::*; use std::fmt; use std::collections::BTreeMap; -use util::{U256, H256, Bytes}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::Bytes; #[derive(Debug, PartialEq, Eq, Clone)] /// Diff type for specifying a change (or not). diff --git a/ethcore/types/src/basic_account.rs b/ethcore/types/src/basic_account.rs index f30872f6b..0e9040fc3 100644 --- a/ethcore/types/src/basic_account.rs +++ b/ethcore/types/src/basic_account.rs @@ -16,7 +16,8 @@ //! Basic account type -- the decoded RLP from the state trie. -use util::{U256, H256}; +use bigint::prelude::U256; +use bigint::prelude::H256; /// Basic account type. #[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] diff --git a/ethcore/types/src/blockchain_info.rs b/ethcore/types/src/blockchain_info.rs index 4ab1432b7..87c581508 100644 --- a/ethcore/types/src/blockchain_info.rs +++ b/ethcore/types/src/blockchain_info.rs @@ -18,7 +18,8 @@ use std::fmt; -use util::{U256, H256}; +use bigint::prelude::U256; +use bigint::hash::H256; use security_level::SecurityLevel; use {BlockNumber}; diff --git a/ethcore/types/src/filter.rs b/ethcore/types/src/filter.rs index 92fc31edd..807ea92cd 100644 --- a/ethcore/types/src/filter.rs +++ b/ethcore/types/src/filter.rs @@ -16,7 +16,8 @@ //! Blockchain filter -use util::{Address, H256, H2048}; +use util::Address; +use bigint::hash::{H256, H2048}; use bloomable::Bloomable; use ids::BlockId; use log_entry::LogEntry; diff --git a/ethcore/types/src/ids.rs b/ethcore/types/src/ids.rs index feda18307..150bb77b1 100644 --- a/ethcore/types/src/ids.rs +++ b/ethcore/types/src/ids.rs @@ -16,7 +16,7 @@ //! Unique identifiers. -use util::hash::H256; +use bigint::hash::H256; use {BlockNumber}; /// Uniquely identifies block. diff --git a/ethcore/types/src/lib.rs b/ethcore/types/src/lib.rs index 62ff153a0..a3af37a69 100644 --- a/ethcore/types/src/lib.rs +++ b/ethcore/types/src/lib.rs @@ -17,6 +17,7 @@ //! Types used in the public API extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; extern crate ethjson; extern crate rlp; #[macro_use] diff --git a/ethcore/types/src/log_entry.rs b/ethcore/types/src/log_entry.rs index f2f01c2dc..1878c66b9 100644 --- a/ethcore/types/src/log_entry.rs +++ b/ethcore/types/src/log_entry.rs @@ -19,13 +19,14 @@ use std::ops::Deref; use hash::keccak; use heapsize::HeapSizeOf; -use util::{H256, Address, Bytes}; +use util::{Address, Bytes}; +use bigint::hash::H256; use bloomable::Bloomable; use {BlockNumber}; use ethjson; -pub type LogBloom = ::util::H2048; +pub type LogBloom = ::bigint::hash::H2048; /// A record of execution for a `LOG` operation. #[derive(Default, Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] @@ -95,7 +96,7 @@ mod tests { #[test] fn test_empty_log_bloom() { - let bloom = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".parse::().unwrap(); + let bloom = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".parse::<::bigint::hash::H2048>().unwrap(); let address = "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6".parse::
().unwrap(); let log = LogEntry { address: address, diff --git a/ethcore/types/src/receipt.rs b/ethcore/types/src/receipt.rs index 63a122179..759f67050 100644 --- a/ethcore/types/src/receipt.rs +++ b/ethcore/types/src/receipt.rs @@ -16,7 +16,9 @@ //! Receipt -use util::{H256, U256, Address}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::Address; use heapsize::HeapSizeOf; use rlp::*; diff --git a/ethcore/types/src/snapshot_manifest.rs b/ethcore/types/src/snapshot_manifest.rs index 2dcce2904..8b7503bef 100644 --- a/ethcore/types/src/snapshot_manifest.rs +++ b/ethcore/types/src/snapshot_manifest.rs @@ -16,7 +16,7 @@ //! Snapshot manifest type definition -use util::hash::H256; +use bigint::hash::H256; use rlp::*; use util::Bytes; diff --git a/ethcore/types/src/tree_route.rs b/ethcore/types/src/tree_route.rs index a47e94ee5..f21e089a5 100644 --- a/ethcore/types/src/tree_route.rs +++ b/ethcore/types/src/tree_route.rs @@ -16,7 +16,7 @@ //! Tree route info type definition -use util::H256; +use bigint::hash::H256; /// Represents a tree route between `from` block and `to` block: #[derive(Debug)] diff --git a/ethcore/vm/Cargo.toml b/ethcore/vm/Cargo.toml index 3f308d8f5..6e5c7d3f2 100644 --- a/ethcore/vm/Cargo.toml +++ b/ethcore/vm/Cargo.toml @@ -6,6 +6,7 @@ authors = ["Parity Technologies "] [dependencies] byteorder = "1.0" ethcore-util = { path = "../../util" } +ethcore-bigint = { path = "../../util/bigint" } log = "0.3" common-types = { path = "../types" } evmjit = { path = "../../evmjit", optional = true } diff --git a/ethcore/vm/src/action_params.rs b/ethcore/vm/src/action_params.rs index ab32e8d9f..89e5da801 100644 --- a/ethcore/vm/src/action_params.rs +++ b/ethcore/vm/src/action_params.rs @@ -15,8 +15,9 @@ // along with Parity. If not, see . //! Evm input params. -use util::{Address, Bytes, U256}; -use util::hash::{H256}; +use bigint::prelude::U256; +use bigint::hash::{H256}; +use util::{Address, Bytes}; use hash::{keccak, KECCAK_EMPTY}; use ethjson; diff --git a/ethcore/vm/src/env_info.rs b/ethcore/vm/src/env_info.rs index 12f035183..cb8ff2241 100644 --- a/ethcore/vm/src/env_info.rs +++ b/ethcore/vm/src/env_info.rs @@ -19,7 +19,9 @@ use std::cmp; use std::sync::Arc; use hash::keccak; -use util::{U256, Address, H256}; +use bigint::hash::H256; +use bigint::prelude::U256; +use util::Address; use types::BlockNumber; use ethjson; @@ -79,7 +81,8 @@ impl From for EnvInfo { mod tests { use std::str::FromStr; use super::*; - use util::{U256, Address}; + use bigint::prelude::U256; + use util::Address; use ethjson; #[test] diff --git a/ethcore/vm/src/ext.rs b/ethcore/vm/src/ext.rs index 54871e511..d292af8d8 100644 --- a/ethcore/vm/src/ext.rs +++ b/ethcore/vm/src/ext.rs @@ -17,6 +17,8 @@ //! Interface for Evm externalities. use std::sync::Arc; +use bigint::prelude::U256; +use bigint::hash::H256; use util::*; use call_type::CallType; use env_info::EnvInfo; diff --git a/ethcore/vm/src/lib.rs b/ethcore/vm/src/lib.rs index 010e88eba..ee8873b01 100644 --- a/ethcore/vm/src/lib.rs +++ b/ethcore/vm/src/lib.rs @@ -17,6 +17,7 @@ //! Virtual machines support library extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; extern crate common_types as types; extern crate ethjson; extern crate rlp; diff --git a/ethcore/vm/src/return_data.rs b/ethcore/vm/src/return_data.rs index 3c8bd182f..c7d5f39dc 100644 --- a/ethcore/vm/src/return_data.rs +++ b/ethcore/vm/src/return_data.rs @@ -14,7 +14,7 @@ //! Return data structures -use util::U256; +use bigint::prelude::U256; /// Return data buffer. Holds memory from a previous call and a slice into that memory. #[derive(Debug)] @@ -65,4 +65,4 @@ pub enum GasLeft { /// Apply or revert state changes on revert. apply_state: bool }, -} \ No newline at end of file +} diff --git a/ethcore/vm/src/tests.rs b/ethcore/vm/src/tests.rs index c3a290d41..923216114 100644 --- a/ethcore/vm/src/tests.rs +++ b/ethcore/vm/src/tests.rs @@ -17,7 +17,9 @@ use std::sync::Arc; use std::collections::{HashMap, HashSet}; -use util::{H256, U256, Address, Bytes}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{Address, Bytes}; use { CallType, Schedule, EnvInfo, ReturnData, Ext, ContractCreateResult, MessageCallResult, diff --git a/ethcore/wasm/Cargo.toml b/ethcore/wasm/Cargo.toml index bbeeeffc5..7f3c41917 100644 --- a/ethcore/wasm/Cargo.toml +++ b/ethcore/wasm/Cargo.toml @@ -6,8 +6,9 @@ authors = ["Parity Technologies "] [dependencies] byteorder = "1.0" ethcore-util = { path = "../../util" } +ethcore-bigint = { path = "../../util/bigint" } log = "0.3" parity-wasm = "0.12" wasm-utils = { git = "https://github.com/paritytech/wasm-utils" } vm = { path = "../vm" } -ethcore-logger = { path = "../../logger" } \ No newline at end of file +ethcore-logger = { path = "../../logger" } diff --git a/ethcore/wasm/src/call_args.rs b/ethcore/wasm/src/call_args.rs index b4cce4982..7fb50bff3 100644 --- a/ethcore/wasm/src/call_args.rs +++ b/ethcore/wasm/src/call_args.rs @@ -16,7 +16,8 @@ //! Wasm evm call arguments helper -use util::{U256, H160}; +use bigint::prelude::U256; +use bigint::hash::H160; /// Input part of the wasm call descriptor pub struct CallArgs { @@ -59,4 +60,4 @@ impl CallArgs { pub fn len(&self) -> u32 { self.data.len() as u32 + 92 } -} \ No newline at end of file +} diff --git a/ethcore/wasm/src/lib.rs b/ethcore/wasm/src/lib.rs index 3fec0f781..fec270be2 100644 --- a/ethcore/wasm/src/lib.rs +++ b/ethcore/wasm/src/lib.rs @@ -18,6 +18,7 @@ extern crate vm; extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; #[macro_use] extern crate log; extern crate ethcore_logger; extern crate byteorder; @@ -153,4 +154,4 @@ impl From for vm::Error { fn from(err: runtime::Error) -> vm::Error { vm::Error::Wasm(format!("WASM runtime-error: {:?}", err)) } -} \ No newline at end of file +} diff --git a/ethcore/wasm/src/runtime.rs b/ethcore/wasm/src/runtime.rs index e1def857e..f7fb07473 100644 --- a/ethcore/wasm/src/runtime.rs +++ b/ethcore/wasm/src/runtime.rs @@ -22,7 +22,9 @@ use byteorder::{LittleEndian, ByteOrder}; use vm; use parity_wasm::interpreter; -use util::{Address, H256, U256}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::Address; use vm::CallType; use super::ptr::{WasmPtr, Error as PtrError}; diff --git a/ethcore/wasm/src/tests.rs b/ethcore/wasm/src/tests.rs index de0b528a1..f0a828394 100644 --- a/ethcore/wasm/src/tests.rs +++ b/ethcore/wasm/src/tests.rs @@ -16,7 +16,9 @@ use std::sync::Arc; use byteorder::{LittleEndian, ByteOrder}; -use util::{U256, H256, Address}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::Address; use super::WasmInterpreter; use vm::{self, Vm, GasLeft, ActionParams, ActionValue}; diff --git a/evmbin/Cargo.toml b/evmbin/Cargo.toml index 5538e10cc..310a2de25 100644 --- a/evmbin/Cargo.toml +++ b/evmbin/Cargo.toml @@ -16,6 +16,7 @@ serde_derive = "1.0" ethcore = { path = "../ethcore" } ethjson = { path = "../json" } ethcore-util = { path = "../util" } +ethcore-bigint = { path = "../util/bigint" } evm = { path = "../ethcore/evm" } vm = { path = "../ethcore/vm" } panic_hook = { path = "../panic_hook" } diff --git a/evmbin/src/display/json.rs b/evmbin/src/display/json.rs index 39147ffa3..47e9ccfe5 100644 --- a/evmbin/src/display/json.rs +++ b/evmbin/src/display/json.rs @@ -18,7 +18,9 @@ use ethcore::trace; use std::collections::HashMap; -use util::{U256, H256, ToPretty}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::ToPretty; use display; use info as vm; diff --git a/evmbin/src/display/mod.rs b/evmbin/src/display/mod.rs index 2c25fe721..50acac20c 100644 --- a/evmbin/src/display/mod.rs +++ b/evmbin/src/display/mod.rs @@ -17,7 +17,7 @@ //! VM Output display utils. use std::time::Duration; -use util::U256; +use bigint::prelude::U256; pub mod json; pub mod simple; diff --git a/evmbin/src/info.rs b/evmbin/src/info.rs index 3392cb441..4af30db71 100644 --- a/evmbin/src/info.rs +++ b/evmbin/src/info.rs @@ -17,7 +17,8 @@ //! VM runner. use std::time::{Instant, Duration}; -use util::{U256, H256}; +use bigint::prelude::U256; +use bigint::hash::H256; use ethcore::{trace, spec, transaction, pod_state}; use ethcore::client::{self, EvmTestClient, EvmTestError, TransactResult}; use ethjson; diff --git a/evmbin/src/main.rs b/evmbin/src/main.rs index 5eb43ed61..bb6435ee0 100644 --- a/evmbin/src/main.rs +++ b/evmbin/src/main.rs @@ -26,6 +26,7 @@ extern crate serde; extern crate serde_derive; extern crate docopt; extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; extern crate vm; extern crate evm; extern crate panic_hook; @@ -35,7 +36,8 @@ use std::{fmt, fs}; use std::path::PathBuf; use docopt::Docopt; use rustc_hex::FromHex; -use util::{U256, Bytes, Address}; +use bigint::prelude::U256; +use util::{Bytes, Address}; use ethcore::spec; use vm::{ActionParams, CallType}; diff --git a/hash-fetch/Cargo.toml b/hash-fetch/Cargo.toml index e87ffea1a..bb26bc509 100644 --- a/hash-fetch/Cargo.toml +++ b/hash-fetch/Cargo.toml @@ -16,6 +16,7 @@ rand = "0.3" rustc-hex = "1.0" fetch = { path = "../util/fetch" } ethcore-util = { path = "../util" } +ethcore-bigint = { path = "../util/bigint" } parity-reactor = { path = "../util/reactor" } native-contracts = { path = "../ethcore/native_contracts" } hash = { path = "../util/hash" } diff --git a/hash-fetch/src/client.rs b/hash-fetch/src/client.rs index d63df794a..2d6c9451a 100644 --- a/hash-fetch/src/client.rs +++ b/hash-fetch/src/client.rs @@ -26,7 +26,7 @@ use fetch::{Fetch, Response, Error as FetchError, Client as FetchClient}; use futures::Future; use parity_reactor::Remote; use urlhint::{ContractClient, URLHintContract, URLHint, URLHintResult}; -use util::H256; +use bigint::hash::H256; /// API for fetching by hash. pub trait HashFetch: Send + Sync + 'static { diff --git a/hash-fetch/src/lib.rs b/hash-fetch/src/lib.rs index 987770252..d54677464 100644 --- a/hash-fetch/src/lib.rs +++ b/hash-fetch/src/lib.rs @@ -25,6 +25,7 @@ extern crate mime; extern crate ethabi; extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; extern crate futures; extern crate mime_guess; extern crate native_contracts; diff --git a/hash-fetch/src/urlhint.rs b/hash-fetch/src/urlhint.rs index 3fa32eb15..f4778184e 100644 --- a/hash-fetch/src/urlhint.rs +++ b/hash-fetch/src/urlhint.rs @@ -117,7 +117,7 @@ impl URLHintContract { } } -fn decode_urlhint_output(output: (String, ::util::H160, Address)) -> Option { +fn decode_urlhint_output(output: (String, ::bigint::hash::H160, Address)) -> Option { let (account_slash_repo, commit, owner) = output; if owner == Address::default() { @@ -176,7 +176,7 @@ impl URLHint for URLHintContract { None => Either::A(future::ok(None)), Some(address) => { let do_call = move |_, data| client.call(address, data); - Either::B(urlhint.entries(do_call, ::util::H256(fixed_id)).map(decode_urlhint_output)) + Either::B(urlhint.entries(do_call, ::bigint::hash::H256(fixed_id)).map(decode_urlhint_output)) } } }).boxed() diff --git a/ipc-common-types/Cargo.toml b/ipc-common-types/Cargo.toml index ec9b157d5..a9efe1439 100644 --- a/ipc-common-types/Cargo.toml +++ b/ipc-common-types/Cargo.toml @@ -13,3 +13,4 @@ ethcore-ipc-codegen = { path = "../ipc/codegen" } semver = "0.6" ethcore-ipc = { path = "../ipc/rpc" } ethcore-util = { path = "../util" } +ethcore-bigint = { path = "../util/bigint" } diff --git a/ipc-common-types/src/lib.rs b/ipc-common-types/src/lib.rs index 2038c9116..c1d18a8d7 100644 --- a/ipc-common-types/src/lib.rs +++ b/ipc-common-types/src/lib.rs @@ -18,6 +18,7 @@ extern crate semver; extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; extern crate ethcore_ipc as ipc; mod types; diff --git a/ipc-common-types/src/types/version_info.rs b/ipc-common-types/src/types/version_info.rs index 1f0e58452..ef386824d 100644 --- a/ipc-common-types/src/types/version_info.rs +++ b/ipc-common-types/src/types/version_info.rs @@ -19,7 +19,7 @@ use std::fmt; use std::str::FromStr; use semver::{Version}; -use util::H160; +use bigint::hash::H160; use util::misc::raw_package_info; use release_track::ReleaseTrack; diff --git a/ipc/rpc/Cargo.toml b/ipc/rpc/Cargo.toml index edfcdf103..12d73a118 100644 --- a/ipc/rpc/Cargo.toml +++ b/ipc/rpc/Cargo.toml @@ -9,5 +9,6 @@ license = "GPL-3.0" [dependencies] ethcore-devtools = { path = "../../devtools" } nanomsg = { git = "https://github.com/paritytech/nanomsg.rs.git", branch = "parity-1.7" } +ethcore-bigint = { path = "../../util/bigint"} ethcore-util = { path = "../../util" } semver = "0.6" diff --git a/ipc/rpc/src/binary.rs b/ipc/rpc/src/binary.rs index b2fc4bb4b..6466acdb1 100644 --- a/ipc/rpc/src/binary.rs +++ b/ipc/rpc/src/binary.rs @@ -16,7 +16,9 @@ //! Binary representation of types -use util::{U256, U512, H256, H512, H2048, Address}; +use bigint::prelude::{U256, U512}; +use bigint::hash::{H256, H512, H2048}; +use util::{Address}; use std::mem; use std::collections::{VecDeque, BTreeMap}; use std::ops::Range; diff --git a/ipc/rpc/src/lib.rs b/ipc/rpc/src/lib.rs index 61493ea36..c6aff23b5 100644 --- a/ipc/rpc/src/lib.rs +++ b/ipc/rpc/src/lib.rs @@ -20,6 +20,7 @@ extern crate ethcore_devtools as devtools; extern crate semver; extern crate nanomsg; extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; pub mod interface; pub mod binary; diff --git a/ipfs/Cargo.toml b/ipfs/Cargo.toml index 4b438efe7..f56159399 100644 --- a/ipfs/Cargo.toml +++ b/ipfs/Cargo.toml @@ -8,6 +8,7 @@ authors = ["Parity Technologies "] [dependencies] ethcore = { path = "../ethcore" } ethcore-util = { path = "../util" } +ethcore-bigint = { path = "../util/bigint" } jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" } rlp = { path = "../util/rlp" } mime = "0.2" diff --git a/ipfs/src/lib.rs b/ipfs/src/lib.rs index 104c7db19..ec065fa48 100644 --- a/ipfs/src/lib.rs +++ b/ipfs/src/lib.rs @@ -22,6 +22,7 @@ extern crate cid; extern crate rlp; extern crate ethcore; extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; extern crate jsonrpc_http_server as http; pub mod error; diff --git a/ipfs/src/route.rs b/ipfs/src/route.rs index c72ca53c1..e95552404 100644 --- a/ipfs/src/route.rs +++ b/ipfs/src/route.rs @@ -19,7 +19,8 @@ use error::{Error, Result}; use cid::{ToCid, Codec}; use multihash::Hash; -use util::{Bytes, H256}; +use bigint::hash::H256; +use util::Bytes; use ethcore::client::{BlockId, TransactionId}; type Reason = &'static str; diff --git a/parity/blockchain.rs b/parity/blockchain.rs index a94b387d4..997e05b7b 100644 --- a/parity/blockchain.rs +++ b/parity/blockchain.rs @@ -22,7 +22,9 @@ use std::thread::sleep; use std::sync::Arc; use rustc_hex::FromHex; use hash::{keccak, KECCAK_NULL_RLP}; -use util::{ToPretty, U256, H256, Address}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{ToPretty, Address}; use rlp::PayloadInfo; use ethcore::service::ClientService; use ethcore::client::{Mode, DatabaseCompactionProfile, VMType, BlockImportError, BlockChainClient, BlockId}; diff --git a/parity/configuration.rs b/parity/configuration.rs index 11360c41b..9b9ad78e4 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -23,7 +23,9 @@ use std::cmp::max; use std::str::FromStr; use cli::{Args, ArgsError}; use hash::keccak; -use util::{H256, U256, Bytes, version_data, Address}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{Bytes, version_data, Address}; use util::journaldb::Algorithm; use util::Colour; use ethsync::{NetworkConfiguration, is_valid_node_url}; diff --git a/parity/dir.rs b/parity/dir.rs index d254886b9..4046e48a6 100644 --- a/parity/dir.rs +++ b/parity/dir.rs @@ -16,7 +16,7 @@ use std::fs; use std::path::{PathBuf, Path}; -use util::{H64, H256}; +use bigint::hash::{H64, H256}; use util::journaldb::Algorithm; use helpers::{replace_home, replace_home_and_local}; use app_dirs::{AppInfo, get_app_root, AppDataType}; diff --git a/parity/helpers.rs b/parity/helpers.rs index 2a1b3156d..9bcaf897e 100644 --- a/parity/helpers.rs +++ b/parity/helpers.rs @@ -18,7 +18,9 @@ use std::{io, env}; use std::io::{Write, BufReader, BufRead}; use std::time::Duration; use std::fs::File; -use util::{clean_0x, U256, Address, CompactionProfile}; +use bigint::prelude::U256; +use bigint::hash::clean_0x; +use util::{Address, CompactionProfile}; use util::journaldb::Algorithm; use ethcore::client::{Mode, BlockId, VMType, DatabaseCompactionProfile, ClientConfig, VerifierType}; use ethcore::miner::{PendingSet, GasLimit, PrioritizationStrategy}; @@ -341,7 +343,7 @@ mod tests { use std::fs::File; use std::io::Write; use devtools::RandomTempPath; - use util::{U256}; + use bigint::prelude::U256; use ethcore::client::{Mode, BlockId}; use ethcore::miner::PendingSet; use super::{to_duration, to_mode, to_block_id, to_u256, to_pending_set, to_address, to_addresses, to_price, geth_ipc_path, to_bootnodes, password_from_file}; diff --git a/parity/informant.rs b/parity/informant.rs index 1935ec9b6..6ce41e8b0 100644 --- a/parity/informant.rs +++ b/parity/informant.rs @@ -35,7 +35,8 @@ use light::client::LightChainClient; use number_prefix::{binary_prefix, Standalone, Prefixed}; use parity_rpc::{is_major_importing}; use parity_rpc::informant::RpcStats; -use util::{RwLock, Mutex, H256, Colour, Bytes}; +use bigint::hash::H256; +use util::{RwLock, Mutex, Colour, Bytes}; /// Format byte counts to standard denominations. pub fn format_bytes(b: usize) -> String { diff --git a/parity/main.rs b/parity/main.rs index 00c219963..1f6d56eb9 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -55,6 +55,7 @@ extern crate ethcore_ipc_nano as nanoipc; extern crate ethcore_light as light; extern crate ethcore_logger; extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; extern crate ethcore_network as network; extern crate ethkey; extern crate ethsync; diff --git a/parity/params.rs b/parity/params.rs index 3054db48f..fda57f99a 100644 --- a/parity/params.rs +++ b/parity/params.rs @@ -16,7 +16,8 @@ use std::{str, fs, fmt, path}; use std::time::Duration; -use util::{Address, U256, version_data}; +use bigint::prelude::U256; +use util::{Address, version_data}; use util::journaldb::Algorithm; use ethcore::spec::Spec; use ethcore::ethereum; diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 382878683..25251adf2 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -37,6 +37,7 @@ jsonrpc-pubsub = { git = "https://github.com/paritytech/jsonrpc.git", branch = " ethcore-io = { path = "../util/io" } ethcore-ipc = { path = "../ipc/rpc" } ethcore-util = { path = "../util" } +ethcore-bigint = { path = "../util/bigint" } ethcore = { path = "../ethcore" } ethcrypto = { path = "../ethcrypto" } ethkey = { path = "../ethkey" } diff --git a/rpc/src/authcodes.rs b/rpc/src/authcodes.rs index bb44eb506..c8a0731e3 100644 --- a/rpc/src/authcodes.rs +++ b/rpc/src/authcodes.rs @@ -22,7 +22,7 @@ use itertools::Itertools; use rand::Rng; use rand::os::OsRng; use hash::keccak; -use util::H256; +use bigint::hash::H256; /// Providing current time in seconds pub trait TimeProvider { @@ -234,7 +234,7 @@ mod tests { use std::cell::Cell; use hash::keccak; - use util::H256; + use bigint::hash::H256; use super::*; fn generate_hash(val: &str, time: u64) -> H256 { diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 7db99ba2c..22b64792e 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -44,6 +44,7 @@ extern crate jsonrpc_pubsub; extern crate ethash; extern crate ethcore; +extern crate ethcore_bigint as bigint; extern crate ethcore_devtools as devtools; extern crate ethcore_io as io; extern crate ethcore_ipc; diff --git a/rpc/src/v1/extractors.rs b/rpc/src/v1/extractors.rs index ab1fad4da..7685b110e 100644 --- a/rpc/src/v1/extractors.rs +++ b/rpc/src/v1/extractors.rs @@ -25,7 +25,7 @@ use ipc; use jsonrpc_core as core; use jsonrpc_pubsub::Session; use ws; -use util::H256; +use bigint::hash::H256; use v1::{Metadata, Origin}; use v1::informant::RpcStats; diff --git a/rpc/src/v1/helpers/dispatch.rs b/rpc/src/v1/helpers/dispatch.rs index 41fc201cf..8423848c5 100644 --- a/rpc/src/v1/helpers/dispatch.rs +++ b/rpc/src/v1/helpers/dispatch.rs @@ -27,7 +27,9 @@ use light::on_demand::{request, OnDemand}; use light::TransactionQueue as LightTransactionQueue; use rlp; use hash::keccak; -use util::{Address, H520, H256, U256, Bytes, Mutex, RwLock}; +use bigint::prelude::U256; +use bigint::hash::{H256, H520}; +use util::{Address, Bytes, Mutex, RwLock}; use stats::Corpus; use ethkey::Signature; diff --git a/rpc/src/v1/helpers/fake_sign.rs b/rpc/src/v1/helpers/fake_sign.rs index 2bbaef0ee..02259a9db 100644 --- a/rpc/src/v1/helpers/fake_sign.rs +++ b/rpc/src/v1/helpers/fake_sign.rs @@ -18,7 +18,7 @@ use std::sync::Arc; use ethcore::client::MiningBlockChainClient; use ethcore::miner::MinerService; use ethcore::transaction::{Transaction, SignedTransaction, Action}; -use util::U256; +use bigint::prelude::U256; use jsonrpc_core::Error; use v1::helpers::CallRequest; diff --git a/rpc/src/v1/helpers/light_fetch.rs b/rpc/src/v1/helpers/light_fetch.rs index 972315272..713ae2464 100644 --- a/rpc/src/v1/helpers/light_fetch.rs +++ b/rpc/src/v1/helpers/light_fetch.rs @@ -37,7 +37,8 @@ use light::on_demand::{request, OnDemand, HeaderRef, Request as OnDemandRequest, use light::request::Field; use ethsync::LightSync; -use util::{Address, Mutex, U256}; +use bigint::prelude::U256; +use util::{Address, Mutex}; use v1::helpers::{CallRequest as CallRequestHelper, errors, dispatch}; use v1::types::{BlockNumber, CallRequest, Log}; diff --git a/rpc/src/v1/helpers/poll_filter.rs b/rpc/src/v1/helpers/poll_filter.rs index faae75c98..ba769ee4e 100644 --- a/rpc/src/v1/helpers/poll_filter.rs +++ b/rpc/src/v1/helpers/poll_filter.rs @@ -1,7 +1,7 @@ //! Helper type with all filter state data. use std::collections::HashSet; -use util::hash::H256; +use bigint::hash::H256; use v1::types::{Filter, Log}; pub type BlockNumber = u64; diff --git a/rpc/src/v1/helpers/requests.rs b/rpc/src/v1/helpers/requests.rs index aa3a4c3d4..8c5307f5f 100644 --- a/rpc/src/v1/helpers/requests.rs +++ b/rpc/src/v1/helpers/requests.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use util::{Address, U256, Bytes}; +use bigint::prelude::U256; +use util::{Address, Bytes}; use v1::types::{Origin, TransactionCondition}; /// Transaction request coming from RPC diff --git a/rpc/src/v1/helpers/signing_queue.rs b/rpc/src/v1/helpers/signing_queue.rs index e9e6313f4..b82009f76 100644 --- a/rpc/src/v1/helpers/signing_queue.rs +++ b/rpc/src/v1/helpers/signing_queue.rs @@ -19,7 +19,8 @@ use std::cell::RefCell; use std::sync::Arc; use std::collections::BTreeMap; use jsonrpc_core; -use util::{Mutex, RwLock, U256, Address}; +use bigint::prelude::U256; +use util::{Mutex, RwLock, Address}; use ethcore::account_provider::DappId; use v1::helpers::{ConfirmationRequest, ConfirmationPayload}; use v1::types::{ConfirmationResponse, H160 as RpcH160, Origin, DappId as RpcDappId}; @@ -297,7 +298,8 @@ mod test { use std::time::Duration; use std::thread; use std::sync::{mpsc, Arc}; - use util::{Address, U256, Mutex}; + use bigint::prelude::U256; + use util::{Address, Mutex}; use v1::helpers::{SigningQueue, ConfirmationsQueue, QueueEvent, FilledTransactionRequest, ConfirmationPayload}; use v1::types::ConfirmationResponse; diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index f31d32426..60f94ae71 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -23,7 +23,9 @@ use std::sync::Arc; use futures::{self, future, BoxFuture, Future}; use rlp::{self, UntrustedRlp}; use time::get_time; -use util::{H160, H256, Address, U256, H64}; +use bigint::prelude::U256; +use bigint::hash::{H64, H160, H256}; +use util::Address; use util::Mutex; use ethash::SeedHashCompute; diff --git a/rpc/src/v1/impls/eth_filter.rs b/rpc/src/v1/impls/eth_filter.rs index 8f448feb5..d2936ec39 100644 --- a/rpc/src/v1/impls/eth_filter.rs +++ b/rpc/src/v1/impls/eth_filter.rs @@ -23,7 +23,8 @@ use jsonrpc_core::*; use ethcore::miner::MinerService; use ethcore::filter::Filter as EthcoreFilter; use ethcore::client::{BlockChainClient, BlockId}; -use util::{H256, Mutex}; +use bigint::hash::H256; +use util::Mutex; use futures::{future, Future, BoxFuture}; diff --git a/rpc/src/v1/impls/eth_pubsub.rs b/rpc/src/v1/impls/eth_pubsub.rs index f918a44ea..84a193bf1 100644 --- a/rpc/src/v1/impls/eth_pubsub.rs +++ b/rpc/src/v1/impls/eth_pubsub.rs @@ -39,7 +39,8 @@ use light::cache::Cache; use light::on_demand::OnDemand; use light::client::{LightChainClient, LightChainNotify}; use parity_reactor::Remote; -use util::{RwLock, Mutex, H256, Bytes}; +use bigint::hash::H256; +use util::{RwLock, Mutex, Bytes}; type Client = Sink; diff --git a/rpc/src/v1/impls/light/eth.rs b/rpc/src/v1/impls/light/eth.rs index 7e40bf71a..cd0823b12 100644 --- a/rpc/src/v1/impls/light/eth.rs +++ b/rpc/src/v1/impls/light/eth.rs @@ -39,7 +39,8 @@ use ethcore::transaction::{Action, SignedTransaction, Transaction as EthTransact use ethsync::LightSync; use rlp::UntrustedRlp; use hash::{KECCAK_NULL_RLP, KECCAK_EMPTY_LIST_RLP}; -use util::{RwLock, Mutex, U256}; +use bigint::prelude::U256; +use util::{RwLock, Mutex}; use futures::{future, Future, BoxFuture, IntoFuture}; use futures::sync::oneshot; @@ -472,7 +473,7 @@ impl Filterable for EthClient { self.client.block_hash(id).map(Into::into) } - fn pending_transactions_hashes(&self, _block_number: u64) -> Vec<::util::H256> { + fn pending_transactions_hashes(&self, _block_number: u64) -> Vec<::bigint::hash::H256> { Vec::new() } diff --git a/rpc/src/v1/impls/personal.rs b/rpc/src/v1/impls/personal.rs index 302190fd4..b606d3e58 100644 --- a/rpc/src/v1/impls/personal.rs +++ b/rpc/src/v1/impls/personal.rs @@ -20,7 +20,8 @@ use std::sync::Arc; use ethcore::account_provider::AccountProvider; use ethcore::transaction::PendingTransaction; -use util::{Address, U128, ToPretty}; +use bigint::prelude::U128; +use util::{Address, ToPretty}; use futures::{future, Future, BoxFuture}; use jsonrpc_core::Error; diff --git a/rpc/src/v1/impls/signing.rs b/rpc/src/v1/impls/signing.rs index 23ce3c78a..b97cec6a3 100644 --- a/rpc/src/v1/impls/signing.rs +++ b/rpc/src/v1/impls/signing.rs @@ -18,7 +18,8 @@ use std::sync::Arc; use transient_hashmap::TransientHashMap; -use util::{U256, Mutex}; +use bigint::prelude::U256; +use util::Mutex; use ethcore::account_provider::AccountProvider; diff --git a/rpc/src/v1/tests/eth.rs b/rpc/src/v1/tests/eth.rs index c13ee79c8..c7a580c58 100644 --- a/rpc/src/v1/tests/eth.rs +++ b/rpc/src/v1/tests/eth.rs @@ -29,7 +29,9 @@ use ethcore::miner::{MinerOptions, Banning, GasPricer, MinerService, ExternalMin use ethcore::account_provider::AccountProvider; use ethjson::blockchain::BlockChain; use io::IoChannel; -use util::{U256, H256, Address}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::Address; use jsonrpc_core::IoHandler; use v1::impls::{EthClient, SigningUnsafeClient}; diff --git a/rpc/src/v1/tests/helpers/miner_service.rs b/rpc/src/v1/tests/helpers/miner_service.rs index 7139d636b..6a3f8cb1d 100644 --- a/rpc/src/v1/tests/helpers/miner_service.rs +++ b/rpc/src/v1/tests/helpers/miner_service.rs @@ -18,7 +18,9 @@ use std::collections::{BTreeMap, HashMap}; use std::collections::hash_map::Entry; -use util::{Address, H256, Bytes, U256, RwLock, Mutex}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{Address, Bytes, RwLock, Mutex}; use ethcore::error::Error; use ethcore::client::MiningBlockChainClient; use ethcore::block::ClosedBlock; diff --git a/rpc/src/v1/tests/helpers/snapshot_service.rs b/rpc/src/v1/tests/helpers/snapshot_service.rs index cfb80619a..06cd254fb 100644 --- a/rpc/src/v1/tests/helpers/snapshot_service.rs +++ b/rpc/src/v1/tests/helpers/snapshot_service.rs @@ -17,7 +17,7 @@ use ethcore::snapshot::{ManifestData, RestorationStatus, SnapshotService}; use util::{Bytes, Mutex}; -use util::hash::H256; +use bigint::hash::H256; /// Mocked snapshot service (used for sync info extensions). pub struct TestSnapshotService { diff --git a/rpc/src/v1/tests/helpers/sync_provider.rs b/rpc/src/v1/tests/helpers/sync_provider.rs index 83c7db015..3447ca8d7 100644 --- a/rpc/src/v1/tests/helpers/sync_provider.rs +++ b/rpc/src/v1/tests/helpers/sync_provider.rs @@ -17,7 +17,8 @@ //! Test implementation of SyncProvider. use std::collections::BTreeMap; -use util::{H256, RwLock}; +use bigint::hash::H256; +use util::RwLock; use ethsync::{SyncProvider, EthProtocolInfo, SyncStatus, SyncState, PeerInfo, TransactionStats}; /// TestSyncProvider config. diff --git a/rpc/src/v1/tests/mocked/eth.rs b/rpc/src/v1/tests/mocked/eth.rs index d1835948f..cb00291ac 100644 --- a/rpc/src/v1/tests/mocked/eth.rs +++ b/rpc/src/v1/tests/mocked/eth.rs @@ -22,7 +22,9 @@ use rustc_hex::{FromHex, ToHex}; use time::get_time; use rlp; -use util::{U256, Address, H256, Mutex}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{Address, Mutex}; use ethkey::Secret; use ethcore::account_provider::AccountProvider; use ethcore::client::{TestBlockChainClient, EachBlockWith, Executed, TransactionId}; @@ -533,7 +535,7 @@ fn rpc_eth_transaction_count_by_number_pending() { #[test] fn rpc_eth_pending_transaction_by_hash() { - use util::H256; + use bigint::hash::H256; use rlp; use ethcore::transaction::SignedTransaction; diff --git a/rpc/src/v1/tests/mocked/parity.rs b/rpc/src/v1/tests/mocked/parity.rs index 3c98ea8ef..bb7765446 100644 --- a/rpc/src/v1/tests/mocked/parity.rs +++ b/rpc/src/v1/tests/mocked/parity.rs @@ -485,7 +485,8 @@ fn rpc_parity_local_transactions() { #[test] fn rpc_parity_chain_status() { - use util::{H256, U256}; + use bigint::prelude::U256; + use bigint::hash::H256; let deps = Dependencies::new(); let io = deps.default_client(); @@ -523,7 +524,7 @@ fn rpc_parity_cid() { #[test] fn rpc_parity_call() { - use util::U256; + use bigint::prelude::U256; let deps = Dependencies::new(); deps.client.set_execution_result(Ok(Executed { diff --git a/rpc/src/v1/tests/mocked/parity_set.rs b/rpc/src/v1/tests/mocked/parity_set.rs index 22e0388e2..ed27862ac 100644 --- a/rpc/src/v1/tests/mocked/parity_set.rs +++ b/rpc/src/v1/tests/mocked/parity_set.rs @@ -17,7 +17,8 @@ use std::sync::Arc; use std::str::FromStr; use rustc_hex::FromHex; -use util::{U256, Address}; +use bigint::prelude::U256; +use util::Address; use ethcore::miner::MinerService; use ethcore::client::TestBlockChainClient; diff --git a/rpc/src/v1/tests/mocked/personal.rs b/rpc/src/v1/tests/mocked/personal.rs index c7205d6ef..d34d734c0 100644 --- a/rpc/src/v1/tests/mocked/personal.rs +++ b/rpc/src/v1/tests/mocked/personal.rs @@ -21,7 +21,8 @@ use ethcore::account_provider::AccountProvider; use ethcore::client::TestBlockChainClient; use ethcore::transaction::{Action, Transaction}; use jsonrpc_core::IoHandler; -use util::{U256, Address}; +use bigint::prelude::U256; +use util::Address; use v1::{PersonalClient, Personal, Metadata}; use v1::helpers::dispatch::FullDispatcher; diff --git a/rpc/src/v1/tests/mocked/signer.rs b/rpc/src/v1/tests/mocked/signer.rs index 6827334de..55f2eae77 100644 --- a/rpc/src/v1/tests/mocked/signer.rs +++ b/rpc/src/v1/tests/mocked/signer.rs @@ -16,7 +16,8 @@ use std::sync::Arc; use std::str::FromStr; -use util::{U256, Address, ToPretty}; +use bigint::prelude::U256; +use util::{Address, ToPretty}; use ethcore::account_provider::AccountProvider; use ethcore::client::TestBlockChainClient; diff --git a/rpc/src/v1/tests/mocked/signing.rs b/rpc/src/v1/tests/mocked/signing.rs index 4c6951f1a..ee8787915 100644 --- a/rpc/src/v1/tests/mocked/signing.rs +++ b/rpc/src/v1/tests/mocked/signing.rs @@ -28,7 +28,8 @@ use v1::types::ConfirmationResponse; use v1::tests::helpers::TestMinerService; use v1::tests::mocked::parity; -use util::{Address, U256, ToPretty}; +use bigint::prelude::U256; +use util::{Address, ToPretty}; use ethkey::Secret; use ethcore::account_provider::AccountProvider; use ethcore::client::TestBlockChainClient; diff --git a/rpc/src/v1/types/filter.rs b/rpc/src/v1/types/filter.rs index 058d14d7e..f552212b0 100644 --- a/rpc/src/v1/types/filter.rs +++ b/rpc/src/v1/types/filter.rs @@ -124,7 +124,7 @@ impl Serialize for FilterChanges { mod tests { use serde_json; use std::str::FromStr; - use util::hash::H256; + use bigint::hash::H256; use super::{VariadicValue, Topic, Filter}; use v1::types::BlockNumber; use ethcore::filter::Filter as EthFilter; diff --git a/rpc/src/v1/types/hash.rs b/rpc/src/v1/types/hash.rs index 1816c96d5..bf381f3b6 100644 --- a/rpc/src/v1/types/hash.rs +++ b/rpc/src/v1/types/hash.rs @@ -20,7 +20,7 @@ use std::cmp::Ordering; use std::hash::{Hash, Hasher}; use serde; use rustc_hex::{ToHex, FromHex}; -use util::{H64 as Eth64, H160 as Eth160, H256 as Eth256, H520 as Eth520, H512 as Eth512, H2048 as Eth2048}; +use bigint::hash::{H64 as Eth64, H160 as Eth160, H256 as Eth256, H520 as Eth520, H512 as Eth512, H2048 as Eth2048}; macro_rules! impl_hash { ($name: ident, $other: ident, $size: expr) => { diff --git a/rpc/src/v1/types/histogram.rs b/rpc/src/v1/types/histogram.rs index 55d8ae835..2f7d210af 100644 --- a/rpc/src/v1/types/histogram.rs +++ b/rpc/src/v1/types/histogram.rs @@ -29,8 +29,8 @@ pub struct Histogram { pub counts: Vec, } -impl From<::stats::Histogram<::util::U256>> for Histogram { - fn from(h: ::stats::Histogram<::util::U256>) -> Self { +impl From<::stats::Histogram<::bigint::prelude::U256>> for Histogram { + fn from(h: ::stats::Histogram<::bigint::prelude::U256>) -> Self { Histogram { bucket_bounds: h.bucket_bounds.into_iter().map(Into::into).collect(), counts: h.counts diff --git a/rpc/src/v1/types/uint.rs b/rpc/src/v1/types/uint.rs index e783aac1f..2de1ad46c 100644 --- a/rpc/src/v1/types/uint.rs +++ b/rpc/src/v1/types/uint.rs @@ -17,7 +17,7 @@ use std::str::FromStr; use std::fmt; use serde; -use util::{U256 as EthU256, U128 as EthU128}; +use bigint::prelude::{U256 as EthU256, U128 as EthU128}; macro_rules! impl_uint { ($name: ident, $other: ident, $size: expr) => { diff --git a/secret_store/Cargo.toml b/secret_store/Cargo.toml index 8a8010540..9143b289a 100644 --- a/secret_store/Cargo.toml +++ b/secret_store/Cargo.toml @@ -29,6 +29,7 @@ ethabi = "2.0" ethcore = { path = "../ethcore" } ethcore-devtools = { path = "../devtools" } ethcore-util = { path = "../util" } +ethcore-bigint = { path = "../util/bigint" } hash = { path = "../util/hash" } ethcore-ipc = { path = "../ipc/rpc" } ethcore-ipc-nano = { path = "../ipc/nano" } diff --git a/secret_store/src/acl_storage.rs b/secret_store/src/acl_storage.rs index 5b8284c6f..0a30a1a60 100644 --- a/secret_store/src/acl_storage.rs +++ b/secret_store/src/acl_storage.rs @@ -21,7 +21,8 @@ use parking_lot::{Mutex, RwLock}; use ethkey::public_to_address; use ethcore::client::{Client, BlockChainClient, BlockId, ChainNotify}; use native_contracts::SecretStoreAclStorage; -use util::{H256, Address, Bytes}; +use bigint::hash::H256; +use util::{Address, Bytes}; use types::all::{Error, ServerKeyId, Public}; const ACL_CHECKER_CONTRACT_REGISTRY_NAME: &'static str = "secretstore_acl_checker"; diff --git a/secret_store/src/key_server.rs b/secret_store/src/key_server.rs index f9fad19df..eefe68aa2 100644 --- a/secret_store/src/key_server.rs +++ b/secret_store/src/key_server.rs @@ -201,7 +201,7 @@ pub mod tests { use node_key_pair::PlainNodeKeyPair; use key_server_set::tests::MapKeyServerSet; use key_server_cluster::math; - use util::H256; + use bigint::hash::H256; use types::all::{Error, Public, ClusterConfiguration, NodeAddress, RequestSignature, ServerKeyId, EncryptedDocumentKey, EncryptedDocumentKeyShadow, MessageHash, EncryptedMessageSignature}; use traits::{ServerKeyGenerator, DocumentKeyServer, MessageSigner, KeyServer}; diff --git a/secret_store/src/key_server_cluster/cluster.rs b/secret_store/src/key_server_cluster/cluster.rs index c267d1259..860048ff8 100644 --- a/secret_store/src/key_server_cluster/cluster.rs +++ b/secret_store/src/key_server_cluster/cluster.rs @@ -27,7 +27,7 @@ use tokio_io::IoFuture; use tokio_core::reactor::{Handle, Remote, Interval}; use tokio_core::net::{TcpListener, TcpStream}; use ethkey::{Public, KeyPair, Signature, Random, Generator}; -use util::H256; +use bigint::hash::H256; use key_server_cluster::{Error, NodeId, SessionId, AclStorage, KeyStorage, KeyServerSet, NodeKeyPair}; use key_server_cluster::cluster_sessions::{ClusterSession, ClusterSessions, GenerationSessionWrapper, EncryptionSessionWrapper, DecryptionSessionWrapper, SigningSessionWrapper}; diff --git a/secret_store/src/key_server_cluster/io/handshake.rs b/secret_store/src/key_server_cluster/io/handshake.rs index bf52ab798..91daaad68 100644 --- a/secret_store/src/key_server_cluster/io/handshake.rs +++ b/secret_store/src/key_server_cluster/io/handshake.rs @@ -20,7 +20,7 @@ use std::collections::BTreeSet; use futures::{Future, Poll, Async}; use tokio_io::{AsyncRead, AsyncWrite}; use ethkey::{Random, Generator, KeyPair, verify_public}; -use util::H256; +use bigint::hash::H256; use key_server_cluster::{NodeId, Error, NodeKeyPair}; use key_server_cluster::message::{Message, ClusterMessage, NodePublicKey, NodePrivateKeySignature}; use key_server_cluster::io::{write_message, write_encrypted_message, WriteMessage, ReadMessage, @@ -254,7 +254,7 @@ mod tests { use futures::Future; use ethkey::{Random, Generator, sign}; use ethcrypto::ecdh::agree; - use util::H256; + use bigint::hash::H256; use key_server_cluster::PlainNodeKeyPair; use key_server_cluster::io::message::fix_shared_key; use key_server_cluster::io::message::tests::TestIo; diff --git a/secret_store/src/key_server_cluster/io/message.rs b/secret_store/src/key_server_cluster/io/message.rs index 5a6b50a3e..c75243760 100644 --- a/secret_store/src/key_server_cluster/io/message.rs +++ b/secret_store/src/key_server_cluster/io/message.rs @@ -22,7 +22,8 @@ use serde_json; use ethcrypto::ecies::{encrypt_single_message, decrypt_single_message}; use ethkey::{Secret, KeyPair}; use ethkey::math::curve_order; -use util::{H256, U256}; +use bigint::prelude::U256; +use bigint::hash::H256; use key_server_cluster::Error; use key_server_cluster::message::{Message, ClusterMessage, GenerationMessage, EncryptionMessage, DecryptionMessage, SigningMessage}; diff --git a/secret_store/src/key_server_cluster/jobs/signing_job.rs b/secret_store/src/key_server_cluster/jobs/signing_job.rs index 28ac31a1e..acf6047ce 100644 --- a/secret_store/src/key_server_cluster/jobs/signing_job.rs +++ b/secret_store/src/key_server_cluster/jobs/signing_job.rs @@ -16,7 +16,7 @@ use std::collections::{BTreeSet, BTreeMap}; use ethkey::{Public, Secret}; -use util::H256; +use bigint::hash::H256; use key_server_cluster::{Error, NodeId, DocumentKeyShare}; use key_server_cluster::math; use key_server_cluster::jobs::job_session::{JobPartialRequestAction, JobPartialResponseAction, JobExecutor}; @@ -139,7 +139,7 @@ impl JobExecutor for SigningJob { let signature_c = math::combine_message_hash_with_public(message_hash, &self.session_public)?; let signature_s = math::compute_signature(partial_responses.values().map(|r| &r.partial_signature))?; - + Ok((signature_c, signature_s)) } } diff --git a/secret_store/src/key_server_cluster/math.rs b/secret_store/src/key_server_cluster/math.rs index 1c81d063e..4cbd546d2 100644 --- a/secret_store/src/key_server_cluster/math.rs +++ b/secret_store/src/key_server_cluster/math.rs @@ -15,7 +15,8 @@ // along with Parity. If not, see . use ethkey::{Public, Secret, Random, Generator, math}; -use util::{U256, H256}; +use bigint::prelude::U256; +use bigint::hash::H256; use hash::keccak; use key_server_cluster::Error; diff --git a/secret_store/src/key_server_cluster/signing_session.rs b/secret_store/src/key_server_cluster/signing_session.rs index e56306142..2e59c594c 100644 --- a/secret_store/src/key_server_cluster/signing_session.rs +++ b/secret_store/src/key_server_cluster/signing_session.rs @@ -18,7 +18,7 @@ use std::collections::BTreeSet; use std::sync::Arc; use parking_lot::{Mutex, Condvar}; use ethkey::{Public, Secret, Signature}; -use util::H256; +use bigint::hash::H256; use key_server_cluster::{Error, NodeId, SessionId, SessionMeta, AclStorage, DocumentKeyShare}; use key_server_cluster::cluster::{Cluster}; use key_server_cluster::cluster_sessions::ClusterSession; @@ -230,13 +230,13 @@ impl SessionImpl { self.on_consensus_message(sender, message), &SigningMessage::SigningGenerationMessage(ref message) => self.on_generation_message(sender, message), - &SigningMessage::RequestPartialSignature(ref message) => + &SigningMessage::RequestPartialSignature(ref message) => self.on_partial_signature_requested(sender, message), - &SigningMessage::PartialSignature(ref message) => + &SigningMessage::PartialSignature(ref message) => self.on_partial_signature(sender, message), - &SigningMessage::SigningSessionError(ref message) => + &SigningMessage::SigningSessionError(ref message) => self.on_session_error(sender, message), - &SigningMessage::SigningSessionCompleted(ref message) => + &SigningMessage::SigningSessionCompleted(ref message) => self.on_session_completed(sender, message), } } @@ -571,7 +571,7 @@ mod tests { use std::sync::Arc; use std::collections::{BTreeMap, VecDeque}; use ethkey::{self, Random, Generator, Public}; - use util::H256; + use bigint::hash::H256; use acl_storage::DummyAclStorage; use key_server_cluster::{NodeId, SessionId, SessionMeta, Error, KeyStorage}; use key_server_cluster::cluster::tests::DummyCluster; diff --git a/secret_store/src/key_server_set.rs b/secret_store/src/key_server_set.rs index 02e509c89..ee959d0ba 100644 --- a/secret_store/src/key_server_set.rs +++ b/secret_store/src/key_server_set.rs @@ -23,7 +23,8 @@ use ethcore::filter::Filter; use ethcore::client::{Client, BlockChainClient, BlockId, ChainNotify}; use native_contracts::KeyServerSet as KeyServerSetContract; use hash::keccak; -use util::{H256, Address, Bytes}; +use bigint::hash::H256; +use util::{Address, Bytes}; use types::all::{Error, Public, NodeAddress}; const KEY_SERVER_SET_CONTRACT_REGISTRY_NAME: &'static str = "secretstore_server_set"; diff --git a/secret_store/src/lib.rs b/secret_store/src/lib.rs index 8ba8648f8..cbad4ffe6 100644 --- a/secret_store/src/lib.rs +++ b/secret_store/src/lib.rs @@ -39,6 +39,7 @@ extern crate ethabi; extern crate ethcore; extern crate ethcore_devtools as devtools; extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; extern crate ethcore_ipc as ipc; extern crate ethcore_logger as logger; extern crate ethcrypto; diff --git a/secret_store/src/node_key_pair.rs b/secret_store/src/node_key_pair.rs index ce6c88a07..29f1ffec6 100644 --- a/secret_store/src/node_key_pair.rs +++ b/secret_store/src/node_key_pair.rs @@ -18,7 +18,8 @@ use std::sync::Arc; use ethcrypto::ecdh::agree; use ethkey::{KeyPair, Public, Signature, Error as EthKeyError, sign}; use ethcore::account_provider::AccountProvider; -use util::{Address, H256}; +use bigint::hash::H256; +use util::Address; use traits::NodeKeyPair; pub struct PlainNodeKeyPair { diff --git a/secret_store/src/serialization.rs b/secret_store/src/serialization.rs index ad26bf7d4..4796a3fd7 100644 --- a/secret_store/src/serialization.rs +++ b/secret_store/src/serialization.rs @@ -21,7 +21,8 @@ use rustc_hex::{ToHex, FromHex}; use serde::{Serialize, Deserialize, Serializer, Deserializer}; use serde::de::{Visitor, Error as SerdeError}; use ethkey::{Public, Secret, Signature}; -use util::{H256, Bytes}; +use bigint::hash::H256; +use util::Bytes; /// Serializable message hash. pub type SerializableMessageHash = SerializableH256; diff --git a/secret_store/src/traits.rs b/secret_store/src/traits.rs index 31da748e0..6a65eacbd 100644 --- a/secret_store/src/traits.rs +++ b/secret_store/src/traits.rs @@ -15,7 +15,7 @@ // along with Parity. If not, see . use ethkey::{KeyPair, Signature, Error as EthKeyError}; -use util::H256; +use bigint::hash::H256; use types::all::{Error, Public, ServerKeyId, MessageHash, EncryptedMessageSignature, RequestSignature, EncryptedDocumentKey, EncryptedDocumentKeyShadow}; diff --git a/secret_store/src/types/all.rs b/secret_store/src/types/all.rs index 6867c82f3..fb57247cb 100644 --- a/secret_store/src/types/all.rs +++ b/secret_store/src/types/all.rs @@ -20,16 +20,17 @@ use serde_json; use ethkey; use util; +use bigint; use key_server_cluster; /// Node id. pub type NodeId = ethkey::Public; /// Server key id. When key is used to encrypt document, it could be document contents hash. -pub type ServerKeyId = util::H256; +pub type ServerKeyId = bigint::hash::H256; /// Encrypted document key type. pub type EncryptedDocumentKey = util::Bytes; /// Message hash. -pub type MessageHash = util::H256; +pub type MessageHash = bigint::hash::H256; /// Message signature. pub type EncryptedMessageSignature = util::Bytes; /// Request signature type. diff --git a/stratum/Cargo.toml b/stratum/Cargo.toml index 9bf75779f..9d6f22e9a 100644 --- a/stratum/Cargo.toml +++ b/stratum/Cargo.toml @@ -15,6 +15,7 @@ jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "pa jsonrpc-macros = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" } jsonrpc-tcp-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" } ethcore-util = { path = "../util" } +ethcore-bigint = { path = "../util/bigint" } ethcore-devtools = { path = "../devtools" } lazy_static = "0.2" env_logger = "0.4" diff --git a/stratum/src/lib.rs b/stratum/src/lib.rs index 0cffd67b6..15939f7f1 100644 --- a/stratum/src/lib.rs +++ b/stratum/src/lib.rs @@ -21,6 +21,7 @@ extern crate jsonrpc_core; extern crate jsonrpc_macros; #[macro_use] extern crate log; extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; extern crate ethcore_ipc as ipc; extern crate semver; extern crate futures; @@ -56,7 +57,8 @@ use std::sync::Arc; use std::net::SocketAddr; use std::collections::{HashSet, HashMap}; use hash::keccak; -use util::{H256, RwLock, RwLockReadGuard}; +use bigint::hash::H256; +use util::{RwLock, RwLockReadGuard}; type RpcResult = BoxFuture; diff --git a/stratum/src/traits.rs b/stratum/src/traits.rs index c2c522b3b..d37000076 100644 --- a/stratum/src/traits.rs +++ b/stratum/src/traits.rs @@ -16,7 +16,7 @@ use std; use std::error::Error as StdError; -use util::H256; +use bigint::hash::H256; use ipc::IpcConfig; use jsonrpc_tcp_server::PushMessageError; diff --git a/sync/Cargo.toml b/sync/Cargo.toml index 5fb3628df..6e01fd3db 100644 --- a/sync/Cargo.toml +++ b/sync/Cargo.toml @@ -13,6 +13,7 @@ ethcore-ipc-codegen = { path = "../ipc/codegen" } [dependencies] ethcore-util = { path = "../util" } +ethcore-bigint = { path = "../util/bigint" } ethcore-network = { path = "../util/network" } ethcore-io = { path = "../util/io" } ethcore-light = { path = "../ethcore/light"} diff --git a/sync/src/api.rs b/sync/src/api.rs index f3c5570ee..6f4b14970 100644 --- a/sync/src/api.rs +++ b/sync/src/api.rs @@ -20,7 +20,8 @@ use std::io; use util::Bytes; use network::{NetworkProtocolHandler, NetworkService, NetworkContext, HostInfo, PeerId, ProtocolId, NetworkConfiguration as BasicNetworkConfiguration, NonReservedPeerMode, NetworkError, ConnectionFilter}; -use util::{U256, H256, H512}; +use bigint::prelude::U256; +use bigint::hash::{H256, H512}; use io::{TimerToken}; use ethcore::ethstore::ethkey::Secret; use ethcore::client::{BlockChainClient, ChainNotify}; diff --git a/sync/src/block_sync.rs b/sync/src/block_sync.rs index 9f341d6de..68fa65564 100644 --- a/sync/src/block_sync.rs +++ b/sync/src/block_sync.rs @@ -21,7 +21,7 @@ use std::collections::{HashSet, VecDeque}; use std::cmp; use heapsize::HeapSizeOf; -use util::*; +use bigint::hash::H256; use rlp::*; use ethcore::views::{BlockView}; use ethcore::header::{BlockNumber, Header as BlockHeader}; diff --git a/sync/src/blocks.rs b/sync/src/blocks.rs index 77cb206c8..800834b4f 100644 --- a/sync/src/blocks.rs +++ b/sync/src/blocks.rs @@ -19,6 +19,7 @@ use std::collections::hash_map::Entry; use smallvec::SmallVec; use hash::{keccak, KECCAK_NULL_RLP, KECCAK_EMPTY_LIST_RLP}; use heapsize::HeapSizeOf; +use bigint::hash::H256; use util::*; use rlp::*; use network::NetworkError; diff --git a/sync/src/chain.rs b/sync/src/chain.rs index 432a0d0f5..bb5c6eb31 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -93,6 +93,8 @@ use std::collections::{HashSet, HashMap}; use std::cmp; use hash::keccak; use heapsize::HeapSizeOf; +use bigint::prelude::U256; +use bigint::hash::{H256, H256FastMap}; use util::*; use rlp::*; use network::*; @@ -2230,8 +2232,9 @@ mod tests { use network::PeerId; use tests::helpers::*; use tests::snapshot::TestSnapshotService; - use util::{U256, Address, RwLock}; - use util::hash::H256; + use bigint::prelude::U256; + use bigint::hash::H256; + use util::{Address, RwLock}; use util::bytes::Bytes; use rlp::{Rlp, RlpStream, UntrustedRlp}; use super::*; diff --git a/sync/src/lib.rs b/sync/src/lib.rs index 237d6c437..e32ecc984 100644 --- a/sync/src/lib.rs +++ b/sync/src/lib.rs @@ -28,6 +28,7 @@ //! extern crate ethcore_network as network; +extern crate ethcore_bigint as bigint; extern crate ethcore_io as io; extern crate ethcore; extern crate env_logger; diff --git a/sync/src/light_sync/mod.rs b/sync/src/light_sync/mod.rs index f05e4d7d0..9276ebf9b 100644 --- a/sync/src/light_sync/mod.rs +++ b/sync/src/light_sync/mod.rs @@ -45,7 +45,9 @@ use light::net::{ }; use light::request::{self, CompleteHeadersRequest as HeadersRequest}; use network::PeerId; -use util::{U256, H256, Mutex, RwLock}; +use bigint::prelude::U256; +use bigint::hash::H256; +use util::{Mutex, RwLock}; use rand::{Rng, OsRng}; use self::sync_round::{AbortReason, SyncRound, ResponseContext}; diff --git a/sync/src/light_sync/response.rs b/sync/src/light_sync/response.rs index 1ab504a9f..59a75dc1d 100644 --- a/sync/src/light_sync/response.rs +++ b/sync/src/light_sync/response.rs @@ -22,7 +22,7 @@ use ethcore::encoded; use ethcore::header::Header; use light::request::{HashOrNumber, CompleteHeadersRequest as HeadersRequest}; use rlp::DecoderError; -use util::H256; +use bigint::hash::H256; /// Errors found when decoding headers and verifying with basic constraints. #[derive(Debug, PartialEq)] diff --git a/sync/src/light_sync/sync_round.rs b/sync/src/light_sync/sync_round.rs index dfa17aad4..f8d1d438a 100644 --- a/sync/src/light_sync/sync_round.rs +++ b/sync/src/light_sync/sync_round.rs @@ -27,7 +27,7 @@ use light::net::ReqId; use light::request::CompleteHeadersRequest as HeadersRequest; use network::PeerId; -use util::H256; +use bigint::hash::H256; use super::response; diff --git a/sync/src/snapshot.rs b/sync/src/snapshot.rs index d3cdf274f..3abd47af4 100644 --- a/sync/src/snapshot.rs +++ b/sync/src/snapshot.rs @@ -15,7 +15,7 @@ // along with Parity. If not, see . use hash::keccak; -use util::H256; +use bigint::hash::H256; use std::collections::HashSet; use ethcore::snapshot::ManifestData; diff --git a/sync/src/tests/consensus.rs b/sync/src/tests/consensus.rs index a47c4a486..a9c26712d 100644 --- a/sync/src/tests/consensus.rs +++ b/sync/src/tests/consensus.rs @@ -16,6 +16,7 @@ use std::sync::Arc; use hash::keccak; +use bigint::prelude::U256; use util::*; use io::{IoHandler, IoContext, IoChannel}; use ethcore::client::{BlockChainClient, Client}; diff --git a/sync/src/tests/helpers.rs b/sync/src/tests/helpers.rs index 3ac68b0fb..90f72d251 100644 --- a/sync/src/tests/helpers.rs +++ b/sync/src/tests/helpers.rs @@ -16,6 +16,7 @@ use std::collections::{VecDeque, HashSet, HashMap}; use std::sync::Arc; +use bigint::hash::H256; use util::*; use network::*; use tests::snapshot::*; diff --git a/sync/src/tests/snapshot.rs b/sync/src/tests/snapshot.rs index d49bcf440..9337a6c45 100644 --- a/sync/src/tests/snapshot.rs +++ b/sync/src/tests/snapshot.rs @@ -17,6 +17,7 @@ use std::collections::HashMap; use std::sync::Arc; use hash::keccak; +use bigint::hash::H256; use util::*; use ethcore::snapshot::{SnapshotService, ManifestData, RestorationStatus}; use ethcore::header::BlockNumber; diff --git a/sync/src/transactions_stats.rs b/sync/src/transactions_stats.rs index dcd2702c8..7a1257cba 100644 --- a/sync/src/transactions_stats.rs +++ b/sync/src/transactions_stats.rs @@ -16,8 +16,7 @@ use api::TransactionStats; use std::collections::{HashSet, HashMap}; -use util::{H256, H512}; -use util::hash::H256FastMap; +use bigint::hash::{H256, H512, H256FastMap}; type NodeId = H512; type BlockNumber = u64; diff --git a/updater/Cargo.toml b/updater/Cargo.toml index bb6557f6d..7a8f8615c 100644 --- a/updater/Cargo.toml +++ b/updater/Cargo.toml @@ -16,6 +16,7 @@ target_info = "0.1" ethcore = { path = "../ethcore" } ethsync = { path = "../sync" } ethcore-util = { path = "../util" } +ethcore-bigint = { path = "../util/bigint" } futures = "0.1" parity-hash-fetch = { path = "../hash-fetch" } ipc-common-types = { path = "../ipc-common-types" } diff --git a/updater/src/lib.rs b/updater/src/lib.rs index b27f2039e..543fb29c1 100644 --- a/updater/src/lib.rs +++ b/updater/src/lib.rs @@ -18,6 +18,7 @@ #[macro_use] extern crate log; extern crate ethcore_util as util; +extern crate ethcore_bigint as bigint; extern crate ipc_common_types; extern crate parity_hash_fetch as hash_fetch; extern crate ethcore; diff --git a/updater/src/operations.rs b/updater/src/operations.rs index d94459bef..4ec53331c 100644 --- a/updater/src/operations.rs +++ b/updater/src/operations.rs @@ -5,6 +5,7 @@ use std::result::Result; use std::fmt; use ethabi; use util; +use bigint; pub struct Operations { contract: ethabi::Contract, @@ -35,7 +36,7 @@ impl Operations { /// Auto-generated from: `{"constant":true,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_release","type":"bytes32"}],"name":"isLatest","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn is_latest(&self, _client: &str, _release: &util::H256) -> Result { + pub fn is_latest(&self, _client: &str, _release: &bigint::hash::H256) -> Result { let call = self.contract.function("isLatest".into()).map_err(Self::as_string)?; let data = call.encode_call( vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::FixedBytes(_release.as_ref().to_owned())] @@ -47,7 +48,7 @@ impl Operations { /// Auto-generated from: `{"constant":false,"inputs":[{"name":"_txid","type":"bytes32"}],"name":"rejectTransaction","outputs":[],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn reject_transaction(&self, _txid: &util::H256) -> Result<(), String> { + pub fn reject_transaction(&self, _txid: &bigint::hash::H256) -> Result<(), String> { let call = self.contract.function("rejectTransaction".into()).map_err(Self::as_string)?; let data = call.encode_call( vec![ethabi::Token::FixedBytes(_txid.as_ref().to_owned())] @@ -71,10 +72,10 @@ impl Operations { /// Auto-generated from: `{"constant":false,"inputs":[{"name":"_number","type":"uint32"},{"name":"_name","type":"bytes32"},{"name":"_hard","type":"bool"},{"name":"_spec","type":"bytes32"}],"name":"proposeFork","outputs":[],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn propose_fork(&self, _number: u32, _name: &util::H256, _hard: bool, _spec: &util::H256) -> Result<(), String> { + pub fn propose_fork(&self, _number: u32, _name: &bigint::hash::H256, _hard: bool, _spec: &bigint::hash::H256) -> Result<(), String> { let call = self.contract.function("proposeFork".into()).map_err(Self::as_string)?; let data = call.encode_call( - vec![ethabi::Token::Uint({ let mut r = [0u8; 32]; util::U256::from(_number as u64).to_big_endian(&mut r); r }), ethabi::Token::FixedBytes(_name.as_ref().to_owned()), ethabi::Token::Bool(_hard), ethabi::Token::FixedBytes(_spec.as_ref().to_owned())] + vec![ethabi::Token::Uint({ let mut r = [0u8; 32]; bigint::prelude::U256::from(_number as u64).to_big_endian(&mut r); r }), ethabi::Token::FixedBytes(_name.as_ref().to_owned()), ethabi::Token::Bool(_hard), ethabi::Token::FixedBytes(_spec.as_ref().to_owned())] ).map_err(Self::as_string)?; call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; @@ -95,26 +96,26 @@ impl Operations { /// Auto-generated from: `{"constant":true,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_release","type":"bytes32"}],"name":"release","outputs":[{"name":"o_forkBlock","type":"uint32"},{"name":"o_track","type":"uint8"},{"name":"o_semver","type":"uint24"},{"name":"o_critical","type":"bool"}],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn release(&self, _client: &str, _release: &util::H256) -> Result<(u32, u8, u32, bool), String> { + pub fn release(&self, _client: &str, _release: &bigint::hash::H256) -> Result<(u32, u8, u32, bool), String> { let call = self.contract.function("release".into()).map_err(Self::as_string)?; let data = call.encode_call( vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::FixedBytes(_release.as_ref().to_owned())] ).map_err(Self::as_string)?; let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); - Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u32 }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u8 }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u32 }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r })) + Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()).as_u64() as u32 }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()).as_u64() as u8 }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()).as_u64() as u32 }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r })) } /// Auto-generated from: `{"constant":true,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_checksum","type":"bytes32"}],"name":"build","outputs":[{"name":"o_release","type":"bytes32"},{"name":"o_platform","type":"bytes32"}],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn build(&self, _client: &str, _checksum: &util::H256) -> Result<(util::H256, util::H256), String> { + pub fn build(&self, _client: &str, _checksum: &bigint::hash::H256) -> Result<(bigint::hash::H256, bigint::hash::H256), String> { let call = self.contract.function("build".into()).map_err(Self::as_string)?; let data = call.encode_call( vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::FixedBytes(_checksum.as_ref().to_owned())] ).map_err(Self::as_string)?; let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); - Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) })) + Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; bigint::hash::H256::from_slice(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; bigint::hash::H256::from_slice(r.as_ref()) })) } /// Auto-generated from: `{"constant":false,"inputs":[],"name":"rejectFork","outputs":[],"payable":false,"type":"function"}` @@ -131,7 +132,7 @@ impl Operations { /// Auto-generated from: `{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"client","outputs":[{"name":"owner","type":"address"},{"name":"required","type":"bool"}],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn client(&self, _1: &util::H256) -> Result<(util::Address, bool), String> { + pub fn client(&self, _1: &bigint::hash::H256) -> Result<(util::Address, bool), String> { let call = self.contract.function("client".into()).map_err(Self::as_string)?; let data = call.encode_call( vec![ethabi::Token::FixedBytes(_1.as_ref().to_owned())] @@ -155,19 +156,19 @@ impl Operations { /// Auto-generated from: `{"constant":true,"inputs":[{"name":"","type":"uint32"}],"name":"fork","outputs":[{"name":"name","type":"bytes32"},{"name":"spec","type":"bytes32"},{"name":"hard","type":"bool"},{"name":"ratified","type":"bool"},{"name":"requiredCount","type":"uint256"}],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn fork(&self, _1: u32) -> Result<(util::H256, util::H256, bool, bool, util::U256), String> { + pub fn fork(&self, _1: u32) -> Result<(bigint::hash::H256, bigint::hash::H256, bool, bool, bigint::prelude::U256), String> { let call = self.contract.function("fork".into()).map_err(Self::as_string)?; let data = call.encode_call( - vec![ethabi::Token::Uint({ let mut r = [0u8; 32]; util::U256::from(_1 as u64).to_big_endian(&mut r); r })] + vec![ethabi::Token::Uint({ let mut r = [0u8; 32]; bigint::prelude::U256::from(_1 as u64).to_big_endian(&mut r); r })] ).map_err(Self::as_string)?; let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); - Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) })) + Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; bigint::hash::H256::from_slice(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; bigint::hash::H256::from_slice(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()) })) } /// Auto-generated from: `{"constant":false,"inputs":[{"name":"_release","type":"bytes32"},{"name":"_platform","type":"bytes32"},{"name":"_checksum","type":"bytes32"}],"name":"addChecksum","outputs":[],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn add_checksum(&self, _release: &util::H256, _platform: &str, _checksum: &util::H256) -> Result<(), String> { + pub fn add_checksum(&self, _release: &bigint::hash::H256, _platform: &str, _checksum: &bigint::hash::H256) -> Result<(), String> { let call = self.contract.function("addChecksum".into()).map_err(Self::as_string)?; let data = call.encode_call( vec![ethabi::Token::FixedBytes(_release.as_ref().to_owned()), ethabi::Token::FixedBytes(_platform.as_bytes().to_owned()), ethabi::Token::FixedBytes(_checksum.as_ref().to_owned())] @@ -179,26 +180,26 @@ impl Operations { /// Auto-generated from: `{"constant":false,"inputs":[{"name":"_txid","type":"bytes32"}],"name":"confirmTransaction","outputs":[{"name":"txSuccess","type":"uint256"}],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn confirm_transaction(&self, _txid: &util::H256) -> Result { + pub fn confirm_transaction(&self, _txid: &bigint::hash::H256) -> Result { let call = self.contract.function("confirmTransaction".into()).map_err(Self::as_string)?; let data = call.encode_call( vec![ethabi::Token::FixedBytes(_txid.as_ref().to_owned())] ).map_err(Self::as_string)?; let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); - Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) })) + Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()) })) } /// Auto-generated from: `{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"proxy","outputs":[{"name":"requiredCount","type":"uint256"},{"name":"to","type":"address"},{"name":"data","type":"bytes"},{"name":"value","type":"uint256"},{"name":"gas","type":"uint256"}],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn proxy(&self, _1: &util::H256) -> Result<(util::U256, util::Address, Vec, util::U256, util::U256), String> { + pub fn proxy(&self, _1: &bigint::hash::H256) -> Result<(bigint::prelude::U256, util::Address, Vec, bigint::prelude::U256, bigint::prelude::U256), String> { let call = self.contract.function("proxy".into()).map_err(Self::as_string)?; let data = call.encode_call( vec![ethabi::Token::FixedBytes(_1.as_ref().to_owned())] ).map_err(Self::as_string)?; let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); - Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_address().ok_or("Invalid type returned")?; util::Address::from(r) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bytes().ok_or("Invalid type returned")?; r }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) })) + Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_address().ok_or("Invalid type returned")?; util::Address::from(r) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bytes().ok_or("Invalid type returned")?; r }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()) })) } /// Auto-generated from: `{"constant":false,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_owner","type":"address"}],"name":"addClient","outputs":[],"payable":false,"type":"function"}` @@ -215,26 +216,26 @@ impl Operations { /// Auto-generated from: `{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"clientOwner","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn client_owner(&self, _1: &util::Address) -> Result { + pub fn client_owner(&self, _1: &util::Address) -> Result { let call = self.contract.function("clientOwner".into()).map_err(Self::as_string)?; let data = call.encode_call( vec![ethabi::Token::Address(_1.clone().0)] ).map_err(Self::as_string)?; let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); - Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) })) + Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; bigint::hash::H256::from_slice(r.as_ref()) })) } /// Auto-generated from: `{"constant":false,"inputs":[{"name":"_txid","type":"bytes32"},{"name":"_to","type":"address"},{"name":"_data","type":"bytes"},{"name":"_value","type":"uint256"},{"name":"_gas","type":"uint256"}],"name":"proposeTransaction","outputs":[{"name":"txSuccess","type":"uint256"}],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn propose_transaction(&self, _txid: &util::H256, _to: &util::Address, _data: &[u8], _value: util::U256, _gas: util::U256) -> Result { + pub fn propose_transaction(&self, _txid: &bigint::hash::H256, _to: &util::Address, _data: &[u8], _value: bigint::prelude::U256, _gas: bigint::prelude::U256) -> Result { let call = self.contract.function("proposeTransaction".into()).map_err(Self::as_string)?; let data = call.encode_call( vec![ethabi::Token::FixedBytes(_txid.as_ref().to_owned()), ethabi::Token::Address(_to.clone().0), ethabi::Token::Bytes(_data.to_owned()), ethabi::Token::Uint({ let mut r = [0u8; 32]; _value.to_big_endian(&mut r); r }), ethabi::Token::Uint({ let mut r = [0u8; 32]; _gas.to_big_endian(&mut r); r })] ).map_err(Self::as_string)?; let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); - Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) })) + Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()) })) } /// Auto-generated from: `{"constant":true,"inputs":[],"name":"grandOwner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"}` @@ -251,10 +252,10 @@ impl Operations { /// Auto-generated from: `{"constant":false,"inputs":[{"name":"_release","type":"bytes32"},{"name":"_forkBlock","type":"uint32"},{"name":"_track","type":"uint8"},{"name":"_semver","type":"uint24"},{"name":"_critical","type":"bool"}],"name":"addRelease","outputs":[],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn add_release(&self, _release: &util::H256, _fork_block: u32, _track: u8, _semver: u32, _critical: bool) -> Result<(), String> { + pub fn add_release(&self, _release: &bigint::hash::H256, _fork_block: u32, _track: u8, _semver: u32, _critical: bool) -> Result<(), String> { let call = self.contract.function("addRelease".into()).map_err(Self::as_string)?; let data = call.encode_call( - vec![ethabi::Token::FixedBytes(_release.as_ref().to_owned()), ethabi::Token::Uint({ let mut r = [0u8; 32]; util::U256::from(_fork_block as u64).to_big_endian(&mut r); r }), ethabi::Token::Uint({ let mut r = [0u8; 32]; util::U256::from(_track as u64).to_big_endian(&mut r); r }), ethabi::Token::Uint({ let mut r = [0u8; 32]; util::U256::from(_semver as u64).to_big_endian(&mut r); r }), ethabi::Token::Bool(_critical)] + vec![ethabi::Token::FixedBytes(_release.as_ref().to_owned()), ethabi::Token::Uint({ let mut r = [0u8; 32]; bigint::prelude::U256::from(_fork_block as u64).to_big_endian(&mut r); r }), ethabi::Token::Uint({ let mut r = [0u8; 32]; bigint::prelude::U256::from(_track as u64).to_big_endian(&mut r); r }), ethabi::Token::Uint({ let mut r = [0u8; 32]; bigint::prelude::U256::from(_semver as u64).to_big_endian(&mut r); r }), ethabi::Token::Bool(_critical)] ).map_err(Self::as_string)?; call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; @@ -282,19 +283,19 @@ impl Operations { ).map_err(Self::as_string)?; let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); - Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u32 })) + Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()).as_u64() as u32 })) } /// Auto-generated from: `{"constant":true,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_release","type":"bytes32"}],"name":"track","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn track(&self, _client: &str, _release: &util::H256) -> Result { + pub fn track(&self, _client: &str, _release: &bigint::hash::H256) -> Result { let call = self.contract.function("track".into()).map_err(Self::as_string)?; let data = call.encode_call( vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::FixedBytes(_release.as_ref().to_owned())] ).map_err(Self::as_string)?; let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); - Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u8 })) + Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()).as_u64() as u8 })) } /// Auto-generated from: `{"constant":false,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_r","type":"bool"}],"name":"setClientRequired","outputs":[],"payable":false,"type":"function"}` @@ -318,31 +319,31 @@ impl Operations { ).map_err(Self::as_string)?; let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); - Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u32 })) + Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()).as_u64() as u32 })) } /// Auto-generated from: `{"constant":true,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_track","type":"uint8"}],"name":"latestInTrack","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn latest_in_track(&self, _client: &str, _track: u8) -> Result { + pub fn latest_in_track(&self, _client: &str, _track: u8) -> Result { let call = self.contract.function("latestInTrack".into()).map_err(Self::as_string)?; let data = call.encode_call( - vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::Uint({ let mut r = [0u8; 32]; util::U256::from(_track as u64).to_big_endian(&mut r); r })] + vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::Uint({ let mut r = [0u8; 32]; bigint::prelude::U256::from(_track as u64).to_big_endian(&mut r); r })] ).map_err(Self::as_string)?; let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); - Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) })) + Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; bigint::hash::H256::from_slice(r.as_ref()) })) } /// Auto-generated from: `{"constant":true,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_release","type":"bytes32"},{"name":"_platform","type":"bytes32"}],"name":"checksum","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"}` #[allow(dead_code)] - pub fn checksum(&self, _client: &str, _release: &util::H256, _platform: &str) -> Result { + pub fn checksum(&self, _client: &str, _release: &bigint::hash::H256, _platform: &str) -> Result { let call = self.contract.function("checksum".into()).map_err(Self::as_string)?; let data = call.encode_call( vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::FixedBytes(_release.as_ref().to_owned()), ethabi::Token::FixedBytes(_platform.as_bytes().to_owned())] ).map_err(Self::as_string)?; let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); - Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) })) + Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; bigint::hash::H256::from_slice(r.as_ref()) })) } /// Auto-generated from: `{"constant":true,"inputs":[],"name":"proposedFork","outputs":[{"name":"","type":"uint32"}],"payable":false,"type":"function"}` @@ -354,6 +355,6 @@ impl Operations { ).map_err(Self::as_string)?; let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); - Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u32 })) + Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()).as_u64() as u32 })) } } diff --git a/updater/src/types/all.rs b/updater/src/types/all.rs index dbb5f413a..aef1a0ce3 100644 --- a/updater/src/types/all.rs +++ b/updater/src/types/all.rs @@ -16,7 +16,7 @@ //! Types used in the public API -use util::{H256}; +use bigint::hash::H256; pub use ipc_common_types::{VersionInfo, ReleaseTrack}; /// Information regarding a particular release of Parity diff --git a/updater/src/updater.rs b/updater/src/updater.rs index 817688688..57d5e7aff 100644 --- a/updater/src/updater.rs +++ b/updater/src/updater.rs @@ -31,7 +31,8 @@ use path::restrict_permissions_owner; use service::{Service}; use target_info::Target; use types::all::{ReleaseInfo, OperationsInfo, CapState}; -use util::{Address, H160, H256, Mutex, Bytes}; +use bigint::hash::{H160, H256}; +use util::{Address, Mutex, Bytes}; use util::misc; /// Filter for releases. diff --git a/util/benches/trie.rs b/util/benches/trie.rs index 2ae10cf39..11b141a26 100644 --- a/util/benches/trie.rs +++ b/util/benches/trie.rs @@ -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::*; diff --git a/util/network/Cargo.toml b/util/network/Cargo.toml index 86f7867f4..f8d1e673b 100644 --- a/util/network/Cargo.toml +++ b/util/network/Cargo.toml @@ -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" } diff --git a/util/network/src/connection.rs b/util/network/src/connection.rs index 45bc5dd7b..f30d46838 100644 --- a/util/network/src/connection.rs +++ b/util/network/src/connection.rs @@ -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(); diff --git a/util/network/src/discovery.rs b/util/network/src/discovery.rs index f4025b26f..205f101bf 100644 --- a/util/network/src/discovery.rs +++ b/util/network/src/discovery.rs @@ -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; diff --git a/util/network/src/handshake.rs b/util/network/src/handshake.rs index 281bfd8d9..40ad57d6f 100644 --- a/util/network/src/handshake.rs +++ b/util/network/src/handshake.rs @@ -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; diff --git a/util/network/src/host.rs b/util/network/src/host.rs index caefc6738..13e5f74a3 100644 --- a/util/network/src/host.rs +++ b/util/network/src/host.rs @@ -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}; diff --git a/util/network/src/lib.rs b/util/network/src/lib.rs index accd6b0a2..beece7ad9 100644 --- a/util/network/src/lib.rs +++ b/util/network/src/lib.rs @@ -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; diff --git a/util/network/src/node_table.rs b/util/network/src/node_table.rs index f9d4e9589..3e63abdcb 100644 --- a/util/network/src/node_table.rs +++ b/util/network/src/node_table.rs @@ -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; diff --git a/util/network/src/session.rs b/util/network/src/session.rs index 8affb4cf7..dbdf065eb 100644 --- a/util/network/src/session.rs +++ b/util/network/src/session.rs @@ -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; diff --git a/util/src/hashdb.rs b/util/src/hashdb.rs index 3b52a2fec..3c149a1a3 100644 --- a/util/src/hashdb.rs +++ b/util/src/hashdb.rs @@ -15,7 +15,7 @@ // along with Parity. If not, see . //! 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()); diff --git a/util/src/journaldb/archivedb.rs b/util/src/journaldb/archivedb.rs index 3f4b948f3..734378a7e 100644 --- a/util/src/journaldb/archivedb.rs +++ b/util/src/journaldb/archivedb.rs @@ -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() { diff --git a/util/src/journaldb/earlymergedb.rs b/util/src/journaldb/earlymergedb.rs index dce7660f8..397c18059 100644 --- a/util/src/journaldb/earlymergedb.rs +++ b/util/src/journaldb/earlymergedb.rs @@ -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() { diff --git a/util/src/journaldb/overlayrecentdb.rs b/util/src/journaldb/overlayrecentdb.rs index d2f6cc741..dad0562d6 100644 --- a/util/src/journaldb/overlayrecentdb.rs +++ b/util/src/journaldb/overlayrecentdb.rs @@ -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()); diff --git a/util/src/journaldb/refcounteddb.rs b/util/src/journaldb/refcounteddb.rs index d0990b125..7b970d640 100644 --- a/util/src/journaldb/refcounteddb.rs +++ b/util/src/journaldb/refcounteddb.rs @@ -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. diff --git a/util/src/journaldb/traits.rs b/util/src/journaldb/traits.rs index 1f14e9765..b70bbdcd9 100644 --- a/util/src/journaldb/traits.rs +++ b/util/src/journaldb/traits.rs @@ -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. diff --git a/util/src/kvdb.rs b/util/src/kvdb.rs index 44321c531..50a4f127a 100644 --- a/util/src/kvdb.rs +++ b/util/src/kvdb.rs @@ -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; diff --git a/util/src/lib.rs b/util/src/lib.rs index 0f16609c7..aee93b99c 100644 --- a/util/src/lib.rs +++ b/util/src/lib.rs @@ -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; diff --git a/util/src/memorydb.rs b/util/src/memorydb.rs index b3a951569..bffb7ea29 100644 --- a/util/src/memorydb.rs +++ b/util/src/memorydb.rs @@ -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::*; diff --git a/util/src/overlaydb.rs b/util/src/overlaydb.rs index 80cc499b9..f2005fb7d 100644 --- a/util/src/overlaydb.rs +++ b/util/src/overlaydb.rs @@ -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::*; diff --git a/util/src/trie/fatdb.rs b/util/src/trie/fatdb.rs index 0ea5d2d65..0793c1ba5 100644 --- a/util/src/trie/fatdb.rs +++ b/util/src/trie/fatdb.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use hash::H256; +use bigint::hash::H256; use keccak::keccak; use hashdb::HashDB; use super::{TrieDB, Trie, TrieDBIterator, TrieItem, TrieIterator, Query}; diff --git a/util/src/trie/fatdbmut.rs b/util/src/trie/fatdbmut.rs index ebbcc92db..8267585f9 100644 --- a/util/src/trie/fatdbmut.rs +++ b/util/src/trie/fatdbmut.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use hash::H256; +use bigint::hash::H256; use keccak::keccak; use hashdb::{HashDB, DBValue}; use super::{TrieDBMut, TrieMut}; diff --git a/util/src/trie/lookup.rs b/util/src/trie/lookup.rs index d24a82e16..168cd00a3 100644 --- a/util/src/trie/lookup.rs +++ b/util/src/trie/lookup.rs @@ -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; diff --git a/util/src/trie/mod.rs b/util/src/trie/mod.rs index e4e9cd3ef..457cc13e8 100644 --- a/util/src/trie/mod.rs +++ b/util/src/trie/mod.rs @@ -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}; diff --git a/util/src/trie/recorder.rs b/util/src/trie/recorder.rs index 1366ccddd..f2b7fd91f 100644 --- a/util/src/trie/recorder.rs +++ b/util/src/trie/recorder.rs @@ -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() { diff --git a/util/src/trie/sectriedb.rs b/util/src/trie/sectriedb.rs index 59dbe5b3a..ce617d9d0 100644 --- a/util/src/trie/sectriedb.rs +++ b/util/src/trie/sectriedb.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use hash::H256; +use bigint::hash::H256; use keccak::keccak; use hashdb::HashDB; use super::triedb::TrieDB; diff --git a/util/src/trie/sectriedbmut.rs b/util/src/trie/sectriedbmut.rs index 9e53aaff1..b3790f27d 100644 --- a/util/src/trie/sectriedbmut.rs +++ b/util/src/trie/sectriedbmut.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use hash::H256; +use bigint::hash::H256; use keccak::keccak; use hashdb::{HashDB, DBValue}; use super::triedbmut::TrieDBMut; diff --git a/util/src/trie/standardmap.rs b/util/src/trie/standardmap.rs index 0c7c1537e..9da8bde74 100644 --- a/util/src/trie/standardmap.rs +++ b/util/src/trie/standardmap.rs @@ -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. diff --git a/util/src/trie/triedb.rs b/util/src/trie/triedb.rs index 0398aed51..208d257bb 100644 --- a/util/src/trie/triedb.rs +++ b/util/src/trie/triedb.rs @@ -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(); diff --git a/util/src/trie/triedbmut.rs b/util/src/trie/triedbmut.rs index fa23ca756..53b8694aa 100644 --- a/util/src/trie/triedbmut.rs +++ b/util/src/trie/triedbmut.rs @@ -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(); diff --git a/util/src/triehash.rs b/util/src/triehash.rs index fa790f3f4..93e5e7956 100644 --- a/util/src/triehash.rs +++ b/util/src/triehash.rs @@ -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(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(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]