From dab2a6bd4b340f4dbe13207fea33f1081ab9f2ec Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Tue, 27 Aug 2019 17:29:33 +0200 Subject: [PATCH] fix compile warnings (#10993) * fix warnings * fix: failing build, use `spec` as dev-dependency --- accounts/ethstore/src/accounts_dir/disk.rs | 6 ++--- accounts/ethstore/src/accounts_dir/mod.rs | 8 +++---- accounts/ethstore/src/accounts_dir/vault.rs | 2 +- accounts/ethstore/src/ethstore.rs | 14 ++++++------ accounts/ethstore/src/import.rs | 6 ++--- accounts/ethstore/src/secret_store.rs | 2 +- accounts/src/lib.rs | 4 ++-- cli-signer/rpc-client/src/lib.rs | 2 +- ethcore/private-tx/src/error.rs | 2 +- ethcore/private-tx/src/lib.rs | 21 +++++++++--------- ethcore/private-tx/src/log.rs | 4 ++-- ethcore/private-tx/src/private_state_db.rs | 6 ++--- ethcore/private-tx/src/state_store.rs | 4 ++-- ethcore/service/src/service.rs | 16 +++++++------- ethcore/sync/src/chain/handler.rs | 2 +- ethcore/sync/src/chain/mod.rs | 2 +- ethcore/sync/src/chain/requester.rs | 2 +- ethcore/sync/src/chain/supplier.rs | 2 +- miner/local-store/src/lib.rs | 10 ++++----- miner/stratum/src/lib.rs | 4 ++-- parity/account_utils.rs | 4 ++-- parity/blockchain.rs | 8 +++---- parity/db/rocksdb/mod.rs | 18 +++++++++------ parity/informant.rs | 6 ++--- parity/ipfs.rs | 2 +- parity/light_helpers/epoch_fetch.rs | 4 ++-- parity/modules.rs | 22 +++++++++---------- parity/rpc_apis.rs | 10 ++++----- parity/run.rs | 12 +++++----- parity/secretstore.rs | 2 +- rpc/Cargo.toml | 2 +- rpc/src/lib.rs | 5 ++++- rpc/src/v1/helpers/deprecated.rs | 2 +- rpc/src/v1/helpers/dispatch/full.rs | 2 +- rpc/src/v1/helpers/dispatch/light.rs | 8 +++---- rpc/src/v1/helpers/dispatch/mod.rs | 4 ++-- .../v1/helpers/dispatch/prospective_signer.rs | 4 ++-- rpc/src/v1/helpers/external_signer/mod.rs | 2 +- .../helpers/external_signer/signing_queue.rs | 2 +- rpc/src/v1/helpers/light_fetch.rs | 12 +++++----- rpc/src/v1/helpers/subscription_manager.rs | 2 +- rpc/src/v1/impls/eth.rs | 8 +++---- rpc/src/v1/impls/eth_pubsub.rs | 2 +- rpc/src/v1/impls/light/eth.rs | 4 ++-- rpc/src/v1/impls/light/parity_set.rs | 6 ++--- rpc/src/v1/impls/parity.rs | 12 +++++----- rpc/src/v1/impls/parity_set.rs | 4 ++-- rpc/src/v1/impls/signer.rs | 6 ++--- rpc/src/v1/impls/signing.rs | 4 ++-- rpc/src/v1/impls/signing_unsafe.rs | 4 ++-- rpc/src/v1/tests/helpers/miner_service.rs | 4 ++-- rpc/src/v1/tests/mocked/manage_network.rs | 2 +- rpc/src/v1/tests/mocked/parity.rs | 2 +- rpc/src/v1/tests/mocked/parity_set.rs | 2 +- rpc/src/v1/types/derivation.rs | 2 +- updater/hash-fetch/src/client.rs | 8 +++---- updater/hash-fetch/src/lib.rs | 2 +- updater/hash-fetch/src/urlhint.rs | 8 +++---- updater/src/lib.rs | 3 +-- updater/src/updater.rs | 18 +++++++-------- util/EIP-712/src/error.rs | 2 +- util/fetch/src/client.rs | 4 ++-- util/migration-rocksdb/src/lib.rs | 6 ++--- util/network-devp2p/src/ip_utils.rs | 8 +++---- util/network/src/error.rs | 2 +- util/network/src/lib.rs | 12 +++++----- util/registrar/src/lib.rs | 3 +-- util/registrar/src/registrar.rs | 8 +++---- util/rlp-compress/src/lib.rs | 4 ++-- 69 files changed, 203 insertions(+), 199 deletions(-) diff --git a/accounts/ethstore/src/accounts_dir/disk.rs b/accounts/ethstore/src/accounts_dir/disk.rs index 4cc8611bf..b70029785 100644 --- a/accounts/ethstore/src/accounts_dir/disk.rs +++ b/accounts/ethstore/src/accounts_dir/disk.rs @@ -284,7 +284,7 @@ impl KeyDirectory for DiskDirectory where T: KeyFileManager { fn path(&self) -> Option<&PathBuf> { Some(&self.path) } - fn as_vault_provider(&self) -> Option<&VaultKeyDirectoryProvider> { + fn as_vault_provider(&self) -> Option<&dyn VaultKeyDirectoryProvider> { Some(self) } @@ -294,12 +294,12 @@ impl KeyDirectory for DiskDirectory where T: KeyFileManager { } impl VaultKeyDirectoryProvider for DiskDirectory where T: KeyFileManager { - fn create(&self, name: &str, key: VaultKey) -> Result, Error> { + fn create(&self, name: &str, key: VaultKey) -> Result, Error> { let vault_dir = VaultDiskDirectory::create(&self.path, name, key)?; Ok(Box::new(vault_dir)) } - fn open(&self, name: &str, key: VaultKey) -> Result, Error> { + fn open(&self, name: &str, key: VaultKey) -> Result, Error> { let vault_dir = VaultDiskDirectory::at(&self.path, name, key)?; Ok(Box::new(vault_dir)) } diff --git a/accounts/ethstore/src/accounts_dir/mod.rs b/accounts/ethstore/src/accounts_dir/mod.rs index 300c39522..93a6879ba 100644 --- a/accounts/ethstore/src/accounts_dir/mod.rs +++ b/accounts/ethstore/src/accounts_dir/mod.rs @@ -57,7 +57,7 @@ pub trait KeyDirectory: Send + Sync { /// Get directory filesystem path, if available fn path(&self) -> Option<&PathBuf> { None } /// Return vault provider, if available - fn as_vault_provider(&self) -> Option<&VaultKeyDirectoryProvider> { None } + fn as_vault_provider(&self) -> Option<&dyn VaultKeyDirectoryProvider> { None } /// Unique representation of directory account collection fn unique_repr(&self) -> Result; } @@ -65,9 +65,9 @@ pub trait KeyDirectory: Send + Sync { /// Vaults provider pub trait VaultKeyDirectoryProvider { /// Create new vault with given key - fn create(&self, name: &str, key: VaultKey) -> Result, Error>; + fn create(&self, name: &str, key: VaultKey) -> Result, Error>; /// Open existing vault with given key - fn open(&self, name: &str, key: VaultKey) -> Result, Error>; + fn open(&self, name: &str, key: VaultKey) -> Result, Error>; /// List all vaults fn list_vaults(&self) -> Result, Error>; /// Get vault meta @@ -77,7 +77,7 @@ pub trait VaultKeyDirectoryProvider { /// Vault directory pub trait VaultKeyDirectory: KeyDirectory { /// Cast to `KeyDirectory` - fn as_key_directory(&self) -> &KeyDirectory; + fn as_key_directory(&self) -> &dyn KeyDirectory; /// Vault name fn name(&self) -> &str; /// Get vault key diff --git a/accounts/ethstore/src/accounts_dir/vault.rs b/accounts/ethstore/src/accounts_dir/vault.rs index 1aea7e104..feab2b356 100644 --- a/accounts/ethstore/src/accounts_dir/vault.rs +++ b/accounts/ethstore/src/accounts_dir/vault.rs @@ -119,7 +119,7 @@ impl VaultDiskDirectory { } impl VaultKeyDirectory for VaultDiskDirectory { - fn as_key_directory(&self) -> &KeyDirectory { + fn as_key_directory(&self) -> &dyn KeyDirectory { self } diff --git a/accounts/ethstore/src/ethstore.rs b/accounts/ethstore/src/ethstore.rs index 6fce9ae62..89bb14ba6 100644 --- a/accounts/ethstore/src/ethstore.rs +++ b/accounts/ethstore/src/ethstore.rs @@ -36,12 +36,12 @@ pub struct EthStore { impl EthStore { /// Open a new accounts store with given key directory backend. - pub fn open(directory: Box) -> Result { + pub fn open(directory: Box) -> Result { Self::open_with_iterations(directory, KEY_ITERATIONS as u32) } /// Open a new account store with given key directory backend and custom number of iterations. - pub fn open_with_iterations(directory: Box, iterations: u32) -> Result { + pub fn open_with_iterations(directory: Box, iterations: u32) -> Result { Ok(EthStore { store: EthMultiStore::open_with_iterations(directory, iterations)?, }) @@ -184,7 +184,7 @@ impl SecretStore for EthStore { Ok(account.check_password(password)) } - fn copy_account(&self, new_store: &SimpleSecretStore, new_vault: SecretVaultRef, account: &StoreAccountRef, password: &Password, new_password: &Password) -> Result<(), Error> { + fn copy_account(&self, new_store: &dyn SimpleSecretStore, new_vault: SecretVaultRef, account: &StoreAccountRef, password: &Password, new_password: &Password) -> Result<(), Error> { let account = self.get(account)?; let secret = account.crypto.secret(password)?; new_store.insert_account(new_vault, secret, new_password)?; @@ -256,11 +256,11 @@ impl SecretStore for EthStore { /// Similar to `EthStore` but may store many accounts (with different passwords) for the same `Address` pub struct EthMultiStore { - dir: Box, + dir: Box, iterations: u32, // order lock: cache, then vaults cache: RwLock>>, - vaults: Mutex>>, + vaults: Mutex>>, timestamp: Mutex, } @@ -272,12 +272,12 @@ struct Timestamp { impl EthMultiStore { /// Open new multi-accounts store with given key directory backend. - pub fn open(directory: Box) -> Result { + pub fn open(directory: Box) -> Result { Self::open_with_iterations(directory, KEY_ITERATIONS as u32) } /// Open new multi-accounts store with given key directory backend and custom number of iterations for new keys. - pub fn open_with_iterations(directory: Box, iterations: u32) -> Result { + pub fn open_with_iterations(directory: Box, iterations: u32) -> Result { let store = EthMultiStore { dir: directory, vaults: Mutex::new(HashMap::new()), diff --git a/accounts/ethstore/src/import.rs b/accounts/ethstore/src/import.rs index 87e9783ea..3fe9763e8 100644 --- a/accounts/ethstore/src/import.rs +++ b/accounts/ethstore/src/import.rs @@ -24,7 +24,7 @@ use dir; use Error; /// Import an account from a file. -pub fn import_account(path: &Path, dst: &KeyDirectory) -> Result { +pub fn import_account(path: &Path, dst: &dyn KeyDirectory) -> Result { let key_manager = DiskKeyFileManager::default(); let existing_accounts = dst.load()?.into_iter().map(|a| a.address).collect::>(); let filename = path.file_name().and_then(|n| n.to_str()).map(|f| f.to_owned()); @@ -40,7 +40,7 @@ pub fn import_account(path: &Path, dst: &KeyDirectory) -> Result } /// Import all accounts from one directory to the other. -pub fn import_accounts(src: &KeyDirectory, dst: &KeyDirectory) -> Result, Error> { +pub fn import_accounts(src: &dyn KeyDirectory, dst: &dyn KeyDirectory) -> Result, Error> { let accounts = src.load()?; let existing_accounts = dst.load()?.into_iter() .map(|a| a.address) @@ -64,7 +64,7 @@ pub fn read_geth_accounts(testnet: bool) -> Vec
{ } /// Import specific `desired` accounts from the Geth keystore into `dst`. -pub fn import_geth_accounts(dst: &KeyDirectory, desired: HashSet
, testnet: bool) -> Result, Error> { +pub fn import_geth_accounts(dst: &dyn KeyDirectory, desired: HashSet
, testnet: bool) -> Result, Error> { let src = RootDiskDirectory::at(dir::geth(testnet)); let accounts = src.load()?; let existing_accounts = dst.load()?.into_iter().map(|a| a.address).collect::>(); diff --git a/accounts/ethstore/src/secret_store.rs b/accounts/ethstore/src/secret_store.rs index 5571f83c0..d3ca1a12f 100644 --- a/accounts/ethstore/src/secret_store.rs +++ b/accounts/ethstore/src/secret_store.rs @@ -118,7 +118,7 @@ pub trait SecretStore: SimpleSecretStore { /// Imports existing JSON wallet fn import_wallet(&self, vault: SecretVaultRef, json: &[u8], password: &Password, gen_id: bool) -> Result; /// Copies account between stores and vaults. - fn copy_account(&self, new_store: &SimpleSecretStore, new_vault: SecretVaultRef, account: &StoreAccountRef, password: &Password, new_password: &Password) -> Result<(), Error>; + fn copy_account(&self, new_store: &dyn SimpleSecretStore, new_vault: SecretVaultRef, account: &StoreAccountRef, password: &Password, new_password: &Password) -> Result<(), Error>; /// Checks if password matches given account. fn test_password(&self, account: &StoreAccountRef, password: &Password) -> Result; diff --git a/accounts/src/lib.rs b/accounts/src/lib.rs index 9f31e8f53..ac87a2ee3 100644 --- a/accounts/src/lib.rs +++ b/accounts/src/lib.rs @@ -64,7 +64,7 @@ pub struct AccountProvider { /// Address book. address_book: RwLock, /// Accounts on disk - sstore: Box, + sstore: Box, /// Accounts unlocked with rolling tokens transient_sstore: EthMultiStore, /// When unlocking account permanently we additionally keep a raw secret in memory @@ -80,7 +80,7 @@ fn transient_sstore() -> EthMultiStore { impl AccountProvider { /// Creates new account provider. - pub fn new(sstore: Box, settings: AccountProviderSettings) -> Self { + pub fn new(sstore: Box, settings: AccountProviderSettings) -> Self { if let Ok(accounts) = sstore.accounts() { for account in accounts.into_iter().filter(|a| settings.blacklisted_accounts.contains(&a.address)) { warn!("Local Account {} has a blacklisted (known to be weak) address and will be ignored", diff --git a/cli-signer/rpc-client/src/lib.rs b/cli-signer/rpc-client/src/lib.rs index d0e087e59..fe945c7f7 100644 --- a/cli-signer/rpc-client/src/lib.rs +++ b/cli-signer/rpc-client/src/lib.rs @@ -36,7 +36,7 @@ extern crate log; extern crate matches; /// Boxed future response. -pub type BoxFuture = Box + Send>; +pub type BoxFuture = Box + Send>; #[cfg(test)] mod tests { diff --git a/ethcore/private-tx/src/error.rs b/ethcore/private-tx/src/error.rs index dada20924..b9167675f 100644 --- a/ethcore/private-tx/src/error.rs +++ b/ethcore/private-tx/src/error.rs @@ -138,7 +138,7 @@ pub enum Error { } impl error::Error for Error { - fn source(&self) -> Option<&(error::Error + 'static)> { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { match self { Error::Io(e) => Some(e), Error::Decoder(e) => Some(e), diff --git a/ethcore/private-tx/src/lib.rs b/ethcore/private-tx/src/lib.rs index 087f85b63..2368205ba 100644 --- a/ethcore/private-tx/src/lib.rs +++ b/ethcore/private-tx/src/lib.rs @@ -63,7 +63,6 @@ extern crate transaction_pool as txpool; extern crate url; #[macro_use] extern crate log as ethlog; -#[macro_use] extern crate ethabi_derive; #[macro_use] extern crate ethabi_contract; @@ -205,17 +204,17 @@ impl Signer for KeyPairSigner { /// Manager of private transactions pub struct Provider { - encryptor: Box, + encryptor: Box, validator_accounts: HashSet
, signer_account: Option
, - notify: RwLock>>, + notify: RwLock>>, transactions_for_signing: RwLock, transactions_for_verification: VerificationStore, client: Arc, miner: Arc, - accounts: Arc, + accounts: Arc, channel: IoChannel, - keys_provider: Arc, + keys_provider: Arc, logging: Option, use_offchain_storage: bool, state_storage: PrivateStateStorage, @@ -234,12 +233,12 @@ impl Provider { pub fn new( client: Arc, miner: Arc, - accounts: Arc, - encryptor: Box, + accounts: Arc, + encryptor: Box, config: ProviderConfig, channel: IoChannel, - keys_provider: Arc, - db: Arc, + keys_provider: Arc, + db: Arc, ) -> Self { keys_provider.update_acl_contract(); Provider { @@ -268,11 +267,11 @@ impl Provider { // TODO [ToDr] Don't use `ChainNotify` here! // Better to create a separate notification type for this. /// Adds an actor to be notified on certain events - pub fn add_notify(&self, target: Arc) { + pub fn add_notify(&self, target: Arc) { self.notify.write().push(Arc::downgrade(&target)); } - fn notify(&self, f: F) where F: Fn(&ChainNotify) { + fn notify(&self, f: F) where F: Fn(&dyn ChainNotify) { for np in self.notify.read().iter() { if let Some(n) = np.upgrade() { f(&*n); diff --git a/ethcore/private-tx/src/log.rs b/ethcore/private-tx/src/log.rs index 0d0979752..6c1f8819c 100644 --- a/ethcore/private-tx/src/log.rs +++ b/ethcore/private-tx/src/log.rs @@ -186,13 +186,13 @@ impl LogsSerializer for FileLogsSerializer { /// Private transactions logging pub struct Logging { logs: RwLock>, - logs_serializer: Arc, + logs_serializer: Arc, mono_time: MonoTime, } impl Logging { /// Creates the logging object - pub fn new(logs_serializer: Arc) -> Self { + pub fn new(logs_serializer: Arc) -> Self { let mut logging = Logging { logs: RwLock::new(HashMap::new()), logs_serializer, diff --git a/ethcore/private-tx/src/private_state_db.rs b/ethcore/private-tx/src/private_state_db.rs index a701f7330..44f787255 100644 --- a/ethcore/private-tx/src/private_state_db.rs +++ b/ethcore/private-tx/src/private_state_db.rs @@ -25,12 +25,12 @@ use error::Error; /// Wrapper around local db with private state for sync purposes pub struct PrivateStateDB { - db: Arc, + db: Arc, } impl PrivateStateDB { /// Constructs the object - pub fn new(db: Arc) -> Self { + pub fn new(db: Arc) -> Self { PrivateStateDB { db, } @@ -59,4 +59,4 @@ impl PrivateStateDB { pub fn state_hash(&self, state: &Bytes) -> Result { Ok(KeccakHasher::hash(state)) } -} \ No newline at end of file +} diff --git a/ethcore/private-tx/src/state_store.rs b/ethcore/private-tx/src/state_store.rs index 002dca365..2b550e351 100644 --- a/ethcore/private-tx/src/state_store.rs +++ b/ethcore/private-tx/src/state_store.rs @@ -57,7 +57,7 @@ pub struct PrivateStateStorage { impl PrivateStateStorage { /// Constructs the object - pub fn new(db: Arc) -> Self { + pub fn new(db: Arc) -> Self { PrivateStateStorage { private_state_db: Arc::new(PrivateStateDB::new(db)), requests: RwLock::new(Vec::new()), @@ -162,4 +162,4 @@ impl PrivateStateStorage { !delete_request }); } -} \ No newline at end of file +} diff --git a/ethcore/service/src/service.rs b/ethcore/service/src/service.rs index c1aebfe93..a1bda778b 100644 --- a/ethcore/service/src/service.rs +++ b/ethcore/service/src/service.rs @@ -94,7 +94,7 @@ pub struct ClientService { client: Arc, snapshot: Arc, private_tx: Arc, - database: Arc, + database: Arc, } impl ClientService { @@ -102,13 +102,13 @@ impl ClientService { pub fn start( config: ClientConfig, spec: &Spec, - blockchain_db: Arc, + blockchain_db: Arc, snapshot_path: &Path, - restoration_db_handler: Box, + restoration_db_handler: Box, _ipc_path: &Path, miner: Arc, - signer: Arc, - encryptor: Box, + signer: Arc, + encryptor: Box, private_tx_conf: ethcore_private_tx::ProviderConfig, private_encryptor_conf: ethcore_private_tx::EncryptorConfig, ) -> Result @@ -173,7 +173,7 @@ impl ClientService { } /// Get general IO interface - pub fn register_io_handler(&self, handler: Arc + Send>) -> Result<(), IoError> { + pub fn register_io_handler(&self, handler: Arc + Send>) -> Result<(), IoError> { self.io_service.register_handler(handler) } @@ -198,12 +198,12 @@ impl ClientService { } /// Set the actor to be notified on certain chain events - pub fn add_notify(&self, notify: Arc) { + pub fn add_notify(&self, notify: Arc) { self.client.add_notify(notify); } /// Get a handle to the database. - pub fn db(&self) -> Arc { self.database.clone() } + pub fn db(&self) -> Arc { self.database.clone() } /// Shutdown the Client Service pub fn shutdown(&self) { diff --git a/ethcore/sync/src/chain/handler.rs b/ethcore/sync/src/chain/handler.rs index 89c740951..e7a54fa95 100644 --- a/ethcore/sync/src/chain/handler.rs +++ b/ethcore/sync/src/chain/handler.rs @@ -743,7 +743,7 @@ impl SyncHandler { Ok(()) } - fn on_private_state_data(sync: &mut ChainSync, io: &mut SyncIo, peer_id: PeerId, r: &Rlp) -> Result<(), DownloaderImportError> { + fn on_private_state_data(sync: &mut ChainSync, io: &mut dyn SyncIo, peer_id: PeerId, r: &Rlp) -> Result<(), DownloaderImportError> { if !sync.peers.get(&peer_id).map_or(false, |p| p.can_sync()) { trace!(target: "sync", "{} Ignoring packet from unconfirmed/unknown peer", peer_id); return Ok(()); diff --git a/ethcore/sync/src/chain/mod.rs b/ethcore/sync/src/chain/mod.rs index 233a41b5f..07be14f7f 100644 --- a/ethcore/sync/src/chain/mod.rs +++ b/ethcore/sync/src/chain/mod.rs @@ -1382,7 +1382,7 @@ impl ChainSync { } /// Request private state from peers - pub fn request_private_state(&mut self, io: &mut SyncIo, hash: &H256) { + pub fn request_private_state(&mut self, io: &mut dyn SyncIo, hash: &H256) { let private_state_peers = self.get_private_state_peers(); if private_state_peers.is_empty() { error!(target: "privatetx", "Cannot request private state, no peers with private tx enabled available"); diff --git a/ethcore/sync/src/chain/requester.rs b/ethcore/sync/src/chain/requester.rs index b47c39301..e79de2292 100644 --- a/ethcore/sync/src/chain/requester.rs +++ b/ethcore/sync/src/chain/requester.rs @@ -100,7 +100,7 @@ impl SyncRequester { SyncRequester::send_request(sync, io, peer_id, PeerAsking::SnapshotManifest, GetSnapshotManifestPacket, rlp.out()); } - pub fn request_private_state(sync: &mut ChainSync, io: &mut SyncIo, peer_id: PeerId, hash: &H256) { + pub fn request_private_state(sync: &mut ChainSync, io: &mut dyn SyncIo, peer_id: PeerId, hash: &H256) { trace!(target: "privatetx", "{} <- GetPrivateStatePacket", peer_id); let mut rlp = RlpStream::new_list(1); rlp.append(hash); diff --git a/ethcore/sync/src/chain/supplier.rs b/ethcore/sync/src/chain/supplier.rs index a6a95f07a..fe09766bf 100644 --- a/ethcore/sync/src/chain/supplier.rs +++ b/ethcore/sync/src/chain/supplier.rs @@ -356,7 +356,7 @@ impl SyncSupplier { } /// Respond to GetPrivateStatePacket - fn return_private_state(io: &SyncIo, r: &Rlp, peer_id: PeerId) -> RlpResponseResult { + fn return_private_state(io: &dyn SyncIo, r: &Rlp, peer_id: PeerId) -> RlpResponseResult { let hash: H256 = r.val_at(0)?; trace!(target: "privatetx", "{} -> GetPrivateStatePacket {:?}", peer_id, hash); io.private_state().map_or(Ok(None), |db| { diff --git a/miner/local-store/src/lib.rs b/miner/local-store/src/lib.rs index 1c0811b4d..7c3a12776 100644 --- a/miner/local-store/src/lib.rs +++ b/miner/local-store/src/lib.rs @@ -107,11 +107,11 @@ pub trait NodeInfo: Send + Sync { /// Create a new local data store, given a database, a column to write to, and a node. /// Attempts to read data out of the store, and move it into the node. -pub fn create(db: Arc, col: Option, node: T) -> LocalDataStore { +pub fn create(db: Arc, col: Option, node: T) -> LocalDataStore { LocalDataStore { - db: db, - col: col, - node: node, + db, + col, + node, } } @@ -120,7 +120,7 @@ pub fn create(db: Arc, col: Option, node: T) -> Lo /// In specific, this will be used to store things like unpropagated local transactions /// and the node security level. pub struct LocalDataStore { - db: Arc, + db: Arc, col: Option, node: T, } diff --git a/miner/stratum/src/lib.rs b/miner/stratum/src/lib.rs index 5ee0296da..cb2eca13e 100644 --- a/miner/stratum/src/lib.rs +++ b/miner/stratum/src/lib.rs @@ -70,7 +70,7 @@ pub struct Stratum { impl Stratum { pub fn start( addr: &SocketAddr, - dispatcher: Arc, + dispatcher: Arc, secret: Option, ) -> Result, Error> { @@ -128,7 +128,7 @@ struct StratumImpl { /// List of workers supposed to receive job update job_que: RwLock>, /// Payload manager - dispatcher: Arc, + dispatcher: Arc, /// Authorized workers (socket - worker_id) workers: Arc>>, /// Secret if any diff --git a/parity/account_utils.rs b/parity/account_utils.rs index 9c380c2f5..4f6533631 100644 --- a/parity/account_utils.rs +++ b/parity/account_utils.rs @@ -199,14 +199,14 @@ mod accounts { } } - pub fn private_tx_signer(accounts: Arc, passwords: &[Password]) -> Result, String> { + pub fn private_tx_signer(accounts: Arc, passwords: &[Password]) -> Result, String> { Ok(Arc::new(self::private_tx::AccountSigner { accounts, passwords: passwords.to_vec(), })) } - pub fn accounts_list(account_provider: Arc) -> Arc Vec
+ Send + Sync> { + pub fn accounts_list(account_provider: Arc) -> Arc Vec
+ Send + Sync> { Arc::new(move || account_provider.accounts().unwrap_or_default()) } diff --git a/parity/blockchain.rs b/parity/blockchain.rs index d5e666768..85000e385 100644 --- a/parity/blockchain.rs +++ b/parity/blockchain.rs @@ -244,7 +244,7 @@ fn execute_import_light(cmd: ImportBlockchain) -> Result<(), String> { let client = service.client(); - let mut instream: Box = match cmd.file_path { + let mut instream: Box = match cmd.file_path { Some(f) => Box::new(fs::File::open(&f).map_err(|_| format!("Cannot open given file: {}", f))?), None => Box::new(io::stdin()), }; @@ -412,7 +412,7 @@ fn execute_import(cmd: ImportBlockchain) -> Result<(), String> { let client = service.client(); - let mut instream: Box = match cmd.file_path { + let mut instream: Box = match cmd.file_path { Some(f) => Box::new(fs::File::open(&f).map_err(|_| format!("Cannot open given file: {}", f))?), None => Box::new(io::stdin()), }; @@ -621,7 +621,7 @@ fn execute_export(cmd: ExportBlockchain) -> Result<(), String> { let client = service.client(); - let mut out: Box = match cmd.file_path { + let mut out: Box = match cmd.file_path { Some(f) => Box::new(fs::File::create(&f).map_err(|_| format!("Cannot write to file given: {}", f))?), None => Box::new(io::stdout()), }; @@ -665,7 +665,7 @@ fn execute_export_state(cmd: ExportState) -> Result<(), String> { let client = service.client(); - let mut out: Box = match cmd.file_path { + let mut out: Box = match cmd.file_path { Some(f) => Box::new(fs::File::create(&f).map_err(|_| format!("Cannot write to file given: {}", f))?), None => Box::new(io::stdout()), }; diff --git a/parity/db/rocksdb/mod.rs b/parity/db/rocksdb/mod.rs index c7aa0a534..bf56b4d29 100644 --- a/parity/db/rocksdb/mod.rs +++ b/parity/db/rocksdb/mod.rs @@ -37,13 +37,13 @@ mod helpers; pub use self::migration::migrate; struct AppDB { - key_value: Arc, + key_value: Arc, blooms: blooms_db::Database, trace_blooms: blooms_db::Database, } impl BlockChainDB for AppDB { - fn key_value(&self) -> &Arc { + fn key_value(&self) -> &Arc { &self.key_value } @@ -58,7 +58,7 @@ impl BlockChainDB for AppDB { /// Open a secret store DB using the given secret store data path. The DB path is one level beneath the data path. #[cfg(feature = "secretstore")] -pub fn open_secretstore_db(data_path: &str) -> Result, String> { +pub fn open_secretstore_db(data_path: &str) -> Result, String> { use std::path::PathBuf; let mut db_path = PathBuf::from(data_path); @@ -68,7 +68,7 @@ pub fn open_secretstore_db(data_path: &str) -> Result, String> { } /// Create a restoration db handler using the config generated by `client_path` and `client_config`. -pub fn restoration_db_handler(client_path: &Path, client_config: &ClientConfig) -> Box { +pub fn restoration_db_handler(client_path: &Path, client_config: &ClientConfig) -> Box { let client_db_config = helpers::client_db_config(client_path, client_config); struct RestorationDBHandler { @@ -76,7 +76,7 @@ pub fn restoration_db_handler(client_path: &Path, client_config: &ClientConfig) } impl BlockChainDBHandler for RestorationDBHandler { - fn open(&self, db_path: &Path) -> io::Result> { + fn open(&self, db_path: &Path) -> io::Result> { open_database(&db_path.to_string_lossy(), &self.config) } } @@ -87,7 +87,11 @@ pub fn restoration_db_handler(client_path: &Path, client_config: &ClientConfig) } /// Open a new main DB. -pub fn open_db(client_path: &str, cache_config: &CacheConfig, compaction: &DatabaseCompactionProfile) -> io::Result> { +pub fn open_db( + client_path: &str, + cache_config: &CacheConfig, + compaction: &DatabaseCompactionProfile +) -> io::Result> { let path = Path::new(client_path); let db_config = DatabaseConfig { @@ -99,7 +103,7 @@ pub fn open_db(client_path: &str, cache_config: &CacheConfig, compaction: &Datab open_database(client_path, &db_config) } -pub fn open_database(client_path: &str, config: &DatabaseConfig) -> io::Result> { +pub fn open_database(client_path: &str, config: &DatabaseConfig) -> io::Result> { let path = Path::new(client_path); let blooms_path = path.join("blooms"); diff --git a/parity/informant.rs b/parity/informant.rs index 0249e60bb..29a278a2a 100644 --- a/parity/informant.rs +++ b/parity/informant.rs @@ -124,8 +124,8 @@ pub trait InformantData: Send + Sync { /// Informant data for a full node. pub struct FullNodeInformantData { pub client: Arc, - pub sync: Option>, - pub net: Option>, + pub sync: Option>, + pub net: Option>, } impl InformantData for FullNodeInformantData { @@ -180,7 +180,7 @@ impl InformantData for FullNodeInformantData { /// Informant data for a light node -- note that the network is required. pub struct LightNodeInformantData { - pub client: Arc, + pub client: Arc, pub sync: Arc, pub cache: Arc>, } diff --git a/parity/ipfs.rs b/parity/ipfs.rs index f8062f52a..fb2e2f42a 100644 --- a/parity/ipfs.rs +++ b/parity/ipfs.rs @@ -40,7 +40,7 @@ impl Default for Configuration { } } -pub fn start_server(conf: Configuration, client: Arc) -> Result, ServerError> { +pub fn start_server(conf: Configuration, client: Arc) -> Result, ServerError> { if !conf.enabled { return Ok(None); } diff --git a/parity/light_helpers/epoch_fetch.rs b/parity/light_helpers/epoch_fetch.rs index f73aec57d..faf9b41dc 100644 --- a/parity/light_helpers/epoch_fetch.rs +++ b/parity/light_helpers/epoch_fetch.rs @@ -35,7 +35,7 @@ use ethereum_types::H256; const ALL_VALID_BACKREFS: &str = "no back-references, therefore all back-references valid; qed"; -type BoxFuture = Box>; +type BoxFuture = Box>; /// Allows on-demand fetch of data useful for the light client. pub struct EpochFetch { @@ -83,7 +83,7 @@ impl ChainDataFetcher for EpochFetch { } /// Fetch epoch transition proof at given header. - fn epoch_transition(&self, hash: H256, engine: Arc, checker: Arc) + fn epoch_transition(&self, hash: H256, engine: Arc, checker: Arc) -> Self::Transition { self.request(request::Signal { diff --git a/parity/modules.rs b/parity/modules.rs index 7b56fa6d5..783d6fcb1 100644 --- a/parity/modules.rs +++ b/parity/modules.rs @@ -28,9 +28,9 @@ pub use ethcore::client::ChainNotify; use ethcore_logger::Config as LogConfig; pub type SyncModules = ( - Arc, - Arc, - Arc, + Arc, + Arc, + Arc, mpsc::Sender, ); @@ -38,13 +38,13 @@ pub fn sync( config: SyncConfig, executor: Executor, network_config: NetworkConfiguration, - chain: Arc, - snapshot_service: Arc, - private_tx_handler: Option>, + chain: Arc, + snapshot_service: Arc, + private_tx_handler: Option>, private_state: Option>, - provider: Arc, + provider: Arc, _log_settings: &LogConfig, - connection_filter: Option>, + connection_filter: Option>, ) -> Result { let eth_sync = EthSync::new(Params { config, @@ -59,9 +59,9 @@ pub fn sync( connection_filter)?; Ok(( - eth_sync.clone() as Arc, - eth_sync.clone() as Arc, - eth_sync.clone() as Arc, + eth_sync.clone() as Arc, + eth_sync.clone() as Arc, + eth_sync.clone() as Arc, eth_sync.priority_tasks() )) } diff --git a/parity/rpc_apis.rs b/parity/rpc_apis.rs index 0b9d4d9f5..35e65c8ad 100644 --- a/parity/rpc_apis.rs +++ b/parity/rpc_apis.rs @@ -235,16 +235,16 @@ pub trait Dependencies { pub struct FullDependencies { pub signer_service: Arc, pub client: Arc, - pub snapshot: Arc, - pub sync: Arc, - pub net: Arc, + pub snapshot: Arc, + pub sync: Arc, + pub net: Arc, pub accounts: Arc, pub private_tx_service: Option>, pub miner: Arc, pub external_miner: Arc, pub logger: Arc, pub settings: Arc, - pub net_service: Arc, + pub net_service: Arc, pub updater: Arc, pub geth_compatibility: bool, pub experimental_rpcs: bool, @@ -485,7 +485,7 @@ pub struct LightDependencies { pub signer_service: Arc, pub client: Arc, pub sync: Arc, - pub net: Arc, + pub net: Arc, pub accounts: Arc, pub logger: Arc, pub settings: Arc, diff --git a/parity/run.rs b/parity/run.rs index 417f544f1..e53e5b293 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -583,7 +583,7 @@ fn execute_impl(cmd: RunCmd, logger: Arc, on_client_rq: // take handle to private transactions service let private_tx_service = service.private_tx_service(); let private_tx_provider = private_tx_service.provider(); - let connection_filter = connection_filter_address.map(|a| Arc::new(NodeFilter::new(Arc::downgrade(&client) as Weak, a))); + let connection_filter = connection_filter_address.map(|a| Arc::new(NodeFilter::new(Arc::downgrade(&client) as Weak, a))); let snapshot_service = service.snapshot_service(); if let Some(filter) = connection_filter.clone() { service.add_notify(filter.clone()); @@ -636,7 +636,7 @@ fn execute_impl(cmd: RunCmd, logger: Arc, on_client_rq: } let (private_tx_sync, private_state) = match cmd.private_tx_enabled { - true => (Some(private_tx_service.clone() as Arc), Some(private_tx_provider.private_state_db())), + true => (Some(private_tx_service.clone() as Arc), Some(private_tx_provider.private_state_db())), false => (None, None), }; @@ -651,7 +651,7 @@ fn execute_impl(cmd: RunCmd, logger: Arc, on_client_rq: private_state, client.clone(), &cmd.logger_config, - connection_filter.clone().map(|f| f as Arc<::sync::ConnectionFilter + 'static>), + connection_filter.clone().map(|f| f as Arc), ).map_err(|e| format!("Sync error: {}", e))?; service.add_notify(chain_notify.clone()); @@ -706,7 +706,7 @@ fn execute_impl(cmd: RunCmd, logger: Arc, on_client_rq: // the updater service let updater_fetch = fetch.clone(); let updater = Updater::new( - &Arc::downgrade(&(service.client() as Arc)), + &Arc::downgrade(&(service.client() as Arc)), &Arc::downgrade(&sync_provider), update_policy, hash_fetch::Client::with_fetch(contract_client.clone(), updater_fetch, runtime.executor()) @@ -843,14 +843,14 @@ enum RunningClientInner { rpc: jsonrpc_core::MetaIoHandler>, informant: Arc>, client: Arc, - keep_alive: Box, + keep_alive: Box, }, Full { rpc: jsonrpc_core::MetaIoHandler>, informant: Arc>, client: Arc, client_service: Arc, - keep_alive: Box, + keep_alive: Box, }, } diff --git a/parity/secretstore.rs b/parity/secretstore.rs index bde67e344..27424e275 100644 --- a/parity/secretstore.rs +++ b/parity/secretstore.rs @@ -93,7 +93,7 @@ pub struct Dependencies<'a> { /// Blockchain client. pub client: Arc, /// Sync provider. - pub sync: Arc, + pub sync: Arc, /// Miner service. pub miner: Arc, /// Account provider. diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index c5e7dd28b..fead96d71 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -64,7 +64,6 @@ parity-updater = { path = "../updater" } parity-version = { path = "../util/version" } rlp = "0.4.0" account-state = { path = "../ethcore/account-state" } -spec = { path = "../ethcore/spec" } stats = { path = "../util/stats" } trace = { path = "../ethcore/trace" } vm = { path = "../ethcore/vm" } @@ -77,6 +76,7 @@ ethcore-io = { path = "../util/io" } ethcore-network = { path = "../util/network" } fake-fetch = { path = "../util/fake-fetch" } macros = { path = "../util/macros" } +spec = { path = "../ethcore/spec" } pretty_assertions = "0.1" transaction-pool = "2.0" diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index ed909484f..648ec43bf 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -85,7 +85,7 @@ extern crate parity_version as version; extern crate eip_712; extern crate rlp; extern crate account_state; -extern crate spec; + extern crate stats; extern crate tempdir; extern crate trace; @@ -127,6 +127,9 @@ extern crate fake_fetch; #[cfg(test)] extern crate ethcore_io as io; +#[cfg(test)] +extern crate spec; + pub extern crate jsonrpc_ws_server as ws; mod authcodes; diff --git a/rpc/src/v1/helpers/deprecated.rs b/rpc/src/v1/helpers/deprecated.rs index 49e9d8b07..8a8ead0d4 100644 --- a/rpc/src/v1/helpers/deprecated.rs +++ b/rpc/src/v1/helpers/deprecated.rs @@ -38,7 +38,7 @@ const PRINT_INTERVAL: Duration = Duration::from_secs(60); pub struct DeprecationNotice Instant> { now: T, next_warning_at: RwLock>, - printer: Box) + Send + Sync>, + printer: Box) + Send + Sync>, } impl Default for DeprecationNotice { diff --git a/rpc/src/v1/helpers/dispatch/full.rs b/rpc/src/v1/helpers/dispatch/full.rs index 8c23f7208..2a81e468c 100644 --- a/rpc/src/v1/helpers/dispatch/full.rs +++ b/rpc/src/v1/helpers/dispatch/full.rs @@ -118,7 +118,7 @@ impl Dispatcher fn sign

( &self, filled: FilledTransactionRequest, - signer: &Arc, + signer: &Arc, password: SignWith, post_sign: P, ) -> BoxFuture diff --git a/rpc/src/v1/helpers/dispatch/light.rs b/rpc/src/v1/helpers/dispatch/light.rs index 88f9fafcf..c9827ccb3 100644 --- a/rpc/src/v1/helpers/dispatch/light.rs +++ b/rpc/src/v1/helpers/dispatch/light.rs @@ -45,7 +45,7 @@ where /// Sync service. pub sync: Arc, /// Header chain client. - pub client: Arc, + pub client: Arc, /// On-demand request service. pub on_demand: Arc, /// Data cache. @@ -68,7 +68,7 @@ where /// For correct operation, the OnDemand service is assumed to be registered as a network handler, pub fn new( sync: Arc, - client: Arc, + client: Arc, on_demand: Arc, cache: Arc>, transaction_queue: Arc>, @@ -215,7 +215,7 @@ where fn sign

( &self, filled: FilledTransactionRequest, - signer: &Arc, + signer: &Arc, password: SignWith, post_sign: P ) -> BoxFuture @@ -248,7 +248,7 @@ where // TODO: this could be `impl Trait`. pub fn fetch_gas_price_corpus( sync: Arc, - client: Arc, + client: Arc, on_demand: Arc, cache: Arc>, ) -> BoxFuture> diff --git a/rpc/src/v1/helpers/dispatch/mod.rs b/rpc/src/v1/helpers/dispatch/mod.rs index fa8238508..81a865f0f 100644 --- a/rpc/src/v1/helpers/dispatch/mod.rs +++ b/rpc/src/v1/helpers/dispatch/mod.rs @@ -111,7 +111,7 @@ pub trait Dispatcher: Send + Sync + Clone { fn sign

( &self, filled: FilledTransactionRequest, - signer: &Arc, + signer: &Arc, password: SignWith, post_sign: P, ) -> BoxFuture where @@ -277,7 +277,7 @@ impl From<(T, Option)> for WithToken { /// Execute a confirmation payload. pub fn execute( dispatcher: D, - signer: &Arc, + signer: &Arc, payload: ConfirmationPayload, pass: SignWith ) -> BoxFuture> { diff --git a/rpc/src/v1/helpers/dispatch/prospective_signer.rs b/rpc/src/v1/helpers/dispatch/prospective_signer.rs index 6d4b47089..78a8e628a 100644 --- a/rpc/src/v1/helpers/dispatch/prospective_signer.rs +++ b/rpc/src/v1/helpers/dispatch/prospective_signer.rs @@ -32,7 +32,7 @@ enum ProspectiveSignerState { } pub struct ProspectiveSigner { - signer: Arc, + signer: Arc, filled: FilledTransactionRequest, chain_id: Option, reserved: nonce::Reserved, @@ -46,7 +46,7 @@ pub struct ProspectiveSigner { impl ProspectiveSigner

{ pub fn new( - signer: Arc, + signer: Arc, filled: FilledTransactionRequest, chain_id: Option, reserved: nonce::Reserved, diff --git a/rpc/src/v1/helpers/external_signer/mod.rs b/rpc/src/v1/helpers/external_signer/mod.rs index 0797929cb..05796c30a 100644 --- a/rpc/src/v1/helpers/external_signer/mod.rs +++ b/rpc/src/v1/helpers/external_signer/mod.rs @@ -30,7 +30,7 @@ pub use self::signing_queue::QueueEvent; pub struct SignerService { is_enabled: bool, queue: Arc, - generate_new_token: Box Result + Send + Sync + 'static>, + generate_new_token: Box Result + Send + Sync + 'static>, } impl SignerService { diff --git a/rpc/src/v1/helpers/external_signer/signing_queue.rs b/rpc/src/v1/helpers/external_signer/signing_queue.rs index 6f3435076..2eb5b7129 100644 --- a/rpc/src/v1/helpers/external_signer/signing_queue.rs +++ b/rpc/src/v1/helpers/external_signer/signing_queue.rs @@ -96,7 +96,7 @@ pub type ConfirmationReceiver = oneshot::Receiver; pub struct ConfirmationsQueue { id: Mutex, queue: RwLock>, - on_event: RwLock () + Send + Sync>>>, + on_event: RwLock () + Send + Sync>>>, } impl ConfirmationsQueue { diff --git a/rpc/src/v1/helpers/light_fetch.rs b/rpc/src/v1/helpers/light_fetch.rs index f2e67f86c..7e97add0a 100644 --- a/rpc/src/v1/helpers/light_fetch.rs +++ b/rpc/src/v1/helpers/light_fetch.rs @@ -82,7 +82,7 @@ where OD: OnDemandRequester + 'static { /// The light client. - pub client: Arc, + pub client: Arc, /// The on-demand request service. pub on_demand: Arc, /// Handle to the network. @@ -585,7 +585,7 @@ where match maybe_future { Some(recv) => recv, - None => Box::new(future::err(errors::network_disabled())) as Box + Send> + None => Box::new(future::err(errors::network_disabled())) as Box + Send> } } @@ -741,7 +741,7 @@ where tx: EthTransaction, hdr: encoded::Header, env_info: ::vm::EnvInfo, - engine: Arc, + engine: Arc, on_demand: Arc, sync: Arc, } @@ -806,7 +806,7 @@ where failed => Ok(future::Loop::Break(failed)), } }) - })) as Box + Send> + })) as Box + Send> } else { trace!(target: "light_fetch", "Placing execution request for {} gas in on_demand", params.tx.gas); @@ -827,8 +827,8 @@ where }); match proved_future { - Some(fut) => Box::new(fut) as Box + Send>, - None => Box::new(future::err(errors::network_disabled())) as Box + Send>, + Some(fut) => Box::new(fut) as Box + Send>, + None => Box::new(future::err(errors::network_disabled())) as Box + Send>, } } } diff --git a/rpc/src/v1/helpers/subscription_manager.rs b/rpc/src/v1/helpers/subscription_manager.rs index 8323060b7..b2dacba88 100644 --- a/rpc/src/v1/helpers/subscription_manager.rs +++ b/rpc/src/v1/helpers/subscription_manager.rs @@ -87,7 +87,7 @@ impl> GenericPollManager { }).is_some() } - pub fn tick(&self) -> Box + Send> { + pub fn tick(&self) -> Box + Send> { let mut futures = Vec::new(); // poll all subscriptions for (id, subscription) in self.subscribers.iter() { diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index 50237326a..5c572b8ee 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -113,7 +113,7 @@ pub struct EthClient where client: Arc, snapshot: Arc, sync: Arc, - accounts: Arc Vec

+ Send + Sync>, + accounts: Arc Vec
+ Send + Sync>, miner: Arc, external_miner: Arc, seed_compute: Mutex, @@ -193,7 +193,7 @@ impl EthClient, snapshot: &Arc, sync: &Arc, - accounts: &Arc Vec
+ Send + Sync>, + accounts: &Arc Vec
+ Send + Sync>, miner: &Arc, em: &Arc, options: EthClientOptions @@ -449,8 +449,8 @@ impl EthClient) - .unwrap_or(Box::new(self.client.latest_state()) as Box) + .map(|s| Box::new(s) as Box) + .unwrap_or(Box::new(self.client.latest_state()) as Box) .into() } } diff --git a/rpc/src/v1/impls/eth_pubsub.rs b/rpc/src/v1/impls/eth_pubsub.rs index d9fe2329e..7841827e9 100644 --- a/rpc/src/v1/impls/eth_pubsub.rs +++ b/rpc/src/v1/impls/eth_pubsub.rs @@ -137,7 +137,7 @@ where { /// Creates a new `EthPubSubClient` for `LightClient`. pub fn light( - client: Arc, + client: Arc, on_demand: Arc, sync: Arc, cache: Arc>, diff --git a/rpc/src/v1/impls/light/eth.rs b/rpc/src/v1/impls/light/eth.rs index 6467bfbc7..3f94a0aa6 100644 --- a/rpc/src/v1/impls/light/eth.rs +++ b/rpc/src/v1/impls/light/eth.rs @@ -58,7 +58,7 @@ pub struct EthClient, on_demand: Arc, transaction_queue: Arc>, - accounts: Arc Vec
+ Send + Sync>, + accounts: Arc Vec
+ Send + Sync>, cache: Arc>, polls: Mutex>, poll_lifetime: u32, @@ -101,7 +101,7 @@ where client: Arc, on_demand: Arc, transaction_queue: Arc>, - accounts: Arc Vec
+ Send + Sync>, + accounts: Arc Vec
+ Send + Sync>, cache: Arc>, gas_price_percentile: usize, poll_lifetime: u32 diff --git a/rpc/src/v1/impls/light/parity_set.rs b/rpc/src/v1/impls/light/parity_set.rs index 68fc212b2..8195e4dda 100644 --- a/rpc/src/v1/impls/light/parity_set.rs +++ b/rpc/src/v1/impls/light/parity_set.rs @@ -34,14 +34,14 @@ use v1::types::{Bytes, ReleaseInfo, Transaction}; /// Parity-specific rpc interface for operations altering the settings. pub struct ParitySetClient { - client: Arc, - net: Arc, + client: Arc, + net: Arc, fetch: F, } impl ParitySetClient { /// Creates new `ParitySetClient` with given `Fetch`. - pub fn new(client: Arc, net: Arc, fetch: F) -> Self { + pub fn new(client: Arc, net: Arc, fetch: F) -> Self { ParitySetClient { client, net, diff --git a/rpc/src/v1/impls/parity.rs b/rpc/src/v1/impls/parity.rs index 0dd657213..3503af586 100644 --- a/rpc/src/v1/impls/parity.rs +++ b/rpc/src/v1/impls/parity.rs @@ -59,13 +59,13 @@ pub struct ParityClient { client: Arc, miner: Arc, updater: Arc, - sync: Arc, - net: Arc, + sync: Arc, + net: Arc, logger: Arc, settings: Arc, signer: Option>, ws_address: Option, - snapshot: Option>, + snapshot: Option>, } impl ParityClient where @@ -75,14 +75,14 @@ impl ParityClient where pub fn new( client: Arc, miner: Arc, - sync: Arc, + sync: Arc, updater: Arc, - net: Arc, + net: Arc, logger: Arc, settings: Arc, signer: Option>, ws_address: Option, - snapshot: Option>, + snapshot: Option>, ) -> Self { ParityClient { client, diff --git a/rpc/src/v1/impls/parity_set.rs b/rpc/src/v1/impls/parity_set.rs index 25d06ed85..7d7b46847 100644 --- a/rpc/src/v1/impls/parity_set.rs +++ b/rpc/src/v1/impls/parity_set.rs @@ -87,7 +87,7 @@ pub struct ParitySetClient { client: Arc, miner: Arc, updater: Arc, - net: Arc, + net: Arc, fetch: F, } @@ -99,7 +99,7 @@ impl ParitySetClient client: &Arc, miner: &Arc, updater: &Arc, - net: &Arc, + net: &Arc, fetch: F, ) -> Self { ParitySetClient { diff --git a/rpc/src/v1/impls/signer.rs b/rpc/src/v1/impls/signer.rs index 3672f3c4c..b135a1fba 100644 --- a/rpc/src/v1/impls/signer.rs +++ b/rpc/src/v1/impls/signer.rs @@ -40,7 +40,7 @@ use v1::types::{TransactionModification, ConfirmationRequest, ConfirmationRespon /// Transactions confirmation (personal) rpc implementation. pub struct SignerClient { signer: Arc, - accounts: Arc, + accounts: Arc, dispatcher: D, subscribers: Arc>>>>, deprecation_notice: DeprecationNotice, @@ -49,7 +49,7 @@ pub struct SignerClient { impl SignerClient { /// Create new instance of signer client. pub fn new( - accounts: Arc, + accounts: Arc, dispatcher: D, signer: &Arc, executor: Executor, @@ -81,7 +81,7 @@ impl SignerClient { } fn confirm_internal(&self, id: U256, modification: TransactionModification, f: F) -> BoxFuture> where - F: FnOnce(D, &Arc, ConfirmationPayload) -> T, + F: FnOnce(D, &Arc, ConfirmationPayload) -> T, T: IntoFuture, Error=Error>, T::Future: Send + 'static { diff --git a/rpc/src/v1/impls/signing.rs b/rpc/src/v1/impls/signing.rs index 38ca6d59c..dc44e5bd4 100644 --- a/rpc/src/v1/impls/signing.rs +++ b/rpc/src/v1/impls/signing.rs @@ -91,7 +91,7 @@ fn schedule(executor: Executor, /// Implementation of functions that require signing when no trusted signer is used. pub struct SigningQueueClient { signer: Arc, - accounts: Arc, + accounts: Arc, dispatcher: D, executor: Executor, // None here means that the request hasn't yet been confirmed @@ -101,7 +101,7 @@ pub struct SigningQueueClient { impl SigningQueueClient { /// Creates a new signing queue client given shared signing queue. - pub fn new(signer: &Arc, dispatcher: D, executor: Executor, accounts: &Arc) -> Self { + pub fn new(signer: &Arc, dispatcher: D, executor: Executor, accounts: &Arc) -> Self { SigningQueueClient { signer: signer.clone(), accounts: accounts.clone(), diff --git a/rpc/src/v1/impls/signing_unsafe.rs b/rpc/src/v1/impls/signing_unsafe.rs index f08a9ffbe..4916e592f 100644 --- a/rpc/src/v1/impls/signing_unsafe.rs +++ b/rpc/src/v1/impls/signing_unsafe.rs @@ -37,14 +37,14 @@ use v1::types::{ /// Implementation of functions that require signing when no trusted signer is used. pub struct SigningUnsafeClient { - accounts: Arc, + accounts: Arc, dispatcher: D, deprecation_notice: DeprecationNotice, } impl SigningUnsafeClient { /// Creates new SigningUnsafeClient. - pub fn new(accounts: &Arc, dispatcher: D) -> Self { + pub fn new(accounts: &Arc, dispatcher: D) -> Self { SigningUnsafeClient { accounts: accounts.clone(), dispatcher, diff --git a/rpc/src/v1/tests/helpers/miner_service.rs b/rpc/src/v1/tests/helpers/miner_service.rs index 8bff84dc3..48c7829b9 100644 --- a/rpc/src/v1/tests/helpers/miner_service.rs +++ b/rpc/src/v1/tests/helpers/miner_service.rs @@ -55,7 +55,7 @@ pub struct TestMinerService { /// Minimum gas price pub min_gas_price: RwLock>, /// Signer (if any) - pub signer: RwLock>>, + pub signer: RwLock>>, authoring_params: RwLock, } @@ -102,7 +102,7 @@ impl StateClient for TestMinerService { } impl EngineInfo for TestMinerService { - fn engine(&self) -> &Engine { + fn engine(&self) -> &dyn Engine { unimplemented!() } } diff --git a/rpc/src/v1/tests/mocked/manage_network.rs b/rpc/src/v1/tests/mocked/manage_network.rs index d327a8743..abb2bc963 100644 --- a/rpc/src/v1/tests/mocked/manage_network.rs +++ b/rpc/src/v1/tests/mocked/manage_network.rs @@ -31,5 +31,5 @@ impl ManageNetwork for TestManageNetwork { fn start_network(&self) {} fn stop_network(&self) {} fn num_peers_range(&self) -> RangeInclusive { 25..=50 } - fn with_proto_context(&self, _: ProtocolId, _: &mut FnMut(&NetworkContext)) { } + fn with_proto_context(&self, _: ProtocolId, _: &mut dyn FnMut(&dyn NetworkContext)) { } } diff --git a/rpc/src/v1/tests/mocked/parity.rs b/rpc/src/v1/tests/mocked/parity.rs index e8a83bb35..7914ac4ed 100644 --- a/rpc/src/v1/tests/mocked/parity.rs +++ b/rpc/src/v1/tests/mocked/parity.rs @@ -45,7 +45,7 @@ pub struct Dependencies { pub updater: Arc, pub logger: Arc, pub settings: Arc, - pub network: Arc, + pub network: Arc, pub ws_address: Option, } diff --git a/rpc/src/v1/tests/mocked/parity_set.rs b/rpc/src/v1/tests/mocked/parity_set.rs index 683f681e4..1ae42c691 100644 --- a/rpc/src/v1/tests/mocked/parity_set.rs +++ b/rpc/src/v1/tests/mocked/parity_set.rs @@ -58,7 +58,7 @@ fn parity_set_client( client, miner, updater, - &(net.clone() as Arc), + &(net.clone() as Arc), FakeFetch::new(Some(1)), ) } diff --git a/rpc/src/v1/types/derivation.rs b/rpc/src/v1/types/derivation.rs index 1f2764d9f..907ce3a00 100644 --- a/rpc/src/v1/types/derivation.rs +++ b/rpc/src/v1/types/derivation.rs @@ -19,7 +19,7 @@ use serde::{Deserialize, Deserializer}; use serde::de::{Error, Visitor}; use ethereum_types::H256; -use ethstore; + /// Type of derivation pub enum DerivationType { diff --git a/updater/hash-fetch/src/client.rs b/updater/hash-fetch/src/client.rs index a3ebdce26..ea50b08ad 100644 --- a/updater/hash-fetch/src/client.rs +++ b/updater/hash-fetch/src/client.rs @@ -37,7 +37,7 @@ pub trait HashFetch: Send + Sync + 'static { /// 2. `on_done` - callback function invoked when the content is ready (or there was error during fetch) /// /// This function may fail immediately when fetch cannot be initialized or content cannot be resolved. - fn fetch(&self, hash: H256, abort: fetch::Abort, on_done: Box) + Send>); + fn fetch(&self, hash: H256, abort: fetch::Abort, on_done: Box) + Send>); } /// Hash-fetching error. @@ -111,12 +111,12 @@ pub struct Client { contract: URLHintContract, fetch: F, executor: Executor, - random_path: Arc PathBuf + Sync + Send>, + random_path: Arc PathBuf + Sync + Send>, } impl Client { /// Creates new instance of the `Client` given on-chain contract client, fetch service and task runner. - pub fn with_fetch(contract: Arc>, fetch: F, executor: Executor) -> Self { + pub fn with_fetch(contract: Arc>, fetch: F, executor: Executor) -> Self { Client { contract: URLHintContract::new(contract), fetch: fetch, @@ -127,7 +127,7 @@ impl Client { } impl HashFetch for Client { - fn fetch(&self, hash: H256, abort: fetch::Abort, on_done: Box) + Send>) { + fn fetch(&self, hash: H256, abort: fetch::Abort, on_done: Box) + Send>) { debug!(target: "fetch", "Fetching: {:?}", hash); let random_path = self.random_path.clone(); diff --git a/updater/hash-fetch/src/lib.rs b/updater/hash-fetch/src/lib.rs index a9ddc7363..1d3b9e105 100644 --- a/updater/hash-fetch/src/lib.rs +++ b/updater/hash-fetch/src/lib.rs @@ -35,7 +35,7 @@ extern crate registrar; pub extern crate fetch; -#[macro_use] +// #[macro_use] extern crate ethabi_derive; #[macro_use] extern crate ethabi_contract; diff --git a/updater/hash-fetch/src/urlhint.rs b/updater/hash-fetch/src/urlhint.rs index 59829d1da..27af8238b 100644 --- a/updater/hash-fetch/src/urlhint.rs +++ b/updater/hash-fetch/src/urlhint.rs @@ -95,18 +95,18 @@ pub enum URLHintResult { /// URLHint Contract interface pub trait URLHint: Send + Sync { /// Resolves given id to registrar entry. - fn resolve(&self, id: H256) -> Box, Error = String> + Send>; + fn resolve(&self, id: H256) -> Box, Error = String> + Send>; } /// `URLHintContract` API pub struct URLHintContract { registrar: Registrar, - client: Arc>, + client: Arc>, } impl URLHintContract { /// Creates new `URLHintContract` - pub fn new(client: Arc>) -> Self { + pub fn new(client: Arc>) -> Self { URLHintContract { registrar: Registrar::new(client.clone()), client: client, @@ -159,7 +159,7 @@ fn decode_urlhint_output(output: (String, [u8; 20], Address)) -> Option Box, Error = String> + Send> { + fn resolve(&self, id: H256) -> Box, Error = String> + Send> { let client = self.client.clone(); let future = self.registrar.get_address(GITHUB_HINT) diff --git a/updater/src/lib.rs b/updater/src/lib.rs index 7bc4eab7d..1abfe2cb6 100644 --- a/updater/src/lib.rs +++ b/updater/src/lib.rs @@ -21,6 +21,7 @@ extern crate client_traits; extern crate common_types; extern crate ethabi; +extern crate ethabi_derive; extern crate ethcore; extern crate ethcore_sync as sync; extern crate ethereum_types; @@ -37,8 +38,6 @@ extern crate target_info; #[macro_use] extern crate ethabi_contract; #[macro_use] -extern crate ethabi_derive; -#[macro_use] extern crate lazy_static; #[macro_use] extern crate log; diff --git a/updater/src/updater.rs b/updater/src/updater.rs index ec51ffd9a..c675fef94 100644 --- a/updater/src/updater.rs +++ b/updater/src/updater.rs @@ -144,11 +144,11 @@ pub struct Updater>>, - client: Weak, - sync: Option>, + client: Weak, + sync: Option>, fetcher: F, operations_client: O, - exit_handler: Mutex>>, + exit_handler: Mutex>>, time_provider: T, rng: R, @@ -205,11 +205,11 @@ pub trait OperationsClient: Send + Sync + 'static { /// `OperationsClient` that delegates calls to the operations contract. pub struct OperationsContractClient { - client: Weak, + client: Weak, } impl OperationsContractClient { - fn new(client: Weak) -> Self { + fn new(client: Weak) -> Self { OperationsContractClient { client } @@ -368,8 +368,8 @@ impl GenRange for ThreadRngGenRange { impl Updater { /// `Updater` constructor pub fn new( - client: &Weak, - sync: &Weak, + client: &Weak, + sync: &Weak, update_policy: UpdatePolicy, fetcher: fetch::Client, ) -> Arc { @@ -756,7 +756,7 @@ pub mod tests { #[derive(Clone)] struct FakeFetch { - on_done: Arc) + Send>>>>, + on_done: Arc) + Send>>>>, } impl FakeFetch { @@ -772,7 +772,7 @@ pub mod tests { } impl HashFetch for FakeFetch { - fn fetch(&self, _hash: H256, _abort: fetch::Abort, on_done: Box) + Send>) { + fn fetch(&self, _hash: H256, _abort: fetch::Abort, on_done: Box) + Send>) { *self.on_done.lock() = Some(on_done); } } diff --git a/util/EIP-712/src/error.rs b/util/EIP-712/src/error.rs index 3ec1292bb..0eaa8e7bd 100644 --- a/util/EIP-712/src/error.rs +++ b/util/EIP-712/src/error.rs @@ -67,7 +67,7 @@ pub(crate) fn serde_error(expected: &str, field: Option<&str>) -> ErrorKind { } impl Fail for Error { - fn cause(&self) -> Option<&Fail> { + fn cause(&self) -> Option<&dyn Fail> { self.inner.cause() } diff --git a/util/fetch/src/client.rs b/util/fetch/src/client.rs index e4474fb79..696b624ef 100644 --- a/util/fetch/src/client.rs +++ b/util/fetch/src/client.rs @@ -271,7 +271,7 @@ impl Client { } impl Fetch for Client { - type Result = Box + Send + 'static>; + type Result = Box + Send + 'static>; fn fetch(&self, request: Request, abort: Abort) -> Self::Result { debug!(target: "fetch", "fetching: {:?}", request.url()); @@ -608,7 +608,7 @@ impl fmt::Display for Error { impl ::std::error::Error for Error { fn description(&self) -> &str { "Fetch client error" } - fn cause(&self) -> Option<&::std::error::Error> { None } + fn cause(&self) -> Option<&dyn std::error::Error> { None } } impl From for Error { diff --git a/util/migration-rocksdb/src/lib.rs b/util/migration-rocksdb/src/lib.rs index d63f2843c..4085d20bc 100644 --- a/util/migration-rocksdb/src/lib.rs +++ b/util/migration-rocksdb/src/lib.rs @@ -32,7 +32,7 @@ use std::{fs, io, error}; use kvdb::DBTransaction; use kvdb_rocksdb::{CompactionProfile, Database, DatabaseConfig}; -fn other_io_err(e: E) -> io::Error where E: Into> { +fn other_io_err(e: E) -> io::Error where E: Into> { io::Error::new(io::ErrorKind::Other, e) } @@ -209,7 +209,7 @@ impl TempIndex { /// Manages database migration. pub struct Manager { config: Config, - migrations: Vec>, + migrations: Vec>, } impl Manager { @@ -317,7 +317,7 @@ impl Manager { } /// Find all needed migrations. - fn migrations_from(&mut self, version: u32) -> Vec<&mut Box> { + fn migrations_from(&mut self, version: u32) -> Vec<&mut Box> { self.migrations.iter_mut().filter(|m| m.version() > version).collect() } } diff --git a/util/network-devp2p/src/ip_utils.rs b/util/network-devp2p/src/ip_utils.rs index 63f440b49..0a599155d 100644 --- a/util/network-devp2p/src/ip_utils.rs +++ b/util/network-devp2p/src/ip_utils.rs @@ -97,12 +97,12 @@ impl SocketAddrExt for Ipv4Addr { self.is_multicast() || self.is_shared_space() || self.is_special_purpose() || - self.is_benchmarking() || + SocketAddrExt::is_benchmarking(self) || self.is_future_use() } fn is_usable_public(&self) -> bool { - !self.is_reserved() && + !SocketAddrExt::is_reserved(self) && !self.is_private() } @@ -186,7 +186,7 @@ impl SocketAddrExt for IpAddr { fn is_reserved(&self) -> bool { match *self { - IpAddr::V4(ref ip) => ip.is_reserved(), + IpAddr::V4(ref ip) => SocketAddrExt::is_reserved(ip), IpAddr::V6(ref ip) => ip.is_reserved(), } } @@ -290,7 +290,7 @@ pub fn select_public_address(port: u16) -> SocketAddr { //prefer IPV4 bindings for addr in &list { //TODO: use better criteria than just the first in the list match addr { - IpAddr::V4(a) if !a.is_reserved() => { + IpAddr::V4(a) if !SocketAddrExt::is_reserved(a) => { return SocketAddr::V4(SocketAddrV4::new(*a, port)); }, _ => {}, diff --git a/util/network/src/error.rs b/util/network/src/error.rs index 81e3b78b8..c43de6b8d 100644 --- a/util/network/src/error.rs +++ b/util/network/src/error.rs @@ -145,7 +145,7 @@ impl From> for AddressResolveError { } impl error::Error for Error { - fn source(&self) -> Option<&(error::Error + 'static)> { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { match self { Error::Decompression(e) => Some(e), Error::Rlp(e) => Some(e), diff --git a/util/network/src/lib.rs b/util/network/src/lib.rs index be47fa367..31071655c 100644 --- a/util/network/src/lib.rs +++ b/util/network/src/lib.rs @@ -75,7 +75,7 @@ pub enum NetworkIoMessage { /// Register a new protocol handler. AddHandler { /// Handler shared instance. - handler: Arc, + handler: Arc, /// Protocol Id. protocol: ProtocolId, /// Supported protocol versions and number of packet IDs reserved by the protocol (packet count). @@ -361,15 +361,15 @@ impl<'a, T> NetworkContext for &'a T where T: ?Sized + NetworkContext { /// `Message` is the type for message data. pub trait NetworkProtocolHandler: Sync + Send { /// Initialize the handler - fn initialize(&self, _io: &NetworkContext) {} + fn initialize(&self, _io: &dyn NetworkContext) {} /// Called when new network packet received. - fn read(&self, io: &NetworkContext, peer: &PeerId, packet_id: u8, data: &[u8]); + fn read(&self, io: &dyn NetworkContext, peer: &PeerId, packet_id: u8, data: &[u8]); /// Called when new peer is connected. Only called when peer supports the same protocol. - fn connected(&self, io: &NetworkContext, peer: &PeerId); + fn connected(&self, io: &dyn NetworkContext, peer: &PeerId); /// Called when a previously connected peer disconnects. - fn disconnected(&self, io: &NetworkContext, peer: &PeerId); + fn disconnected(&self, io: &dyn NetworkContext, peer: &PeerId); /// Timer function called after a timeout created with `NetworkContext::timeout`. - fn timeout(&self, _io: &NetworkContext, _timer: TimerToken) {} + fn timeout(&self, _io: &dyn NetworkContext, _timer: TimerToken) {} } /// Non-reserved peer modes. diff --git a/util/registrar/src/lib.rs b/util/registrar/src/lib.rs index d07e17c1b..40a7de903 100644 --- a/util/registrar/src/lib.rs +++ b/util/registrar/src/lib.rs @@ -16,10 +16,9 @@ extern crate futures; extern crate ethabi; +extern crate ethabi_derive; extern crate keccak_hash; -#[macro_use] -extern crate ethabi_derive; #[macro_use] extern crate ethabi_contract; diff --git a/util/registrar/src/registrar.rs b/util/registrar/src/registrar.rs index cd6d35660..bc7fe0976 100644 --- a/util/registrar/src/registrar.rs +++ b/util/registrar/src/registrar.rs @@ -24,25 +24,25 @@ use_contract!(registrar, "res/registrar.json"); // Maps a domain name to an Ethereum address const DNS_A_RECORD: &'static str = "A"; -pub type Asynchronous = Box + Send>; +pub type Asynchronous = Box + Send>; pub type Synchronous = Result; /// Registrar is dedicated interface to access the registrar contract /// which in turn generates an address when a client requests one pub struct Registrar { - client: Arc>, + client: Arc>, } impl Registrar { /// Registrar constructor - pub fn new(client: Arc>) -> Self { + pub fn new(client: Arc>) -> Self { Self { client: client, } } /// Generate an address for the given key - pub fn get_address<'a>(&self, key: &'a str) -> Box + Send> { + pub fn get_address<'a>(&self, key: &'a str) -> Box + Send> { // Address of the registrar itself let registrar_address = match self.client.registrar_address() { Ok(a) => a, diff --git a/util/rlp-compress/src/lib.rs b/util/rlp-compress/src/lib.rs index 48620ed23..890cd66f8 100644 --- a/util/rlp-compress/src/lib.rs +++ b/util/rlp-compress/src/lib.rs @@ -40,7 +40,7 @@ pub trait Decompressor { } /// Call this function to compress rlp. -pub fn compress(c: &[u8], swapper: &Compressor) -> ElasticArray1024 { +pub fn compress(c: &[u8], swapper: &dyn Compressor) -> ElasticArray1024 { let rlp = Rlp::new(c); if rlp.is_data() { ElasticArray1024::from_slice(swapper.compressed(rlp.as_raw()).unwrap_or_else(|| rlp.as_raw())) @@ -50,7 +50,7 @@ pub fn compress(c: &[u8], swapper: &Compressor) -> ElasticArray1024 { } /// Call this function to decompress rlp. -pub fn decompress(c: &[u8], swapper: &Decompressor) -> ElasticArray1024 { +pub fn decompress(c: &[u8], swapper: &dyn Decompressor) -> ElasticArray1024 { let rlp = Rlp::new(c); if rlp.is_data() { ElasticArray1024::from_slice(swapper.decompressed(rlp.as_raw()).unwrap_or_else(|| rlp.as_raw()))