ethkey and ethstore use hash structures from bigint (#1851)

* Address renamed to H160 at bigint library level

* moved uint specific test from util to bigint library

* naming

* unifing hashes in progress

* unifing hashes

* cleanup redundant unwraps in tests

* fixed compiling
This commit is contained in:
Marek Kotewicz
2016-08-15 15:09:00 +02:00
committed by Gav Wood
parent e6d9fb2ad3
commit c39761c042
32 changed files with 245 additions and 396 deletions

View File

@@ -30,7 +30,7 @@ use ethcore::account_provider::AccountProvider;
use devtools::RandomTempPath;
use util::Hashable;
use io::IoChannel;
use util::{U256, H256, Uint};
use util::{U256, H256, Uint, Address};
use jsonrpc_core::IoHandler;
use ethjson::blockchain::BlockChain;
@@ -416,7 +416,7 @@ fn verify_transaction_counts(name: String, chain: BlockChain) {
#[test]
fn starting_nonce_test() {
let tester = EthTester::from_spec(Spec::load(POSITIVE_NONCE_SPEC));
let address = ::util::hash::Address::from(10);
let address = Address::from(10);
let sample = tester.handler.handle_request(&(r#"
{

View File

@@ -19,9 +19,7 @@ use std::collections::HashMap;
use std::sync::Arc;
use std::time::{Instant, Duration};
use jsonrpc_core::IoHandler;
use util::hash::{Address, H256, FixedHash};
use util::{Uint, U256};
use util::Mutex;
use util::{Uint, U256, Address, H256, FixedHash, Mutex};
use ethcore::account_provider::AccountProvider;
use ethcore::client::{TestBlockChainClient, EachBlockWith, Executed, TransactionID};
use ethcore::log_entry::{LocalizedLogEntry, LogEntry};
@@ -187,7 +185,7 @@ fn rpc_eth_sign() {
],
"id": 1
}"#;
let res = r#"{"jsonrpc":"2.0","result":""#.to_owned() + &format!("0x{:?}", signed) + r#"","id":1}"#;
let res = r#"{"jsonrpc":"2.0","result":""#.to_owned() + &format!("0x{}", signed) + r#"","id":1}"#;
assert_eq!(tester.io.handle_request(&req), Some(res));
}

View File

@@ -185,7 +185,7 @@ fn should_sign_if_account_is_unlocked() {
],
"id": 1
}"#;
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:?}", signature).as_ref() + r#"","id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{}", signature).as_ref() + r#"","id":1}"#;
assert_eq!(tester.io.handle_request(&request), Some(response.to_owned()));
assert_eq!(tester.queue.requests().len(), 0);
}

View File

@@ -20,7 +20,7 @@ use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use serde;
use rustc_serialize::hex::{ToHex, FromHex};
use util::{H64 as Eth64, H256 as EthH256, H520 as EthH520, H2048 as Eth2048, Address};
use util::{H64 as Eth64, H256 as EthH256, H520 as EthH520, H2048 as Eth2048, H160 as Eth160};
macro_rules! impl_hash {
($name: ident, $other: ident, $size: expr) => {
@@ -143,7 +143,7 @@ macro_rules! impl_hash {
}
impl_hash!(H64, Eth64, 8);
impl_hash!(H160, Address, 20);
impl_hash!(H160, Eth160, 20);
impl_hash!(H256, EthH256, 32);
impl_hash!(H520, EthH520, 65);
impl_hash!(H2048, Eth2048, 256);