diff --git a/Cargo.lock b/Cargo.lock index eb2fdba292f..ee745c32389 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -779,7 +779,6 @@ dependencies = [ name = "ethcore-accounts" version = "0.1.0" dependencies = [ - "common-types 0.1.0", "ethereum-types 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethkey 0.3.0", "ethstore 0.2.1", diff --git a/accounts/Cargo.toml b/accounts/Cargo.toml index bcdb25c6a99..3ccfb795794 100644 --- a/accounts/Cargo.toml +++ b/accounts/Cargo.toml @@ -8,7 +8,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -common-types = { path = "../ethcore/types" } ethkey = { path = "ethkey" } ethstore = { path = "ethstore" } log = "0.4" diff --git a/accounts/ethstore/src/accounts_dir/disk.rs b/accounts/ethstore/src/accounts_dir/disk.rs index 00c59b254d2..2937ef148b9 100644 --- a/accounts/ethstore/src/accounts_dir/disk.rs +++ b/accounts/ethstore/src/accounts_dir/disk.rs @@ -61,7 +61,6 @@ pub fn find_unique_filename_using_random_suffix(parent_path: &Path, original_fil /// Create a new file and restrict permissions to owner only. It errors if the file already exists. #[cfg(unix)] pub fn create_new_file_with_permissions_to_owner(file_path: &Path) -> io::Result { - use libc; use std::os::unix::fs::OpenOptionsExt; fs::OpenOptions::new() @@ -83,7 +82,6 @@ pub fn create_new_file_with_permissions_to_owner(file_path: &Path) -> io::Result /// Create a new file and restrict permissions to owner only. It replaces the existing file if it already exists. #[cfg(unix)] pub fn replace_file_with_permissions_to_owner(file_path: &Path) -> io::Result { - use libc; use std::os::unix::fs::PermissionsExt; let file = fs::File::create(file_path)?; diff --git a/accounts/src/lib.rs b/accounts/src/lib.rs index b16e6dfc674..1cc083cf6d2 100644 --- a/accounts/src/lib.rs +++ b/accounts/src/lib.rs @@ -28,14 +28,13 @@ use self::stores::AddressBook; use std::collections::HashMap; use std::time::{Instant, Duration}; -use common_types::transaction::{Action, Transaction}; use ethkey::{Address, Message, Public, Secret, Password, Random, Generator}; use ethstore::accounts_dir::MemoryDirectory; use ethstore::{ SimpleSecretStore, SecretStore, EthStore, EthMultiStore, random_string, SecretVaultRef, StoreAccountRef, OpaqueSecret, }; -use log::{warn, debug}; +use log::warn; use parking_lot::RwLock; pub use ethkey::Signature; diff --git a/ethcore/node-filter/src/lib.rs b/ethcore/node-filter/src/lib.rs index 92abb89742a..db158cbe740 100644 --- a/ethcore/node-filter/src/lib.rs +++ b/ethcore/node-filter/src/lib.rs @@ -106,8 +106,8 @@ impl ConnectionFilter for NodeFilter { }); let mut cache = self.cache.write(); if cache.cache.len() == CACHE_SIZE { - let poped = cache.order.pop_front().unwrap(); - cache.cache.remove(&poped).is_none(); + let popped = cache.order.pop_front().expect("the cache is full so there's at least one item we can pop; qed"); + cache.cache.remove(&popped); }; if cache.cache.insert(*connecting_id, allowed).is_none() { cache.order.push_back(*connecting_id); diff --git a/ethcore/src/spec/spec.rs b/ethcore/src/spec/spec.rs index fe32c0d87e1..0287a59f208 100644 --- a/ethcore/src/spec/spec.rs +++ b/ethcore/src/spec/spec.rs @@ -847,8 +847,6 @@ impl Spec { /// constructor. pub fn genesis_epoch_data(&self) -> Result, String> { use types::transaction::{Action, Transaction}; - use journaldb; - use kvdb_memorydb; let genesis = self.genesis_header(); diff --git a/ethcore/sync/src/chain/sync_packet.rs b/ethcore/sync/src/chain/sync_packet.rs index 3891090f65e..f3aa11119f8 100644 --- a/ethcore/sync/src/chain/sync_packet.rs +++ b/ethcore/sync/src/chain/sync_packet.rs @@ -25,37 +25,37 @@ use api::{ETH_PROTOCOL, WARP_SYNC_PROTOCOL_ID}; use network::{PacketId, ProtocolId}; -/// An enum that defines all known packet ids in the context of -/// synchronization and provides a mechanism to convert from -/// packet ids (of type PacketId or u8) directly read from the network -/// to enum variants. This implicitly provides a mechanism to -/// check whether a given packet id is known, and to prevent -/// packet id clashes when defining new ids. enum_from_primitive! { -#[derive(Clone, Copy, Debug, PartialEq)] -pub enum SyncPacket { - StatusPacket = 0x00, - NewBlockHashesPacket = 0x01, - TransactionsPacket = 0x02, - GetBlockHeadersPacket = 0x03, - BlockHeadersPacket = 0x04, - GetBlockBodiesPacket = 0x05, - BlockBodiesPacket = 0x06, - NewBlockPacket = 0x07, - - GetNodeDataPacket = 0x0d, - NodeDataPacket = 0x0e, - GetReceiptsPacket = 0x0f, - ReceiptsPacket = 0x10, - - GetSnapshotManifestPacket = 0x11, - SnapshotManifestPacket = 0x12, - GetSnapshotDataPacket = 0x13, - SnapshotDataPacket = 0x14, - ConsensusDataPacket = 0x15, - PrivateTransactionPacket = 0x16, - SignedPrivateTransactionPacket = 0x17, -} + /// An enum that defines all known packet ids in the context of + /// synchronization and provides a mechanism to convert from + /// packet ids (of type PacketId or u8) directly read from the network + /// to enum variants. This implicitly provides a mechanism to + /// check whether a given packet id is known, and to prevent + /// packet id clashes when defining new ids. + #[derive(Clone, Copy, Debug, PartialEq)] + pub enum SyncPacket { + StatusPacket = 0x00, + NewBlockHashesPacket = 0x01, + TransactionsPacket = 0x02, + GetBlockHeadersPacket = 0x03, + BlockHeadersPacket = 0x04, + GetBlockBodiesPacket = 0x05, + BlockBodiesPacket = 0x06, + NewBlockPacket = 0x07, + + GetNodeDataPacket = 0x0d, + NodeDataPacket = 0x0e, + GetReceiptsPacket = 0x0f, + ReceiptsPacket = 0x10, + + GetSnapshotManifestPacket = 0x11, + SnapshotManifestPacket = 0x12, + GetSnapshotDataPacket = 0x13, + SnapshotDataPacket = 0x14, + ConsensusDataPacket = 0x15, + PrivateTransactionPacket = 0x16, + SignedPrivateTransactionPacket = 0x17, + } } use self::SyncPacket::*; diff --git a/ethcore/types/src/views/view_rlp.rs b/ethcore/types/src/views/view_rlp.rs index a6c789de989..4c5bb25ebd5 100644 --- a/ethcore/types/src/views/view_rlp.rs +++ b/ethcore/types/src/views/view_rlp.rs @@ -128,6 +128,7 @@ impl<'a, 'view> Iterator for ViewRlpIterator<'a, 'view> { } #[macro_export] +/// Create a view into RLP-data macro_rules! view { ($view: ident, $bytes: expr) => { $view::new($crate::views::ViewRlp::new($bytes, file!(), line!()))