Hashable::sha3 -> fn keccak for ethcore

This commit is contained in:
debris
2017-08-30 19:18:28 +02:00
parent e120c75d17
commit f0e8abb07b
69 changed files with 429 additions and 398 deletions

View File

@@ -128,6 +128,7 @@ impl ValidatorSet for ValidatorContract {
mod tests {
use std::sync::Arc;
use rustc_hex::FromHex;
use hash::keccak;
use util::*;
use rlp::encode;
use spec::Spec;
@@ -153,7 +154,7 @@ mod tests {
#[test]
fn reports_validators() {
let tap = Arc::new(AccountProvider::transient_provider());
let v1 = tap.insert_account("1".sha3().into(), "").unwrap();
let v1 = tap.insert_account(keccak("1").into(), "").unwrap();
let client = generate_dummy_client_with_spec_and_accounts(Spec::new_validator_contract, Some(tap.clone()));
client.engine().register_client(Arc::downgrade(&client));
let validator_contract = "0000000000000000000000000000000000000005".parse::<Address>().unwrap();

View File

@@ -144,6 +144,7 @@ impl ValidatorSet for Multi {
mod tests {
use std::sync::Arc;
use std::collections::BTreeMap;
use hash::keccak;
use account_provider::AccountProvider;
use client::{BlockChainClient, EngineClient};
use engines::EpochChange;
@@ -163,9 +164,9 @@ mod tests {
let _ = ::env_logger::init();
let tap = Arc::new(AccountProvider::transient_provider());
let s0: Secret = "0".sha3().into();
let s0: Secret = keccak("0").into();
let v0 = tap.insert_account(s0.clone(), "").unwrap();
let v1 = tap.insert_account("1".sha3().into(), "").unwrap();
let v1 = tap.insert_account(keccak("1").into(), "").unwrap();
let client = generate_dummy_client_with_spec_and_accounts(Spec::new_validator_multi, Some(tap));
client.engine().register_client(Arc::downgrade(&client));

View File

@@ -19,6 +19,7 @@
use std::sync::{Weak, Arc};
use futures::Future;
use native_contracts::ValidatorSet as Provider;
use hash::keccak;
use util::*;
use util::cache::MemoryLruCache;
@@ -41,7 +42,7 @@ const MEMOIZE_CAPACITY: usize = 500;
const EVENT_NAME: &'static [u8] = &*b"InitiateChange(bytes32,address[])";
lazy_static! {
static ref EVENT_NAME_HASH: H256 = EVENT_NAME.sha3();
static ref EVENT_NAME_HASH: H256 = keccak(EVENT_NAME);
}
/// The validator contract should have the following interface:
@@ -424,6 +425,7 @@ impl ValidatorSet for ValidatorSafeContract {
mod tests {
use std::sync::Arc;
use rustc_hex::FromHex;
use hash::keccak;
use util::*;
use types::ids::BlockId;
use spec::Spec;
@@ -449,9 +451,9 @@ mod tests {
#[test]
fn knows_validators() {
let tap = Arc::new(AccountProvider::transient_provider());
let s0: Secret = "1".sha3().into();
let s0: Secret = keccak("1").into();
let v0 = tap.insert_account(s0.clone(), "").unwrap();
let v1 = tap.insert_account("0".sha3().into(), "").unwrap();
let v1 = tap.insert_account(keccak("0").into(), "").unwrap();
let chain_id = Spec::new_validator_safe_contract().chain_id();
let client = generate_dummy_client_with_spec_and_accounts(Spec::new_validator_safe_contract, Some(tap));
client.engine().register_client(Arc::downgrade(&client));