updated serde to version 1.0
This commit is contained in:
@@ -10,7 +10,7 @@ build = "build.rs"
|
||||
[dependencies]
|
||||
log = "0.3"
|
||||
env_logger = "0.4"
|
||||
rustc-serialize = "0.3"
|
||||
rustc-hex = "1.0"
|
||||
rand = "0.3.12"
|
||||
time = "0.1.34"
|
||||
rocksdb = { git = "https://github.com/paritytech/rust-rocksdb" }
|
||||
@@ -26,7 +26,7 @@ ethcore-devtools = { path = "../devtools" }
|
||||
libc = "0.2.7"
|
||||
vergen = "0.1"
|
||||
target_info = "0.1"
|
||||
ethcore-bigint = { path = "bigint" }
|
||||
ethcore-bigint = { path = "bigint", features = ["heapsizeof"] }
|
||||
parking_lot = "0.4"
|
||||
using_queue = { path = "using_queue" }
|
||||
table = { path = "table" }
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! benchmarking for bigint
|
||||
//! should be started with:
|
||||
//! ```bash
|
||||
//! multirust run nightly cargo bench
|
||||
//! ```
|
||||
|
||||
#![feature(test)]
|
||||
#![feature(asm)]
|
||||
|
||||
extern crate test;
|
||||
extern crate ethcore_util;
|
||||
|
||||
use test::{Bencher, black_box};
|
||||
use ethcore_util::{U256, U512, U128};
|
||||
|
||||
#[bench]
|
||||
fn u256_add(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
let n = black_box(10000);
|
||||
let zero = black_box(U256::zero());
|
||||
(0..n).fold(zero, |old, new| { old.overflowing_add(U256::from(black_box(new))).0 })
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn u256_sub(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
let n = black_box(10000);
|
||||
let max = black_box(U256::max_value());
|
||||
(0..n).fold(max, |old, new| { old.overflowing_sub(U256::from(black_box(new))).0 })
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn u512_sub(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
let n = black_box(10000);
|
||||
let max = black_box(U512::max_value());
|
||||
(0..n).fold(
|
||||
max,
|
||||
|old, new| {
|
||||
let new = black_box(new);
|
||||
let p = new % 2;
|
||||
old.overflowing_sub(U512([p, p, p, p, p, p, p, new])).0
|
||||
}
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn u512_add(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
let n = black_box(10000);
|
||||
let zero = black_box(U512::zero());
|
||||
(0..n).fold(zero,
|
||||
|old, new| {
|
||||
let new = black_box(new);
|
||||
old.overflowing_add(U512([new, new, new, new, new, new, new, new])).0
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn u256_mul(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
let n = black_box(10000);
|
||||
let one = black_box(U256::one());
|
||||
(0..n).fold(one, |old, new| { old.overflowing_mul(U256::from(black_box(new))).0 })
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
#[bench]
|
||||
fn u256_full_mul(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
let n = black_box(10000);
|
||||
let one = black_box(U256::one());
|
||||
(0..n).fold(one,
|
||||
|old, new| {
|
||||
let new = black_box(new);
|
||||
let U512(ref u512words) = old.full_mul(U256([new, new, new, new]));
|
||||
U256([u512words[0], u512words[2], u512words[2], u512words[3]])
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
#[bench]
|
||||
fn u128_mul(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
let n = black_box(10000);
|
||||
(0..n).fold(U128([12345u64, 0u64]), |old, new| { old.overflowing_mul(U128::from(new)).0 })
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,12 +8,13 @@ version = "0.1.3"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
bigint = "2.0"
|
||||
rustc-serialize = "0.3"
|
||||
heapsize = "0.4"
|
||||
bigint = "3.0"
|
||||
rustc-hex = "1.0"
|
||||
rand = "0.3.12"
|
||||
libc = "0.2"
|
||||
heapsize = { version = "0.4", optional = true }
|
||||
|
||||
[features]
|
||||
x64asm_arithmetic=[]
|
||||
rust_arithmetic=[]
|
||||
heapsizeof = ["heapsize", "bigint/heapsizeof"]
|
||||
|
||||
@@ -8,15 +8,14 @@
|
||||
|
||||
//! General hash types, a fixed-size raw-data type used as the output of hash functions.
|
||||
|
||||
use std::{ops, fmt, cmp};
|
||||
use std::{ops, fmt, cmp, str};
|
||||
use std::cmp::{min, Ordering};
|
||||
use std::ops::{Deref, DerefMut, BitXor, BitAnd, BitOr, IndexMut, Index};
|
||||
use std::hash::{Hash, Hasher, BuildHasherDefault};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::str::FromStr;
|
||||
use rand::Rng;
|
||||
use rand::os::OsRng;
|
||||
use rustc_serialize::hex::{FromHex, FromHexError};
|
||||
use rustc_hex::{FromHex, FromHexError};
|
||||
use bigint::U256;
|
||||
use libc::{c_void, memcmp};
|
||||
|
||||
@@ -141,7 +140,7 @@ macro_rules! impl_hash {
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for $from {
|
||||
impl str::FromStr for $from {
|
||||
type Err = FromHexError;
|
||||
|
||||
fn from_str(s: &str) -> Result<$from, FromHexError> {
|
||||
@@ -349,9 +348,9 @@ macro_rules! impl_hash {
|
||||
fn from(s: &'static str) -> $from {
|
||||
let s = clean_0x(s);
|
||||
if s.len() % 2 == 1 {
|
||||
$from::from_str(&("0".to_owned() + s)).unwrap()
|
||||
("0".to_owned() + s).parse().unwrap()
|
||||
} else {
|
||||
$from::from_str(s).unwrap()
|
||||
s.parse().unwrap()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -435,6 +434,7 @@ impl_hash!(H520, 65);
|
||||
impl_hash!(H1024, 128);
|
||||
impl_hash!(H2048, 256);
|
||||
|
||||
#[cfg(feature="heapsizeof")]
|
||||
known_heap_size!(0, H32, H64, H128, H160, H256, H264, H512, H520, H1024, H2048);
|
||||
// Specialized HashMap and HashSet
|
||||
|
||||
|
||||
@@ -11,10 +11,13 @@
|
||||
#![cfg_attr(asm_available, feature(asm))]
|
||||
|
||||
extern crate rand;
|
||||
extern crate rustc_serialize;
|
||||
extern crate rustc_hex;
|
||||
extern crate bigint;
|
||||
extern crate libc;
|
||||
#[macro_use] extern crate heapsize;
|
||||
|
||||
#[cfg(feature="heapsizeof")]
|
||||
#[macro_use]
|
||||
extern crate heapsize;
|
||||
|
||||
pub mod hash;
|
||||
|
||||
|
||||
@@ -11,10 +11,8 @@ futures = "0.1"
|
||||
futures-cpupool = "0.1"
|
||||
parking_lot = "0.4"
|
||||
log = "0.3"
|
||||
reqwest = "0.4"
|
||||
reqwest = "0.6"
|
||||
mime = "0.2"
|
||||
clippy = { version = "0.0.90", optional = true}
|
||||
|
||||
[features]
|
||||
default = []
|
||||
dev = ["clippy"]
|
||||
|
||||
@@ -9,7 +9,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
[dependencies]
|
||||
log = "0.3"
|
||||
mio = "0.6.8"
|
||||
bytes = "0.3.0"
|
||||
bytes = "0.4"
|
||||
rand = "0.3.12"
|
||||
time = "0.1.34"
|
||||
tiny-keccak = "1.0"
|
||||
@@ -20,6 +20,7 @@ igd = "0.6"
|
||||
libc = "0.2.7"
|
||||
parking_lot = "0.4"
|
||||
ansi_term = "0.9"
|
||||
rustc-hex = "1.0"
|
||||
rustc-serialize = "0.3"
|
||||
ethcore-io = { path = "../io" }
|
||||
ethcore-util = { path = ".." }
|
||||
|
||||
@@ -35,7 +35,7 @@ use rcrypto::aessafe::*;
|
||||
use rcrypto::symmetriccipher::*;
|
||||
use rcrypto::buffer::*;
|
||||
use tiny_keccak::Keccak;
|
||||
use bytes::{Buf, MutBuf};
|
||||
use bytes::{Buf, BufMut};
|
||||
use crypto;
|
||||
|
||||
const ENCRYPTED_HEADER_LEN: usize = 32;
|
||||
@@ -83,9 +83,9 @@ impl<Socket: GenericSocket> GenericConnection<Socket> {
|
||||
let sock_ref = <Socket as Read>::by_ref(&mut self.socket);
|
||||
loop {
|
||||
let max = self.rec_size - self.rec_buf.len();
|
||||
match sock_ref.take(max as u64).try_read(unsafe { self.rec_buf.mut_bytes() }) {
|
||||
match sock_ref.take(max as u64).try_read(unsafe { self.rec_buf.bytes_mut() }) {
|
||||
Ok(Some(size)) if size != 0 => {
|
||||
unsafe { self.rec_buf.advance(size); }
|
||||
unsafe { self.rec_buf.advance_mut(size); }
|
||||
self.stats.inc_recv(size);
|
||||
trace!(target:"network", "{}: Read {} of {} bytes", self.token, self.rec_buf.len(), self.rec_size);
|
||||
if self.rec_size != 0 && self.rec_buf.len() == self.rec_size {
|
||||
@@ -136,8 +136,8 @@ impl<Socket: GenericSocket> GenericConnection<Socket> {
|
||||
warn!(target:"net", "Unexpected connection data");
|
||||
return Ok(WriteStatus::Complete)
|
||||
}
|
||||
let buf = buf as &mut Buf;
|
||||
match self.socket.try_write(buf.bytes()) {
|
||||
|
||||
match self.socket.try_write(Buf::bytes(&buf)) {
|
||||
Ok(Some(size)) if (pos + size) < send_size => {
|
||||
buf.advance(size);
|
||||
self.stats.inc_send(size);
|
||||
|
||||
@@ -559,7 +559,7 @@ mod tests {
|
||||
use node_table::{Node, NodeId, NodeEndpoint};
|
||||
|
||||
use std::str::FromStr;
|
||||
use rustc_serialize::hex::FromHex;
|
||||
use rustc_hex::FromHex;
|
||||
use ethkey::{Random, Generator};
|
||||
use AllowIP;
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ impl Handshake {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use std::sync::Arc;
|
||||
use rustc_serialize::hex::FromHex;
|
||||
use rustc_hex::FromHex;
|
||||
use super::*;
|
||||
use util::hash::H256;
|
||||
use io::*;
|
||||
|
||||
@@ -66,6 +66,7 @@ extern crate crypto as rcrypto;
|
||||
extern crate rand;
|
||||
extern crate time;
|
||||
extern crate ansi_term; //TODO: remove this
|
||||
extern crate rustc_hex;
|
||||
extern crate rustc_serialize;
|
||||
extern crate igd;
|
||||
extern crate libc;
|
||||
|
||||
@@ -10,5 +10,5 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
elastic-array = "0.9"
|
||||
ethcore-bigint = { path = "../bigint" }
|
||||
lazy_static = "0.2"
|
||||
rustc-serialize = "0.3"
|
||||
rustc-hex = "1.0"
|
||||
byteorder = "1.0"
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
extern crate byteorder;
|
||||
extern crate ethcore_bigint as bigint;
|
||||
extern crate elastic_array;
|
||||
extern crate rustc_serialize;
|
||||
extern crate rustc_hex;
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
@@ -273,7 +273,7 @@ impl<'a, 'view> Iterator for RlpIterator<'a, 'view> {
|
||||
|
||||
#[test]
|
||||
fn break_it() {
|
||||
use rustc_serialize::hex::FromHex;
|
||||
use rustc_hex::FromHex;
|
||||
use bigint::prelude::U256;
|
||||
|
||||
let h: Vec<u8> = FromHex::from_hex("f84d0589010efbef67941f79b2a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470").unwrap();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::fmt;
|
||||
use rustc_serialize::hex::ToHex;
|
||||
use rustc_hex::ToHex;
|
||||
use impls::decode_usize;
|
||||
use {Decodable, DecoderError};
|
||||
|
||||
@@ -389,7 +389,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_rlp_display() {
|
||||
use rustc_serialize::hex::FromHex;
|
||||
use rustc_hex::FromHex;
|
||||
let data = "f84d0589010efbef67941f79b2a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470".from_hex().unwrap();
|
||||
let rlp = UntrustedRlp::new(&data);
|
||||
assert_eq!(format!("{}", rlp), "[\"0x05\", \"0x010efbef67941f79b2\", \"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421\", \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"]");
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! General error types for use in ethcore.
|
||||
|
||||
use rustc_serialize::hex::FromHexError;
|
||||
use rustc_hex::FromHexError;
|
||||
use rlp::DecoderError;
|
||||
use std::fmt;
|
||||
use hash::H256;
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
//! cargo build --release
|
||||
//! ```
|
||||
|
||||
extern crate rustc_serialize;
|
||||
extern crate rustc_hex;
|
||||
extern crate rand;
|
||||
extern crate rocksdb;
|
||||
extern crate env_logger;
|
||||
|
||||
@@ -39,11 +39,7 @@ pub use std::cmp::*;
|
||||
pub use std::sync::Arc;
|
||||
pub use std::collections::*;
|
||||
|
||||
pub use rustc_serialize::json::Json;
|
||||
pub use rustc_serialize::base64::FromBase64;
|
||||
pub use rustc_serialize::hex::{FromHex, FromHexError};
|
||||
|
||||
pub use heapsize::HeapSizeOf;
|
||||
pub use itertools::Itertools;
|
||||
|
||||
pub use parking_lot::{Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard};
|
||||
pub use parking_lot::{Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard};
|
||||
|
||||
Reference in New Issue
Block a user