From 19f01194b194f9635e0965989ecf57b68993eb94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Wed, 7 Jun 2017 11:34:53 +0200 Subject: [PATCH 1/5] Blacklist empty phrase account. (#5730) --- ethcore/src/account_provider/mod.rs | 46 +++++++++++++++++++++++++++-- parity/run.rs | 6 ++++ 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/ethcore/src/account_provider/mod.rs b/ethcore/src/account_provider/mod.rs index 0ecbf3b17..9e4944ef0 100755 --- a/ethcore/src/account_provider/mod.rs +++ b/ethcore/src/account_provider/mod.rs @@ -125,6 +125,8 @@ pub struct AccountProvider { transient_sstore: EthMultiStore, /// Accounts in hardware wallets. hardware_store: Option, + /// Disallowed accounts. + blacklisted_accounts: Vec
, } /// Account management settings. @@ -133,6 +135,8 @@ pub struct AccountProviderSettings { pub enable_hardware_wallets: bool, /// Use the classic chain key on the hardware wallet. pub hardware_wallet_classic_key: bool, + /// Disallowed accounts. + pub blacklisted_accounts: Vec
, } impl Default for AccountProviderSettings { @@ -140,6 +144,7 @@ impl Default for AccountProviderSettings { AccountProviderSettings { enable_hardware_wallets: false, hardware_wallet_classic_key: false, + blacklisted_accounts: vec![], } } } @@ -157,13 +162,21 @@ impl AccountProvider { Err(e) => debug!("Error initializing hardware wallets: {}", e), } } + + // Remove blacklisted accounts from address book. + let mut address_book = AddressBook::new(&sstore.local_path()); + for addr in &settings.blacklisted_accounts { + address_book.remove(*addr); + } + AccountProvider { unlocked: RwLock::new(HashMap::new()), - address_book: RwLock::new(AddressBook::new(&sstore.local_path())), + address_book: RwLock::new(address_book), dapps_settings: RwLock::new(DappsSettingsStore::new(&sstore.local_path())), sstore: sstore, transient_sstore: transient_sstore(), hardware_store: hardware_store, + blacklisted_accounts: settings.blacklisted_accounts, } } @@ -176,6 +189,7 @@ impl AccountProvider { sstore: Box::new(EthStore::open(Box::new(MemoryDirectory::default())).expect("MemoryDirectory load always succeeds; qed")), transient_sstore: transient_sstore(), hardware_store: None, + blacklisted_accounts: vec![], } } @@ -197,6 +211,10 @@ impl AccountProvider { /// Does not unlock account! pub fn insert_account(&self, secret: Secret, password: &str) -> Result { let account = self.sstore.insert_account(SecretVaultRef::Root, secret, password)?; + if self.blacklisted_accounts.contains(&account.address) { + self.sstore.remove_account(&account, password)?; + return Err(SSError::InvalidAccount.into()); + } Ok(account.address) } @@ -223,6 +241,10 @@ impl AccountProvider { /// Import a new presale wallet. pub fn import_wallet(&self, json: &[u8], password: &str) -> Result { let account = self.sstore.import_wallet(SecretVaultRef::Root, json, password)?; + if self.blacklisted_accounts.contains(&account.address) { + self.sstore.remove_account(&account, password)?; + return Err(SSError::InvalidAccount.into()); + } Ok(Address::from(account.address).into()) } @@ -234,7 +256,12 @@ impl AccountProvider { /// Returns addresses of all accounts. pub fn accounts(&self) -> Result, Error> { let accounts = self.sstore.accounts()?; - Ok(accounts.into_iter().map(|a| a.address).collect()) + Ok(accounts + .into_iter() + .map(|a| a.address) + .filter(|address| !self.blacklisted_accounts.contains(address)) + .collect() + ) } /// Returns addresses of hardware accounts. @@ -436,6 +463,7 @@ impl AccountProvider { pub fn accounts_info(&self) -> Result, Error> { let r = self.sstore.accounts()? .into_iter() + .filter(|a| !self.blacklisted_accounts.contains(&a.address)) .map(|a| (a.address.clone(), self.account_meta(a.address).ok().unwrap_or_default())) .collect(); Ok(r) @@ -719,7 +747,7 @@ impl AccountProvider { mod tests { use super::{AccountProvider, Unlock, DappId}; use std::time::Instant; - use ethstore::ethkey::{Generator, Random}; + use ethstore::ethkey::{Generator, Random, Address}; use ethstore::{StoreAccountRef, Derivation}; use util::H256; @@ -934,4 +962,16 @@ mod tests { assert_eq!(ap.new_dapps_default_address().unwrap(), address); assert_eq!(ap.dapp_default_address("app1".into()).unwrap(), address); } + + #[test] + fn should_not_return_blacklisted_account() { + // given + let mut ap = AccountProvider::transient_provider(); + let acc = ap.new_account("test").unwrap(); + ap.blacklisted_accounts = vec![acc]; + + // then + assert_eq!(ap.accounts_info().unwrap().keys().cloned().collect::>(), vec![]); + assert_eq!(ap.accounts().unwrap(), vec![]); + } } diff --git a/parity/run.rs b/parity/run.rs index 352f11c5d..5bc720ec2 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -777,6 +777,12 @@ fn prepare_account_provider(spec: &SpecType, dirs: &Directories, data_dir: &str, let account_settings = AccountProviderSettings { enable_hardware_wallets: cfg.enable_hardware_wallets, hardware_wallet_classic_key: spec == &SpecType::Classic, + blacklisted_accounts: match *spec { + SpecType::Morden | SpecType::Ropsten | SpecType::Kovan | SpecType::Dev => vec![], + _ => vec![ + "00a329c0648769a73afac7f9381e08fb43dbea72".into() + ], + }, }; let account_provider = AccountProvider::new( Box::new(EthStore::open_with_iterations(dir, cfg.iterations).map_err(|e| format!("Could not open keys directory: {}", e))?), From 05aa960c2546038c985c4683f320d36d25bcc0d0 Mon Sep 17 00:00:00 2001 From: Guanqun Lu Date: Wed, 7 Jun 2017 17:58:39 +0800 Subject: [PATCH 2/5] use NULL_RLP, remove NULL_RLP_STATIC (#5742) --- ethcore/src/account_db.rs | 10 ++++------ util/src/memorydb.rs | 6 ++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/ethcore/src/account_db.rs b/ethcore/src/account_db.rs index 34dcb9760..10e63dba3 100644 --- a/ethcore/src/account_db.rs +++ b/ethcore/src/account_db.rs @@ -18,8 +18,6 @@ use util::*; use rlp::NULL_RLP; -static NULL_RLP_STATIC: [u8; 1] = [0x80; 1]; - // combines a key with an address hash to ensure uniqueness. // leaves the first 96 bits untouched in order to support partial key lookup. #[inline] @@ -99,7 +97,7 @@ impl<'db> HashDB for AccountDB<'db>{ fn get(&self, key: &H256) -> Option { if key == &SHA3_NULL_RLP { - return Some(DBValue::from_slice(&NULL_RLP_STATIC)); + return Some(DBValue::from_slice(&NULL_RLP)); } self.db.get(&combine_key(&self.address_hash, key)) } @@ -158,7 +156,7 @@ impl<'db> HashDB for AccountDBMut<'db>{ fn get(&self, key: &H256) -> Option { if key == &SHA3_NULL_RLP { - return Some(DBValue::from_slice(&NULL_RLP_STATIC)); + return Some(DBValue::from_slice(&NULL_RLP)); } self.db.get(&combine_key(&self.address_hash, key)) } @@ -206,7 +204,7 @@ impl<'db> HashDB for Wrapping<'db> { fn get(&self, key: &H256) -> Option { if key == &SHA3_NULL_RLP { - return Some(DBValue::from_slice(&NULL_RLP_STATIC)); + return Some(DBValue::from_slice(&NULL_RLP)); } self.0.get(key) } @@ -240,7 +238,7 @@ impl<'db> HashDB for WrappingMut<'db>{ fn get(&self, key: &H256) -> Option { if key == &SHA3_NULL_RLP { - return Some(DBValue::from_slice(&NULL_RLP_STATIC)); + return Some(DBValue::from_slice(&NULL_RLP)); } self.0.get(key) } diff --git a/util/src/memorydb.rs b/util/src/memorydb.rs index ea625d227..1feca9cba 100644 --- a/util/src/memorydb.rs +++ b/util/src/memorydb.rs @@ -122,7 +122,7 @@ impl MemoryDB { /// when the refs > 0. pub fn raw(&self, key: &H256) -> Option<(DBValue, i32)> { if key == &SHA3_NULL_RLP { - return Some((DBValue::from_slice(&NULL_RLP_STATIC), 1)); + return Some((DBValue::from_slice(&NULL_RLP), 1)); } self.data.get(key).cloned() } @@ -172,12 +172,10 @@ impl MemoryDB { } } -static NULL_RLP_STATIC: [u8; 1] = [0x80; 1]; - impl HashDB for MemoryDB { fn get(&self, key: &H256) -> Option { if key == &SHA3_NULL_RLP { - return Some(DBValue::from_slice(&NULL_RLP_STATIC)); + return Some(DBValue::from_slice(&NULL_RLP)); } match self.data.get(key) { From 9773aa4c76efa70543f74509b443075abdd6b35c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Wed, 7 Jun 2017 12:31:12 +0200 Subject: [PATCH 3/5] Update Cid/multihash/ring/tinykeccak (#5785) * Updating ring,multihash,tiny-keccak * Updating CID in ipfs. --- Cargo.lock | 116 +++++++++++------- ethcore/Cargo.toml | 2 +- ethcore/native_contracts/generator/Cargo.toml | 2 +- ethcrypto/Cargo.toml | 2 +- ethkey/Cargo.toml | 2 +- evmjit/Cargo.toml | 2 +- hash-fetch/Cargo.toml | 2 +- ipfs/Cargo.toml | 4 +- rpc/Cargo.toml | 2 +- secret_store/Cargo.toml | 2 +- updater/Cargo.toml | 2 +- 11 files changed, 81 insertions(+), 57 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b62d673e..ff8b71780 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -166,12 +166,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cid" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "integer-encoding 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "multibase 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "multihash 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "multihash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -294,7 +294,7 @@ name = "docopt" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -341,14 +341,14 @@ dependencies = [ [[package]] name = "ethabi" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -372,7 +372,7 @@ dependencies = [ "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ethabi 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ethabi 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "ethash 1.7.0", "ethcore-bloom-journal 0.1.0", "ethcore-devtools 1.7.0", @@ -391,7 +391,7 @@ dependencies = [ "hardware-wallet 1.7.0", "hyper 0.10.0-a.0 (git+https://github.com/paritytech/hyper)", "itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -485,7 +485,7 @@ name = "ethcore-ipc-nano" version = "1.7.0" dependencies = [ "ethcore-ipc 1.7.0", - "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)", ] @@ -536,7 +536,7 @@ dependencies = [ "arrayvec 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -568,7 +568,7 @@ dependencies = [ "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -576,7 +576,7 @@ name = "ethcore-secretstore" version = "1.0.0" dependencies = [ "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethabi 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ethabi 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.7.0", "ethcore-devtools 1.7.0", "ethcore-ipc 1.7.0", @@ -618,7 +618,7 @@ dependencies = [ "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "jsonrpc-macros 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "jsonrpc-tcp-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", - "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -654,7 +654,7 @@ dependencies = [ "table 0.1.0", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "using_queue 0.1.0", "vergen 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -667,7 +667,7 @@ dependencies = [ "ethcore-bigint 0.1.3", "ethkey 0.2.0", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -690,11 +690,11 @@ dependencies = [ "docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "eth-secp256k1 0.5.6 (git+https://github.com/paritytech/rust-secp256k1)", "ethcore-bigint 0.1.3", - "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -719,7 +719,7 @@ dependencies = [ "smallvec 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -762,7 +762,7 @@ dependencies = [ name = "evmjit" version = "1.7.0" dependencies = [ - "tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1139,7 +1139,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazy_static" -version = "0.2.1" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1320,11 +1320,11 @@ dependencies = [ [[package]] name = "multihash" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ring 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1349,7 +1349,7 @@ dependencies = [ name = "native-contract-generator" version = "0.1.0" dependencies = [ - "ethabi 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ethabi 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "heck 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1358,7 +1358,7 @@ name = "native-contracts" version = "0.1.0" dependencies = [ "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethabi 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ethabi 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-util 1.7.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "native-contract-generator 0.1.0", @@ -1503,7 +1503,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1640,7 +1640,7 @@ dependencies = [ name = "parity-hash-fetch" version = "1.7.0" dependencies = [ - "ethabi 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ethabi 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-util 1.7.0", "fetch 0.1.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1657,12 +1657,12 @@ dependencies = [ name = "parity-ipfs-api" version = "1.7.0" dependencies = [ - "cid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.7.0", "ethcore-util 1.7.0", "jsonrpc-http-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "multihash 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "multihash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.0", ] @@ -1693,7 +1693,7 @@ dependencies = [ name = "parity-rpc" version = "1.7.0" dependencies = [ - "cid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "ethash 1.7.0", "ethcore 1.7.0", @@ -1718,7 +1718,7 @@ dependencies = [ "jsonrpc-pubsub 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "jsonrpc-ws-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "multihash 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "multihash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "order-stat 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-reactor 0.1.0", "parity-updater 1.7.0", @@ -1800,7 +1800,7 @@ dependencies = [ name = "parity-updater" version = "1.7.0" dependencies = [ - "ethabi 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ethabi 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.7.0", "ethcore-ipc 1.7.0", "ethcore-ipc-codegen 1.7.0", @@ -1821,7 +1821,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2006,6 +2006,26 @@ dependencies = [ "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rayon" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rayon-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rayon-core" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "regex" version = "0.2.1" @@ -2044,12 +2064,14 @@ dependencies = [ [[package]] name = "ring" -version = "0.7.1" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "untrusted 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2059,7 +2081,7 @@ dependencies = [ "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "elastic-array 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-bigint 0.1.3", - "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2168,7 +2190,7 @@ dependencies = [ "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "crypt32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "secur32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2508,7 +2530,7 @@ dependencies = [ [[package]] name = "tiny-keccak" -version = "1.0.5" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2703,7 +2725,7 @@ dependencies = [ [[package]] name = "untrusted" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2842,7 +2864,7 @@ dependencies = [ "checksum bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c129aff112dcc562970abb69e2508b40850dd24c274761bb50fb8a0067ba6c27" "checksum bytes 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f9edb851115d67d1f18680f9326901768a91d37875b87015518357c6ce22b553" "checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c" -"checksum cid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e53e6cdfa5ca294863e8c8a32a7cdb4dc0a442c8971d47a0e75b6c27ea268a6a" +"checksum cid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "34aa7da06f10541fbca6850719cdaa8fa03060a5d2fb33840f149cf8133a00c7" "checksum clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)" = "5b4fabf979ddf6419a313c1c0ada4a5b95cfd2049c56e8418d622d27b4b6ff32" "checksum clippy 0.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "d19bda68c3db98e3a780342f6101b44312fef20a5f13ce756d1202a35922b01b" "checksum clippy_lints 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)" = "ce96ec05bfe018a0d5d43da115e54850ea2217981ff0f2e462780ab9d594651a" @@ -2862,7 +2884,7 @@ dependencies = [ "checksum elastic-array 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "561b1b1bb58e6d9212b75a28cca442f8a87cceb35cb1b6d6f39f5df5346a9160" "checksum env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e3856f1697098606fc6cb97a93de88ca3f3bc35bb878c725920e6e82ecf05e83" "checksum eth-secp256k1 0.5.6 (git+https://github.com/paritytech/rust-secp256k1)" = "" -"checksum ethabi 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "63df67d0af5e3cb906b667ca1a6e00baffbed87d0d8f5f78468a1f5eb3a66345" +"checksum ethabi 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "65f71b9ac0b0f8e6230d32dbf5acf7c2c61334af1148175d0a7e72b14c3d475e" "checksum fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1ee15a7050e5580b3712877157068ea713b245b080ff302ae2ca973cfcd9baa" "checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb" "checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344" @@ -2898,7 +2920,7 @@ dependencies = [ "checksum jsonrpc-ws-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)" = "" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" -"checksum lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "49247ec2a285bb3dcb23cbd9c35193c025e7251bfce77c1d5da97e6362dffe7f" +"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" "checksum lazycell 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce12306c4739d86ee97c23139f3a34ddf0387bbf181bc7929d287025a8c3ef6b" "checksum lazycell 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec38a5c22f1ef3e30d2642aa875620d60edeef36cef43c4739d86215ce816331" "checksum libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "88ee81885f9f04bff991e306fea7c1c60a5f0f9e409e99f6b40e3311a3363135" @@ -2920,7 +2942,7 @@ dependencies = [ "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum msdos_time 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c04b68cc63a8480fb2550343695f7be72effdec953a9d4508161c3e69041c7d8" "checksum multibase 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b9c35dac080fd6e16a99924c8dfdef0af89d797dd851adab25feaffacf7850d6" -"checksum multihash 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c9f70f2402fa07c16c40be8fd0a748a39257c5dc3ff5c857cbbde2f39135c505" +"checksum multihash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d14363c7695e2e5adbbb8fe139d806a19b8b13f02b9b1fb770fab0c12edaff58" "checksum nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)" = "" "checksum nanomsg-sys 0.5.0 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)" = "" "checksum native-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4e52995154bb6f0b41e4379a279482c9387c1632e3798ba4e511ef8c54ee09" @@ -2968,11 +2990,13 @@ dependencies = [ "checksum quote 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)" = "6732e32663c9c271bfc7c1823486b471f18c47a2dbf87c066897b7b51afc83be" "checksum rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2791d88c6defac799c3f20d74f094ca33b9332612d9aef9078519c82e4fe04a5" "checksum rayon 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50c575b58c2b109e2fbc181820cbe177474f35610ff9e357dc75f6bac854ffbf" +"checksum rayon 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8c83adcb08e5b922e804fe1918142b422602ef11f2fd670b0b52218cb5984a20" +"checksum rayon-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "767d91bacddf07d442fe39257bf04fd95897d1c47c545d009f6beb03efd038f8" "checksum regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4278c17d0f6d62dfef0ab00028feb45bd7d2102843f80763474eeb1be8a10c01" "checksum regex-syntax 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "841591b1e05609a643e3b4d0045fce04f701daba7151ddcd3ad47b080693d5a9" "checksum regex-syntax 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9191b1f57603095f105d317e375d19b1c9c5c3185ea9633a99a6dcbed04457" "checksum reqwest 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bef9ed8fdfcc30947d6b774938dc0c3f369a474efe440df2c7f278180b2d2e6" -"checksum ring 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "595afba2db7545b940ec900dc59b5281f719d327fc0674eeadc9953617e55357" +"checksum ring 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)" = "873ec7c2b7c9bf58024eb8f1bbc40a6499cd23c1adc59532f4af9e355f1de0f3" "checksum rocksdb 0.4.5 (git+https://github.com/paritytech/rust-rocksdb)" = "" "checksum rocksdb-sys 0.3.0 (git+https://github.com/paritytech/rust-rocksdb)" = "" "checksum rotor 0.6.3 (git+https://github.com/tailhook/rotor)" = "" @@ -3024,7 +3048,7 @@ dependencies = [ "checksum thread-id 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4437c97558c70d129e40629a5b385b3fb1ffac301e63941335e4d354081ec14a" "checksum thread_local 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c85048c6260d17cf486ceae3282d9fb6b90be220bf5b28c400f5485ffc29f0c7" "checksum time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7ec6d62a20df54e07ab3b78b9a3932972f4b7981de295563686849eb3989af" -"checksum tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f7aef43048292ca0bae4ab32180e85f6202cf2816c2a210c396a84b99dab9270" +"checksum tiny-keccak 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b50173faa6ee499206f77b189d7ff3bef40f6969f228c9ec22b82080df9aa41" "checksum tokio-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "99e958104a67877907c1454386d5482fe8e965a55d60be834a15a44328e7dc76" "checksum tokio-io 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "48f55df1341bb92281f229a6030bc2abffde2c7a44c6d6b802b7687dd8be0775" "checksum tokio-minihttp 0.1.0 (git+https://github.com/tomusdrw/tokio-minihttp)" = "" @@ -3045,7 +3069,7 @@ dependencies = [ "checksum unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18127285758f0e2c6cf325bb3f3d138a12fee27de4f23e146cd6a179f26c2cf3" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91" -"checksum untrusted 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "193df64312e3515fd983ded55ad5bcaa7647a035804828ed757e832ce6029ef3" +"checksum untrusted 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6b65243989ef6aacd9c0d6bd2b822765c3361d8ed352185a6f3a41f3a718c673" "checksum url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afe9ec54bc4db14bc8744b7fed060d785ac756791450959b2248443319d5b119" "checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47" "checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index c3ea4e844..b207ae2b3 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -18,7 +18,7 @@ byteorder = "1.0" clippy = { version = "0.0.103", optional = true} crossbeam = "0.2.9" env_logger = "0.4" -ethabi = "1.0.0" +ethabi = "1.0" ethash = { path = "../ethash" } ethcore-bloom-journal = { path = "../util/bloom" } ethcore-devtools = { path = "../devtools" } diff --git a/ethcore/native_contracts/generator/Cargo.toml b/ethcore/native_contracts/generator/Cargo.toml index 26e9a6611..a114420f0 100644 --- a/ethcore/native_contracts/generator/Cargo.toml +++ b/ethcore/native_contracts/generator/Cargo.toml @@ -5,5 +5,5 @@ version = "0.1.0" authors = ["Parity Technologies "] [dependencies] -ethabi = "1.0.2" +ethabi = "1.0" heck = "0.2" diff --git a/ethcrypto/Cargo.toml b/ethcrypto/Cargo.toml index 84f905804..7d749d9ca 100644 --- a/ethcrypto/Cargo.toml +++ b/ethcrypto/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] [dependencies] rust-crypto = "0.2.36" -tiny-keccak = "1.0" +tiny-keccak = "1.2" eth-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1" } ethkey = { path = "../ethkey" } ethcore-bigint = { path = "../util/bigint" } diff --git a/ethkey/Cargo.toml b/ethkey/Cargo.toml index 8254e194a..e99e1cbe7 100644 --- a/ethkey/Cargo.toml +++ b/ethkey/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Parity Technologies "] [dependencies] rand = "0.3.14" lazy_static = "0.2" -tiny-keccak = "1.0" +tiny-keccak = "1.2" eth-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1" } rustc-serialize = "0.3" docopt = { version = "0.7", optional = true } diff --git a/evmjit/Cargo.toml b/evmjit/Cargo.toml index 2f84a7efd..5c36cc34b 100644 --- a/evmjit/Cargo.toml +++ b/evmjit/Cargo.toml @@ -7,4 +7,4 @@ authors = ["Parity Technologies "] crate-type = ["dylib"] [dependencies] -tiny-keccak = "1.0" +tiny-keccak = "1.2" diff --git a/hash-fetch/Cargo.toml b/hash-fetch/Cargo.toml index 0ad1149aa..600402559 100644 --- a/hash-fetch/Cargo.toml +++ b/hash-fetch/Cargo.toml @@ -7,7 +7,7 @@ version = "1.7.0" authors = ["Parity Technologies "] [dependencies] -ethabi = "1.0.4" +ethabi = "1.0" futures = "0.1" log = "0.3" mime = "0.2" diff --git a/ipfs/Cargo.toml b/ipfs/Cargo.toml index c6241a7aa..fca03d6b8 100644 --- a/ipfs/Cargo.toml +++ b/ipfs/Cargo.toml @@ -11,5 +11,5 @@ ethcore-util = { path = "../util" } jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" } rlp = { path = "../util/rlp" } mime = "0.2" -cid = "0.2.1" -multihash = "0.5" +cid = "0.2" +multihash = "0.6" diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index f9b18ef32..c2fe7fb8a 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -11,7 +11,7 @@ authors = ["Parity Technologies "] cid = "0.2" futures = "0.1" log = "0.3" -multihash = "0.5" +multihash ="0.6" order-stat = "0.1" rand = "0.3" rust-crypto = "0.2" diff --git a/secret_store/Cargo.toml b/secret_store/Cargo.toml index d28209904..d31ebe11d 100644 --- a/secret_store/Cargo.toml +++ b/secret_store/Cargo.toml @@ -25,7 +25,7 @@ tokio-io = "0.1.0" tokio-service = "0.1" tokio-proto = "0.1" url = "1.0" -ethabi = "1.0.0" +ethabi = "1.0" ethcore = { path = "../ethcore" } ethcore-devtools = { path = "../devtools" } ethcore-util = { path = "../util" } diff --git a/updater/Cargo.toml b/updater/Cargo.toml index 29767cf8b..49083cee9 100644 --- a/updater/Cargo.toml +++ b/updater/Cargo.toml @@ -11,7 +11,7 @@ ethcore-ipc-codegen = { path = "../ipc/codegen" } [dependencies] log = "0.3" -ethabi = "1.0.0" +ethabi = "1.0" target_info = "0.1" ethcore = { path = "../ethcore" } ethsync = { path = "../sync" } From 882f963e6b1c654d5111f1c39bdee6d87570a798 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 7 Jun 2017 16:27:01 +0200 Subject: [PATCH 4/5] Block invalid account name creation (#5784) * Additional non-empty phrase check (fromNew) * Explicit canCreate check in create (not only on UI) * BN instance check (fixes Geth imports) * Fixup tests after better checks * PR comments (Thanks @tomusdrw ) * Typo --- js/src/modals/CreateAccount/createAccount.js | 4 -- .../CreateAccount/createAccount.test.js | 4 +- js/src/modals/CreateAccount/store.js | 16 +++++- js/src/modals/CreateAccount/store.spec.js | 57 +++++++++++++++---- js/src/ui/Balance/balance.js | 2 +- 5 files changed, 63 insertions(+), 20 deletions(-) diff --git a/js/src/modals/CreateAccount/createAccount.js b/js/src/modals/CreateAccount/createAccount.js index 06809adf0..988a5f521 100644 --- a/js/src/modals/CreateAccount/createAccount.js +++ b/js/src/modals/CreateAccount/createAccount.js @@ -329,17 +329,13 @@ class CreateAccount extends Component { } onCreate = () => { - this.createStore.setBusy(true); - return this.createStore .createAccount(this.vaultStore) .then(() => { - this.createStore.setBusy(false); this.createStore.nextStage(); this.props.onUpdate && this.props.onUpdate(); }) .catch((error) => { - this.createStore.setBusy(false); this.props.newError(error); }); } diff --git a/js/src/modals/CreateAccount/createAccount.test.js b/js/src/modals/CreateAccount/createAccount.test.js index 1cbc62329..31ddd56b0 100644 --- a/js/src/modals/CreateAccount/createAccount.test.js +++ b/js/src/modals/CreateAccount/createAccount.test.js @@ -17,6 +17,7 @@ import BigNumber from 'bignumber.js'; import sinon from 'sinon'; +import Api from '~/api'; import Store from './store'; const ADDRESS = '0x00000123456789abcdef123456789abcdef123456789abcdef'; @@ -45,7 +46,8 @@ function createApi () { setAccountName: sinon.stub().resolves(), listVaults: sinon.stub().resolves([]), listOpenedVaults: sinon.stub().resolves([]) - } + }, + util: Api.util }; } diff --git a/js/src/modals/CreateAccount/store.js b/js/src/modals/CreateAccount/store.js index afc13cd54..148658fc8 100644 --- a/js/src/modals/CreateAccount/store.js +++ b/js/src/modals/CreateAccount/store.js @@ -70,7 +70,7 @@ export default class Store { return !(this.nameError || this.walletFileError); case 'fromNew': - return !(this.nameError || this.passwordRepeatError) && this.hasAddress; + return !(this.nameError || this.passwordRepeatError) && this.hasAddress && this.hasPhrase; case 'fromPhrase': return !(this.nameError || this.passwordRepeatError || this.passPhraseError); @@ -94,6 +94,10 @@ export default class Store { return !!(this.address); } + @computed get hasPhrase () { + return this.phrase.length !== 0; + } + @computed get passwordRepeatError () { return this.password === this.passwordRepeat ? null @@ -112,7 +116,7 @@ export default class Store { this.passwordRepeat = ''; this.phrase = ''; this.name = ''; - this.nameError = null; + this.nameError = ERRORS.noName; this.qrAddress = null; this.rawKey = ''; this.rawKeyError = null; @@ -250,6 +254,10 @@ export default class Store { } @action nextStage = () => { + if (this.stage === 0) { + this.clearErrors(); + } + this.stage++; } @@ -258,6 +266,10 @@ export default class Store { } createAccount = (vaultStore) => { + if (!this.canCreate) { + return false; + } + this.setBusy(true); return this diff --git a/js/src/modals/CreateAccount/store.spec.js b/js/src/modals/CreateAccount/store.spec.js index 6ec59fb85..fbb88b084 100644 --- a/js/src/modals/CreateAccount/store.spec.js +++ b/js/src/modals/CreateAccount/store.spec.js @@ -90,7 +90,7 @@ describe('modals/CreateAccount/Store', () => { store.clearErrors(); expect(store.name).to.equal(''); - expect(store.nameError).to.be.null; + expect(store.nameError).not.to.be.null; expect(store.password).to.equal(''); expect(store.passwordRepeatError).to.be.null; expect(store.qrAddress).to.be.null; @@ -309,6 +309,7 @@ describe('modals/CreateAccount/Store', () => { describe('createType === fromJSON/fromPresale', () => { beforeEach(() => { store.setCreateType('fromJSON'); + store.setName('blah'); }); it('returns true on no errors', () => { @@ -330,6 +331,8 @@ describe('modals/CreateAccount/Store', () => { beforeEach(() => { store.setCreateType('fromNew'); store.setAddress('0x0000000000000000000000000000000000000000'); + store.setName('blah'); + store.setPhrase('testing'); }); it('returns true on no errors', () => { @@ -342,6 +345,12 @@ describe('modals/CreateAccount/Store', () => { expect(store.canCreate).to.be.false; }); + it('returns false on no phrase', () => { + store.setPhrase(''); + + expect(store.canCreate).to.be.false; + }); + it('returns false on passwordRepeatError', () => { store.setPassword('testing'); @@ -352,6 +361,7 @@ describe('modals/CreateAccount/Store', () => { describe('createType === fromPhrase', () => { beforeEach(() => { store.setCreateType('fromPhrase'); + store.setName('name'); }); it('returns true on no errors', () => { @@ -372,6 +382,8 @@ describe('modals/CreateAccount/Store', () => { describe('createType === fromRaw', () => { beforeEach(() => { store.setCreateType('fromRaw'); + store.setName('name'); + store.setRawKey('0x1000000000000000000000000000000000000000000000000000000000000000'); }); it('returns true on no errors', () => { @@ -389,7 +401,7 @@ describe('modals/CreateAccount/Store', () => { }); it('returns false on rawKeyError', () => { - store.setRawKey('testing'); + store.setRawKey('0x1'); expect(store.canCreate).to.be.false; }); }); @@ -459,6 +471,9 @@ describe('modals/CreateAccount/Store', () => { createAccountFromQrSpy = sinon.spy(store, 'createAccountFromQr'); createAccountFromRawSpy = sinon.spy(store, 'createAccountFromRaw'); busySpy = sinon.spy(store, 'setBusy'); + + store.setName('name'); + store.setPhrase('testing'); }); afterEach(() => { @@ -477,6 +492,8 @@ describe('modals/CreateAccount/Store', () => { it('calls createAccountFromGeth on createType === fromGeth', () => { store.setCreateType('fromGeth'); + store.setGethAccountsAvailable(GETH_ADDRESSES); + store.selectGethAccount(GETH_ADDRESSES[0]); return store.createAccount().then(() => { expect(createAccountFromGethSpy).to.have.been.called; @@ -485,6 +502,8 @@ describe('modals/CreateAccount/Store', () => { it('calls createAccountFromWallet on createType === fromJSON', () => { store.setCreateType('fromJSON'); + store.setName('name'); + store.setWalletJson('{}'); return store.createAccount().then(() => { expect(createAccountFromWalletSpy).to.have.been.called; @@ -493,6 +512,9 @@ describe('modals/CreateAccount/Store', () => { it('calls createAccountFromPhrase on createType === fromNew', () => { store.setCreateType('fromNew'); + store.setName('name'); + store.setPhrase('phrase'); + store.setAddress('0x1234567890123456789012345678901234567890'); return store.createAccount().then(() => { expect(createAccountFromPhraseSpy).to.have.been.called; @@ -501,6 +523,9 @@ describe('modals/CreateAccount/Store', () => { it('calls createAccountFromPhrase on createType === fromPhrase', () => { store.setCreateType('fromPhrase'); + store.setName('name'); + store.setPhrase('phrase'); + store.setAddress('0x1234567890123456789012345678901234567890'); return store.createAccount().then(() => { expect(createAccountFromPhraseSpy).to.have.been.called; @@ -509,6 +534,8 @@ describe('modals/CreateAccount/Store', () => { it('calls createAccountFromWallet on createType === fromPresale', () => { store.setCreateType('fromPresale'); + store.setName('name'); + store.setWalletJson('{}'); return store.createAccount().then(() => { expect(createAccountFromWalletSpy).to.have.been.called; @@ -517,6 +544,8 @@ describe('modals/CreateAccount/Store', () => { it('calls createAccountFromQr on createType === fromQr', () => { store.setCreateType('fromQr'); + store.setQrAddress('0x1234567890123456789012345678901234567890'); + store.setName('name'); return store.createAccount().then(() => { expect(createAccountFromQrSpy).to.have.been.called; @@ -525,6 +554,8 @@ describe('modals/CreateAccount/Store', () => { it('calls createAccountFromRaw on createType === fromRaw', () => { store.setCreateType('fromRaw'); + store.setName('name'); + store.setRawKey('0x1000000000000000000000000000000000000000000000000000000000000000'); return store.createAccount().then(() => { expect(createAccountFromRawSpy).to.have.been.called; @@ -534,6 +565,9 @@ describe('modals/CreateAccount/Store', () => { it('moves account to vault when vaultName set', () => { store.setCreateType('fromNew'); store.setVaultName('testing'); + store.setName('name'); + store.setAddress('0x1234567890123456789012345678901234567890'); + store.setPhrase('phrase'); return store.createAccount(vaultStore).then(() => { expect(vaultStore.moveAccount).to.have.been.calledWith('testing', ADDRESS); @@ -542,6 +576,9 @@ describe('modals/CreateAccount/Store', () => { it('sets and rests the busy flag', () => { store.setCreateType('fromNew'); + store.setName('name'); + store.setAddress('0x1234567890123456789012345678901234567890'); + store.setPhrase('phrase'); return store.createAccount().then(() => { expect(busySpy).to.have.been.calledWith(true); @@ -634,22 +671,18 @@ describe('modals/CreateAccount/Store', () => { beforeEach(() => { store.setName('some name'); store.setDescription('some desc'); - store.setQrAddress('0x123'); + store.setQrAddress('0x1234567890123456789012345678901234567890'); + sinon.spy(store, 'setupMeta'); return store.createAccountFromQr(-1); }); - it('sets the accountInfo name', () => { - expect(api.parity.setAccountName).to.have.been.calledWith('0x123', 'some name'); + afterEach(() => { + store.setupMeta.restore(); }); - it('sets the meta (with extrenal flag)', () => { - expect(api.parity.setAccountMeta).to.have.been.calledWith('0x123', { - description: 'some desc', - passwordHint: '', - timestamp: -1, - external: true - }); + it('sets the meta', () => { + expect(store.setupMeta).to.have.been.called; }); }); diff --git a/js/src/ui/Balance/balance.js b/js/src/ui/Balance/balance.js index 8bb552daa..c6ed41f87 100644 --- a/js/src/ui/Balance/balance.js +++ b/js/src/ui/Balance/balance.js @@ -56,7 +56,7 @@ export class Balance extends Component { const isEthToken = token.native; const isFullToken = !showOnlyEth || isEthToken; - const hasBalance = balanceValue.gt(0); + const hasBalance = (balanceValue instanceof BigNumber) && balanceValue.gt(0); if (!hasBalance && !isEthToken) { return null; From b9b5c84417b1ceb7289be5707197d8deecf5cede Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Wed, 7 Jun 2017 16:27:26 +0200 Subject: [PATCH 5/5] Fixed default UI port for mac installer (#5782) --- mac/post-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mac/post-install.sh b/mac/post-install.sh index 835d2ceda..a364878d8 100755 --- a/mac/post-install.sh +++ b/mac/post-install.sh @@ -4,5 +4,5 @@ test -f /usr/local/libexec/uninstall-parity.sh && /usr/local/libexec/uninstall-p killall -9 parity && sleep 5 su $USER -c "open /Applications/Parity\ Ethereum.app" sleep 5 -su $USER -c "open http://127.0.0.1:8080/" +su $USER -c "open http://127.0.0.1:8180/" exit 0