Merge branch 'backporting' into beta

This commit is contained in:
arkpar 2017-01-19 11:30:32 +01:00
commit 536cf73db8
23 changed files with 215 additions and 103 deletions

48
Cargo.lock generated
View File

@ -414,8 +414,8 @@ dependencies = [
"fetch 0.1.0", "fetch 0.1.0",
"futures 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)", "hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)",
"jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)",
"jsonrpc-http-server 6.1.1 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-http-server 6.1.1 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)",
"linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -583,10 +583,10 @@ dependencies = [
"ethsync 1.5.0", "ethsync 1.5.0",
"fetch 0.1.0", "fetch 0.1.0",
"futures 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)",
"jsonrpc-http-server 6.1.1 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-http-server 6.1.1 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)",
"jsonrpc-ipc-server 0.2.4 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-ipc-server 0.2.4 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)",
"jsonrpc-macros 0.1.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-macros 0.1.0 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-reactor 0.1.0", "parity-reactor 0.1.0",
"parity-updater 1.5.0", "parity-updater 1.5.0",
@ -611,7 +611,7 @@ dependencies = [
"ethcore-io 1.5.0", "ethcore-io 1.5.0",
"ethcore-rpc 1.5.0", "ethcore-rpc 1.5.0",
"ethcore-util 1.5.0", "ethcore-util 1.5.0",
"jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-ui 1.5.0", "parity-ui 1.5.0",
@ -630,8 +630,8 @@ dependencies = [
"ethcore-ipc-codegen 1.5.0", "ethcore-ipc-codegen 1.5.0",
"ethcore-ipc-nano 1.5.0", "ethcore-ipc-nano 1.5.0",
"ethcore-util 1.5.0", "ethcore-util 1.5.0",
"jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)",
"jsonrpc-tcp-server 0.1.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-tcp-server 0.1.0 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.5.1 (git+https://github.com/ethcore/mio?branch=v0.5.x)", "mio 0.5.1 (git+https://github.com/ethcore/mio?branch=v0.5.x)",
@ -952,7 +952,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "jsonrpc-core" name = "jsonrpc-core"
version = "4.0.0" version = "4.0.0"
source = "git+https://github.com/ethcore/jsonrpc.git#33262d626a294a00c20435dec331058ba65e224a" source = "git+https://github.com/ethcore/jsonrpc.git?branch=mio-old#057cc58a849d18933a9cce60a33559c7505bd7ce"
dependencies = [ dependencies = [
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -964,10 +964,10 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-http-server" name = "jsonrpc-http-server"
version = "6.1.1" version = "6.1.1"
source = "git+https://github.com/ethcore/jsonrpc.git#33262d626a294a00c20435dec331058ba65e224a" source = "git+https://github.com/ethcore/jsonrpc.git?branch=mio-old#057cc58a849d18933a9cce60a33559c7505bd7ce"
dependencies = [ dependencies = [
"hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)", "hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)",
"jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -975,11 +975,11 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-ipc-server" name = "jsonrpc-ipc-server"
version = "0.2.4" version = "0.2.4"
source = "git+https://github.com/ethcore/jsonrpc.git#33262d626a294a00c20435dec331058ba65e224a" source = "git+https://github.com/ethcore/jsonrpc.git?branch=mio-old#057cc58a849d18933a9cce60a33559c7505bd7ce"
dependencies = [ dependencies = [
"bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -990,20 +990,20 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-macros" name = "jsonrpc-macros"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/ethcore/jsonrpc.git#33262d626a294a00c20435dec331058ba65e224a" source = "git+https://github.com/ethcore/jsonrpc.git?branch=mio-old#057cc58a849d18933a9cce60a33559c7505bd7ce"
dependencies = [ dependencies = [
"jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)",
"serde 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "jsonrpc-tcp-server" name = "jsonrpc-tcp-server"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/ethcore/jsonrpc.git#33262d626a294a00c20435dec331058ba65e224a" source = "git+https://github.com/ethcore/jsonrpc.git?branch=mio-old#057cc58a849d18933a9cce60a33559c7505bd7ce"
dependencies = [ dependencies = [
"bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1471,7 +1471,7 @@ dependencies = [
"ethcore-signer 1.5.0", "ethcore-signer 1.5.0",
"ethcore-util 1.5.0", "ethcore-util 1.5.0",
"futures 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2415,11 +2415,11 @@ dependencies = [
"checksum isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7408a548dc0e406b7912d9f84c261cc533c1866e047644a811c133c56041ac0c" "checksum isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7408a548dc0e406b7912d9f84c261cc533c1866e047644a811c133c56041ac0c"
"checksum itertools 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "086e1fa5fe48840b1cfdef3a20c7e3115599f8d5c4c87ef32a794a7cdd184d76" "checksum itertools 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "086e1fa5fe48840b1cfdef3a20c7e3115599f8d5c4c87ef32a794a7cdd184d76"
"checksum itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3088ea4baeceb0284ee9eea42f591226e6beaecf65373e41b38d95a1b8e7a1" "checksum itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3088ea4baeceb0284ee9eea42f591226e6beaecf65373e41b38d95a1b8e7a1"
"checksum jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git)" = "<none>" "checksum jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)" = "<none>"
"checksum jsonrpc-http-server 6.1.1 (git+https://github.com/ethcore/jsonrpc.git)" = "<none>" "checksum jsonrpc-http-server 6.1.1 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)" = "<none>"
"checksum jsonrpc-ipc-server 0.2.4 (git+https://github.com/ethcore/jsonrpc.git)" = "<none>" "checksum jsonrpc-ipc-server 0.2.4 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)" = "<none>"
"checksum jsonrpc-macros 0.1.0 (git+https://github.com/ethcore/jsonrpc.git)" = "<none>" "checksum jsonrpc-macros 0.1.0 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)" = "<none>"
"checksum jsonrpc-tcp-server 0.1.0 (git+https://github.com/ethcore/jsonrpc.git)" = "<none>" "checksum jsonrpc-tcp-server 0.1.0 (git+https://github.com/ethcore/jsonrpc.git?branch=mio-old)" = "<none>"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
"checksum lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "49247ec2a285bb3dcb23cbd9c35193c025e7251bfce77c1d5da97e6362dffe7f" "checksum lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "49247ec2a285bb3dcb23cbd9c35193c025e7251bfce77c1d5da97e6362dffe7f"

View File

@ -13,8 +13,8 @@ rand = "0.3"
log = "0.3" log = "0.3"
env_logger = "0.3" env_logger = "0.3"
futures = "0.1" futures = "0.1"
jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git" } jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git", branch="mio-old" }
jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc.git" } jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc.git", branch="mio-old" }
hyper = { default-features = false, git = "https://github.com/ethcore/hyper" } hyper = { default-features = false, git = "https://github.com/ethcore/hyper" }
unicase = "1.3" unicase = "1.3"
url = "1.0" url = "1.0"

View File

@ -242,7 +242,7 @@ impl TestBlockChainClient {
value: U256::from(100), value: U256::from(100),
data: "3331600055".from_hex().unwrap(), data: "3331600055".from_hex().unwrap(),
gas: U256::from(100_000), gas: U256::from(100_000),
gas_price: U256::one(), gas_price: U256::from(200_000_000_000u64),
nonce: U256::zero() nonce: U256::zero()
}; };
let signed_tx = tx.sign(keypair.secret(), None); let signed_tx = tx.sign(keypair.secret(), None);
@ -308,11 +308,11 @@ impl TestBlockChainClient {
value: U256::from(100), value: U256::from(100),
data: "3331600055".from_hex().unwrap(), data: "3331600055".from_hex().unwrap(),
gas: U256::from(100_000), gas: U256::from(100_000),
gas_price: U256::one(), gas_price: U256::from(20_000_000_000u64),
nonce: U256::zero() nonce: U256::zero()
}; };
let signed_tx = tx.sign(keypair.secret(), None); let signed_tx = tx.sign(keypair.secret(), None);
self.set_balance(signed_tx.sender().unwrap(), 10_000_000.into()); self.set_balance(signed_tx.sender().unwrap(), 10_000_000_000_000_000_000u64.into());
let res = self.miner.import_external_transactions(self, vec![signed_tx]); let res = self.miner.import_external_transactions(self, vec![signed_tx]);
let res = res.into_iter().next().unwrap().expect("Successful import"); let res = res.into_iter().next().unwrap().expect("Successful import");
assert_eq!(res, TransactionImportResult::Current); assert_eq!(res, TransactionImportResult::Current);

View File

@ -149,7 +149,8 @@ impl GasPriceCalibrator {
if Instant::now() >= self.next_calibration { if Instant::now() >= self.next_calibration {
let usd_per_tx = self.options.usd_per_tx; let usd_per_tx = self.options.usd_per_tx;
trace!(target: "miner", "Getting price info"); trace!(target: "miner", "Getting price info");
let price_info = PriceInfo::get(move |price: PriceInfo| {
PriceInfo::get(move |price: PriceInfo| {
trace!(target: "miner", "Price info arrived: {:?}", price); trace!(target: "miner", "Price info arrived: {:?}", price);
let usd_per_eth = price.ethusd; let usd_per_eth = price.ethusd;
let wei_per_usd: f32 = 1.0e18 / usd_per_eth; let wei_per_usd: f32 = 1.0e18 / usd_per_eth;
@ -159,11 +160,7 @@ impl GasPriceCalibrator {
set_price(U256::from(wei_per_gas as u64)); set_price(U256::from(wei_per_gas as u64));
}); });
if price_info.is_ok() { self.next_calibration = Instant::now() + self.options.recalibration_period;
self.next_calibration = Instant::now() + self.options.recalibration_period;
} else {
warn!(target: "miner", "Unable to update Ether price.");
}
} }
} }
} }
@ -307,16 +304,6 @@ impl Miner {
#[cfg_attr(feature="dev", allow(match_same_arms))] #[cfg_attr(feature="dev", allow(match_same_arms))]
/// Prepares new block for sealing including top transactions from queue. /// Prepares new block for sealing including top transactions from queue.
fn prepare_block(&self, chain: &MiningBlockChainClient) -> (ClosedBlock, Option<H256>) { fn prepare_block(&self, chain: &MiningBlockChainClient) -> (ClosedBlock, Option<H256>) {
{
trace!(target: "miner", "prepare_block: recalibrating...");
let txq = self.transaction_queue.clone();
self.gas_pricer.lock().recalibrate(move |price| {
trace!(target: "miner", "prepare_block: Got gas price! {}", price);
txq.lock().set_minimal_gas_price(price);
});
trace!(target: "miner", "prepare_block: done recalibration.");
}
let _timer = PerfTimer::new("prepare_block"); let _timer = PerfTimer::new("prepare_block");
let chain_info = chain.chain_info(); let chain_info = chain.chain_info();
let (transactions, mut open_block, original_work_hash) = { let (transactions, mut open_block, original_work_hash) = {
@ -431,6 +418,16 @@ impl Miner {
(block, original_work_hash) (block, original_work_hash)
} }
/// Asynchronously updates minimal gas price for transaction queue
pub fn recalibrate_minimal_gas_price(&self) {
debug!(target: "miner", "minimal_gas_price: recalibrating...");
let txq = self.transaction_queue.clone();
self.gas_pricer.lock().recalibrate(move |price| {
debug!(target: "miner", "minimal_gas_price: Got gas price! {}", price);
txq.lock().set_minimal_gas_price(price);
});
}
/// Check is reseal is allowed and necessary. /// Check is reseal is allowed and necessary.
fn requires_reseal(&self, best_block: BlockNumber) -> bool { fn requires_reseal(&self, best_block: BlockNumber) -> bool {
let has_local_transactions = self.transaction_queue.lock().has_local_pending_transactions(); let has_local_transactions = self.transaction_queue.lock().has_local_pending_transactions();
@ -1124,6 +1121,9 @@ impl MinerService for Miner {
// First update gas limit in transaction queue // First update gas limit in transaction queue
self.update_gas_limit(chain); self.update_gas_limit(chain);
// Update minimal gas price
self.recalibrate_minimal_gas_price();
// Then import all transactions... // Then import all transactions...
{ {
retracted.par_iter() retracted.par_iter()

View File

@ -21,7 +21,7 @@ use std::time::Duration;
use std::str::FromStr; use std::str::FromStr;
use std::sync::mpsc; use std::sync::mpsc;
use hyper::client::{Handler, Request, Response, Client}; use hyper::client::{Handler, Request, Response, Client};
use hyper::{Next, Encoder, Decoder}; use hyper::{Url, Next, Encoder, Decoder};
use hyper::net::HttpStream; use hyper::net::HttpStream;
#[derive(Debug)] #[derive(Debug)]
@ -29,12 +29,12 @@ pub struct PriceInfo {
pub ethusd: f32, pub ethusd: f32,
} }
pub struct SetPriceHandler<F: Fn(PriceInfo) + Sync + Send + 'static> { pub struct SetPriceHandler<F> {
set_price: F, set_price: F,
channel: mpsc::Sender<()>, channel: mpsc::Sender<()>,
} }
impl<F: Fn(PriceInfo) + Sync + Send + 'static> Drop for SetPriceHandler<F> { impl<F> Drop for SetPriceHandler<F> {
fn drop(&mut self) { fn drop(&mut self) {
let _ = self.channel.send(()); let _ = self.channel.send(());
} }
@ -47,37 +47,61 @@ impl<F: Fn(PriceInfo) + Sync + Send + 'static> Handler<HttpStream> for SetPriceH
fn on_response_readable(&mut self, r: &mut Decoder<HttpStream>) -> Next { fn on_response_readable(&mut self, r: &mut Decoder<HttpStream>) -> Next {
let mut body = String::new(); let mut body = String::new();
let _ = r.read_to_string(&mut body).ok() let info = r.read_to_string(&mut body)
.and_then(|_| Json::from_str(&body).ok()) .map_err(|e| format!("Unable to read response: {:?}", e))
.and_then(|json| json.find_path(&["result", "ethusd"]) .and_then(|_| self.process_response(&body));
.and_then(|obj| match *obj {
Json::String(ref s) => Some((self.set_price)(PriceInfo { if let Err(e) = info {
ethusd: FromStr::from_str(s) warn!("Failed to auto-update latest ETH price: {:?}", e);
.expect("Etherscan API will always return properly formatted price; qed") }
})),
_ => None,
}));
Next::end() Next::end()
} }
}
impl<F: Fn(PriceInfo) + Sync + Send + 'static> SetPriceHandler<F> {
fn process_response(&self, body: &str) -> Result<(), String> {
let json = Json::from_str(body).map_err(|e| format!("Invalid JSON returned: {:?}", e))?;
let obj = json.find_path(&["result", "ethusd"]).ok_or("USD price not found".to_owned())?;
let ethusd = match *obj {
Json::String(ref s) => FromStr::from_str(s).ok(),
_ => None,
}.ok_or("Unexpected price format.".to_owned())?;
(self.set_price)(PriceInfo {
ethusd: ethusd,
});
Ok(())
}
} }
impl PriceInfo { impl PriceInfo {
pub fn get<F: Fn(PriceInfo) + Sync + Send + 'static>(set_price: F) -> Result<(), ()> { pub fn get<F: Fn(PriceInfo) + Sync + Send + 'static>(set_price: F) {
// TODO: Handle each error type properly
let client = Client::new().map_err(|_| ())?;
thread::spawn(move || { thread::spawn(move || {
let (tx, rx) = mpsc::channel();
let url = FromStr::from_str("http://api.etherscan.io/api?module=stats&action=ethprice") let url = FromStr::from_str("http://api.etherscan.io/api?module=stats&action=ethprice")
.expect("string known to be a valid URL; qed"); .expect("string known to be a valid URL; qed");
let _ = client.request(
url, if let Err(e) = Self::request(url, set_price) {
SetPriceHandler { warn!("Failed to auto-update latest ETH price: {:?}", e);
set_price: set_price, }
channel: tx,
}).ok().and_then(|_| rx.recv().ok());
client.close();
}); });
}
fn request<F: Fn(PriceInfo) + Send + Sync + 'static>(url: Url, set_price: F) -> Result<(), String> {
let (tx, rx) = mpsc::channel();
let client = Client::new().map_err(|e| format!("Unable to start client: {:?}", e))?;
client.request(
url,
SetPriceHandler {
set_price: set_price,
channel: tx,
},
).map_err(|_| "Request failed.".to_owned())?;
// Wait for exit
let _ = rx.recv().map_err(|e| format!("Request interrupted: {:?}", e))?;
client.close();
Ok(()) Ok(())
} }
} }
@ -93,7 +117,7 @@ fn should_get_price_info() {
let done = Arc::new((Mutex::new(PriceInfo { ethusd: 0f32 }), Condvar::new())); let done = Arc::new((Mutex::new(PriceInfo { ethusd: 0f32 }), Condvar::new()));
let rdone = done.clone(); let rdone = done.clone();
PriceInfo::get(move |price| { let mut p = rdone.0.lock(); *p = price; rdone.1.notify_one(); }).unwrap(); PriceInfo::get(move |price| { let mut p = rdone.0.lock(); *p = price; rdone.1.notify_one(); });
let mut p = done.0.lock(); let mut p = done.0.lock();
let t = done.1.wait_for(&mut p, Duration::from_millis(10000)); let t = done.1.wait_for(&mut p, Duration::from_millis(10000));
assert!(!t.timed_out()); assert!(!t.timed_out());

View File

@ -73,6 +73,26 @@ export default class BadgeReg {
}); });
} }
fetchCertifierByName (name) {
return this
.getContract()
.then((badgeReg) => {
return badgeReg.instance.fromName.call({}, [ name ]);
})
.then(([ id, address, owner ]) => {
if (address === ZERO20) {
throw new Error(`Certifier ${name} does not exist.`);
}
return this.fetchMeta(id)
.then(({ title, icon }) => {
const data = { address, id, name, title, icon };
this.certifiers[id] = data;
return data;
});
});
}
fetchMeta (id) { fetchMeta (id) {
return this return this
.getContract() .getContract()

View File

@ -16,7 +16,7 @@
module.exports = [ module.exports = [
{ name: 'basiccoin', entry: 'basiccoin.js', title: 'Basic Token Deployment' }, { name: 'basiccoin', entry: 'basiccoin.js', title: 'Basic Token Deployment' },
{ name: 'dappreg', entry: 'dappreg.js', title: 'Dapp Registry', secure: true }, { name: 'dappreg', entry: 'dappreg.js', title: 'Dapp Registry' },
{ name: 'githubhint', entry: 'githubhint.js', title: 'GitHub Hint', secure: true }, { name: 'githubhint', entry: 'githubhint.js', title: 'GitHub Hint', secure: true },
{ name: 'localtx', entry: 'localtx.js', title: 'Local transactions Viewer', secure: true }, { name: 'localtx', entry: 'localtx.js', title: 'Local transactions Viewer', secure: true },
{ name: 'registry', entry: 'registry.js', title: 'Registry' }, { name: 'registry', entry: 'registry.js', title: 'Registry' },

View File

@ -18,6 +18,7 @@
// TODO: Fix linting issues // TODO: Fix linting issues
if (typeof(window.parity) == 'object') if (typeof(window.parity) == 'object')
window.api = window.parent.secureApi;
window.parity.api.subscribe('eth_blockNumber', function (error, blockNumber) { window.parity.api.subscribe('eth_blockNumber', function (error, blockNumber) {
if (error) { if (error) {
console.log('error', error); console.log('error', error);

View File

@ -115,13 +115,26 @@ export default class GatherData extends Component {
if (!fee) { if (!fee) {
return (<p>Fetching the fee</p>); return (<p>Fetching the fee</p>);
} }
if (fee.eq(0)) {
return (
<div className={ styles.container }>
<InfoIcon />
<p className={ styles.message }>
<FormattedMessage
id='ui.verification.gatherData.nofee'
defaultMessage='There is no additional fee.'
/>
</p>
</div>
);
}
return ( return (
<div className={ styles.container }> <div className={ styles.container }>
<InfoIcon /> <InfoIcon />
<p className={ styles.message }> <p className={ styles.message }>
<FormattedMessage <FormattedMessage
id='ui.verification.gatherData.fee' id='ui.verification.gatherData.fee'
defaultMessage='The fee is {amount} ETH.' defaultMessage='The additional fee is {amount} ETH.'
values={ { values={ {
amount: fromWei(fee).toFixed(3) amount: fromWei(fee).toFixed(3)
} } } }

View File

@ -23,7 +23,8 @@ import VerificationStore, {
} from './store'; } from './store';
import { isServerRunning, postToServer } from '../../3rdparty/email-verification'; import { isServerRunning, postToServer } from '../../3rdparty/email-verification';
const EMAIL_VERIFICATION = 7; // id in the `BadgeReg.sol` contract // name in the `BadgeReg.sol` contract
const EMAIL_VERIFICATION = 'emailverification';
export default class EmailVerificationStore extends VerificationStore { export default class EmailVerificationStore extends VerificationStore {
@observable email = ''; @observable email = '';

View File

@ -23,7 +23,8 @@ import VerificationStore, {
} from './store'; } from './store';
import { isServerRunning, postToServer } from '../../3rdparty/sms-verification'; import { isServerRunning, postToServer } from '../../3rdparty/sms-verification';
const SMS_VERIFICATION = 0; // id in the `BadgeReg.sol` contract // name in the `BadgeReg.sol` contract
const SMS_VERIFICATION = 'smsverification';
export default class SMSVerificationStore extends VerificationStore { export default class SMSVerificationStore extends VerificationStore {
@observable number = ''; @observable number = '';

View File

@ -47,13 +47,13 @@ export default class VerificationStore {
@observable isCodeValid = null; @observable isCodeValid = null;
@observable confirmationTx = null; @observable confirmationTx = null;
constructor (api, abi, certifierId, account, isTestnet) { constructor (api, abi, certifierName, account, isTestnet) {
this.api = api; this.api = api;
this.account = account; this.account = account;
this.isTestnet = isTestnet; this.isTestnet = isTestnet;
this.step = LOADING; this.step = LOADING;
Contracts.get().badgeReg.fetchCertifier(certifierId) Contracts.get().badgeReg.fetchCertifierByName(certifierName)
.then(({ address }) => { .then(({ address }) => {
this.contract = new Contract(api, abi).at(address); this.contract = new Contract(api, abi).at(address);
this.load(); this.load();

View File

@ -62,8 +62,7 @@
"description": "Enables the registration and content management of dapps on the network", "description": "Enables the registration and content management of dapps on the network",
"author": "Parity Team <admin@ethcore.io>", "author": "Parity Team <admin@ethcore.io>",
"version": "1.0.0", "version": "1.0.0",
"visible": false, "visible": false
"secure": true
}, },
{ {
"id": "0x9042323cd85c6576992d211de34b3ecc183f15e4f639aa87859882f839c374e5", "id": "0x9042323cd85c6576992d211de34b3ecc183f15e4f639aa87859882f839c374e5",
@ -81,6 +80,7 @@
"description": "A Javascript development console complete with web3 and parity objects.", "description": "A Javascript development console complete with web3 and parity objects.",
"version": "0.3", "version": "0.3",
"author": "Gav Wood <gavin@ethcore.io>", "author": "Gav Wood <gavin@ethcore.io>",
"visible": true "visible": true,
"secure": true
} }
] ]

View File

@ -91,8 +91,6 @@ usage! {
flag_no_download: bool = false, or |c: &Config| otry!(c.parity).no_download.clone(), flag_no_download: bool = false, or |c: &Config| otry!(c.parity).no_download.clone(),
flag_no_consensus: bool = false, or |c: &Config| otry!(c.parity).no_consensus.clone(), flag_no_consensus: bool = false, or |c: &Config| otry!(c.parity).no_consensus.clone(),
flag_chain: String = "homestead", or |c: &Config| otry!(c.parity).chain.clone(), flag_chain: String = "homestead", or |c: &Config| otry!(c.parity).chain.clone(),
flag_base_path: String = dir::default_data_path(), or |c: &Config| otry!(c.parity).base_path.clone(),
flag_db_path: String = dir::CHAINS_PATH, or |c: &Config| otry!(c.parity).db_path.clone(),
flag_keys_path: String = "$BASE/keys", or |c: &Config| otry!(c.parity).keys_path.clone(), flag_keys_path: String = "$BASE/keys", or |c: &Config| otry!(c.parity).keys_path.clone(),
flag_identity: String = "", or |c: &Config| otry!(c.parity).identity.clone(), flag_identity: String = "", or |c: &Config| otry!(c.parity).identity.clone(),
@ -289,6 +287,11 @@ usage! {
flag_no_color: bool = false, flag_no_color: bool = false,
or |c: &Config| otry!(c.misc).color.map(|c| !c).clone(), or |c: &Config| otry!(c.misc).color.map(|c| !c).clone(),
} }
{
// Values with optional default value.
flag_base_path: Option<String>, display dir::default_data_path(), or |c: &Config| otry!(c.parity).base_path.clone().map(Some),
flag_db_path: Option<String>, display dir::CHAINS_PATH, or |c: &Config| otry!(c.parity).db_path.clone().map(Some),
}
} }
@ -547,8 +550,8 @@ mod tests {
flag_no_download: false, flag_no_download: false,
flag_no_consensus: false, flag_no_consensus: false,
flag_chain: "xyz".into(), flag_chain: "xyz".into(),
flag_base_path: "$HOME/.parity".into(), flag_base_path: Some("$HOME/.parity".into()),
flag_db_path: "$HOME/.parity/chains".into(), flag_db_path: Some("$HOME/.parity/chains".into()),
flag_keys_path: "$HOME/.parity/keys".into(), flag_keys_path: "$HOME/.parity/keys".into(),
flag_identity: "".into(), flag_identity: "".into(),

View File

@ -43,6 +43,11 @@ macro_rules! usage {
$field:ident : $typ:ty = $default:expr, or $from_config:expr, $field:ident : $typ:ty = $default:expr, or $from_config:expr,
)* )*
} }
{
$(
$field_s:ident : $typ_s:ty, display $default_s:expr, or $from_config_s:expr,
)*
}
) => { ) => {
use toml; use toml;
use std::{fs, io, process}; use std::{fs, io, process};
@ -108,6 +113,10 @@ macro_rules! usage {
$( $(
pub $field: $typ, pub $field: $typ,
)* )*
$(
pub $field_s: $typ_s,
)*
} }
impl Default for Args { impl Default for Args {
@ -120,6 +129,10 @@ macro_rules! usage {
$( $(
$field: $default.into(), $field: $default.into(),
)* )*
$(
$field_s: Default::default(),
)*
} }
} }
} }
@ -132,6 +145,9 @@ macro_rules! usage {
$( $(
$field: Option<$typ>, $field: Option<$typ>,
)* )*
$(
$field_s: Option<$typ_s>,
)*
} }
impl Args { impl Args {
@ -206,6 +222,9 @@ macro_rules! usage {
$( $(
args.$field = self.$field.or_else(|| $from_config(&config)).unwrap_or_else(|| $default.into()); args.$field = self.$field.or_else(|| $from_config(&config)).unwrap_or_else(|| $default.into());
)* )*
$(
args.$field_s = self.$field_s.or_else(|| $from_config_s(&config)).unwrap_or(None);
)*
args args
} }
@ -222,6 +241,9 @@ macro_rules! usage {
// "named argument never used" error // "named argument never used" error
// $field = $default, // $field = $default,
)* )*
$(
$field_s = $default_s,
)*
) )
} }
} }

View File

@ -35,7 +35,7 @@ use helpers::{to_duration, to_mode, to_block_id, to_u256, to_pending_set, to_pri
geth_ipc_path, parity_ipc_path, to_bootnodes, to_addresses, to_address, to_gas_limit, to_queue_strategy}; geth_ipc_path, parity_ipc_path, to_bootnodes, to_addresses, to_address, to_gas_limit, to_queue_strategy};
use params::{ResealPolicy, AccountsConfig, GasPricerConfig, MinerExtras}; use params::{ResealPolicy, AccountsConfig, GasPricerConfig, MinerExtras};
use ethcore_logger::Config as LogConfig; use ethcore_logger::Config as LogConfig;
use dir::{Directories, default_hypervisor_path, default_local_path}; use dir::{self, Directories, default_hypervisor_path, default_local_path, default_data_path};
use dapps::Configuration as DappsConfiguration; use dapps::Configuration as DappsConfiguration;
use signer::{Configuration as SignerConfiguration}; use signer::{Configuration as SignerConfiguration};
use updater::{UpdatePolicy, UpdateFilter, ReleaseTrack}; use updater::{UpdatePolicy, UpdateFilter, ReleaseTrack};
@ -532,22 +532,32 @@ impl Configuration {
} }
fn gas_pricer_config(&self) -> Result<GasPricerConfig, String> { fn gas_pricer_config(&self) -> Result<GasPricerConfig, String> {
fn wei_per_gas(usd_per_tx: f32, usd_per_eth: f32) -> U256 {
let wei_per_usd: f32 = 1.0e18 / usd_per_eth;
let gas_per_tx: f32 = 21000.0;
let wei_per_gas: f32 = wei_per_usd * usd_per_tx / gas_per_tx;
U256::from_dec_str(&format!("{:.0}", wei_per_gas)).unwrap()
}
if let Some(d) = self.args.flag_gasprice.as_ref() { if let Some(d) = self.args.flag_gasprice.as_ref() {
return Ok(GasPricerConfig::Fixed(to_u256(d)?)); return Ok(GasPricerConfig::Fixed(to_u256(d)?));
} }
let usd_per_tx = to_price(&self.args.flag_usd_per_tx)?; let usd_per_tx = to_price(&self.args.flag_usd_per_tx)?;
if "auto" == self.args.flag_usd_per_eth.as_str() { if "auto" == self.args.flag_usd_per_eth.as_str() {
// Just a very rough estimate to avoid accepting
// ZGP transactions before the price is fetched
// if user does not want it.
let last_known_usd_per_eth = 10.0;
return Ok(GasPricerConfig::Calibrated { return Ok(GasPricerConfig::Calibrated {
initial_minimum: wei_per_gas(usd_per_tx, last_known_usd_per_eth),
usd_per_tx: usd_per_tx, usd_per_tx: usd_per_tx,
recalibration_period: to_duration(self.args.flag_price_update_period.as_str())?, recalibration_period: to_duration(self.args.flag_price_update_period.as_str())?,
}); });
} }
let usd_per_eth = to_price(&self.args.flag_usd_per_eth)?; let usd_per_eth = to_price(&self.args.flag_usd_per_eth)?;
let wei_per_usd: f32 = 1.0e18 / usd_per_eth; let wei_per_gas = wei_per_gas(usd_per_tx, usd_per_eth);
let gas_per_tx: f32 = 21000.0;
let wei_per_gas: f32 = wei_per_usd * usd_per_tx / gas_per_tx;
info!( info!(
"Using a fixed conversion rate of Ξ1 = {} ({} wei/gas)", "Using a fixed conversion rate of Ξ1 = {} ({} wei/gas)",
@ -555,7 +565,7 @@ impl Configuration {
Colour::Yellow.bold().paint(format!("{}", wei_per_gas)) Colour::Yellow.bold().paint(format!("{}", wei_per_gas))
); );
Ok(GasPricerConfig::Fixed(U256::from_dec_str(&format!("{:.0}", wei_per_gas)).unwrap())) Ok(GasPricerConfig::Fixed(wei_per_gas))
} }
fn extra_data(&self) -> Result<Bytes, String> { fn extra_data(&self) -> Result<Bytes, String> {
@ -734,13 +744,16 @@ impl Configuration {
use util::path; use util::path;
let local_path = default_local_path(); let local_path = default_local_path();
let data_path = replace_home("", self.args.flag_datadir.as_ref().unwrap_or(&self.args.flag_base_path)); let base_path = self.args.flag_base_path.as_ref().map_or_else(|| default_data_path(), |s| s.clone());
let data_path = replace_home("", self.args.flag_datadir.as_ref().unwrap_or(&base_path));
let db_path = if self.args.flag_datadir.is_some() { let base_db_path = if self.args.flag_base_path.is_some() && self.args.flag_db_path.is_none() {
replace_home(&data_path, &self.args.flag_db_path) // If base_path is set and db_path is not we default to base path subdir instead of LOCAL.
"$BASE/chains"
} else { } else {
replace_home_for_db(&data_path, &local_path, &self.args.flag_db_path) self.args.flag_db_path.as_ref().map_or(dir::CHAINS_PATH, |s| &s)
}; };
let db_path = replace_home_for_db(&data_path, &local_path, &base_db_path);
let keys_path = replace_home(&data_path, &self.args.flag_keys_path); let keys_path = replace_home(&data_path, &self.args.flag_keys_path);
let dapps_path = replace_home(&data_path, &self.args.flag_dapps_path); let dapps_path = replace_home(&data_path, &self.args.flag_dapps_path);
let ui_path = replace_home(&data_path, &self.args.flag_ui_path); let ui_path = replace_home(&data_path, &self.args.flag_ui_path);

View File

@ -192,14 +192,25 @@ impl Default for AccountsConfig {
pub enum GasPricerConfig { pub enum GasPricerConfig {
Fixed(U256), Fixed(U256),
Calibrated { Calibrated {
initial_minimum: U256,
usd_per_tx: f32, usd_per_tx: f32,
recalibration_period: Duration, recalibration_period: Duration,
} }
} }
impl GasPricerConfig {
pub fn initial_min(&self) -> U256 {
match *self {
GasPricerConfig::Fixed(ref min) => min.clone(),
GasPricerConfig::Calibrated { ref initial_minimum, .. } => initial_minimum.clone(),
}
}
}
impl Default for GasPricerConfig { impl Default for GasPricerConfig {
fn default() -> Self { fn default() -> Self {
GasPricerConfig::Calibrated { GasPricerConfig::Calibrated {
initial_minimum: 11904761856u64.into(),
usd_per_tx: 0.0025f32, usd_per_tx: 0.0025f32,
recalibration_period: Duration::from_secs(3600), recalibration_period: Duration::from_secs(3600),
} }
@ -210,7 +221,7 @@ impl Into<GasPricer> for GasPricerConfig {
fn into(self) -> GasPricer { fn into(self) -> GasPricer {
match self { match self {
GasPricerConfig::Fixed(u) => GasPricer::Fixed(u), GasPricerConfig::Fixed(u) => GasPricer::Fixed(u),
GasPricerConfig::Calibrated { usd_per_tx, recalibration_period } => { GasPricerConfig::Calibrated { usd_per_tx, recalibration_period, .. } => {
GasPricer::new_calibrated(GasPriceCalibratorOptions { GasPricer::new_calibrated(GasPriceCalibratorOptions {
usd_per_tx: usd_per_tx, usd_per_tx: usd_per_tx,
recalibration_period: recalibration_period, recalibration_period: recalibration_period,

View File

@ -236,12 +236,15 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> R
spec.engine.register_account_provider(account_provider.clone()); spec.engine.register_account_provider(account_provider.clone());
// create miner // create miner
let initial_min_gas_price = cmd.gas_pricer.initial_min();
let miner = Miner::new(cmd.miner_options, cmd.gas_pricer.into(), &spec, Some(account_provider.clone())); let miner = Miner::new(cmd.miner_options, cmd.gas_pricer.into(), &spec, Some(account_provider.clone()));
miner.set_author(cmd.miner_extras.author); miner.set_author(cmd.miner_extras.author);
miner.set_gas_floor_target(cmd.miner_extras.gas_floor_target); miner.set_gas_floor_target(cmd.miner_extras.gas_floor_target);
miner.set_gas_ceil_target(cmd.miner_extras.gas_ceil_target); miner.set_gas_ceil_target(cmd.miner_extras.gas_ceil_target);
miner.set_extra_data(cmd.miner_extras.extra_data); miner.set_extra_data(cmd.miner_extras.extra_data);
miner.set_transactions_limit(cmd.miner_extras.transactions_limit); miner.set_transactions_limit(cmd.miner_extras.transactions_limit);
miner.set_minimal_gas_price(initial_min_gas_price);
miner.recalibrate_minimal_gas_price();
let engine_signer = cmd.miner_extras.engine_signer; let engine_signer = cmd.miner_extras.engine_signer;
if engine_signer != Default::default() { if engine_signer != Default::default() {

View File

@ -18,10 +18,10 @@ time = "0.1"
rand = "0.3" rand = "0.3"
semver = "0.5" semver = "0.5"
transient-hashmap = "0.1" transient-hashmap = "0.1"
jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git" } jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git", branch="mio-old" }
jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc.git" } jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc.git", branch="mio-old" }
jsonrpc-ipc-server = { git = "https://github.com/ethcore/jsonrpc.git" } jsonrpc-ipc-server = { git = "https://github.com/ethcore/jsonrpc.git", branch="mio-old" }
jsonrpc-macros = { git = "https://github.com/ethcore/jsonrpc.git" } jsonrpc-macros = { git = "https://github.com/ethcore/jsonrpc.git", branch="mio-old" }
ethcore-io = { path = "../util/io" } ethcore-io = { path = "../util/io" }
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }
ethcore = { path = "../ethcore" } ethcore = { path = "../ethcore" }

View File

@ -16,7 +16,7 @@ serde = "0.8"
serde_json = "0.8" serde_json = "0.8"
tempdir = "0.3.5" tempdir = "0.3.5"
url = "1.2.0" url = "1.2.0"
jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git" } jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git", branch="mio-old" }
ws = { git = "https://github.com/ethcore/ws-rs.git", branch = "mio-upstream-stable" } ws = { git = "https://github.com/ethcore/ws-rs.git", branch = "mio-upstream-stable" }
ethcore-rpc = { path = "../rpc" } ethcore-rpc = { path = "../rpc" }
ethcore-signer = { path = "../signer" } ethcore-signer = { path = "../signer" }

View File

@ -12,7 +12,7 @@ rustc_version = "0.1"
[dependencies] [dependencies]
rand = "0.3.14" rand = "0.3.14"
jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git" } jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git", branch="mio-old" }
log = "0.3" log = "0.3"
env_logger = "0.3" env_logger = "0.3"
parity-dapps-glue = { version = "1.4", optional = true } parity-dapps-glue = { version = "1.4", optional = true }

View File

@ -11,8 +11,8 @@ ethcore-ipc-codegen = { path = "../ipc/codegen" }
[dependencies] [dependencies]
log = "0.3" log = "0.3"
jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git" } jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git", branch="mio-old" }
jsonrpc-tcp-server = { git = "https://github.com/ethcore/jsonrpc.git" } jsonrpc-tcp-server = { git = "https://github.com/ethcore/jsonrpc.git", branch="mio-old" }
mio = { git = "https://github.com/ethcore/mio", branch = "v0.5.x" } mio = { git = "https://github.com/ethcore/mio", branch = "v0.5.x" }
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }
ethcore-devtools = { path = "../devtools" } ethcore-devtools = { path = "../devtools" }

View File

@ -2775,7 +2775,7 @@ mod tests {
// Add some balance to clients and reset nonces // Add some balance to clients and reset nonces
for h in &[good_blocks[0], retracted_blocks[0]] { for h in &[good_blocks[0], retracted_blocks[0]] {
let block = client.block(BlockId::Hash(*h)).unwrap(); let block = client.block(BlockId::Hash(*h)).unwrap();
client.set_balance(block.transactions()[0].sender().unwrap(), U256::from(1_000_000_000)); client.set_balance(block.transactions()[0].sender().unwrap(), U256::from(10_000_000_000_000_000_000u64));
client.set_nonce(block.transactions()[0].sender().unwrap(), U256::from(0)); client.set_nonce(block.transactions()[0].sender().unwrap(), U256::from(0));
} }