Merge branch 'master' into light-poa
This commit is contained in:
@@ -8,12 +8,14 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
[lib]
|
||||
|
||||
[dependencies]
|
||||
ansi_term = "0.9"
|
||||
cid = "0.2"
|
||||
futures = "0.1"
|
||||
futures-cpupool = "0.1"
|
||||
log = "0.3"
|
||||
multihash ="0.6"
|
||||
order-stat = "0.1"
|
||||
parking_lot = "0.4"
|
||||
rand = "0.3"
|
||||
rust-crypto = "0.2"
|
||||
rustc-hex = "1.0"
|
||||
@@ -54,6 +56,7 @@ parity-updater = { path = "../updater" }
|
||||
rlp = { path = "../util/rlp" }
|
||||
stats = { path = "../util/stats" }
|
||||
vm = { path = "../ethcore/vm" }
|
||||
hash = { path = "../util/hash" }
|
||||
|
||||
clippy = { version = "0.0.103", optional = true}
|
||||
pretty_assertions = "0.1"
|
||||
|
||||
@@ -21,7 +21,8 @@ use std::{fs, time, mem};
|
||||
use itertools::Itertools;
|
||||
use rand::Rng;
|
||||
use rand::os::OsRng;
|
||||
use util::{H256, Hashable};
|
||||
use hash::keccak;
|
||||
use util::H256;
|
||||
|
||||
/// Providing current time in seconds
|
||||
pub trait TimeProvider {
|
||||
@@ -162,7 +163,7 @@ impl<T: TimeProvider> AuthCodes<T> {
|
||||
return false;
|
||||
}
|
||||
|
||||
let as_token = |code| format!("{}:{}", code, time).sha3();
|
||||
let as_token = |code| keccak(format!("{}:{}", code, time));
|
||||
|
||||
// Check if it's the initial token.
|
||||
if self.is_empty() {
|
||||
@@ -231,12 +232,13 @@ mod tests {
|
||||
use std::io::{Read, Write};
|
||||
use std::{time, fs};
|
||||
use std::cell::Cell;
|
||||
use hash::keccak;
|
||||
|
||||
use util::{H256, Hashable};
|
||||
use util::H256;
|
||||
use super::*;
|
||||
|
||||
fn generate_hash(val: &str, time: u64) -> H256 {
|
||||
format!("{}:{}", val, time).sha3()
|
||||
keccak(format!("{}:{}", val, time))
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#![cfg_attr(feature="dev", feature(plugin))]
|
||||
#![cfg_attr(feature="dev", plugin(clippy))]
|
||||
|
||||
extern crate ansi_term;
|
||||
extern crate cid;
|
||||
extern crate crypto as rust_crypto;
|
||||
extern crate futures;
|
||||
@@ -27,6 +28,7 @@ extern crate futures_cpupool;
|
||||
extern crate itertools;
|
||||
extern crate multihash;
|
||||
extern crate order_stat;
|
||||
extern crate parking_lot;
|
||||
extern crate rand;
|
||||
extern crate rustc_hex;
|
||||
extern crate semver;
|
||||
@@ -60,6 +62,7 @@ extern crate parity_reactor;
|
||||
extern crate parity_updater as updater;
|
||||
extern crate rlp;
|
||||
extern crate stats;
|
||||
extern crate hash;
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
@@ -56,7 +56,7 @@ pub fn request(server: Server<ws::Server>, request: &str) -> http_client::Respon
|
||||
#[cfg(test)]
|
||||
mod testing {
|
||||
use std::time;
|
||||
use util::Hashable;
|
||||
use hash::keccak;
|
||||
use devtools::http_client;
|
||||
use super::{serve, request};
|
||||
|
||||
@@ -125,7 +125,7 @@ mod testing {
|
||||
{{}}
|
||||
",
|
||||
port,
|
||||
format!("{}:{}", code, timestamp).sha3(),
|
||||
keccak(format!("{}:{}", code, timestamp)),
|
||||
timestamp,
|
||||
)
|
||||
);
|
||||
@@ -155,7 +155,7 @@ mod testing {
|
||||
{{}}
|
||||
",
|
||||
port,
|
||||
format!("{}:{}", code, timestamp).sha3(),
|
||||
keccak(format!("{}:{}", code, timestamp)),
|
||||
timestamp,
|
||||
)
|
||||
);
|
||||
@@ -171,7 +171,7 @@ mod testing {
|
||||
{{}}
|
||||
",
|
||||
port,
|
||||
format!("{}:{}", code, timestamp).sha3(),
|
||||
keccak(format!("{}:{}", code, timestamp)),
|
||||
timestamp,
|
||||
)
|
||||
);
|
||||
|
||||
@@ -26,8 +26,9 @@ use light::client::LightChainClient;
|
||||
use light::on_demand::{request, OnDemand};
|
||||
use light::TransactionQueue as LightTransactionQueue;
|
||||
use rlp;
|
||||
use util::{Address, H520, H256, U256, Bytes, Mutex, RwLock};
|
||||
use util::sha3::Hashable;
|
||||
use hash::keccak;
|
||||
use util::{Address, H520, H256, U256, Bytes};
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use stats::Corpus;
|
||||
|
||||
use ethkey::Signature;
|
||||
@@ -226,7 +227,7 @@ pub fn eth_data_hash(mut data: Bytes) -> H256 {
|
||||
format!("\x19Ethereum Signed Message:\n{}", data.len())
|
||||
.into_bytes();
|
||||
message_data.append(&mut data);
|
||||
message_data.sha3()
|
||||
keccak(message_data)
|
||||
}
|
||||
|
||||
/// Dispatcher for light clients -- fetches default gas price, next nonce, etc. from network.
|
||||
|
||||
@@ -37,7 +37,8 @@ use light::on_demand::{request, OnDemand, HeaderRef, Request as OnDemandRequest,
|
||||
use light::request::Field;
|
||||
|
||||
use ethsync::LightSync;
|
||||
use util::{Address, Mutex, U256};
|
||||
use util::{Address, U256};
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use v1::helpers::{CallRequest as CallRequestHelper, errors, dispatch};
|
||||
use v1::types::{BlockNumber, CallRequest, Log};
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use std::sync::Arc;
|
||||
use std::ops::Deref;
|
||||
use http::Origin;
|
||||
use util::Mutex;
|
||||
use parking_lot::Mutex;
|
||||
use transient_hashmap::TransientHashMap;
|
||||
|
||||
use ethstore::random_string;
|
||||
|
||||
@@ -19,7 +19,8 @@ use std::cell::RefCell;
|
||||
use std::sync::Arc;
|
||||
use std::collections::BTreeMap;
|
||||
use jsonrpc_core;
|
||||
use util::{Mutex, RwLock, U256, Address};
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use util::{U256, Address};
|
||||
use ethcore::account_provider::DappId;
|
||||
use v1::helpers::{ConfirmationRequest, ConfirmationPayload};
|
||||
use v1::types::{ConfirmationResponse, H160 as RpcH160, Origin, DappId as RpcDappId};
|
||||
@@ -297,7 +298,8 @@ mod test {
|
||||
use std::time::Duration;
|
||||
use std::thread;
|
||||
use std::sync::{mpsc, Arc};
|
||||
use util::{Address, U256, Mutex};
|
||||
use parking_lot::Mutex;
|
||||
use util::{Address, U256};
|
||||
use v1::helpers::{SigningQueue, ConfirmationsQueue, QueueEvent, FilledTransactionRequest, ConfirmationPayload};
|
||||
use v1::types::ConfirmationResponse;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{self, AtomicBool};
|
||||
use util::Mutex;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use jsonrpc_core::futures::future::{self, Either};
|
||||
use jsonrpc_core::futures::sync::mpsc;
|
||||
|
||||
@@ -24,8 +24,7 @@ use futures::{self, future, BoxFuture, Future};
|
||||
use rlp::{self, UntrustedRlp};
|
||||
use time::get_time;
|
||||
use util::{H160, H256, Address, U256, H64};
|
||||
use util::sha3::Hashable;
|
||||
use util::Mutex;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use ethash::SeedHashCompute;
|
||||
use ethcore::account_provider::{AccountProvider, DappId};
|
||||
@@ -149,7 +148,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> EthClient<C, SN, S, M, EM> where
|
||||
let view = block.header_view();
|
||||
Ok(Some(RichBlock {
|
||||
inner: Block {
|
||||
hash: Some(view.sha3().into()),
|
||||
hash: Some(view.hash().into()),
|
||||
size: Some(block.rlp().as_raw().len().into()),
|
||||
parent_hash: view.parent_hash().into(),
|
||||
uncles_hash: view.uncles_hash().into(),
|
||||
|
||||
@@ -23,7 +23,8 @@ use jsonrpc_core::*;
|
||||
use ethcore::miner::MinerService;
|
||||
use ethcore::filter::Filter as EthcoreFilter;
|
||||
use ethcore::client::{BlockChainClient, BlockId};
|
||||
use util::{H256, Mutex};
|
||||
use util::H256;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use futures::{future, Future, BoxFuture};
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ use light::cache::Cache;
|
||||
use light::on_demand::OnDemand;
|
||||
use light::client::{LightChainClient, LightChainNotify};
|
||||
use parity_reactor::Remote;
|
||||
use util::{RwLock, Mutex, H256, Bytes};
|
||||
use util::{H256, Bytes};
|
||||
use parking_lot::{RwLock, Mutex};
|
||||
|
||||
type Client = Sink<pubsub::Result>;
|
||||
|
||||
|
||||
@@ -38,8 +38,9 @@ use ethcore::filter::Filter as EthcoreFilter;
|
||||
use ethcore::transaction::{Action, SignedTransaction, Transaction as EthTransaction};
|
||||
use ethsync::LightSync;
|
||||
use rlp::UntrustedRlp;
|
||||
use util::sha3::{SHA3_NULL_RLP, SHA3_EMPTY_LIST_RLP};
|
||||
use util::{RwLock, Mutex, U256};
|
||||
use hash::{KECCAK_NULL_RLP, KECCAK_EMPTY_LIST_RLP};
|
||||
use util::U256;
|
||||
use parking_lot::{RwLock, Mutex};
|
||||
|
||||
use futures::{future, Future, BoxFuture, IntoFuture};
|
||||
use futures::sync::oneshot;
|
||||
@@ -295,7 +296,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
|
||||
let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone());
|
||||
|
||||
self.fetcher().header(BlockId::Hash(hash.into())).and_then(move |hdr| {
|
||||
if hdr.transactions_root() == SHA3_NULL_RLP {
|
||||
if hdr.transactions_root() == KECCAK_NULL_RLP {
|
||||
future::ok(Some(U256::from(0).into())).boxed()
|
||||
} else {
|
||||
sync.with_context(|ctx| on_demand.request(ctx, request::Body(hdr.into())))
|
||||
@@ -311,7 +312,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
|
||||
let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone());
|
||||
|
||||
self.fetcher().header(num.into()).and_then(move |hdr| {
|
||||
if hdr.transactions_root() == SHA3_NULL_RLP {
|
||||
if hdr.transactions_root() == KECCAK_NULL_RLP {
|
||||
future::ok(Some(U256::from(0).into())).boxed()
|
||||
} else {
|
||||
sync.with_context(|ctx| on_demand.request(ctx, request::Body(hdr.into())))
|
||||
@@ -327,7 +328,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
|
||||
let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone());
|
||||
|
||||
self.fetcher().header(BlockId::Hash(hash.into())).and_then(move |hdr| {
|
||||
if hdr.uncles_hash() == SHA3_EMPTY_LIST_RLP {
|
||||
if hdr.uncles_hash() == KECCAK_EMPTY_LIST_RLP {
|
||||
future::ok(Some(U256::from(0).into())).boxed()
|
||||
} else {
|
||||
sync.with_context(|ctx| on_demand.request(ctx, request::Body(hdr.into())))
|
||||
@@ -343,7 +344,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
|
||||
let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone());
|
||||
|
||||
self.fetcher().header(num.into()).and_then(move |hdr| {
|
||||
if hdr.uncles_hash() == SHA3_EMPTY_LIST_RLP {
|
||||
if hdr.uncles_hash() == KECCAK_EMPTY_LIST_RLP {
|
||||
future::ok(Some(U256::from(0).into())).boxed()
|
||||
} else {
|
||||
sync.with_context(|ctx| on_demand.request(ctx, request::Body(hdr.into())))
|
||||
|
||||
@@ -23,7 +23,7 @@ use std::sync::Arc;
|
||||
use ethsync::ManageNetwork;
|
||||
use fetch::Fetch;
|
||||
use futures::{BoxFuture, Future};
|
||||
use util::sha3;
|
||||
use hash::keccak_buffer;
|
||||
|
||||
use jsonrpc_core::Error;
|
||||
use v1::helpers::dapps::DappsService;
|
||||
@@ -129,7 +129,7 @@ impl<F: Fetch> ParitySet for ParitySetClient<F> {
|
||||
result
|
||||
.map_err(errors::fetch)
|
||||
.and_then(|response| {
|
||||
sha3(&mut io::BufReader::new(response)).map_err(errors::fetch)
|
||||
keccak_buffer(&mut io::BufReader::new(response)).map_err(errors::fetch)
|
||||
})
|
||||
.map(Into::into)
|
||||
}))
|
||||
|
||||
@@ -24,7 +24,7 @@ use ethcore::mode::Mode;
|
||||
use ethsync::ManageNetwork;
|
||||
use fetch::{self, Fetch};
|
||||
use futures::{BoxFuture, Future};
|
||||
use util::sha3;
|
||||
use hash::keccak_buffer;
|
||||
use updater::{Service as UpdateService};
|
||||
|
||||
use jsonrpc_core::Error;
|
||||
@@ -170,7 +170,7 @@ impl<C, M, U, F> ParitySet for ParitySetClient<C, M, U, F> where
|
||||
result
|
||||
.map_err(errors::fetch)
|
||||
.and_then(|response| {
|
||||
sha3(&mut io::BufReader::new(response)).map_err(errors::fetch)
|
||||
keccak_buffer(&mut io::BufReader::new(response)).map_err(errors::fetch)
|
||||
})
|
||||
.map(Into::into)
|
||||
}))
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use util::RwLock;
|
||||
use parking_lot::RwLock;
|
||||
|
||||
use futures::{self, BoxFuture, Future, Stream, Sink};
|
||||
use jsonrpc_core::{self as core, Error, MetaIoHandler};
|
||||
|
||||
@@ -24,7 +24,7 @@ use ethkey;
|
||||
use futures::{future, BoxFuture, Future, IntoFuture};
|
||||
use parity_reactor::Remote;
|
||||
use rlp::UntrustedRlp;
|
||||
use util::Mutex;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use jsonrpc_core::{futures, Error};
|
||||
use jsonrpc_pubsub::SubscriptionId;
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
use transient_hashmap::TransientHashMap;
|
||||
use util::{U256, Mutex};
|
||||
use parking_lot::Mutex;
|
||||
use util::U256;
|
||||
|
||||
use ethcore::account_provider::AccountProvider;
|
||||
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Web3 rpc implementation.
|
||||
use hash::keccak;
|
||||
use jsonrpc_core::*;
|
||||
use util::version;
|
||||
use v1::traits::Web3;
|
||||
use v1::types::{H256, Bytes};
|
||||
use util::sha3::Hashable;
|
||||
|
||||
/// Web3 rpc implementation.
|
||||
pub struct Web3Client;
|
||||
@@ -35,6 +35,6 @@ impl Web3 for Web3Client {
|
||||
}
|
||||
|
||||
fn sha3(&self, data: Bytes) -> Result<H256, Error> {
|
||||
Ok(data.0.sha3().into())
|
||||
Ok(keccak(&data.0).into())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ use futures::Future;
|
||||
use futures_cpupool as pool;
|
||||
use jsonrpc_core as rpc;
|
||||
use order_stat;
|
||||
use util::RwLock;
|
||||
use parking_lot::RwLock;
|
||||
|
||||
pub use self::pool::CpuPool;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ use ethcore::miner::{MinerOptions, Banning, GasPricer, MinerService, ExternalMin
|
||||
use ethcore::account_provider::AccountProvider;
|
||||
use ethjson::blockchain::BlockChain;
|
||||
use io::IoChannel;
|
||||
use util::{U256, H256, Address, Hashable};
|
||||
use util::{U256, H256, Address};
|
||||
|
||||
use jsonrpc_core::IoHandler;
|
||||
use v1::impls::{EthClient, SigningUnsafeClient};
|
||||
@@ -431,7 +431,7 @@ fn verify_transaction_counts(name: String, chain: BlockChain) {
|
||||
for b in chain.blocks_rlp().iter().filter(|b| Block::is_good(b)).map(|b| BlockView::new(b)) {
|
||||
let count = b.transactions_count();
|
||||
|
||||
let hash = b.sha3();
|
||||
let hash = b.hash();
|
||||
let number = b.header_view().number();
|
||||
|
||||
let (req, res) = by_hash(hash, count, &mut id);
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::collections::hash_map::Entry;
|
||||
use util::{Address, H256, Bytes, U256, RwLock, Mutex};
|
||||
use util::{Address, H256, Bytes, U256};
|
||||
use parking_lot::{RwLock, Mutex};
|
||||
use ethcore::error::Error;
|
||||
use ethcore::client::MiningBlockChainClient;
|
||||
use ethcore::block::ClosedBlock;
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
use ethcore::snapshot::{ManifestData, RestorationStatus, SnapshotService};
|
||||
|
||||
use util::{Bytes, Mutex};
|
||||
use parking_lot::Mutex;
|
||||
use util::Bytes;
|
||||
use util::hash::H256;
|
||||
|
||||
/// Mocked snapshot service (used for sync info extensions).
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
//! Test implementation of SyncProvider.
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use util::{H256, RwLock};
|
||||
use parking_lot::RwLock;
|
||||
use util::H256;
|
||||
use ethsync::{SyncProvider, EthProtocolInfo, SyncStatus, SyncState, PeerInfo, TransactionStats};
|
||||
|
||||
/// TestSyncProvider config.
|
||||
|
||||
@@ -22,7 +22,8 @@ use rustc_hex::{FromHex, ToHex};
|
||||
use time::get_time;
|
||||
use rlp;
|
||||
|
||||
use util::{U256, Address, H256, Mutex};
|
||||
use util::{U256, Address, H256};
|
||||
use parking_lot::Mutex;
|
||||
use ethkey::Secret;
|
||||
use ethcore::account_provider::AccountProvider;
|
||||
use ethcore::client::{TestBlockChainClient, EachBlockWith, Executed, TransactionId};
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use std::fmt;
|
||||
use serde::{Serialize, Serializer};
|
||||
use util::Colour;
|
||||
use ansi_term::Colour;
|
||||
use util::bytes::ToPretty;
|
||||
|
||||
use v1::types::{U256, TransactionRequest, RichRawTransaction, H160, H256, H520, Bytes, TransactionCondition, Origin};
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use v1::types::{Bytes, H160, U256, TransactionCondition};
|
||||
use v1::helpers;
|
||||
use util::Colour;
|
||||
use ansi_term::Colour;
|
||||
|
||||
use std::fmt;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user