diff --git a/src/core/address.rs b/src/core/address.rs index 186d1293..9ceafbcb 100644 --- a/src/core/address.rs +++ b/src/core/address.rs @@ -130,38 +130,30 @@ mod tests { #[test] fn should_catch_wrong_address_encoding() { - assert!( - "0x___c045110b8dbf29765047380898919c5cb56f4" - .parse::
() - .is_err() - ); + assert!("0x___c045110b8dbf29765047380898919c5cb56f4" + .parse::() + .is_err()); } #[test] fn should_catch_wrong_address_insufficient_length() { - assert!( - "0x0e7c045110b8dbf297650473808989" - .parse::() - .is_err() - ); + assert!("0x0e7c045110b8dbf297650473808989" + .parse::() + .is_err()); } #[test] fn should_catch_wrong_address_excess_length() { - assert!( - "0x0e7c045110b8dbf29765047380898919c5cb56f400000000" - .parse::() - .is_err() - ); + assert!("0x0e7c045110b8dbf29765047380898919c5cb56f400000000" + .parse::() + .is_err()); } #[test] fn should_catch_wrong_address_prefix() { - assert!( - "0_0e7c045110b8dbf29765047380898919c5cb56f4" - .parse::() - .is_err() - ); + assert!("0_0e7c045110b8dbf29765047380898919c5cb56f4" + .parse::() + .is_err()); } #[test] diff --git a/src/mnemonic/mod.rs b/src/mnemonic/mod.rs index c4312b36..d61192b8 100644 --- a/src/mnemonic/mod.rs +++ b/src/mnemonic/mod.rs @@ -14,7 +14,6 @@ use num::bigint::BigUint; use num::{FromPrimitive, ToPrimitive}; use rand::{OsRng, Rng}; use sha2::{self, Digest}; -use std::iter::repeat; use std::ops::{BitAnd, Shr}; /// Size of entropy in bytes diff --git a/src/storage/storage_ctrl.rs b/src/storage/storage_ctrl.rs index 51614c6b..f8d0c5dc 100644 --- a/src/storage/storage_ctrl.rs +++ b/src/storage/storage_ctrl.rs @@ -16,8 +16,8 @@ const CHAIN_NAMES: &'static [&'static str; 9] = &[ "rootstock-main", "rootstock-test", "kovan", - "etc-main", - "etc-test", + "etc", + "etc-morden", ]; /// Controller to switch storage according to specified chain diff --git a/src/util/crypto.rs b/src/util/crypto.rs index e9f852b7..af7dd348 100644 --- a/src/util/crypto.rs +++ b/src/util/crypto.rs @@ -1,6 +1,5 @@ //! # Crypto util functions -use hmac::digest::FixedOutput; use sha3::Digest; use sha3::Keccak256; /// Keccak-256 crypto hash length in bytes diff --git a/src/util/mod.rs b/src/util/mod.rs index 6854ccdf..913f032e 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -12,6 +12,17 @@ use std::mem::transmute; static HEX_CHARS: &'static [u8] = b"0123456789abcdef"; +const ETH: &'static str = "eth"; +const MORDEN: &'static str = "morden"; +const ROPSTEN: &'static str = "ropsten"; +const RINKEBY: &'static str = "rinkeby"; +const ROOTSTOCK_MAINNET: &'static str = "rootstock-main"; +const ROOTSTOCK_TESTNET: &'static str = "rootstock-test"; +const KOVAN: &'static str = "kovan"; +const ETC: &'static str = "etc"; +const MAINNET: &'static str = "mainnet"; +const ETC_MORDEN: &'static str = "etc-morden"; + /// Convert `self` into hex string pub trait ToHex { /// converts to hex @@ -42,17 +53,17 @@ impl ToHex for u64 { /// # Arguments: /// * `id` - target chain id /// -pub fn to_chain_name(id: u8) -> Option