Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Merge github.com:paritytech/parity into whisper
Browse files Browse the repository at this point in the history
  • Loading branch information
rphmeier committed Jul 6, 2017
2 parents fcf8b01 + 6334893 commit ca8f8eb
Show file tree
Hide file tree
Showing 139 changed files with 7,924 additions and 2,764 deletions.
92 changes: 44 additions & 48 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dapps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ parity-dapps-glue = "1.7"
mime = "0.2"
mime_guess = "1.6.1"
rand = "0.3"
rustc-serialize = "0.3"
rustc-hex = "1.0"
serde = "0.9"
serde_derive = "0.9"
serde_json = "0.9"
Expand Down
2 changes: 1 addition & 1 deletion dapps/src/apps/fetcher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mod installers;
use std::{fs, env};
use std::path::PathBuf;
use std::sync::Arc;
use rustc_serialize::hex::FromHex;
use rustc_hex::FromHex;
use fetch::{Client as FetchClient, Fetch};
use hash_fetch::urlhint::{URLHintContract, URLHint, URLHintResult};
use parity_reactor::Remote;
Expand Down
2 changes: 1 addition & 1 deletion dapps/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extern crate futures;
extern crate linked_hash_map;
extern crate mime_guess;
extern crate rand;
extern crate rustc_serialize;
extern crate rustc_hex;
extern crate serde;
extern crate serde_json;
extern crate time;
Expand Down
2 changes: 1 addition & 1 deletion dapps/src/tests/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

use devtools::http_client;
use rustc_serialize::hex::FromHex;
use rustc_hex::FromHex;
use tests::helpers::{
serve_with_registrar, serve_with_registrar_and_sync, serve_with_fetch,
serve_with_registrar_and_fetch, serve_with_registrar_and_fetch_and_threads,
Expand Down
2 changes: 1 addition & 1 deletion dapps/src/tests/helpers/registrar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use std::str;
use std::sync::Arc;
use std::collections::HashMap;
use rustc_serialize::hex::FromHex;
use rustc_hex::FromHex;

use hash_fetch::urlhint::ContractClient;
use util::{Bytes, Address, Mutex, H256, ToPretty};
Expand Down
1 change: 1 addition & 0 deletions ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ num_cpus = "1.2"
rand = "0.3"
rlp = { path = "../util/rlp" }
rust-crypto = "0.2.34"
rustc-hex = "1.0"
rustc-serialize = "0.3"
semver = "0.6"
stats = { path = "../util/stats" }
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/blockchain/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ impl BlockChain {
mod tests {
#![cfg_attr(feature="dev", allow(similar_names))]
use std::sync::Arc;
use rustc_serialize::hex::FromHex;
use rustc_hex::FromHex;
use util::kvdb::KeyValueDB;
use util::hash::*;
use util::sha3::Hashable;
Expand Down
8 changes: 1 addition & 7 deletions ethcore/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ mod tests {
use super::{Builtin, Linear, ethereum_builtin, Pricer, Modexp};
use ethjson;
use util::{U256, BytesRef};
use rustc_serialize::hex::FromHex;
use rustc_hex::FromHex;

#[test]
fn identity() {
Expand All @@ -524,7 +524,6 @@ mod tests {

#[test]
fn sha256() {
use rustc_serialize::hex::FromHex;
let f = ethereum_builtin("sha256");

let i = [0u8; 0];
Expand All @@ -548,7 +547,6 @@ mod tests {

#[test]
fn ripemd160() {
use rustc_serialize::hex::FromHex;
let f = ethereum_builtin("ripemd160");

let i = [0u8; 0];
Expand All @@ -568,7 +566,6 @@ mod tests {

#[test]
fn ecrecover() {
use rustc_serialize::hex::FromHex;
/*let k = KeyPair::from_secret(b"test".sha3()).unwrap();
let a: Address = From::from(k.public().sha3());
println!("Address: {}", a);
Expand Down Expand Up @@ -627,7 +624,6 @@ mod tests {

#[test]
fn modexp() {
use rustc_serialize::hex::FromHex;

let f = Builtin {
pricer: Box::new(Modexp { divisor: 20 }),
Expand Down Expand Up @@ -714,7 +710,6 @@ mod tests {

#[test]
fn bn128_add() {
use rustc_serialize::hex::FromHex;

let f = Builtin {
pricer: Box::new(Linear { base: 0, word: 0 }),
Expand Down Expand Up @@ -776,7 +771,6 @@ mod tests {

#[test]
fn bn128_mul() {
use rustc_serialize::hex::FromHex;

let f = Builtin {
pricer: Box::new(Linear { base: 0, word: 0 }),
Expand Down
1 change: 1 addition & 0 deletions ethcore/src/client/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//! Test client.

use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrder};
use rustc_hex::FromHex;
use util::*;
use rlp::*;
use ethkey::{Generator, Random};
Expand Down
1 change: 1 addition & 0 deletions ethcore/src/engines/tendermint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ impl Engine for Tendermint {

#[cfg(test)]
mod tests {
use rustc_hex::FromHex;
use util::*;
use block::*;
use error::{Error, BlockError};
Expand Down
1 change: 1 addition & 0 deletions ethcore/src/engines/validator_set/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ impl ValidatorSet for ValidatorContract {

#[cfg(test)]
mod tests {
use rustc_hex::FromHex;
use util::*;
use rlp::encode;
use spec::Spec;
Expand Down
1 change: 1 addition & 0 deletions ethcore/src/engines/validator_set/safe_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ impl ValidatorSet for ValidatorSafeContract {

#[cfg(test)]
mod tests {
use rustc_hex::FromHex;
use util::*;
use types::ids::BlockId;
use spec::Spec;
Expand Down
2 changes: 0 additions & 2 deletions ethcore/src/env_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ impl From<ethjson::vm::Env> for EnvInfo {

#[cfg(test)]
mod tests {
extern crate rustc_serialize;

use std::str::FromStr;
use super::*;
use util::{U256, Address};
Expand Down
14 changes: 10 additions & 4 deletions ethcore/src/ethereum/ethash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,14 @@ impl Ethash {
let parent_has_uncles = parent.uncles_hash() != &sha3::SHA3_EMPTY_LIST_RLP;

let min_difficulty = self.ethash_params.minimum_difficulty;

let difficulty_hardfork = header.number() >= self.ethash_params.difficulty_hardfork_transition;
let difficulty_bound_divisor = match difficulty_hardfork {
true => self.ethash_params.difficulty_hardfork_bound_divisor,
false => self.ethash_params.difficulty_bound_divisor,
let difficulty_bound_divisor = if difficulty_hardfork {
self.ethash_params.difficulty_hardfork_bound_divisor
} else {
self.ethash_params.difficulty_bound_divisor
};

let duration_limit = self.ethash_params.duration_limit;
let frontier_limit = self.ethash_params.homestead_transition;

Expand All @@ -483,7 +486,10 @@ impl Ethash {
if diff_inc <= threshold {
*parent.difficulty() + *parent.difficulty() / difficulty_bound_divisor * (threshold - diff_inc).into()
} else {
*parent.difficulty() - *parent.difficulty() / difficulty_bound_divisor * min(diff_inc - threshold, 99).into()
let multiplier = min(diff_inc - threshold, 99).into();
parent.difficulty().saturating_sub(
*parent.difficulty() / difficulty_bound_divisor * multiplier
)
}
};
target = max(min_difficulty, target);
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/evm/interpreter/shared_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl Default for SharedCache {

#[test]
fn test_find_jump_destinations() {
use util::FromHex;
use rustc_hex::FromHex;
// given
let code = "7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b01600055".from_hex().unwrap();

Expand Down
3 changes: 2 additions & 1 deletion ethcore/src/evm/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

use std::fmt::Debug;
use rustc_hex::FromHex;
use util::*;
use action_params::{ActionParams, ActionValue};
use env_info::EnvInfo;
use types::executed::CallType;
use evm::{self, Ext, Schedule, Factory, GasLeft, VMType, ContractCreateResult, MessageCallResult, CreateContractAddress, ReturnData};
use std::fmt::Debug;
use tests::helpers::*;
use types::transaction::SYSTEM_ADDRESS;
use executive::Executive;
Expand Down
3 changes: 2 additions & 1 deletion ethcore/src/executive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,10 @@ impl<'a, B: 'a + StateBackend, E: Engine + ?Sized> Executive<'a, B, E> {
#[allow(dead_code)]
mod tests {
use std::sync::Arc;
use rustc_hex::FromHex;
use ethkey::{Generator, Random};
use super::*;
use util::{H256, U256, U512, Address, FromHex, FromStr};
use util::{H256, U256, U512, Address, FromStr};
use util::bytes::BytesRef;
use action_params::{ActionParams, ActionValue};
use env_info::EnvInfo;
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ impl HeapSizeOf for Header {

#[cfg(test)]
mod tests {
use rustc_serialize::hex::FromHex;
use rustc_hex::FromHex;
use rlp;
use super::Header;

Expand Down
1 change: 1 addition & 0 deletions ethcore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ extern crate num_cpus;
extern crate num;
extern crate rand;
extern crate rlp;
extern crate rustc_hex;
extern crate rustc_serialize;
extern crate semver;
extern crate stats;
Expand Down
3 changes: 2 additions & 1 deletion ethcore/src/miner/banning_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,14 @@ impl DerefMut for BanningTransactionQueue {
#[cfg(test)]
mod tests {
use std::time::Duration;
use rustc_hex::FromHex;
use super::{BanningTransactionQueue, Threshold};
use ethkey::{Random, Generator};
use transaction::{Transaction, SignedTransaction, Action};
use error::{Error, TransactionError};
use client::TransactionImportResult;
use miner::{TransactionQueue, TransactionOrigin};
use util::{U256, Address, FromHex, Hashable};
use util::{U256, Address, Hashable};
use miner::transaction_queue::test::DummyTransactionDetailsProvider;

fn queue() -> BanningTransactionQueue {
Expand Down
3 changes: 2 additions & 1 deletion ethcore/src/miner/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1261,10 +1261,11 @@ mod tests {

use std::sync::Arc;
use std::time::Duration;
use rustc_hex::FromHex;
use super::super::{MinerService, PrioritizationStrategy};
use super::*;
use block::IsBlock;
use util::{U256, FromHex};
use util::U256;
use ethkey::{Generator, Random};
use client::{BlockChainClient, TestBlockChainClient, EachBlockWith, TransactionImportResult};
use header::BlockNumber;
Expand Down
6 changes: 3 additions & 3 deletions ethcore/src/miner/transaction_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
//! extern crate ethcore_util as util;
//! extern crate ethcore;
//! extern crate ethkey;
//! extern crate rustc_serialize;
//! extern crate rustc_hex;
//!
//! use util::{U256, Address};
//! use ethkey::{Random, Generator};
//! use ethcore::miner::{TransactionQueue, RemovalReason, TransactionQueueDetailsProvider, AccountDetails, TransactionOrigin};
//! use ethcore::transaction::*;
//! use rustc_serialize::hex::FromHex;
//! use rustc_hex::FromHex;
//!
//! #[derive(Default)]
//! struct DummyTransactionDetailsProvider;
Expand Down Expand Up @@ -1422,7 +1422,7 @@ fn check_if_removed(sender: &Address, nonce: &U256, dropped: Option<HashMap<Addr

#[cfg(test)]
pub mod test {
extern crate rustc_serialize;
use rustc_hex::FromHex;
use util::table::*;
use util::*;
use ethkey::{Random, Generator};
Expand Down
1 change: 1 addition & 0 deletions ethcore/src/spec/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

//! Parameters for a block chain.

use rustc_hex::FromHex;
use super::genesis::Genesis;
use super::seal::Generic as GenericSeal;

Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ mod tests {

use std::sync::Arc;
use std::str::FromStr;
use rustc_serialize::hex::FromHex;
use rustc_hex::FromHex;
use super::*;
use ethkey::Secret;
use util::{U256, H256, Address, Hashable};
Expand Down
4 changes: 2 additions & 2 deletions ethcore/src/types/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ pub struct LocalizedReceipt {

#[test]
fn test_no_state_root() {
let expected = ::rustc_serialize::hex::FromHex::from_hex("f9014183040caeb9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000f838f794dcf421d093428b096ca501a7cd1a740855a7976fc0a00000000000000000000000000000000000000000000000000000000000000000").unwrap();
let expected = ::rustc_hex::FromHex::from_hex("f9014183040caeb9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000f838f794dcf421d093428b096ca501a7cd1a740855a7976fc0a00000000000000000000000000000000000000000000000000000000000000000").unwrap();
let r = Receipt::new(
None,
0x40cae.into(),
Expand All @@ -155,7 +155,7 @@ fn test_no_state_root() {

#[test]
fn test_basic() {
let expected = ::rustc_serialize::hex::FromHex::from_hex("f90162a02f697d671e9ae4ee24a43c4b0d7e15f1cb4ba6de1561120d43b9a4e8c4a8a6ee83040caeb9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000f838f794dcf421d093428b096ca501a7cd1a740855a7976fc0a00000000000000000000000000000000000000000000000000000000000000000").unwrap();
let expected = ::rustc_hex::FromHex::from_hex("f90162a02f697d671e9ae4ee24a43c4b0d7e15f1cb4ba6de1561120d43b9a4e8c4a8a6ee83040caeb9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000f838f794dcf421d093428b096ca501a7cd1a740855a7976fc0a00000000000000000000000000000000000000000000000000000000000000000").unwrap();
let r = Receipt::new(
Some("2f697d671e9ae4ee24a43c4b0d7e15f1cb4ba6de1561120d43b9a4e8c4a8a6ee".into()),
0x40cae.into(),
Expand Down
4 changes: 2 additions & 2 deletions ethcore/src/types/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ impl From<SignedTransaction> for PendingTransaction {

#[test]
fn sender_test() {
let t: UnverifiedTransaction = decode(&::rustc_serialize::hex::FromHex::from_hex("f85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804").unwrap());
let t: UnverifiedTransaction = decode(&::rustc_hex::FromHex::from_hex("f85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804").unwrap());
assert_eq!(t.data, b"");
assert_eq!(t.gas, U256::from(0x5208u64));
assert_eq!(t.gas_price, U256::from(0x01u64));
Expand Down Expand Up @@ -612,7 +612,7 @@ fn should_recover_from_network_specific_signing() {

#[test]
fn should_agree_with_vitalik() {
use rustc_serialize::hex::FromHex;
use rustc_hex::FromHex;

let test_vector = |tx_data: &str, address: &'static str| {
let signed = decode(&FromHex::from_hex(tx_data).unwrap());
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/views/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl<'a> Hashable for BlockView<'a> {
#[cfg(test)]
mod tests {
use std::str::FromStr;
use rustc_serialize::hex::FromHex;
use rustc_hex::FromHex;
use util::H256;
use super::BlockView;

Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/views/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl<'a> BodyView<'a> {

#[cfg(test)]
mod tests {
use util::*;
use rustc_hex::FromHex;
use super::BodyView;
use blockchain::BlockChain;

Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/views/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl<'a> Hashable for HeaderView<'a> {
#[cfg(test)]
mod tests {
use std::str::FromStr;
use rustc_serialize::hex::FromHex;
use rustc_hex::FromHex;
use util::{H256, Address, H2048, U256};
use super::HeaderView;

Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/views/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl<'a> Hashable for TransactionView<'a> {
#[cfg(test)]
mod tests {
use std::str::FromStr;
use rustc_serialize::hex::FromHex;
use rustc_hex::FromHex;
use util::U256;
use super::TransactionView;

Expand Down
2 changes: 1 addition & 1 deletion ethkey/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ rand = "0.3.14"
lazy_static = "0.2"
tiny-keccak = "1.2"
eth-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1" }
rustc-serialize = "0.3"
rustc-hex = "1.0"
ethcore-bigint = { path = "../util/bigint" }
rust-crypto = "0.2"
byteorder = "1.0"
Loading

0 comments on commit ca8f8eb

Please sign in to comment.