Merge branch 'master' of github.com:ethcore/parity into ethrpc_test
This commit is contained in:
commit
757f0c9bc4
30
Cargo.lock
generated
30
Cargo.lock
generated
@ -2,7 +2,7 @@
|
|||||||
name = "parity"
|
name = "parity"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ctrlc 1.1.1 (git+https://github.com/tomusdrw/rust-ctrlc.git)",
|
"ctrlc 1.1.1 (git+https://github.com/tomusdrw/rust-ctrlc.git)",
|
||||||
"daemonize 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"daemonize 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"docopt 0.6.78 (registry+https://github.com/rust-lang/crates.io-index)",
|
"docopt 0.6.78 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -97,11 +97,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clippy"
|
name = "clippy"
|
||||||
version = "0.0.50"
|
version = "0.0.54"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"regex-syntax 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex-syntax 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -210,7 +211,7 @@ dependencies = [
|
|||||||
name = "ethcore"
|
name = "ethcore"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"crossbeam 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crossbeam 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethash 1.1.0",
|
"ethash 1.1.0",
|
||||||
@ -237,7 +238,7 @@ dependencies = [
|
|||||||
name = "ethcore-rpc"
|
name = "ethcore-rpc"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethash 1.1.0",
|
"ethash 1.1.0",
|
||||||
"ethcore 1.1.0",
|
"ethcore 1.1.0",
|
||||||
"ethcore-util 1.1.0",
|
"ethcore-util 1.1.0",
|
||||||
@ -261,7 +262,7 @@ dependencies = [
|
|||||||
"arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bigint 0.1.0",
|
"bigint 0.1.0",
|
||||||
"chrono 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
"chrono 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"clippy 0.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"crossbeam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crossbeam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"elastic-array 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"elastic-array 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -305,7 +306,7 @@ dependencies = [
|
|||||||
name = "ethminer"
|
name = "ethminer"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore 1.1.0",
|
"ethcore 1.1.0",
|
||||||
"ethcore-util 1.1.0",
|
"ethcore-util 1.1.0",
|
||||||
@ -319,7 +320,7 @@ dependencies = [
|
|||||||
name = "ethsync"
|
name = "ethsync"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore 1.1.0",
|
"ethcore 1.1.0",
|
||||||
"ethcore-util 1.1.0",
|
"ethcore-util 1.1.0",
|
||||||
@ -711,11 +712,6 @@ dependencies = [
|
|||||||
"utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "regex-syntax"
|
|
||||||
version = "0.2.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
@ -897,6 +893,14 @@ name = "tiny-keccak"
|
|||||||
version = "1.0.5"
|
version = "1.0.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml"
|
||||||
|
version = "0.1.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "traitobject"
|
name = "traitobject"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
@ -20,7 +20,7 @@ fdlimit = { path = "util/fdlimit" }
|
|||||||
daemonize = "0.2"
|
daemonize = "0.2"
|
||||||
number_prefix = "0.2"
|
number_prefix = "0.2"
|
||||||
rpassword = "0.1"
|
rpassword = "0.1"
|
||||||
clippy = { version = "0.0.50", optional = true }
|
clippy = { version = "0.0.54", optional = true }
|
||||||
ethcore = { path = "ethcore" }
|
ethcore = { path = "ethcore" }
|
||||||
ethcore-util = { path = "util" }
|
ethcore-util = { path = "util" }
|
||||||
ethsync = { path = "sync" }
|
ethsync = { path = "sync" }
|
||||||
|
@ -17,7 +17,7 @@ ethcore-util = { path = "../util" }
|
|||||||
evmjit = { path = "../evmjit", optional = true }
|
evmjit = { path = "../evmjit", optional = true }
|
||||||
ethash = { path = "../ethash" }
|
ethash = { path = "../ethash" }
|
||||||
num_cpus = "0.2"
|
num_cpus = "0.2"
|
||||||
clippy = { version = "0.0.50", optional = true }
|
clippy = { version = "0.0.54", optional = true }
|
||||||
crossbeam = "0.1.5"
|
crossbeam = "0.1.5"
|
||||||
lazy_static = "0.1"
|
lazy_static = "0.1"
|
||||||
ethcore-devtools = { path = "../devtools" }
|
ethcore-devtools = { path = "../devtools" }
|
||||||
|
@ -391,7 +391,8 @@ impl<V> BlockChainClient for Client<V> where V: Verifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO [todr] Should be moved to miner crate eventually.
|
// TODO [todr] Should be moved to miner crate eventually.
|
||||||
fn prepare_sealing(&self, author: Address, gas_floor_target: U256, extra_data: Bytes, transactions: Vec<SignedTransaction>) -> Option<ClosedBlock> {
|
fn prepare_sealing(&self, author: Address, gas_floor_target: U256, extra_data: Bytes, transactions: Vec<SignedTransaction>)
|
||||||
|
-> Option<(ClosedBlock, HashSet<H256>)> {
|
||||||
let engine = self.engine.deref().deref();
|
let engine = self.engine.deref().deref();
|
||||||
let h = self.chain.best_block_hash();
|
let h = self.chain.best_block_hash();
|
||||||
|
|
||||||
@ -417,21 +418,40 @@ impl<V> BlockChainClient for Client<V> where V: Verifier {
|
|||||||
|
|
||||||
// Add transactions
|
// Add transactions
|
||||||
let block_number = b.block().header().number();
|
let block_number = b.block().header().number();
|
||||||
|
let min_tx_gas = U256::from(self.engine.schedule(&b.env_info()).tx_gas);
|
||||||
|
let mut invalid_transactions = HashSet::new();
|
||||||
|
|
||||||
for tx in transactions {
|
for tx in transactions {
|
||||||
|
// Push transaction to block
|
||||||
|
let hash = tx.hash();
|
||||||
let import = b.push_transaction(tx, None);
|
let import = b.push_transaction(tx, None);
|
||||||
if let Err(e) = import {
|
|
||||||
trace!("Error adding transaction to block: number={}. Error: {:?}", block_number, e);
|
match import {
|
||||||
|
Err(Error::Execution(ExecutionError::BlockGasLimitReached { gas_limit, gas_used, .. })) => {
|
||||||
|
trace!(target: "miner", "Skipping adding transaction to block because of gas limit: {:?}", hash);
|
||||||
|
// Exit early if gas left is smaller then min_tx_gas
|
||||||
|
if gas_limit - gas_used < min_tx_gas {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(e) => {
|
||||||
|
invalid_transactions.insert(hash);
|
||||||
|
trace!(target: "miner",
|
||||||
|
"Error adding transaction to block: number={}. transaction_hash={:?}, Error: {:?}",
|
||||||
|
block_number, hash, e);
|
||||||
|
},
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// And close
|
// And close
|
||||||
let b = b.close();
|
let b = b.close();
|
||||||
trace!("Sealing: number={}, hash={}, diff={}",
|
trace!(target: "miner", "Sealing: number={}, hash={}, diff={}",
|
||||||
b.block().header().number(),
|
b.block().header().number(),
|
||||||
b.hash(),
|
b.hash(),
|
||||||
b.block().header().difficulty()
|
b.block().header().difficulty()
|
||||||
);
|
);
|
||||||
Some(b)
|
Some((b, invalid_transactions))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn block_header(&self, id: BlockId) -> Option<Bytes> {
|
fn block_header(&self, id: BlockId) -> Option<Bytes> {
|
||||||
|
@ -26,6 +26,7 @@ pub use self::config::{ClientConfig, BlockQueueConfig, BlockChainConfig};
|
|||||||
pub use self::ids::{BlockId, TransactionId};
|
pub use self::ids::{BlockId, TransactionId};
|
||||||
pub use self::test_client::{TestBlockChainClient, EachBlockWith};
|
pub use self::test_client::{TestBlockChainClient, EachBlockWith};
|
||||||
|
|
||||||
|
use std::collections::HashSet;
|
||||||
use util::bytes::Bytes;
|
use util::bytes::Bytes;
|
||||||
use util::hash::{Address, H256, H2048};
|
use util::hash::{Address, H256, H2048};
|
||||||
use util::numbers::U256;
|
use util::numbers::U256;
|
||||||
@ -110,7 +111,8 @@ pub trait BlockChainClient : Sync + Send {
|
|||||||
|
|
||||||
// TODO [todr] Should be moved to miner crate eventually.
|
// TODO [todr] Should be moved to miner crate eventually.
|
||||||
/// Returns ClosedBlock prepared for sealing.
|
/// Returns ClosedBlock prepared for sealing.
|
||||||
fn prepare_sealing(&self, author: Address, gas_floor_target: U256, extra_data: Bytes, transactions: Vec<SignedTransaction>) -> Option<ClosedBlock>;
|
fn prepare_sealing(&self, author: Address, gas_floor_target: U256, extra_data: Bytes, transactions: Vec<SignedTransaction>)
|
||||||
|
-> Option<(ClosedBlock, HashSet<H256>)>;
|
||||||
|
|
||||||
// TODO [todr] Should be moved to miner crate eventually.
|
// TODO [todr] Should be moved to miner crate eventually.
|
||||||
/// Attempts to seal given block. Returns `SealedBlock` on success and the same block in case of error.
|
/// Attempts to seal given block. Returns `SealedBlock` on success and the same block in case of error.
|
||||||
|
@ -217,7 +217,7 @@ impl BlockChainClient for TestBlockChainClient {
|
|||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_sealing(&self, _author: Address, _gas_floor_target: U256, _extra_data: Bytes, _transactions: Vec<SignedTransaction>) -> Option<ClosedBlock> {
|
fn prepare_sealing(&self, _author: Address, _gas_floor_target: U256, _extra_data: Bytes, _transactions: Vec<SignedTransaction>) -> Option<(ClosedBlock, HashSet<H256>)> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +67,7 @@ pub trait Ext {
|
|||||||
/// Returns Err, if we run out of gas.
|
/// Returns Err, if we run out of gas.
|
||||||
/// Otherwise returns call_result which contains gas left
|
/// Otherwise returns call_result which contains gas left
|
||||||
/// and true if subcall was successfull.
|
/// and true if subcall was successfull.
|
||||||
|
#[cfg_attr(feature="dev", allow(too_many_arguments))]
|
||||||
fn call(&mut self,
|
fn call(&mut self,
|
||||||
gas: &U256,
|
gas: &U256,
|
||||||
sender_address: &Address,
|
sender_address: &Address,
|
||||||
|
@ -521,6 +521,7 @@ impl Interpreter {
|
|||||||
Ok(overflowing!(offset.overflowing_add(size.clone())))
|
Ok(overflowing!(offset.overflowing_add(size.clone())))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature="dev", allow(too_many_arguments))]
|
||||||
fn exec_instruction(&self,
|
fn exec_instruction(&self,
|
||||||
gas: Gas,
|
gas: Gas,
|
||||||
params: &ActionParams,
|
params: &ActionParams,
|
||||||
|
@ -144,7 +144,7 @@ fn can_mine() {
|
|||||||
let client_result = get_test_client_with_blocks(vec![dummy_blocks[0].clone()]);
|
let client_result = get_test_client_with_blocks(vec![dummy_blocks[0].clone()]);
|
||||||
let client = client_result.reference();
|
let client = client_result.reference();
|
||||||
|
|
||||||
let b = client.prepare_sealing(Address::default(), x!(31415926), vec![], vec![]).unwrap();
|
let b = client.prepare_sealing(Address::default(), x!(31415926), vec![], vec![]).unwrap().0;
|
||||||
|
|
||||||
assert_eq!(*b.block().header().parent_hash(), BlockView::new(&dummy_blocks[0]).header_view().sha3());
|
assert_eq!(*b.block().header().parent_hash(), BlockView::new(&dummy_blocks[0]).header_view().sha3());
|
||||||
assert!(client.try_seal(b, vec![]).is_ok());
|
assert!(client.try_seal(b, vec![]).is_ok());
|
||||||
|
@ -10,7 +10,7 @@ rustc-serialize = "0.3"
|
|||||||
serde = "0.7.0"
|
serde = "0.7.0"
|
||||||
serde_json = "0.7.0"
|
serde_json = "0.7.0"
|
||||||
serde_macros = { version = "0.7.0", optional = true }
|
serde_macros = { version = "0.7.0", optional = true }
|
||||||
clippy = { version = "0.0.50", optional = true }
|
clippy = { version = "0.0.54", optional = true }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
serde_codegen = { version = "0.7.0", optional = true }
|
serde_codegen = { version = "0.7.0", optional = true }
|
||||||
|
@ -17,7 +17,7 @@ log = "0.3"
|
|||||||
env_logger = "0.3"
|
env_logger = "0.3"
|
||||||
rustc-serialize = "0.3"
|
rustc-serialize = "0.3"
|
||||||
rayon = "0.3.1"
|
rayon = "0.3.1"
|
||||||
clippy = { version = "0.0.50", optional = true }
|
clippy = { version = "0.0.54", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
@ -125,17 +125,25 @@ impl MinerService for Miner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_sealing(&self, chain: &BlockChainClient) {
|
fn prepare_sealing(&self, chain: &BlockChainClient) {
|
||||||
let no_of_transactions = 128;
|
let transactions = self.transaction_queue.lock().unwrap().top_transactions();
|
||||||
// TODO: should select transactions orm queue according to gas limit of block.
|
|
||||||
let transactions = self.transaction_queue.lock().unwrap().top_transactions(no_of_transactions);
|
|
||||||
|
|
||||||
let b = chain.prepare_sealing(
|
let b = chain.prepare_sealing(
|
||||||
self.author(),
|
self.author(),
|
||||||
self.gas_floor_target(),
|
self.gas_floor_target(),
|
||||||
self.extra_data(),
|
self.extra_data(),
|
||||||
transactions,
|
transactions,
|
||||||
);
|
);
|
||||||
*self.sealing_block.lock().unwrap() = b;
|
|
||||||
|
*self.sealing_block.lock().unwrap() = b.map(|(block, invalid_transactions)| {
|
||||||
|
let mut queue = self.transaction_queue.lock().unwrap();
|
||||||
|
queue.remove_all(
|
||||||
|
&invalid_transactions.into_iter().collect::<Vec<H256>>(),
|
||||||
|
|a: &Address| AccountDetails {
|
||||||
|
nonce: chain.nonce(a),
|
||||||
|
balance: chain.balance(a),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
block
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sealing_block(&self, chain: &BlockChainClient) -> &Mutex<Option<ClosedBlock>> {
|
fn sealing_block(&self, chain: &BlockChainClient) -> &Mutex<Option<ClosedBlock>> {
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
//! // Check status
|
//! // Check status
|
||||||
//! assert_eq!(txq.status().pending, 2);
|
//! assert_eq!(txq.status().pending, 2);
|
||||||
//! // Check top transactions
|
//! // Check top transactions
|
||||||
//! let top = txq.top_transactions(3);
|
//! let top = txq.top_transactions();
|
||||||
//! assert_eq!(top.len(), 2);
|
//! assert_eq!(top.len(), 2);
|
||||||
//! assert_eq!(top[0], st1);
|
//! assert_eq!(top[0], st1);
|
||||||
//! assert_eq!(top[1], st2);
|
//! assert_eq!(top[1], st2);
|
||||||
@ -69,7 +69,7 @@
|
|||||||
//! txq.remove(&st1.hash(), &default_nonce);
|
//! txq.remove(&st1.hash(), &default_nonce);
|
||||||
//! assert_eq!(txq.status().pending, 0);
|
//! assert_eq!(txq.status().pending, 0);
|
||||||
//! assert_eq!(txq.status().future, 1);
|
//! assert_eq!(txq.status().future, 1);
|
||||||
//! assert_eq!(txq.top_transactions(3).len(), 0);
|
//! assert_eq!(txq.top_transactions().len(), 0);
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
@ -306,8 +306,6 @@ impl TransactionQueue {
|
|||||||
self.minimal_gas_price = min_gas_price;
|
self.minimal_gas_price = min_gas_price;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will be used when rpc merged
|
|
||||||
#[allow(dead_code)]
|
|
||||||
/// Returns current status for this queue
|
/// Returns current status for this queue
|
||||||
pub fn status(&self) -> TransactionQueueStatus {
|
pub fn status(&self) -> TransactionQueueStatus {
|
||||||
TransactionQueueStatus {
|
TransactionQueueStatus {
|
||||||
@ -456,13 +454,10 @@ impl TransactionQueue {
|
|||||||
self.future.enforce_limit(&mut self.by_hash);
|
self.future.enforce_limit(&mut self.by_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will be used when mining merged
|
|
||||||
#[allow(dead_code)]
|
|
||||||
/// Returns top transactions from the queue ordered by priority.
|
/// Returns top transactions from the queue ordered by priority.
|
||||||
pub fn top_transactions(&self, size: usize) -> Vec<SignedTransaction> {
|
pub fn top_transactions(&self) -> Vec<SignedTransaction> {
|
||||||
self.current.by_priority
|
self.current.by_priority
|
||||||
.iter()
|
.iter()
|
||||||
.take(size)
|
|
||||||
.map(|t| self.by_hash.get(&t.hash).expect("Transaction Queue Inconsistency"))
|
.map(|t| self.by_hash.get(&t.hash).expect("Transaction Queue Inconsistency"))
|
||||||
.map(|t| t.transaction.clone())
|
.map(|t| t.transaction.clone())
|
||||||
.collect()
|
.collect()
|
||||||
@ -754,7 +749,7 @@ mod test {
|
|||||||
txq.add(tx2.clone(), &default_nonce).unwrap();
|
txq.add(tx2.clone(), &default_nonce).unwrap();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
let top = txq.top_transactions(5);
|
let top = txq.top_transactions();
|
||||||
assert_eq!(top[0], tx);
|
assert_eq!(top[0], tx);
|
||||||
assert_eq!(top[1], tx2);
|
assert_eq!(top[1], tx2);
|
||||||
assert_eq!(top.len(), 2);
|
assert_eq!(top.len(), 2);
|
||||||
@ -793,7 +788,7 @@ mod test {
|
|||||||
let stats = txq.status();
|
let stats = txq.status();
|
||||||
assert_eq!(stats.pending, 1);
|
assert_eq!(stats.pending, 1);
|
||||||
assert_eq!(stats.future, 1);
|
assert_eq!(stats.future, 1);
|
||||||
let top = txq.top_transactions(5);
|
let top = txq.top_transactions();
|
||||||
assert_eq!(top.len(), 1);
|
assert_eq!(top.len(), 1);
|
||||||
assert_eq!(top[0], tx);
|
assert_eq!(top[0], tx);
|
||||||
}
|
}
|
||||||
@ -920,7 +915,7 @@ mod test {
|
|||||||
txq.add(tx2.clone(), &default_nonce).unwrap();
|
txq.add(tx2.clone(), &default_nonce).unwrap();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
let t = txq.top_transactions(2);
|
let t = txq.top_transactions();
|
||||||
assert_eq!(txq.status().pending, 1);
|
assert_eq!(txq.status().pending, 1);
|
||||||
assert_eq!(t.len(), 1);
|
assert_eq!(t.len(), 1);
|
||||||
assert_eq!(t[0], tx);
|
assert_eq!(t[0], tx);
|
||||||
@ -1044,7 +1039,7 @@ mod test {
|
|||||||
let stats = txq.status();
|
let stats = txq.status();
|
||||||
assert_eq!(stats.pending, 1);
|
assert_eq!(stats.pending, 1);
|
||||||
assert_eq!(stats.future, 0);
|
assert_eq!(stats.future, 0);
|
||||||
assert_eq!(txq.top_transactions(1)[0].gas_price, U256::from(200));
|
assert_eq!(txq.top_transactions()[0].gas_price, U256::from(200));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1074,7 +1069,7 @@ mod test {
|
|||||||
let stats = txq.status();
|
let stats = txq.status();
|
||||||
assert_eq!(stats.future, 0);
|
assert_eq!(stats.future, 0);
|
||||||
assert_eq!(stats.pending, 2);
|
assert_eq!(stats.pending, 2);
|
||||||
assert_eq!(txq.top_transactions(2)[1].gas_price, U256::from(200));
|
assert_eq!(txq.top_transactions()[1].gas_price, U256::from(200));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -370,7 +370,7 @@ impl Configuration {
|
|||||||
|
|
||||||
fn init_nodes(&self, spec: &Spec) -> Vec<String> {
|
fn init_nodes(&self, spec: &Spec) -> Vec<String> {
|
||||||
match self.args.flag_bootnodes {
|
match self.args.flag_bootnodes {
|
||||||
Some(ref x) if x.len() > 0 => x.split(',').map(|s| {
|
Some(ref x) if !x.is_empty() => x.split(',').map(|s| {
|
||||||
Self::normalize_enode(s).unwrap_or_else(|| {
|
Self::normalize_enode(s).unwrap_or_else(|| {
|
||||||
die!("{}: Invalid node address format given for a boot node.", s)
|
die!("{}: Invalid node address format given for a boot node.", s)
|
||||||
})
|
})
|
||||||
@ -409,6 +409,7 @@ impl Configuration {
|
|||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature="dev", allow(useless_format))]
|
||||||
fn client_config(&self) -> ClientConfig {
|
fn client_config(&self) -> ClientConfig {
|
||||||
let mut client_config = ClientConfig::default();
|
let mut client_config = ClientConfig::default();
|
||||||
match self.args.flag_cache {
|
match self.args.flag_cache {
|
||||||
|
@ -22,7 +22,7 @@ ethminer = { path = "../miner" }
|
|||||||
rustc-serialize = "0.3"
|
rustc-serialize = "0.3"
|
||||||
transient-hashmap = "0.1"
|
transient-hashmap = "0.1"
|
||||||
serde_macros = { version = "0.7.0", optional = true }
|
serde_macros = { version = "0.7.0", optional = true }
|
||||||
clippy = { version = "0.0.50", optional = true }
|
clippy = { version = "0.0.54", optional = true }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
serde_codegen = { version = "0.7.0", optional = true }
|
serde_codegen = { version = "0.7.0", optional = true }
|
||||||
|
@ -10,7 +10,7 @@ authors = ["Ethcore <admin@ethcore.io"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
ethcore-util = { path = "../util" }
|
ethcore-util = { path = "../util" }
|
||||||
ethcore = { path = "../ethcore" }
|
ethcore = { path = "../ethcore" }
|
||||||
clippy = { version = "0.0.50", optional = true }
|
clippy = { version = "0.0.54", optional = true }
|
||||||
ethminer = { path = "../miner" }
|
ethminer = { path = "../miner" }
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
env_logger = "0.3"
|
env_logger = "0.3"
|
||||||
|
@ -27,9 +27,8 @@ crossbeam = "0.2"
|
|||||||
slab = "0.1"
|
slab = "0.1"
|
||||||
sha3 = { path = "sha3" }
|
sha3 = { path = "sha3" }
|
||||||
serde = "0.7.0"
|
serde = "0.7.0"
|
||||||
clippy = { version = "0.0.50", optional = true }
|
clippy = { version = "0.0.54", optional = true }
|
||||||
json-tests = { path = "json-tests" }
|
json-tests = { path = "json-tests" }
|
||||||
rustc_version = "0.1.0"
|
|
||||||
igd = "0.4.2"
|
igd = "0.4.2"
|
||||||
ethcore-devtools = { path = "../devtools" }
|
ethcore-devtools = { path = "../devtools" }
|
||||||
libc = "0.2.7"
|
libc = "0.2.7"
|
||||||
@ -44,3 +43,4 @@ dev = ["clippy"]
|
|||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
vergen = "*"
|
vergen = "*"
|
||||||
|
rustc_version = "0.1.0"
|
||||||
|
@ -15,9 +15,23 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
extern crate vergen;
|
extern crate vergen;
|
||||||
|
extern crate rustc_version;
|
||||||
|
|
||||||
use vergen::*;
|
use vergen::*;
|
||||||
|
use std::env;
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::Write;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
vergen(OutputFns::all()).unwrap();
|
vergen(OutputFns::all()).unwrap();
|
||||||
|
let out_dir = env::var("OUT_DIR").unwrap();
|
||||||
|
let dest_path = Path::new(&out_dir).join("rustc_version.rs");
|
||||||
|
let mut f = File::create(&dest_path).unwrap();
|
||||||
|
f.write_all(format!("
|
||||||
|
/// Returns compiler version.
|
||||||
|
pub fn rustc_version() -> &'static str {{
|
||||||
|
\"{}\"
|
||||||
|
}}
|
||||||
|
", rustc_version::version()).as_bytes()).unwrap();
|
||||||
}
|
}
|
||||||
|
@ -175,6 +175,8 @@ impl JournalDB for ArchiveDB {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
#![cfg_attr(feature="dev", allow(blacklisted_name))]
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use super::*;
|
use super::*;
|
||||||
use hashdb::*;
|
use hashdb::*;
|
||||||
|
@ -527,6 +527,8 @@ impl JournalDB for EarlyMergeDB {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
#![cfg_attr(feature="dev", allow(blacklisted_name))]
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use super::*;
|
use super::*;
|
||||||
use super::super::traits::JournalDB;
|
use super::super::traits::JournalDB;
|
||||||
|
@ -358,6 +358,8 @@ impl HashDB for OverlayRecentDB {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
#![cfg_attr(feature="dev", allow(blacklisted_name))]
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use super::*;
|
use super::*;
|
||||||
use hashdb::*;
|
use hashdb::*;
|
||||||
|
@ -194,6 +194,8 @@ impl JournalDB for RefCountedDB {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
#![cfg_attr(feature="dev", allow(blacklisted_name))]
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use super::*;
|
use super::*;
|
||||||
use super::super::traits::JournalDB;
|
use super::super::traits::JournalDB;
|
||||||
|
@ -109,9 +109,7 @@ extern crate log as rlog;
|
|||||||
extern crate igd;
|
extern crate igd;
|
||||||
extern crate ethcore_devtools as devtools;
|
extern crate ethcore_devtools as devtools;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
extern crate rustc_version;
|
|
||||||
extern crate target_info;
|
extern crate target_info;
|
||||||
extern crate vergen;
|
|
||||||
extern crate bigint;
|
extern crate bigint;
|
||||||
extern crate chrono;
|
extern crate chrono;
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@ use std::fs::File;
|
|||||||
use common::*;
|
use common::*;
|
||||||
use rlp::{Stream, RlpStream};
|
use rlp::{Stream, RlpStream};
|
||||||
use target_info::Target;
|
use target_info::Target;
|
||||||
use rustc_version;
|
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/version.rs"));
|
include!(concat!(env!("OUT_DIR"), "/version.rs"));
|
||||||
|
include!(concat!(env!("OUT_DIR"), "/rustc_version.rs"));
|
||||||
|
|
||||||
#[derive(Debug,Clone,PartialEq,Eq)]
|
#[derive(Debug,Clone,PartialEq,Eq)]
|
||||||
/// Diff type for specifying a change (or not).
|
/// Diff type for specifying a change (or not).
|
||||||
@ -70,7 +70,13 @@ pub fn contents(name: &str) -> Result<Bytes, UtilError> {
|
|||||||
|
|
||||||
/// Get the standard version string for this software.
|
/// Get the standard version string for this software.
|
||||||
pub fn version() -> String {
|
pub fn version() -> String {
|
||||||
format!("Parity/v{}-unstable-{}-{}/{}-{}-{}/rustc{}", env!("CARGO_PKG_VERSION"), short_sha(), commit_date().replace("-", ""), Target::arch(), Target::os(), Target::env(), rustc_version::version())
|
let sha3 = short_sha();
|
||||||
|
let sha3_dash = if sha3.is_empty() { "" } else { "-" };
|
||||||
|
let commit_date = commit_date().replace("-", "");
|
||||||
|
let date_dash = if commit_date.is_empty() { "" } else { "-" };
|
||||||
|
let env = Target::env();
|
||||||
|
let env_dash = if env.is_empty() { "" } else { "-" };
|
||||||
|
format!("Parity/v{}-unstable{}{}{}{}/{}-{}{}{}/rustc{}", env!("CARGO_PKG_VERSION"), sha3_dash, sha3, date_dash, commit_date, Target::arch(), Target::os(), env_dash, env, rustc_version())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the standard version data for this software.
|
/// Get the standard version data for this software.
|
||||||
@ -82,7 +88,7 @@ pub fn version_data() -> Bytes {
|
|||||||
u32::from_str(env!("CARGO_PKG_VERSION_PATCH")).unwrap();
|
u32::from_str(env!("CARGO_PKG_VERSION_PATCH")).unwrap();
|
||||||
s.append(&v);
|
s.append(&v);
|
||||||
s.append(&"Parity");
|
s.append(&"Parity");
|
||||||
s.append(&format!("{}", rustc_version::version()));
|
s.append(&rustc_version());
|
||||||
s.append(&&Target::os()[0..2]);
|
s.append(&&Target::os()[0..2]);
|
||||||
s.out()
|
s.out()
|
||||||
}
|
}
|
||||||
|
@ -216,6 +216,8 @@ fn can_map_external_address_or_fail() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn ipv4_properties() {
|
fn ipv4_properties() {
|
||||||
|
|
||||||
|
#![cfg_attr(feature="dev", allow(too_many_arguments))]
|
||||||
fn check(octets: &[u8; 4], unspec: bool, loopback: bool,
|
fn check(octets: &[u8; 4], unspec: bool, loopback: bool,
|
||||||
private: bool, link_local: bool, global: bool,
|
private: bool, link_local: bool, global: bool,
|
||||||
multicast: bool, broadcast: bool, documentation: bool) {
|
multicast: bool, broadcast: bool, documentation: bool) {
|
||||||
|
Loading…
Reference in New Issue
Block a user