Merge remote-tracking branch 'origin/master' into vmtracing
This commit is contained in:
@@ -26,51 +26,50 @@ pub use sha3::*;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! hash_map {
|
||||
( $( $x:expr => $y:expr ),* ) => {
|
||||
vec![ $( ($x, $y) ),* ].into_iter().collect::<HashMap<_, _>>()
|
||||
}
|
||||
() => { HashMap::new() };
|
||||
( $( $x:expr => $y:expr ),* ) => {{
|
||||
let mut x = HashMap::new();
|
||||
$(
|
||||
x.insert($x, $y);
|
||||
)*
|
||||
x
|
||||
}}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! hash_mapx {
|
||||
( $( $x:expr => $y:expr ),* ) => {
|
||||
vec![ $( ( From::from($x), From::from($y) ) ),* ].into_iter().collect::<HashMap<_, _>>()
|
||||
}
|
||||
macro_rules! hash_map_into {
|
||||
() => { HashMap::new() };
|
||||
( $( $x:expr => $y:expr ),* ) => {{
|
||||
let mut x = HashMap::new();
|
||||
$(
|
||||
x.insert($x.into(), $y.into());
|
||||
)*
|
||||
x
|
||||
}}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! map {
|
||||
( $( $x:expr => $y:expr ),* ) => {
|
||||
vec![ $( ($x, $y) ),* ].into_iter().collect::<BTreeMap<_, _>>()
|
||||
}
|
||||
() => { BTreeMap::new() };
|
||||
( $( $x:expr => $y:expr ),* ) => {{
|
||||
let mut x = BTreeMap::new();
|
||||
$(
|
||||
x.insert($x, $y);
|
||||
)*
|
||||
x
|
||||
}}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! mapx {
|
||||
( $( $x:expr => $y:expr ),* ) => {
|
||||
vec![ $( ( From::from($x), From::from($y) ) ),* ].into_iter().collect::<BTreeMap<_, _>>()
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! vecx {
|
||||
( $( $x:expr ),* ) => {
|
||||
vec![ $( From::from($x) ),* ]
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! x {
|
||||
( $x:expr ) => {
|
||||
From::from($x)
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! xx {
|
||||
( $x:expr ) => {
|
||||
From::from(From::from($x))
|
||||
}
|
||||
macro_rules! map_into {
|
||||
() => { BTreeMap::new() };
|
||||
( $( $x:expr => $y:expr ),* ) => {{
|
||||
let mut x = BTreeMap::new();
|
||||
$(
|
||||
x.insert($x.into(), $y.into());
|
||||
)*
|
||||
x
|
||||
}}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
|
||||
@@ -718,7 +718,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn from_and_to_u256() {
|
||||
let u: U256 = x!(0x123456789abcdef0u64);
|
||||
let u: U256 = 0x123456789abcdef0u64.into();
|
||||
let h = H256::from(u);
|
||||
assert_eq!(H256::from(u), H256::from("000000000000000000000000000000000000000000000000123456789abcdef0"));
|
||||
let h_ref = H256::from(&u);
|
||||
|
||||
@@ -48,7 +48,7 @@ impl FromJson for Bytes {
|
||||
impl FromJson for BTreeMap<H256, H256> {
|
||||
fn from_json(json: &Json) -> Self {
|
||||
match *json {
|
||||
Json::Object(ref o) => o.iter().map(|(key, value)| (x!(&u256_from_str(key)), x!(&U256::from_json(value)))).collect(),
|
||||
Json::Object(ref o) => o.iter().map(|(key, value)| (u256_from_str(key).into(), U256::from_json(value).into())).collect(),
|
||||
_ => BTreeMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ struct AccountUnlock {
|
||||
}
|
||||
|
||||
/// Basic account management trait
|
||||
pub trait AccountProvider : Send + Sync {
|
||||
pub trait AccountProvider: Send + Sync {
|
||||
/// Lists all accounts
|
||||
fn accounts(&self) -> Result<Vec<Address>, ::std::io::Error>;
|
||||
/// Unlocks account with the password provided
|
||||
@@ -325,7 +325,7 @@ impl SecretStore {
|
||||
ret
|
||||
}
|
||||
|
||||
/// Returns secret for unlocked account.
|
||||
/// Returns secret for locked account.
|
||||
pub fn locked_account_secret(&self, account: &Address, pass: &str) -> Result<crypto::Secret, SigningError> {
|
||||
let secret_id = try!(self.account(&account).ok_or(SigningError::NoAccount));
|
||||
self.get(&secret_id, pass).or_else(|e| Err(match e {
|
||||
@@ -554,7 +554,7 @@ mod tests {
|
||||
H256::from_str("517ead924a9d0dc3124507e3393d175ce3ff7c1e96529c6c555ce9e51205e9b2").unwrap(),
|
||||
262144,
|
||||
32));
|
||||
key_file.account = Some(x!(i as u64));
|
||||
key_file.account = Some((i as u64).into());
|
||||
result.push(key_file.id.clone());
|
||||
write_sstore.import_key(key_file).unwrap();
|
||||
}
|
||||
@@ -627,7 +627,7 @@ mod tests {
|
||||
sstore.sign(&address, &H256::random()).unwrap()
|
||||
};
|
||||
|
||||
assert!(signature != x!(0));
|
||||
assert!(signature != 0.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user