diff --git a/Cargo.lock b/Cargo.lock index d6f38caa4..275c224f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -766,11 +766,11 @@ dependencies = [ "ethcore 1.11.0", "ethcore-bytes 0.1.0", "ethcore-logger 1.11.0", + "ethcore-sync 1.11.0", "ethcore-transaction 0.1.0", "ethcrypto 0.1.0", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethkey 0.3.0", - "ethsync 1.11.0", "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -802,7 +802,7 @@ dependencies = [ "ethcore 1.11.0", "ethcore-io 1.11.0", "ethcore-private-tx 1.0.0", - "ethsync 1.11.0", + "ethcore-sync 1.11.0", "kvdb 0.1.0", "kvdb-rocksdb 0.1.0", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -827,6 +827,37 @@ dependencies = [ "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ethcore-sync" +version = "1.11.0" +dependencies = [ + "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ethcore 1.11.0", + "ethcore-bytes 0.1.0", + "ethcore-io 1.11.0", + "ethcore-light 1.11.0", + "ethcore-network 1.11.0", + "ethcore-network-devp2p 1.11.0", + "ethcore-transaction 0.1.0", + "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethkey 0.3.0", + "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)", + "keccak-hash 0.1.0", + "kvdb 0.1.0", + "kvdb-memorydb 0.1.0", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "macros 0.1.0", + "parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "plain_hasher 0.1.0", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.2.1", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "triehash 0.1.0", +] + [[package]] name = "ethcore-transaction" version = "0.1.0" @@ -962,37 +993,6 @@ dependencies = [ "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "ethsync" -version = "1.11.0" -dependencies = [ - "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore 1.11.0", - "ethcore-bytes 0.1.0", - "ethcore-io 1.11.0", - "ethcore-light 1.11.0", - "ethcore-network 1.11.0", - "ethcore-network-devp2p 1.11.0", - "ethcore-transaction 0.1.0", - "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethkey 0.3.0", - "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)", - "keccak-hash 0.1.0", - "kvdb 0.1.0", - "kvdb-memorydb 0.1.0", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "macros 0.1.0", - "parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "plain_hasher 0.1.0", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.1", - "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "triehash 0.1.0", -] - [[package]] name = "evm" version = "0.1.0" @@ -1983,10 +1983,10 @@ dependencies = [ "ethcore-secretstore 1.0.0", "ethcore-service 0.1.0", "ethcore-stratum 1.11.0", + "ethcore-sync 1.11.0", "ethcore-transaction 0.1.0", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethkey 0.3.0", - "ethsync 1.11.0", "fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2187,13 +2187,13 @@ dependencies = [ "ethcore-miner 1.11.0", "ethcore-network 1.11.0", "ethcore-private-tx 1.0.0", + "ethcore-sync 1.11.0", "ethcore-transaction 0.1.0", "ethcrypto 0.1.0", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethjson 0.1.0", "ethkey 0.3.0", "ethstore 0.2.0", - "ethsync 1.11.0", "fetch 0.1.0", "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2320,8 +2320,8 @@ dependencies = [ "ethabi-derive 5.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.11.0", "ethcore-bytes 0.1.0", + "ethcore-sync 1.11.0", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethsync 1.11.0", "keccak-hash 0.1.0", "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 34d347d45..09c00b338 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,6 @@ fdlimit = "0.1" ws2_32-sys = "0.2" ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" } jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.11" } -ethsync = { path = "sync" } ethcore = { path = "ethcore" } ethcore-bytes = { path = "util/bytes" } ethcore-io = { path = "util/io" } @@ -45,6 +44,7 @@ ethcore-network = { path = "util/network" } ethcore-private-tx = { path = "ethcore/private-tx" } ethcore-service = { path = "ethcore/service" } ethcore-stratum = { path = "ethcore/stratum" } +ethcore-sync = { path = "ethcore/sync" } ethcore-transaction = { path = "ethcore/transaction" } ethereum-types = "0.3" node-filter = { path = "ethcore/node_filter" } diff --git a/ethcore/service/Cargo.toml b/ethcore/service/Cargo.toml index 608d591e0..b612baf56 100644 --- a/ethcore/service/Cargo.toml +++ b/ethcore/service/Cargo.toml @@ -9,7 +9,7 @@ error-chain = { version = "0.11", default-features = false } ethcore = { path = ".." } ethcore-io = { path = "../../util/io" } ethcore-private-tx = { path = "../private-tx" } -ethsync = { path = "../../sync" } +ethcore-sync = { path = "../sync" } kvdb = { path = "../../util/kvdb" } log = "0.3" stop-guard = { path = "../../util/stop-guard" } diff --git a/ethcore/service/src/lib.rs b/ethcore/service/src/lib.rs index 5bd1c39de..1604e84b1 100644 --- a/ethcore/service/src/lib.rs +++ b/ethcore/service/src/lib.rs @@ -17,9 +17,9 @@ extern crate ansi_term; extern crate ethcore; extern crate ethcore_io as io; -extern crate ethsync; -extern crate kvdb; extern crate ethcore_private_tx; +extern crate ethcore_sync as sync; +extern crate kvdb; extern crate stop_guard; #[macro_use] diff --git a/ethcore/service/src/service.rs b/ethcore/service/src/service.rs index 27f58b421..8fab54557 100644 --- a/ethcore/service/src/service.rs +++ b/ethcore/service/src/service.rs @@ -24,7 +24,7 @@ use io::{IoContext, TimerToken, IoHandler, IoService, IoError}; use kvdb::{KeyValueDB, KeyValueDBHandler}; use stop_guard::StopGuard; -use ethsync::PrivateTxHandler; +use sync::PrivateTxHandler; use ethcore::client::{Client, ClientConfig, ChainNotify, ClientIoMessage}; use ethcore::miner::Miner; use ethcore::snapshot::service::{Service as SnapshotService, ServiceParams as SnapServiceParams}; diff --git a/ethcore/sync/Cargo.toml b/ethcore/sync/Cargo.toml new file mode 100644 index 000000000..a09f161e2 --- /dev/null +++ b/ethcore/sync/Cargo.toml @@ -0,0 +1,37 @@ +[package] +description = "Ethcore blockchain sync" +name = "ethcore-sync" +version = "1.11.0" +license = "GPL-3.0" +authors = ["Parity Technologies "] + +[lib] + +[dependencies] +ethcore-bytes = { path = "../../util/bytes" } +ethcore-network = { path = "../../util/network" } +ethcore-network-devp2p = { path = "../../util/network-devp2p" } +ethcore-io = { path = "../../util/io" } +ethcore-light = { path = "../light" } +ethcore-transaction = { path = "../transaction" } +ethcore = { path = ".." } +ethereum-types = "0.3" +plain_hasher = { path = "../../util/plain_hasher" } +rlp = { path = "../../util/rlp" } +rustc-hex = "1.0" +keccak-hash = { path = "../../util/hash" } +triehash = { path = "../../util/triehash" } +kvdb = { path = "../../util/kvdb" } +macros = { path = "../../util/macros" } +log = "0.3" +env_logger = "0.4" +rand = "0.4" +heapsize = "0.4" +semver = "0.9" +smallvec = { version = "0.4", features = ["heapsizeof"] } +parking_lot = "0.5" +ipnetwork = "0.12.6" + +[dev-dependencies] +ethkey = { path = "../../ethkey" } +kvdb-memorydb = { path = "../../util/kvdb-memorydb" } diff --git a/sync/src/api.rs b/ethcore/sync/src/api.rs similarity index 100% rename from sync/src/api.rs rename to ethcore/sync/src/api.rs diff --git a/sync/src/block_sync.rs b/ethcore/sync/src/block_sync.rs similarity index 100% rename from sync/src/block_sync.rs rename to ethcore/sync/src/block_sync.rs diff --git a/sync/src/blocks.rs b/ethcore/sync/src/blocks.rs similarity index 100% rename from sync/src/blocks.rs rename to ethcore/sync/src/blocks.rs diff --git a/sync/src/chain.rs b/ethcore/sync/src/chain.rs similarity index 100% rename from sync/src/chain.rs rename to ethcore/sync/src/chain.rs diff --git a/sync/src/lib.rs b/ethcore/sync/src/lib.rs similarity index 100% rename from sync/src/lib.rs rename to ethcore/sync/src/lib.rs diff --git a/sync/src/light_sync/mod.rs b/ethcore/sync/src/light_sync/mod.rs similarity index 100% rename from sync/src/light_sync/mod.rs rename to ethcore/sync/src/light_sync/mod.rs diff --git a/sync/src/light_sync/response.rs b/ethcore/sync/src/light_sync/response.rs similarity index 100% rename from sync/src/light_sync/response.rs rename to ethcore/sync/src/light_sync/response.rs diff --git a/sync/src/light_sync/sync_round.rs b/ethcore/sync/src/light_sync/sync_round.rs similarity index 100% rename from sync/src/light_sync/sync_round.rs rename to ethcore/sync/src/light_sync/sync_round.rs diff --git a/sync/src/light_sync/tests/mod.rs b/ethcore/sync/src/light_sync/tests/mod.rs similarity index 100% rename from sync/src/light_sync/tests/mod.rs rename to ethcore/sync/src/light_sync/tests/mod.rs diff --git a/sync/src/light_sync/tests/test_net.rs b/ethcore/sync/src/light_sync/tests/test_net.rs similarity index 100% rename from sync/src/light_sync/tests/test_net.rs rename to ethcore/sync/src/light_sync/tests/test_net.rs diff --git a/sync/src/private_tx.rs b/ethcore/sync/src/private_tx.rs similarity index 100% rename from sync/src/private_tx.rs rename to ethcore/sync/src/private_tx.rs diff --git a/sync/src/snapshot.rs b/ethcore/sync/src/snapshot.rs similarity index 100% rename from sync/src/snapshot.rs rename to ethcore/sync/src/snapshot.rs diff --git a/sync/src/sync_io.rs b/ethcore/sync/src/sync_io.rs similarity index 100% rename from sync/src/sync_io.rs rename to ethcore/sync/src/sync_io.rs diff --git a/sync/src/tests/chain.rs b/ethcore/sync/src/tests/chain.rs similarity index 100% rename from sync/src/tests/chain.rs rename to ethcore/sync/src/tests/chain.rs diff --git a/sync/src/tests/consensus.rs b/ethcore/sync/src/tests/consensus.rs similarity index 100% rename from sync/src/tests/consensus.rs rename to ethcore/sync/src/tests/consensus.rs diff --git a/sync/src/tests/helpers.rs b/ethcore/sync/src/tests/helpers.rs similarity index 100% rename from sync/src/tests/helpers.rs rename to ethcore/sync/src/tests/helpers.rs diff --git a/sync/src/tests/mod.rs b/ethcore/sync/src/tests/mod.rs similarity index 100% rename from sync/src/tests/mod.rs rename to ethcore/sync/src/tests/mod.rs diff --git a/sync/src/tests/rpc.rs b/ethcore/sync/src/tests/rpc.rs similarity index 100% rename from sync/src/tests/rpc.rs rename to ethcore/sync/src/tests/rpc.rs diff --git a/sync/src/tests/snapshot.rs b/ethcore/sync/src/tests/snapshot.rs similarity index 100% rename from sync/src/tests/snapshot.rs rename to ethcore/sync/src/tests/snapshot.rs diff --git a/sync/src/transactions_stats.rs b/ethcore/sync/src/transactions_stats.rs similarity index 100% rename from sync/src/transactions_stats.rs rename to ethcore/sync/src/transactions_stats.rs diff --git a/parity/configuration.rs b/parity/configuration.rs index 7760fe470..3e8f58b6f 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -27,7 +27,7 @@ use ethereum_types::{U256, H256, Address}; use parity_version::{version_data, version}; use bytes::Bytes; use ansi_term::Colour; -use ethsync::{NetworkConfiguration, validate_node_url, self}; +use sync::{NetworkConfiguration, validate_node_url, self}; use ethcore::ethstore::ethkey::{Secret, Public}; use ethcore::client::{VMType}; use ethcore::miner::{MinerOptions, Banning, StratumOptions}; @@ -738,7 +738,7 @@ impl Configuration { for line in &lines { match validate_node_url(line).map(Into::into) { None => continue, - Some(ethsync::ErrorKind::AddressResolve(_)) => return Err(format!("Failed to resolve hostname of a boot node: {}", line)), + Some(sync::ErrorKind::AddressResolve(_)) => return Err(format!("Failed to resolve hostname of a boot node: {}", line)), Some(_) => return Err(format!("Invalid node address format given for a boot node: {}", line)), } } diff --git a/parity/dapps.rs b/parity/dapps.rs index d93ae2db7..42ff21b58 100644 --- a/parity/dapps.rs +++ b/parity/dapps.rs @@ -21,7 +21,7 @@ use bytes::Bytes; use dir::default_data_path; use dir::helpers::replace_home; use ethcore::client::{Client, BlockChainClient, BlockId, CallContract}; -use ethsync::LightSync; +use sync::LightSync; use futures::{Future, future, IntoFuture}; use futures_cpupool::CpuPool; use hash_fetch::fetch::Client as FetchClient; diff --git a/parity/helpers.rs b/parity/helpers.rs index 1c6c70cda..0494be40d 100644 --- a/parity/helpers.rs +++ b/parity/helpers.rs @@ -31,7 +31,7 @@ use dir::DatabaseDirectories; use dir::helpers::replace_home; use upgrade::{upgrade, upgrade_data_paths}; use migration::migrate; -use ethsync::{validate_node_url, self}; +use sync::{validate_node_url, self}; use kvdb::{KeyValueDB, KeyValueDBHandler}; use kvdb_rocksdb::{Database, DatabaseConfig, CompactionProfile}; use path; @@ -174,7 +174,7 @@ pub fn to_bootnodes(bootnodes: &Option) -> Result, String> { Some(ref x) if !x.is_empty() => x.split(',').map(|s| { match validate_node_url(s).map(Into::into) { None => Ok(s.to_owned()), - Some(ethsync::ErrorKind::AddressResolve(_)) => Err(format!("Failed to resolve hostname of a boot node: {}", s)), + Some(sync::ErrorKind::AddressResolve(_)) => Err(format!("Failed to resolve hostname of a boot node: {}", s)), Some(_) => Err(format!("Invalid node address format given for a boot node: {}", s)), } }).collect(), @@ -184,8 +184,8 @@ pub fn to_bootnodes(bootnodes: &Option) -> Result, String> { } #[cfg(test)] -pub fn default_network_config() -> ::ethsync::NetworkConfiguration { - use ethsync::{NetworkConfiguration}; +pub fn default_network_config() -> ::sync::NetworkConfiguration { + use sync::{NetworkConfiguration}; use super::network::IpFilter; NetworkConfiguration { config_path: Some(replace_home(&::dir::default_data_path(), "$BASE/network")), diff --git a/parity/informant.rs b/parity/informant.rs index b834b018d..2ccc622a7 100644 --- a/parity/informant.rs +++ b/parity/informant.rs @@ -29,7 +29,7 @@ use ethcore::client::{ use ethcore::header::BlockNumber; use ethcore::snapshot::{RestorationStatus, SnapshotService as SS}; use ethcore::snapshot::service::Service as SnapshotService; -use ethsync::{LightSyncProvider, LightSync, SyncProvider, ManageNetwork}; +use sync::{LightSyncProvider, LightSync, SyncProvider, ManageNetwork}; use io::{TimerToken, IoContext, IoHandler}; use isatty::{stdout_isatty}; use light::Cache as LightDataCache; diff --git a/parity/light_helpers/epoch_fetch.rs b/parity/light_helpers/epoch_fetch.rs index ff384c131..1b9ae8648 100644 --- a/parity/light_helpers/epoch_fetch.rs +++ b/parity/light_helpers/epoch_fetch.rs @@ -21,7 +21,7 @@ use ethcore::engines::{EthEngine, StateDependentProof}; use ethcore::header::Header; use ethcore::machine::EthereumMachine; use ethcore::receipt::Receipt; -use ethsync::LightSync; +use sync::LightSync; use futures::{future, Future}; use futures::future::Either; diff --git a/parity/light_helpers/queue_cull.rs b/parity/light_helpers/queue_cull.rs index 9acf2bf1f..0d0ff6d45 100644 --- a/parity/light_helpers/queue_cull.rs +++ b/parity/light_helpers/queue_cull.rs @@ -20,7 +20,7 @@ use std::sync::Arc; use std::time::Duration; use ethcore::client::ClientIoMessage; -use ethsync::LightSync; +use sync::LightSync; use io::{IoContext, IoHandler, TimerToken}; use light::client::LightChainClient; diff --git a/parity/main.rs b/parity/main.rs index 9ff3d97ab..7179996bf 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -55,10 +55,10 @@ extern crate ethcore_miner as miner; extern crate ethcore_network as network; extern crate ethcore_private_tx; extern crate ethcore_service; +extern crate ethcore_sync as sync; extern crate ethcore_transaction as transaction; extern crate ethereum_types; extern crate ethkey; -extern crate ethsync; extern crate kvdb; extern crate kvdb_rocksdb; extern crate migration as migr; diff --git a/parity/modules.rs b/parity/modules.rs index 22f8afe9f..cf46149b8 100644 --- a/parity/modules.rs +++ b/parity/modules.rs @@ -17,11 +17,11 @@ use std::sync::Arc; use ethcore::client::BlockChainClient; -use ethsync::{self, AttachedProtocol, SyncConfig, NetworkConfiguration, Params, ConnectionFilter}; +use sync::{self, AttachedProtocol, SyncConfig, NetworkConfiguration, Params, ConnectionFilter}; use ethcore::snapshot::SnapshotService; use light::Provider; -pub use ethsync::{EthSync, SyncProvider, ManageNetwork, PrivateTxHandler}; +pub use sync::{EthSync, SyncProvider, ManageNetwork, PrivateTxHandler}; pub use ethcore::client::ChainNotify; use ethcore_logger::Config as LogConfig; @@ -37,7 +37,7 @@ pub fn sync( _log_settings: &LogConfig, attached_protos: Vec, connection_filter: Option>, -) -> Result { +) -> Result { let eth_sync = EthSync::new(Params { config: sync_cfg, chain: client, diff --git a/parity/rpc_apis.rs b/parity/rpc_apis.rs index 23a69755f..7b914f286 100644 --- a/parity/rpc_apis.rs +++ b/parity/rpc_apis.rs @@ -28,7 +28,7 @@ use ethcore::client::Client; use ethcore::miner::Miner; use ethcore::snapshot::SnapshotService; use ethcore_logger::RotatingLogger; -use ethsync::{ManageNetwork, SyncProvider, LightSync}; +use sync::{ManageNetwork, SyncProvider, LightSync}; use futures_cpupool::CpuPool; use hash_fetch::fetch::Client as FetchClient; use jsonrpc_core::{self as core, MetaIoHandler}; diff --git a/parity/run.rs b/parity/run.rs index 9d43801ac..9db2f1ca4 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -34,7 +34,7 @@ use ethcore::spec::{SpecParams, OptimizeFor}; use ethcore::verification::queue::VerifierSettings; use ethcore_logger::{Config as LogConfig, RotatingLogger}; use ethcore_service::ClientService; -use ethsync::{self, SyncConfig}; +use sync::{self, SyncConfig}; use fdlimit::raise_fd_limit; use futures_cpupool::CpuPool; use hash_fetch::{self, fetch}; @@ -99,7 +99,7 @@ pub struct RunCmd { pub ws_conf: rpc::WsConfiguration, pub http_conf: rpc::HttpConfiguration, pub ipc_conf: rpc::IpcConfiguration, - pub net_conf: ethsync::NetworkConfiguration, + pub net_conf: sync::NetworkConfiguration, pub network_id: Option, pub warp_sync: bool, pub warp_barrier: Option, @@ -188,7 +188,7 @@ type LightClient = ::light::client::Client<::light_helpers::EpochFetch>; // helper for light execution. fn execute_light_impl(cmd: RunCmd, logger: Arc) -> Result { use light::client as light_client; - use ethsync::{LightSyncParams, LightSync, ManageNetwork}; + use sync::{LightSyncParams, LightSync, ManageNetwork}; use parking_lot::{Mutex, RwLock}; // load spec @@ -290,7 +290,7 @@ fn execute_light_impl(cmd: RunCmd, logger: Arc) -> Result) -> Result bool { self.0.is_major_importing() } fn peers(&self) -> (usize, usize) { - let peers = ethsync::LightSyncProvider::peer_numbers(&*self.0); + let peers = sync::LightSyncProvider::peer_numbers(&*self.0); (peers.connected, peers.max) } } @@ -535,9 +535,9 @@ fn execute_impl(cmd: RunCmd, logger: Arc, on_client_rq: } } sync_config.warp_sync = match (warp_sync, cmd.warp_barrier) { - (true, Some(block)) => ethsync::WarpSync::OnlyAndAfter(block), - (true, _) => ethsync::WarpSync::Enabled, - _ => ethsync::WarpSync::Disabled, + (true, Some(block)) => sync::WarpSync::OnlyAndAfter(block), + (true, _) => sync::WarpSync::Enabled, + _ => sync::WarpSync::Disabled, }; sync_config.download_old_blocks = cmd.download_old_blocks; sync_config.serve_light = cmd.serve_light; @@ -711,7 +711,7 @@ fn execute_impl(cmd: RunCmd, logger: Arc, on_client_rq: client.clone(), &cmd.logger_config, attached_protos, - connection_filter.clone().map(|f| f as Arc<::ethsync::ConnectionFilter + 'static>), + connection_filter.clone().map(|f| f as Arc<::sync::ConnectionFilter + 'static>), ).map_err(|e| format!("Sync error: {}", e))?; service.add_notify(chain_notify.clone()); @@ -758,7 +758,7 @@ fn execute_impl(cmd: RunCmd, logger: Arc, on_client_rq: let (node_health, dapps_deps) = { let (sync, client) = (sync_provider.clone(), client.clone()); - struct SyncStatus(Arc, Arc, ethsync::NetworkConfiguration); + struct SyncStatus(Arc, Arc, sync::NetworkConfiguration); impl fmt::Debug for SyncStatus { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "Dapps Sync Status") diff --git a/parity/secretstore.rs b/parity/secretstore.rs index 8e9f5fef5..9c130a59a 100644 --- a/parity/secretstore.rs +++ b/parity/secretstore.rs @@ -22,7 +22,7 @@ use ethcore::account_provider::AccountProvider; use ethcore::client::Client; use ethcore::miner::Miner; use ethkey::{Secret, Public}; -use ethsync::SyncProvider; +use sync::SyncProvider; use ethereum_types::Address; /// This node secret key. diff --git a/parity/whisper.rs b/parity/whisper.rs index ed4812063..c7acd8f9d 100644 --- a/parity/whisper.rs +++ b/parity/whisper.rs @@ -17,7 +17,7 @@ use std::sync::Arc; use std::io; -use ethsync::{AttachedProtocol, ManageNetwork}; +use sync::{AttachedProtocol, ManageNetwork}; use parity_rpc::Metadata; use parity_whisper::message::Message; use parity_whisper::net::{self as whisper_net, Network as WhisperNetwork}; diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index ed59a91e8..7f975ca9d 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -45,6 +45,7 @@ ethcore-light = { path = "../ethcore/light" } ethcore-logger = { path = "../logger" } ethcore-miner = { path = "../miner" } ethcore-private-tx = { path = "../ethcore/private-tx" } +ethcore-sync = { path = "../ethcore/sync" } ethcore-transaction = { path = "../ethcore/transaction" } ethereum-types = "0.3" @@ -52,7 +53,6 @@ ethcrypto = { path = "../ethcrypto" } ethjson = { path = "../json" } ethkey = { path = "../ethkey" } ethstore = { path = "../ethstore" } -ethsync = { path = "../sync" } fetch = { path = "../util/fetch" } hardware-wallet = { path = "../hw" } keccak-hash = { path = "../util/hash" } diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 79911938b..13e700375 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -49,14 +49,15 @@ extern crate ethcore_bytes as bytes; extern crate ethcore_devtools as devtools; extern crate ethcore_io as io; extern crate ethcore_light as light; +extern crate ethcore_logger; extern crate ethcore_miner as miner; +extern crate ethcore_private_tx; +extern crate ethcore_sync as sync; extern crate ethcore_transaction as transaction; extern crate ethcrypto as crypto; extern crate ethereum_types; extern crate ethkey; extern crate ethstore; -extern crate ethsync; -extern crate ethcore_logger; extern crate vm; extern crate fetch; extern crate node_health; @@ -67,7 +68,6 @@ extern crate rlp; extern crate stats; extern crate keccak_hash as hash; extern crate hardware_wallet; -extern crate ethcore_private_tx; extern crate patricia_trie as trie; #[macro_use] diff --git a/rpc/src/v1/helpers/block_import.rs b/rpc/src/v1/helpers/block_import.rs index 3c3f84635..1246faa65 100644 --- a/rpc/src/v1/helpers/block_import.rs +++ b/rpc/src/v1/helpers/block_import.rs @@ -17,7 +17,7 @@ //! Block import analysis functions. use ethcore::client::BlockQueueInfo; -use ethsync::SyncState; +use sync::SyncState; /// Check if client is during major sync or during block import. pub fn is_major_importing(sync_state: Option, queue_info: BlockQueueInfo) -> bool { @@ -32,7 +32,7 @@ pub fn is_major_importing(sync_state: Option, queue_info: BlockQueueI #[cfg(test)] mod tests { use ethcore::client::BlockQueueInfo; - use ethsync::SyncState; + use sync::SyncState; use super::is_major_importing; diff --git a/rpc/src/v1/helpers/dispatch.rs b/rpc/src/v1/helpers/dispatch.rs index b082320d5..b1fc07a22 100644 --- a/rpc/src/v1/helpers/dispatch.rs +++ b/rpc/src/v1/helpers/dispatch.rs @@ -32,7 +32,7 @@ use parking_lot::{Mutex, RwLock}; use stats::Corpus; use ethkey::Signature; -use ethsync::LightSync; +use sync::LightSync; use ethcore::ids::BlockId; use ethcore::miner::MinerService; use ethcore::client::MiningBlockChainClient; diff --git a/rpc/src/v1/helpers/light_fetch.rs b/rpc/src/v1/helpers/light_fetch.rs index f0c389d57..d8a157da2 100644 --- a/rpc/src/v1/helpers/light_fetch.rs +++ b/rpc/src/v1/helpers/light_fetch.rs @@ -36,7 +36,7 @@ use light::cht; use light::on_demand::{request, OnDemand, HeaderRef, Request as OnDemandRequest, Response as OnDemandResponse}; use light::request::Field; -use ethsync::LightSync; +use sync::LightSync; use ethereum_types::{U256, Address}; use hash::H256; use parking_lot::Mutex; diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index 4c48ccb61..c833e3ee7 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -35,7 +35,7 @@ use ethcore::log_entry::LogEntry; use ethcore::miner::MinerService; use ethcore::snapshot::SnapshotService; use ethcore::encoded; -use ethsync::{SyncProvider}; +use sync::{SyncProvider}; use miner::external::ExternalMinerService; use transaction::{SignedTransaction, LocalizedTransaction}; diff --git a/rpc/src/v1/impls/eth_pubsub.rs b/rpc/src/v1/impls/eth_pubsub.rs index 315fc2f4f..d7e6112a9 100644 --- a/rpc/src/v1/impls/eth_pubsub.rs +++ b/rpc/src/v1/impls/eth_pubsub.rs @@ -34,7 +34,7 @@ use v1::types::{pubsub, RichHeader, Log}; use ethcore::encoded; use ethcore::filter::Filter as EthFilter; use ethcore::client::{BlockChainClient, ChainNotify, BlockId}; -use ethsync::LightSync; +use sync::LightSync; use light::cache::Cache; use light::on_demand::OnDemand; use light::client::{LightChainClient, LightChainNotify}; diff --git a/rpc/src/v1/impls/light/eth.rs b/rpc/src/v1/impls/light/eth.rs index b449a2a22..c617c03b1 100644 --- a/rpc/src/v1/impls/light/eth.rs +++ b/rpc/src/v1/impls/light/eth.rs @@ -32,7 +32,7 @@ use ethcore::account_provider::{AccountProvider, DappId}; use ethcore::encoded; use ethcore::filter::Filter as EthcoreFilter; use ethcore::ids::BlockId; -use ethsync::LightSync; +use sync::LightSync; use hash::{KECCAK_NULL_RLP, KECCAK_EMPTY_LIST_RLP}; use ethereum_types::U256; use parking_lot::{RwLock, Mutex}; diff --git a/rpc/src/v1/impls/light/net.rs b/rpc/src/v1/impls/light/net.rs index 3491b35ba..1b374247a 100644 --- a/rpc/src/v1/impls/light/net.rs +++ b/rpc/src/v1/impls/light/net.rs @@ -17,7 +17,7 @@ //! Net rpc implementation. use std::sync::Arc; use jsonrpc_core::Result; -use ethsync::LightSyncProvider; +use sync::LightSyncProvider; use v1::traits::Net; /// Net rpc implementation. diff --git a/rpc/src/v1/impls/light/parity.rs b/rpc/src/v1/impls/light/parity.rs index 3b2fab9a3..e1dc8d4d3 100644 --- a/rpc/src/v1/impls/light/parity.rs +++ b/rpc/src/v1/impls/light/parity.rs @@ -23,7 +23,7 @@ use version::version_data; use crypto::{ecies, DEFAULT_MAC}; use ethkey::{Brain, Generator}; use ethstore::random_phrase; -use ethsync::LightSyncProvider; +use sync::LightSyncProvider; use ethcore::account_provider::AccountProvider; use ethcore_logger::RotatingLogger; use node_health::{NodeHealth, Health}; diff --git a/rpc/src/v1/impls/light/parity_set.rs b/rpc/src/v1/impls/light/parity_set.rs index 0a6c2c5a5..76c33cf45 100644 --- a/rpc/src/v1/impls/light/parity_set.rs +++ b/rpc/src/v1/impls/light/parity_set.rs @@ -20,7 +20,7 @@ use std::io; use std::sync::Arc; -use ethsync::ManageNetwork; +use sync::ManageNetwork; use fetch::{self, Fetch}; use futures_cpupool::CpuPool; use hash::keccak_buffer; diff --git a/rpc/src/v1/impls/net.rs b/rpc/src/v1/impls/net.rs index 50dbffdc7..3f42f01b9 100644 --- a/rpc/src/v1/impls/net.rs +++ b/rpc/src/v1/impls/net.rs @@ -17,7 +17,7 @@ //! Net rpc implementation. use std::sync::Arc; use jsonrpc_core::Result; -use ethsync::SyncProvider; +use sync::SyncProvider; use v1::traits::Net; /// Net rpc implementation. diff --git a/rpc/src/v1/impls/parity.rs b/rpc/src/v1/impls/parity.rs index 95c810aa1..451556e85 100644 --- a/rpc/src/v1/impls/parity.rs +++ b/rpc/src/v1/impls/parity.rs @@ -25,7 +25,7 @@ use version::version_data; use crypto::{DEFAULT_MAC, ecies}; use ethkey::{Brain, Generator}; use ethstore::random_phrase; -use ethsync::{SyncProvider, ManageNetwork}; +use sync::{SyncProvider, ManageNetwork}; use ethcore::account_provider::AccountProvider; use ethcore::client::{MiningBlockChainClient, StateClient, Call}; use ethcore::ids::BlockId; diff --git a/rpc/src/v1/impls/parity_set.rs b/rpc/src/v1/impls/parity_set.rs index 1be136e1d..475f5e019 100644 --- a/rpc/src/v1/impls/parity_set.rs +++ b/rpc/src/v1/impls/parity_set.rs @@ -21,7 +21,7 @@ use std::sync::Arc; use ethcore::miner::MinerService; use ethcore::client::MiningBlockChainClient; use ethcore::mode::Mode; -use ethsync::ManageNetwork; +use sync::ManageNetwork; use fetch::{self, Fetch}; use futures_cpupool::CpuPool; use hash::keccak_buffer; diff --git a/rpc/src/v1/tests/helpers/sync_provider.rs b/rpc/src/v1/tests/helpers/sync_provider.rs index cbe665423..a5ca4a4b3 100644 --- a/rpc/src/v1/tests/helpers/sync_provider.rs +++ b/rpc/src/v1/tests/helpers/sync_provider.rs @@ -19,7 +19,7 @@ use std::collections::BTreeMap; use ethereum_types::H256; use parking_lot::RwLock; -use ethsync::{SyncProvider, EthProtocolInfo, SyncStatus, SyncState, PeerInfo, TransactionStats}; +use sync::{SyncProvider, EthProtocolInfo, SyncStatus, SyncState, PeerInfo, TransactionStats}; /// TestSyncProvider config. pub struct Config { diff --git a/rpc/src/v1/tests/mocked/eth.rs b/rpc/src/v1/tests/mocked/eth.rs index 99c67286e..e79411f70 100644 --- a/rpc/src/v1/tests/mocked/eth.rs +++ b/rpc/src/v1/tests/mocked/eth.rs @@ -27,7 +27,7 @@ use ethcore::log_entry::{LocalizedLogEntry, LogEntry}; use ethcore::miner::MinerService; use ethcore::receipt::{LocalizedReceipt, TransactionOutcome}; use ethkey::Secret; -use ethsync::SyncState; +use sync::SyncState; use miner::external::ExternalMiner; use rlp; use rustc_hex::{FromHex, ToHex}; diff --git a/rpc/src/v1/tests/mocked/manage_network.rs b/rpc/src/v1/tests/mocked/manage_network.rs index 9438429cd..3a901c8e9 100644 --- a/rpc/src/v1/tests/mocked/manage_network.rs +++ b/rpc/src/v1/tests/mocked/manage_network.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use ethsync::{ManageNetwork, NetworkConfiguration}; +use sync::{ManageNetwork, NetworkConfiguration}; use self::ethcore_network::{ProtocolId, NetworkContext}; extern crate ethcore_network; diff --git a/rpc/src/v1/tests/mocked/parity.rs b/rpc/src/v1/tests/mocked/parity.rs index 332221b08..18f76c671 100644 --- a/rpc/src/v1/tests/mocked/parity.rs +++ b/rpc/src/v1/tests/mocked/parity.rs @@ -20,7 +20,7 @@ use ethcore::client::{TestBlockChainClient, Executed}; use ethcore::miner::LocalTransactionStatus; use ethcore_logger::RotatingLogger; use ethstore::ethkey::{Generator, Random}; -use ethsync::ManageNetwork; +use sync::ManageNetwork; use node_health::{self, NodeHealth}; use parity_reactor; use ethereum_types::{Address, U256, H256}; diff --git a/rpc/src/v1/tests/mocked/parity_set.rs b/rpc/src/v1/tests/mocked/parity_set.rs index 549811bd5..2ae8ab5b2 100644 --- a/rpc/src/v1/tests/mocked/parity_set.rs +++ b/rpc/src/v1/tests/mocked/parity_set.rs @@ -21,7 +21,7 @@ use ethereum_types::{U256, Address}; use ethcore::miner::MinerService; use ethcore::client::TestBlockChainClient; -use ethsync::ManageNetwork; +use sync::ManageNetwork; use futures_cpupool::CpuPool; use jsonrpc_core::IoHandler; diff --git a/rpc/src/v1/types/sync.rs b/rpc/src/v1/types/sync.rs index ae421ed40..cbac3e1bb 100644 --- a/rpc/src/v1/types/sync.rs +++ b/rpc/src/v1/types/sync.rs @@ -15,7 +15,7 @@ // along with Parity. If not, see . use std::collections::BTreeMap; -use ethsync::{self, PeerInfo as SyncPeerInfo, TransactionStats as SyncTransactionStats}; +use sync::{self, PeerInfo as SyncPeerInfo, TransactionStats as SyncTransactionStats}; use serde::{Serialize, Serializer}; use v1::types::{U256, H512}; @@ -98,8 +98,8 @@ pub struct EthProtocolInfo { pub head: String, } -impl From for EthProtocolInfo { - fn from(info: ethsync::EthProtocolInfo) -> Self { +impl From for EthProtocolInfo { + fn from(info: sync::EthProtocolInfo) -> Self { EthProtocolInfo { version: info.version, difficulty: info.difficulty.map(Into::into), @@ -119,8 +119,8 @@ pub struct PipProtocolInfo { pub head: String, } -impl From for PipProtocolInfo { - fn from(info: ethsync::PipProtocolInfo) -> Self { +impl From for PipProtocolInfo { + fn from(info: sync::PipProtocolInfo) -> Self { PipProtocolInfo { version: info.version, difficulty: info.difficulty.into(), diff --git a/secret_store/Cargo.toml b/secret_store/Cargo.toml index d894bb4ef..b9dee7303 100644 --- a/secret_store/Cargo.toml +++ b/secret_store/Cargo.toml @@ -24,9 +24,9 @@ tokio-proto = "0.1" url = "1.0" ethcore = { path = "../ethcore" } ethcore-bytes = { path = "../util/bytes" } +ethcore-sync = { path = "../ethcore/sync" } ethcore-transaction = { path = "../ethcore/transaction" } ethereum-types = "0.3" -ethsync = { path = "../sync" } kvdb = { path = "../util/kvdb" } kvdb-rocksdb = { path = "../util/kvdb-rocksdb" } keccak-hash = { path = "../util/hash" } diff --git a/secret_store/src/lib.rs b/secret_store/src/lib.rs index d58e37ffe..c087d6651 100644 --- a/secret_store/src/lib.rs +++ b/secret_store/src/lib.rs @@ -19,11 +19,11 @@ extern crate ethabi; extern crate ethcore; extern crate ethcore_bytes as bytes; extern crate ethcore_logger as logger; +extern crate ethcore_sync as sync; extern crate ethcore_transaction as transaction; extern crate ethcrypto; extern crate ethereum_types; extern crate ethkey; -extern crate ethsync; extern crate futures_cpupool; extern crate hyper; extern crate keccak_hash as hash; @@ -70,7 +70,7 @@ mod trusted_client; use std::sync::Arc; use ethcore::client::Client; use ethcore::miner::Miner; -use ethsync::SyncProvider; +use sync::SyncProvider; pub use types::all::{ServerKeyId, EncryptedDocumentKey, RequestSignature, Public, Error, NodeAddress, ContractAddress, ServiceConfiguration, ClusterConfiguration}; diff --git a/secret_store/src/trusted_client.rs b/secret_store/src/trusted_client.rs index e40961e04..5a9efe4b6 100644 --- a/secret_store/src/trusted_client.rs +++ b/secret_store/src/trusted_client.rs @@ -19,7 +19,7 @@ use bytes::Bytes; use ethereum_types::Address; use ethcore::client::{Client, BlockChainClient, ChainInfo, Nonce}; use ethcore::miner::{Miner, MinerService}; -use ethsync::SyncProvider; +use sync::SyncProvider; use transaction::{Transaction, SignedTransaction, Action}; use {Error, NodeKeyPair}; diff --git a/sync/Cargo.toml b/sync/Cargo.toml deleted file mode 100644 index 23cbbcf34..000000000 --- a/sync/Cargo.toml +++ /dev/null @@ -1,37 +0,0 @@ -[package] -description = "Ethcore blockchain sync" -name = "ethsync" -version = "1.11.0" -license = "GPL-3.0" -authors = ["Parity Technologies "] - -[lib] - -[dependencies] -ethcore-bytes = { path = "../util/bytes" } -ethcore-network = { path = "../util/network" } -ethcore-network-devp2p = { path = "../util/network-devp2p" } -ethcore-io = { path = "../util/io" } -ethcore-light = { path = "../ethcore/light" } -ethcore-transaction = { path = "../ethcore/transaction" } -ethcore = { path = "../ethcore" } -ethereum-types = "0.3" -plain_hasher = { path = "../util/plain_hasher" } -rlp = { path = "../util/rlp" } -rustc-hex = "1.0" -keccak-hash = { path = "../util/hash" } -triehash = { path = "../util/triehash" } -kvdb = { path = "../util/kvdb" } -macros = { path = "../util/macros" } -log = "0.3" -env_logger = "0.4" -rand = "0.4" -heapsize = "0.4" -semver = "0.9" -smallvec = { version = "0.4", features = ["heapsizeof"] } -parking_lot = "0.5" -ipnetwork = "0.12.6" - -[dev-dependencies] -ethkey = { path = "../ethkey" } -kvdb-memorydb = { path = "../util/kvdb-memorydb" } diff --git a/updater/Cargo.toml b/updater/Cargo.toml index 4afe802c6..9e7733bc4 100644 --- a/updater/Cargo.toml +++ b/updater/Cargo.toml @@ -15,8 +15,8 @@ ethabi-contract = "5.0" target_info = "0.1" semver = "0.9" ethcore = { path = "../ethcore" } -ethsync = { path = "../sync" } ethcore-bytes = { path = "../util/bytes" } +ethcore-sync = { path = "../ethcore/sync" } ethereum-types = "0.3" parking_lot = "0.5" parity-hash-fetch = { path = "../hash-fetch" } diff --git a/updater/src/lib.rs b/updater/src/lib.rs index 91c66d768..67525aa4b 100644 --- a/updater/src/lib.rs +++ b/updater/src/lib.rs @@ -19,8 +19,8 @@ extern crate ethabi; extern crate ethcore; extern crate ethcore_bytes as bytes; +extern crate ethcore_sync as sync; extern crate ethereum_types; -extern crate ethsync; extern crate keccak_hash as hash; extern crate parity_hash_fetch as hash_fetch; extern crate parity_version as version; diff --git a/updater/src/updater.rs b/updater/src/updater.rs index 60984e10f..3b5ce01a9 100644 --- a/updater/src/updater.rs +++ b/updater/src/updater.rs @@ -30,7 +30,7 @@ use ethcore::BlockNumber; use ethcore::filter::Filter; use ethcore::client::{BlockId, BlockChainClient, ChainNotify}; use ethereum_types::H256; -use ethsync::{SyncProvider}; +use sync::{SyncProvider}; use hash_fetch::{self as fetch, HashFetch}; use path::restrict_permissions_owner; use service::Service;