Merge branch 'master' into main-refactor

Conflicts:
	parity/main.rs
This commit is contained in:
Tomasz Drwięga 2016-04-21 17:35:54 +02:00
commit ffc5d726bd
9 changed files with 20 additions and 11 deletions

View File

@ -4,7 +4,7 @@ echo "#!/bin/sh\n" > $FILE
# Exit on any error # Exit on any error
echo "set -e" >> $FILE echo "set -e" >> $FILE
# Run release build # Run release build
echo "cargo build --release --features dev" >> $FILE echo "cargo build --features dev" >> $FILE
# Build tests # Build tests
echo "cargo test --no-run --features dev \\" >> $FILE echo "cargo test --no-run --features dev \\" >> $FILE
echo " -p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity -p ethminer -p ethcore-webapp" >> $FILE echo " -p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity -p ethminer -p ethcore-webapp" >> $FILE

View File

@ -77,7 +77,7 @@ fn push_handshake_struct(cx: &ExtCtxt, push: &mut FnMut(Annotatable)) {
pub struct BinHandshake { pub struct BinHandshake {
api_version: String, api_version: String,
protocol_version: String, protocol_version: String,
_reserved: Vec<u8>, reserved: Vec<u8>,
} }
).unwrap(); ).unwrap();
@ -306,7 +306,7 @@ fn strip_ptr(ty: &P<ast::Ty>) -> P<ast::Ty> {
} }
fn has_ptr(ty: &P<ast::Ty>) -> bool { fn has_ptr(ty: &P<ast::Ty>) -> bool {
if let ast::TyKind::Rptr(_, ref ptr_mut) = ty.node { if let ast::TyKind::Rptr(_, ref _ptr_mut) = ty.node {
true true
} }
else { false } else { false }
@ -625,7 +625,7 @@ fn push_client_implementation(
let payload = BinHandshake { let payload = BinHandshake {
protocol_version: $item_ident::protocol_version().to_string(), protocol_version: $item_ident::protocol_version().to_string(),
api_version: $item_ident::api_version().to_string(), api_version: $item_ident::api_version().to_string(),
_reserved: vec![0u8; 64], reserved: vec![0u8; 64],
}; };
let mut socket_ref = self.socket.borrow_mut(); let mut socket_ref = self.socket.borrow_mut();

View File

@ -138,11 +138,11 @@ pub fn push_bin_box(
let serialize_impl = quote_item!(cx, let serialize_impl = quote_item!(cx,
impl ::serde::ser::Serialize for $ident { impl ::serde::ser::Serialize for $ident {
fn serialize<__S>(&self, _serializer: &mut __S) -> ::std::result::Result<(), __S::Error> fn serialize<__S>(&self, serializer: &mut __S) -> ::std::result::Result<(), __S::Error>
where __S: ::serde::ser::Serializer where __S: ::serde::ser::Serializer
{ {
let &$ident(ref val) = self; let &$ident(ref val) = self;
_serializer.serialize_bytes(val.as_slice()) serializer.serialize_bytes(val.as_slice())
} }
}).unwrap(); }).unwrap();

View File

@ -16,7 +16,7 @@
//! Engine deserialization. //! Engine deserialization.
use serde::{Deserializer, Error}; use serde::Deserializer;
use serde::de::Visitor; use serde::de::Visitor;
use spec::Ethash; use spec::Ethash;

View File

@ -230,7 +230,7 @@ impl TransactionSet {
by_hash.remove(&order.hash) by_hash.remove(&order.hash)
.expect("Hash found in `by_priorty` matches the one dropped; so it is included in `by_hash`"); .expect("Hash found in `by_priorty` matches the one dropped; so it is included in `by_hash`");
let max = removed.get(&sender).map(|val| cmp::max(*val, nonce)).unwrap_or(nonce); let max = removed.get(&sender).map_or(nonce, |val| cmp::max(*val, nonce));
removed.insert(sender, max); removed.insert(sender, max);
removed removed
})) }))

View File

@ -18,6 +18,7 @@
// while not included in binary // while not included in binary
#![allow(dead_code)] #![allow(dead_code)]
#![cfg_attr(feature="dev", allow(used_underscore_binding))]
pub mod service; pub mod service;
@ -41,6 +42,12 @@ pub struct Hypervisor {
processes: RwLock<HashMap<BinaryId, Child>>, processes: RwLock<HashMap<BinaryId, Child>>,
} }
impl Default for Hypervisor {
fn default() -> Self {
Hypervisor::new()
}
}
impl Hypervisor { impl Hypervisor {
/// initializes the Hypervisor service with the open ipc socket for incoming clients /// initializes the Hypervisor service with the open ipc socket for incoming clients
pub fn new() -> Hypervisor { pub fn new() -> Hypervisor {

View File

@ -21,6 +21,7 @@ use std::collections::*;
use std::fs::{File, create_dir_all}; use std::fs::{File, create_dir_all};
use std::env; use std::env;
use std::io::{Read, Write}; use std::io::{Read, Write};
use std::path::PathBuf;
#[cfg_attr(feature="dev", allow(enum_variant_names))] #[cfg_attr(feature="dev", allow(enum_variant_names))]
#[derive(Debug)] #[derive(Debug)]
@ -99,7 +100,7 @@ fn with_locked_version<F>(db_path: Option<&str>, script: F) -> Result<usize, Err
let mut path = env::home_dir().expect("Applications should have a home dir"); let mut path = env::home_dir().expect("Applications should have a home dir");
path.push(".parity"); path.push(".parity");
path path
}, |s| ::std::path::PathBuf::from(s)); }, PathBuf::from);
try!(create_dir_all(&path).map_err(|_| Error::CannotCreateConfigPath)); try!(create_dir_all(&path).map_err(|_| Error::CannotCreateConfigPath));
path.push("ver.lock"); path.push("ver.lock");

View File

@ -156,6 +156,7 @@ fn rpc_ethcore_dev_logs_levels() {
assert_eq!(io.handle_request(request), Some(response.to_owned())); assert_eq!(io.handle_request(request), Some(response.to_owned()));
} }
#[test]
fn rpc_ethcore_set_transactions_limit() { fn rpc_ethcore_set_transactions_limit() {
let miner = miner_service(); let miner = miner_service();
let ethcore = EthcoreClient::new(&miner, logger()).to_delegate(); let ethcore = EthcoreClient::new(&miner, logger()).to_delegate();

View File

@ -495,6 +495,8 @@ fn populate_big_types() {
#[test] #[test]
fn raw_bytes_from_tuple() { fn raw_bytes_from_tuple() {
type Tup = (Vec<u16>, u16);
let tup = (vec![1u16, 1u16, 1u16, 1u16], 10u16); let tup = (vec![1u16, 1u16, 1u16, 1u16], 10u16);
let bytes = vec![ let bytes = vec![
// map // map
@ -507,8 +509,6 @@ fn raw_bytes_from_tuple() {
// 10u16 // 10u16
10u8, 0u8]; 10u8, 0u8];
type Tup = (Vec<u16>, u16);
let tup_from = Tup::from_bytes(&bytes).unwrap(); let tup_from = Tup::from_bytes(&bytes).unwrap();
assert_eq!(tup, tup_from); assert_eq!(tup, tup_from);