dissolve util (#7460)
* ethereum-types refactor in progress * ethereum-types refactor in progress * ethereum-types refactor in progress * ethereum-types refactor in progress * ethereum-types refactor finished * removed obsolete util/src/lib.rs * removed commented out code
This commit is contained in:
committed by
Svyatoslav Nikolsky
parent
4a4d64be56
commit
e95b093483
@@ -24,8 +24,7 @@ tokio-proto = "0.1"
|
||||
url = "1.0"
|
||||
ethcore = { path = "../ethcore" }
|
||||
ethcore-bytes = { path = "../util/bytes" }
|
||||
ethcore-util = { path = "../util" }
|
||||
ethcore-bigint = { path = "../util/bigint" }
|
||||
ethereum-types = "0.1"
|
||||
ethsync = { path = "../sync" }
|
||||
kvdb = { path = "../util/kvdb" }
|
||||
kvdb-rocksdb = { path = "../util/kvdb-rocksdb" }
|
||||
|
||||
@@ -21,8 +21,7 @@ use parking_lot::{Mutex, RwLock};
|
||||
use ethkey::public_to_address;
|
||||
use ethcore::client::{BlockChainClient, BlockId, ChainNotify};
|
||||
use native_contracts::SecretStoreAclStorage;
|
||||
use bigint::hash::H256;
|
||||
use util::Address;
|
||||
use ethereum_types::{H256, Address};
|
||||
use bytes::Bytes;
|
||||
use trusted_client::TrustedClient;
|
||||
use types::all::{Error, ServerKeyId, Public};
|
||||
|
||||
@@ -215,7 +215,7 @@ pub mod tests {
|
||||
use node_key_pair::PlainNodeKeyPair;
|
||||
use key_server_set::tests::MapKeyServerSet;
|
||||
use key_server_cluster::math;
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use types::all::{Error, Public, ClusterConfiguration, NodeAddress, RequestSignature, ServerKeyId,
|
||||
EncryptedDocumentKey, EncryptedDocumentKeyShadow, MessageHash, EncryptedMessageSignature, NodeId};
|
||||
use traits::{AdminSessionsServer, ServerKeyGenerator, DocumentKeyServer, MessageSigner, KeyServer};
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::collections::{BTreeSet, BTreeMap};
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use ethkey::Secret;
|
||||
use parking_lot::{Mutex, Condvar};
|
||||
use key_server_cluster::{Error, SessionId, NodeId, DocumentKeyShare};
|
||||
|
||||
@@ -18,7 +18,7 @@ use std::sync::Arc;
|
||||
use std::collections::{BTreeSet, BTreeMap};
|
||||
use std::collections::btree_map::Entry;
|
||||
use parking_lot::{Mutex, Condvar};
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use ethkey::{Public, Signature};
|
||||
use key_server_cluster::{Error, NodeId, SessionId, KeyStorage};
|
||||
use key_server_cluster::math;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::collections::{BTreeSet, BTreeMap};
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use ethkey::{Public, Secret, Signature};
|
||||
use parking_lot::{Mutex, Condvar};
|
||||
use key_server_cluster::{Error, SessionId, NodeId, DocumentKeyShare, DocumentKeyShareVersion, KeyStorage};
|
||||
@@ -853,7 +853,7 @@ pub mod tests {
|
||||
use std::sync::Arc;
|
||||
use std::collections::{VecDeque, BTreeMap, BTreeSet};
|
||||
use ethkey::{Random, Generator, Public, KeyPair, Signature, sign};
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use key_server_cluster::{NodeId, SessionId, Error, KeyStorage, DummyKeyStorage};
|
||||
use key_server_cluster::cluster::Cluster;
|
||||
use key_server_cluster::cluster::tests::DummyCluster;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::collections::{BTreeSet, BTreeMap};
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use ethkey::Secret;
|
||||
use key_server_cluster::{Error, NodeId, SessionId, KeyStorage};
|
||||
use key_server_cluster::cluster::Cluster;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use std::collections::BTreeSet;
|
||||
use std::sync::Arc;
|
||||
use parking_lot::{Mutex, Condvar};
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use ethkey::{Secret, Signature};
|
||||
use key_server_cluster::{Error, AclStorage, DocumentKeyShare, NodeId, SessionId, EncryptedDocumentKeyShadow, SessionMeta};
|
||||
use key_server_cluster::cluster::Cluster;
|
||||
|
||||
@@ -301,7 +301,7 @@ impl SessionImpl {
|
||||
self.on_session_error(sender, Error::Io(message.error.clone().into()));
|
||||
Ok(())
|
||||
},
|
||||
&GenerationMessage::SessionCompleted(ref message) =>
|
||||
&GenerationMessage::SessionCompleted(ref message) =>
|
||||
self.on_session_completed(sender.clone(), message),
|
||||
}
|
||||
}
|
||||
@@ -526,7 +526,7 @@ impl SessionImpl {
|
||||
data.secret_share.as_ref().expect("secret_share is filled in KG phase; we are at the end of KG phase; qed").clone(),
|
||||
)],
|
||||
};
|
||||
|
||||
|
||||
if let Some(ref key_storage) = self.key_storage {
|
||||
key_storage.insert(self.id.clone(), encrypted_data.clone())
|
||||
.map_err(|e| Error::KeyStorage(e.into()))?;
|
||||
@@ -626,7 +626,7 @@ impl SessionImpl {
|
||||
/// Keys verification (KV) phase
|
||||
fn verify_keys(&self) -> Result<(), Error> {
|
||||
let mut data = self.data.lock();
|
||||
|
||||
|
||||
// key verification (KV) phase: check that other nodes have passed correct secrets
|
||||
let threshold = data.threshold.expect("threshold is filled in initialization phase; KV phase follows initialization phase; qed");
|
||||
let derived_point = data.derived_point.clone().expect("derived point generated on initialization phase; KV phase follows initialization phase; qed");
|
||||
@@ -674,7 +674,7 @@ impl SessionImpl {
|
||||
/// Complete generation
|
||||
fn complete_generation(&self) -> Result<(), Error> {
|
||||
let mut data = self.data.lock();
|
||||
|
||||
|
||||
// calculate joint public key
|
||||
let joint_public = {
|
||||
let public_shares = data.nodes.values().map(|n| n.public_share.as_ref().expect("keys received on KD phase; KG phase follows KD phase; qed"));
|
||||
@@ -1305,8 +1305,6 @@ pub mod tests {
|
||||
|
||||
#[test]
|
||||
fn encryption_session_works_over_network() {
|
||||
//::util::log::init_log();
|
||||
|
||||
let test_cases = [(1, 3)];
|
||||
for &(threshold, num_nodes) in &test_cases {
|
||||
let mut core = Core::new().unwrap();
|
||||
|
||||
@@ -18,7 +18,7 @@ use std::collections::BTreeSet;
|
||||
use std::sync::Arc;
|
||||
use parking_lot::{Mutex, Condvar};
|
||||
use ethkey::{Public, Secret, Signature};
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use key_server_cluster::{Error, NodeId, SessionId, SessionMeta, AclStorage, DocumentKeyShare};
|
||||
use key_server_cluster::cluster::{Cluster};
|
||||
use key_server_cluster::cluster_sessions::{SessionIdWithSubSession, ClusterSession};
|
||||
@@ -799,7 +799,7 @@ mod tests {
|
||||
use std::sync::Arc;
|
||||
use std::str::FromStr;
|
||||
use std::collections::{BTreeMap, VecDeque};
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use ethkey::{self, Random, Generator, Public, Secret, KeyPair};
|
||||
use acl_storage::DummyAclStorage;
|
||||
use key_server_cluster::{NodeId, DummyKeyStorage, DocumentKeyShare, DocumentKeyShareVersion, SessionId, SessionMeta, Error, KeyStorage};
|
||||
|
||||
@@ -27,7 +27,7 @@ use tokio_io::IoFuture;
|
||||
use tokio_core::reactor::{Handle, Remote, Interval};
|
||||
use tokio_core::net::{TcpListener, TcpStream};
|
||||
use ethkey::{Public, KeyPair, Signature, Random, Generator};
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use key_server_cluster::{Error, NodeId, SessionId, AclStorage, KeyStorage, KeyServerSet, NodeKeyPair};
|
||||
use key_server_cluster::cluster_sessions::{ClusterSession, AdminSession, ClusterSessions, SessionIdWithSubSession,
|
||||
ClusterSessionsContainer, SERVERS_SET_CHANGE_SESSION_ID, create_cluster_view, AdminSessionCreationData, ClusterSessionsListener};
|
||||
@@ -1038,7 +1038,7 @@ pub mod tests {
|
||||
use std::collections::{BTreeSet, VecDeque};
|
||||
use parking_lot::Mutex;
|
||||
use tokio_core::reactor::Core;
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use ethkey::{Random, Generator, Public, Signature, sign};
|
||||
use key_server_cluster::{NodeId, SessionId, Error, DummyAclStorage, DummyKeyStorage, MapKeyServerSet, PlainNodeKeyPair, KeyStorage};
|
||||
use key_server_cluster::message::Message;
|
||||
@@ -1309,7 +1309,7 @@ pub mod tests {
|
||||
// try to start generation session => fails in initialization
|
||||
assert_eq!(clusters[0].client().new_generation_session(SessionId::default(), Public::default(), 100).map(|_| ()),
|
||||
Err(Error::InvalidThreshold));
|
||||
|
||||
|
||||
assert!(clusters[0].data.sessions.generation_sessions.is_empty());
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ use std::sync::{Arc, Weak};
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::collections::{VecDeque, BTreeMap, BTreeSet};
|
||||
use parking_lot::{Mutex, RwLock, Condvar};
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use ethkey::{Secret, Signature};
|
||||
use key_server_cluster::{Error, NodeId, SessionId};
|
||||
use key_server_cluster::cluster::{Cluster, ClusterData, ClusterConfiguration, ClusterView};
|
||||
|
||||
@@ -18,7 +18,7 @@ use std::collections::{BTreeSet, BTreeMap};
|
||||
use std::collections::btree_map::Entry;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::Arc;
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use ethkey::Public;
|
||||
use key_server_cluster::{KeyServerSet, KeyServerSetSnapshot};
|
||||
use key_server_cluster::cluster::{ClusterClient, ClusterConnectionsData};
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use std::collections::{BTreeSet, BTreeMap};
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::Arc;
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use ethkey::Public;
|
||||
use parking_lot::Mutex;
|
||||
use key_server_cluster::{KeyServerSet, KeyServerSetSnapshot, KeyServerSetMigration, is_migration_required};
|
||||
|
||||
@@ -39,7 +39,7 @@ use futures::{Future, Poll, Async};
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use ethcrypto::ecdh::agree;
|
||||
use ethkey::{Random, Generator, KeyPair, Public, Signature, verify_public, sign, recover};
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use key_server_cluster::{NodeId, Error, NodeKeyPair};
|
||||
use key_server_cluster::message::{Message, ClusterMessage, NodePublicKey, NodePrivateKeySignature};
|
||||
use key_server_cluster::io::{write_message, write_encrypted_message, WriteMessage, ReadMessage,
|
||||
@@ -193,7 +193,7 @@ impl<A> Future for Handshake<A> where A: AsyncRead + AsyncWrite {
|
||||
self.peer_session_public.as_ref().expect(
|
||||
"we are in passive mode; in passive mode SendPublicKey follows ReceivePublicKey; peer_session_public is filled in ReceivePublicKey; qed"),
|
||||
);
|
||||
|
||||
|
||||
self.shared_key = match shared_key {
|
||||
Ok(shared_key) => Some(shared_key),
|
||||
Err(err) => return Ok((stream, Err(err)).into()),
|
||||
@@ -318,7 +318,7 @@ mod tests {
|
||||
use std::collections::BTreeSet;
|
||||
use futures::Future;
|
||||
use ethkey::{Random, Generator, sign};
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use key_server_cluster::PlainNodeKeyPair;
|
||||
use key_server_cluster::io::message::tests::TestIo;
|
||||
use key_server_cluster::message::{Message, ClusterMessage, NodePublicKey, NodePrivateKeySignature};
|
||||
|
||||
@@ -22,8 +22,7 @@ use serde_json;
|
||||
use ethcrypto::ecies::{encrypt_single_message, decrypt_single_message};
|
||||
use ethkey::{Secret, KeyPair};
|
||||
use ethkey::math::curve_order;
|
||||
use bigint::prelude::U256;
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::{H256, U256};
|
||||
use key_server_cluster::Error;
|
||||
use key_server_cluster::message::{Message, ClusterMessage, GenerationMessage, EncryptionMessage,
|
||||
DecryptionMessage, SigningMessage, ServersSetChangeMessage, ShareAddMessage, KeyVersionNegotiationMessage};
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::collections::{BTreeSet, BTreeMap};
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use ethkey::{Public, Secret};
|
||||
use ethcrypto::ecies::encrypt;
|
||||
use ethcrypto::DEFAULT_MAC;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use std::collections::{BTreeSet, BTreeMap};
|
||||
use ethkey::{Public, Secret};
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use key_server_cluster::{Error, NodeId, DocumentKeyShare};
|
||||
use key_server_cluster::math;
|
||||
use key_server_cluster::jobs::job_session::{JobPartialRequestAction, JobPartialResponseAction, JobExecutor};
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use ethkey::{Public, Secret, Random, Generator, math};
|
||||
use bigint::prelude::U256;
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::{H256, U256};
|
||||
use hash::keccak;
|
||||
use key_server_cluster::Error;
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ use ethcore::client::{Client, BlockChainClient, BlockId, ChainNotify};
|
||||
use ethkey::public_to_address;
|
||||
use native_contracts::KeyServerSet as KeyServerSetContract;
|
||||
use hash::keccak;
|
||||
use bigint::hash::H256;
|
||||
use util::Address;
|
||||
use ethereum_types::{H256, Address};
|
||||
use bytes::Bytes;
|
||||
use types::all::{Error, Public, NodeAddress, NodeId};
|
||||
use trusted_client::TrustedClient;
|
||||
@@ -544,7 +543,7 @@ fn block_confirmations(client: &BlockChainClient, block: H256) -> Option<u64> {
|
||||
pub mod tests {
|
||||
use std::collections::BTreeMap;
|
||||
use std::net::SocketAddr;
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use ethkey::Public;
|
||||
use super::{update_future_set, update_number_of_confirmations, FutureNewSet,
|
||||
KeyServerSet, KeyServerSetSnapshot, MIGRATION_CONFIRMATIONS_REQUIRED};
|
||||
|
||||
@@ -18,7 +18,7 @@ use std::path::PathBuf;
|
||||
use std::collections::BTreeMap;
|
||||
use serde_json;
|
||||
use tiny_keccak::Keccak;
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use ethkey::{Secret, Public};
|
||||
use kvdb_rocksdb::{Database, DatabaseIterator};
|
||||
use types::all::{Error, ServiceConfiguration, ServerKeyId, NodeId};
|
||||
|
||||
@@ -38,9 +38,8 @@ extern crate url;
|
||||
|
||||
extern crate ethcore;
|
||||
extern crate ethcore_bytes as bytes;
|
||||
extern crate ethcore_util as util;
|
||||
extern crate ethcore_bigint as bigint;
|
||||
extern crate ethcore_logger as logger;
|
||||
extern crate ethereum_types;
|
||||
extern crate ethcrypto;
|
||||
extern crate ethkey;
|
||||
extern crate ethsync;
|
||||
|
||||
@@ -22,8 +22,7 @@ use ethcore::client::{Client, BlockChainClient, BlockId};
|
||||
use ethkey::{Public, Signature, public_to_address};
|
||||
use native_contracts::SecretStoreService;
|
||||
use hash::keccak;
|
||||
use bigint::hash::H256;
|
||||
use bigint::prelude::U256;
|
||||
use ethereum_types::{H256, U256};
|
||||
use listener::service_contract_listener::ServiceTask;
|
||||
use trusted_client::TrustedClient;
|
||||
use {ServerKeyId, NodeKeyPair, ContractAddress};
|
||||
@@ -307,9 +306,9 @@ fn get_confirmed_block_hash(client: &Client, confirmations: u64) -> Option<H256>
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use parking_lot::Mutex;
|
||||
use parking_lot::Mutex;
|
||||
use ethkey::Public;
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use listener::service_contract_listener::ServiceTask;
|
||||
use ServerKeyId;
|
||||
use super::ServiceContract;
|
||||
|
||||
@@ -22,8 +22,7 @@ use parking_lot::Mutex;
|
||||
use ethcore::client::ChainNotify;
|
||||
use ethkey::{Random, Generator, Public, sign};
|
||||
use bytes::Bytes;
|
||||
use bigint::hash::H256;
|
||||
use bigint::prelude::U256;
|
||||
use ethereum_types::{H256, U256};
|
||||
use key_server_set::KeyServerSet;
|
||||
use key_server_cluster::{ClusterClient, ClusterSessionsListener, ClusterSession};
|
||||
use key_server_cluster::generation_session::SessionImpl as GenerationSession;
|
||||
|
||||
@@ -18,8 +18,7 @@ use std::sync::Arc;
|
||||
use ethcrypto::ecdh::agree;
|
||||
use ethkey::{KeyPair, Public, Signature, Error as EthKeyError, sign, public_to_address};
|
||||
use ethcore::account_provider::AccountProvider;
|
||||
use bigint::hash::H256;
|
||||
use util::Address;
|
||||
use ethereum_types::{H256, Address};
|
||||
use traits::NodeKeyPair;
|
||||
|
||||
pub struct PlainNodeKeyPair {
|
||||
|
||||
@@ -21,7 +21,7 @@ use rustc_hex::{ToHex, FromHex};
|
||||
use serde::{Serialize, Deserialize, Serializer, Deserializer};
|
||||
use serde::de::{Visitor, Error as SerdeError};
|
||||
use ethkey::{Public, Secret, Signature};
|
||||
use bigint::hash::H256;
|
||||
use ethereum_types::H256;
|
||||
use bytes::Bytes;
|
||||
|
||||
/// Serializable message hash.
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::collections::BTreeSet;
|
||||
use ethkey::{KeyPair, Signature, Address, Error as EthKeyError};
|
||||
use bigint::hash::H256;
|
||||
use ethkey::{KeyPair, Signature, Error as EthKeyError};
|
||||
use ethereum_types::{H256, Address};
|
||||
|
||||
use types::all::{Error, Public, ServerKeyId, MessageHash, EncryptedMessageSignature, RequestSignature, EncryptedDocumentKey,
|
||||
EncryptedDocumentKeyShadow, NodeId};
|
||||
|
||||
|
||||
@@ -18,16 +18,16 @@ use std::fmt;
|
||||
use std::collections::BTreeMap;
|
||||
use serde_json;
|
||||
|
||||
use {ethkey, kvdb, bytes, bigint, key_server_cluster};
|
||||
use {ethkey, kvdb, bytes, ethereum_types, key_server_cluster};
|
||||
|
||||
/// Node id.
|
||||
pub type NodeId = ethkey::Public;
|
||||
/// Server key id. When key is used to encrypt document, it could be document contents hash.
|
||||
pub type ServerKeyId = bigint::hash::H256;
|
||||
pub type ServerKeyId = ethereum_types::H256;
|
||||
/// Encrypted document key type.
|
||||
pub type EncryptedDocumentKey = bytes::Bytes;
|
||||
/// Message hash.
|
||||
pub type MessageHash = bigint::hash::H256;
|
||||
pub type MessageHash = ethereum_types::H256;
|
||||
/// Message signature.
|
||||
pub type EncryptedMessageSignature = bytes::Bytes;
|
||||
/// Request signature type.
|
||||
|
||||
Reference in New Issue
Block a user