From 498a708df72e03e88d64b536c52fc2693559762b Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Thu, 23 Nov 2017 08:22:51 +0300 Subject: [PATCH] fixed warnings --- .../src/key_server_cluster/cluster.rs | 18 ++++---- secret_store/src/listener/service_contract.rs | 46 ++++--------------- .../src/listener/service_contract_listener.rs | 20 +++----- 3 files changed, 26 insertions(+), 58 deletions(-) diff --git a/secret_store/src/key_server_cluster/cluster.rs b/secret_store/src/key_server_cluster/cluster.rs index ae352a9b4..59f1bfac5 100644 --- a/secret_store/src/key_server_cluster/cluster.rs +++ b/secret_store/src/key_server_cluster/cluster.rs @@ -1025,7 +1025,7 @@ pub mod tests { use key_server_cluster::encryption_session::{SessionImpl as EncryptionSession}; use key_server_cluster::signing_session::{SessionImpl as SigningSession}; use key_server_cluster::key_version_negotiation_session::{SessionImpl as KeyVersionNegotiationSession, - IsolatedSessionTransport as KeyVersionNegotiationSessionTransport, ContinueAction}; + IsolatedSessionTransport as KeyVersionNegotiationSessionTransport}; #[derive(Default)] pub struct DummyClusterClient; @@ -1044,17 +1044,17 @@ pub mod tests { impl ClusterClient for DummyClusterClient { fn cluster_state(&self) -> ClusterState { unimplemented!() } - fn new_generation_session(&self, session_id: SessionId, author: Public, threshold: usize) -> Result, Error> { unimplemented!() } - fn new_encryption_session(&self, session_id: SessionId, requestor_signature: Signature, common_point: Public, encrypted_point: Public) -> Result, Error> { unimplemented!() } - fn new_decryption_session(&self, session_id: SessionId, requestor_signature: Signature, version: Option, is_shadow_decryption: bool) -> Result, Error> { unimplemented!() } - fn new_signing_session(&self, session_id: SessionId, requestor_signature: Signature, version: Option, message_hash: H256) -> Result, Error> { unimplemented!() } - fn new_key_version_negotiation_session(&self, session_id: SessionId) -> Result>, Error> { unimplemented!() } - fn new_servers_set_change_session(&self, session_id: Option, new_nodes_set: BTreeSet, old_set_signature: Signature, new_set_signature: Signature) -> Result, Error> { unimplemented!() } + fn new_generation_session(&self, _session_id: SessionId, _author: Public, _threshold: usize) -> Result, Error> { unimplemented!() } + fn new_encryption_session(&self, _session_id: SessionId, _requestor_signature: Signature, _common_point: Public, _encrypted_point: Public) -> Result, Error> { unimplemented!() } + fn new_decryption_session(&self, _session_id: SessionId, _requestor_signature: Signature, _version: Option, _is_shadow_decryption: bool) -> Result, Error> { unimplemented!() } + fn new_signing_session(&self, _session_id: SessionId, _requestor_signature: Signature, _version: Option, _message_hash: H256) -> Result, Error> { unimplemented!() } + fn new_key_version_negotiation_session(&self, _session_id: SessionId) -> Result>, Error> { unimplemented!() } + fn new_servers_set_change_session(&self, _session_id: Option, _new_nodes_set: BTreeSet, _old_set_signature: Signature, _new_set_signature: Signature) -> Result, Error> { unimplemented!() } - fn add_generation_listener(&self, listener: Arc>) {} + fn add_generation_listener(&self, _listener: Arc>) {} fn make_faulty_generation_sessions(&self) { unimplemented!() } - fn generation_session(&self, session_id: &SessionId) -> Option> { unimplemented!() } + fn generation_session(&self, _session_id: &SessionId) -> Option> { unimplemented!() } fn connect(&self) { unimplemented!() } fn key_storage(&self) -> Arc { unimplemented!() } } diff --git a/secret_store/src/listener/service_contract.rs b/secret_store/src/listener/service_contract.rs index 30ad8937d..3d5b25b72 100644 --- a/secret_store/src/listener/service_contract.rs +++ b/secret_store/src/listener/service_contract.rs @@ -14,28 +14,19 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use std::collections::{VecDeque, HashSet}; use std::sync::{Arc, Weak}; -use std::sync::atomic::{AtomicUsize, Ordering}; -use std::thread; use futures::{future, Future}; -use parking_lot::{RwLock, Mutex, Condvar}; +use parking_lot::RwLock; use ethcore::filter::Filter; -use ethcore::client::{Client, BlockChainClient, BlockId, ChainNotify}; -use ethkey::{Random, Generator, Public, Signature, sign, public_to_address}; +use ethcore::client::{Client, BlockChainClient, BlockId}; +use ethkey::{Public, Signature, public_to_address}; use ethsync::SyncProvider; use native_contracts::SecretStoreService; -use bytes::Bytes; use hash::keccak; use bigint::hash::H256; use bigint::prelude::U256; -use util::Address; -use key_server_set::KeyServerSet; -use key_server_cluster::{ClusterClient, ClusterSessionsListener, ClusterSession}; -use key_server_cluster::generation_session::SessionImpl as GenerationSession; -use key_storage::KeyStorage; -use listener::service_contract_listener::{ServiceTask, ServiceContractListenerParams}; -use {ServerKeyId, NodeKeyPair, KeyServer}; +use listener::service_contract_listener::ServiceTask; +use {ServerKeyId, NodeKeyPair}; /// Name of the SecretStore contract in the registry. const SERVICE_CONTRACT_REGISTRY_NAME: &'static str = "secretstore_service"; @@ -250,28 +241,11 @@ impl Iterator for PendingRequestsIterator { #[cfg(test)] pub mod tests { - use std::collections::{VecDeque, HashSet}; - use std::sync::{Arc, Weak}; - use std::sync::atomic::{AtomicUsize, Ordering}; - use std::thread; - use futures::{future, Future}; - use parking_lot::{RwLock, Mutex, Condvar}; - use ethcore::filter::Filter; - use ethcore::client::{Client, BlockChainClient, BlockId, ChainNotify}; - use ethkey::{Random, Generator, Public, Signature, sign, public_to_address}; - use ethsync::SyncProvider; - use native_contracts::SecretStoreService; - use bytes::Bytes; - use hash::keccak; + use parking_lot::Mutex; + use ethkey::Public; use bigint::hash::H256; - use bigint::prelude::U256; - use util::Address; - use key_server_set::KeyServerSet; - use key_server_cluster::{ClusterClient, ClusterSessionsListener, ClusterSession}; - use key_server_cluster::generation_session::SessionImpl as GenerationSession; - use key_storage::KeyStorage; - use listener::service_contract_listener::{ServiceTask, ServiceContractListenerParams}; - use {ServerKeyId, NodeKeyPair, KeyServer}; + use listener::service_contract_listener::ServiceTask; + use ServerKeyId; use super::ServiceContract; #[derive(Default)] @@ -290,7 +264,7 @@ pub mod tests { self.is_actual } - fn read_logs(&self, first_block: H256, last_block: H256) -> Box>> { + fn read_logs(&self, _first_block: H256, _last_block: H256) -> Box>> { Box::new(self.logs.clone().into_iter()) } diff --git a/secret_store/src/listener/service_contract_listener.rs b/secret_store/src/listener/service_contract_listener.rs index 3a85efd6a..8ffc75224 100644 --- a/secret_store/src/listener/service_contract_listener.rs +++ b/secret_store/src/listener/service_contract_listener.rs @@ -15,21 +15,15 @@ // along with Parity. If not, see . use std::collections::{VecDeque, HashSet}; -use std::sync::{Arc, Weak}; +use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering}; use std::thread; -use futures::{future, Future}; -use parking_lot::{RwLock, Mutex, Condvar}; -use ethcore::filter::Filter; -use ethcore::client::{Client, BlockChainClient, BlockId, ChainNotify}; -use ethkey::{Random, Generator, Public, Signature, sign, public_to_address}; -use ethsync::SyncProvider; -use native_contracts::SecretStoreService; +use parking_lot::{Mutex, Condvar}; +use ethcore::client::ChainNotify; +use ethkey::{Random, Generator, Public, sign}; use bytes::Bytes; -use hash::keccak; use bigint::hash::H256; use bigint::prelude::U256; -use util::Address; use key_server_set::KeyServerSet; use key_server_cluster::{ClusterClient, ClusterSessionsListener, ClusterSession}; use key_server_cluster::generation_session::SessionImpl as GenerationSession; @@ -744,7 +738,7 @@ mod tests { let mut contract = DummyServiceContract::default(); contract.logs.push(vec![Default::default(), Default::default(), Default::default()]); let listener = make_service_contract_listener(Some(Arc::new(contract)), None, None); - listener.data.key_storage.insert(Default::default(), Default::default()); + listener.data.key_storage.insert(Default::default(), Default::default()).unwrap(); assert_eq!(listener.data.tasks_queue.service_tasks.lock().len(), 1); listener.process_service_contract_events(Default::default(), Default::default()); assert_eq!(listener.data.tasks_queue.service_tasks.lock().len(), 2); @@ -775,7 +769,7 @@ mod tests { let key_storage = Arc::new(DummyKeyStorage::default()); let mut key_share = DocumentKeyShare::default(); key_share.public = KeyPair::from_secret("0000000000000000000000000000000000000000000000000000000000000001".parse().unwrap()).unwrap().public().clone(); - key_storage.insert(Default::default(), key_share.clone()); + key_storage.insert(Default::default(), key_share.clone()).unwrap(); let listener = make_service_contract_listener(Some(contract.clone()), None, Some(key_storage)); ServiceContractListener::process_service_task(&listener.data, ServiceTask::RestoreServerKey(Default::default())).unwrap(); assert_eq!(*contract.published_keys.lock(), vec![(Default::default(), key_share.public)]); @@ -788,7 +782,7 @@ mod tests { let key_server = Arc::new(DummyKeyServer::default()); let listener = make_service_contract_listener(Some(Arc::new(contract)), Some(key_server.clone()), None); listener.data.retry_data.lock().generated_keys.insert(Default::default()); - ServiceContractListener::retry_pending_requests(&listener.data); + ServiceContractListener::retry_pending_requests(&listener.data).unwrap(); assert_eq!(key_server.generation_requests_count.load(Ordering::Relaxed), 0); } }