udpated serde to version 0.7.0

This commit is contained in:
debris 2016-02-27 13:14:58 +01:00
parent db9774fb62
commit 11de5b4923
10 changed files with 48 additions and 42 deletions

43
Cargo.lock generated
View File

@ -151,15 +151,15 @@ dependencies = [
[[package]] [[package]]
name = "eth-secp256k1" name = "eth-secp256k1"
version = "0.5.4" version = "0.5.4"
source = "git+https://github.com/arkpar/rust-secp256k1.git#45503e1de68d909b1862e3f2bdb9e1cdfdff3f1e" source = "git+https://github.com/ethcore/rust-secp256k1#283a0677d8327536be58a87e0494d7e0e7b1d1d8"
dependencies = [ dependencies = [
"arrayvec 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"gcc 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", "gcc 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -205,12 +205,12 @@ dependencies = [
"ethcore 0.9.99", "ethcore 0.9.99",
"ethcore-util 0.9.99", "ethcore-util 0.9.99",
"ethsync 0.9.99", "ethsync 0.9.99",
"jsonrpc-core 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-http-server 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-http-server 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", "serde_codegen 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)", "syntex 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -223,7 +223,7 @@ dependencies = [
"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)",
"eth-secp256k1 0.5.4 (git+https://github.com/arkpar/rust-secp256k1.git)", "eth-secp256k1 0.5.4 (git+https://github.com/ethcore/rust-secp256k1)",
"ethcore-devtools 0.9.99", "ethcore-devtools 0.9.99",
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"igd 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "igd 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -238,7 +238,7 @@ dependencies = [
"rust-crypto 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sha3 0.1.0", "sha3 0.1.0",
"slab 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -371,22 +371,22 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-core" name = "jsonrpc-core"
version = "1.1.4" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", "serde_codegen 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)", "syntex 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "jsonrpc-http-server" name = "jsonrpc-http-server"
version = "2.0.0" version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"hyper 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -689,9 +689,14 @@ dependencies = [
"num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "serde"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "serde_codegen" name = "serde_codegen"
version = "0.6.14" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"aster 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "aster 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -703,11 +708,11 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "0.6.0" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]

View File

@ -9,19 +9,19 @@ build = "build.rs"
[lib] [lib]
[dependencies] [dependencies]
serde = "0.6.7" serde = "0.7.0"
serde_json = "0.6.0" serde_json = "0.7.0"
jsonrpc-core = "1.1" jsonrpc-core = "1.2"
jsonrpc-http-server = "2.0" jsonrpc-http-server = "2.1"
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }
ethcore = { path = "../ethcore" } ethcore = { path = "../ethcore" }
ethsync = { path = "../sync" } ethsync = { path = "../sync" }
clippy = { version = "0.0.44", optional = true } clippy = { version = "0.0.44", optional = true }
rustc-serialize = "0.3" rustc-serialize = "0.3"
serde_macros = { version = "0.6.13", optional = true } serde_macros = { version = "0.7.0", optional = true }
[build-dependencies] [build-dependencies]
serde_codegen = { version = "0.6.13", optional = true } serde_codegen = { version = "0.7.0", optional = true }
syntex = "0.29.0" syntex = "0.29.0"
[features] [features]

View File

@ -16,8 +16,8 @@
//! Ethcore rpc. //! Ethcore rpc.
#![warn(missing_docs)] #![warn(missing_docs)]
#![cfg_attr(nightly, feature(custom_derive, custom_attribute, plugin))] #![cfg_attr(feature="nightly", feature(custom_derive, custom_attribute, plugin))]
#![cfg_attr(nightly, plugin(serde_macros, clippy))] #![cfg_attr(feature="nightly", plugin(serde_macros, clippy))]
extern crate rustc_serialize; extern crate rustc_serialize;
extern crate serde; extern crate serde;

View File

@ -30,7 +30,7 @@ pub enum BlockNumber {
impl Deserialize for BlockNumber { impl Deserialize for BlockNumber {
fn deserialize<D>(deserializer: &mut D) -> Result<BlockNumber, D::Error> fn deserialize<D>(deserializer: &mut D) -> Result<BlockNumber, D::Error>
where D: Deserializer { where D: Deserializer {
deserializer.visit(BlockNumberVisitor) deserializer.deserialize(BlockNumberVisitor)
} }
} }
@ -44,8 +44,8 @@ impl Visitor for BlockNumberVisitor {
"latest" => Ok(BlockNumber::Latest), "latest" => Ok(BlockNumber::Latest),
"earliest" => Ok(BlockNumber::Earliest), "earliest" => Ok(BlockNumber::Earliest),
"pending" => Ok(BlockNumber::Pending), "pending" => Ok(BlockNumber::Pending),
_ if value.starts_with("0x") => u64::from_str_radix(&value[2..], 16).map(BlockNumber::Num).map_err(|_| Error::syntax("invalid block number")), _ if value.starts_with("0x") => u64::from_str_radix(&value[2..], 16).map(BlockNumber::Num).map_err(|_| Error::custom("invalid block number")),
_ => value.parse::<u64>().map(BlockNumber::Num).map_err(|_| Error::syntax("invalid block number")) _ => value.parse::<u64>().map(BlockNumber::Num).map_err(|_| Error::custom("invalid block number"))
} }
} }

View File

@ -40,7 +40,7 @@ impl Serialize for Bytes {
where S: Serializer { where S: Serializer {
let mut serialized = "0x".to_owned(); let mut serialized = "0x".to_owned();
serialized.push_str(self.0.to_hex().as_ref()); serialized.push_str(self.0.to_hex().as_ref());
serializer.visit_str(serialized.as_ref()) serializer.serialize_str(serialized.as_ref())
} }
} }

View File

@ -40,7 +40,7 @@ impl<T> Deserialize for VariadicValue<T> where T: Deserialize {
Deserialize::deserialize(&mut value::Deserializer::new(v.clone())).map(VariadicValue::Single) Deserialize::deserialize(&mut value::Deserializer::new(v.clone())).map(VariadicValue::Single)
.or_else(|_| Deserialize::deserialize(&mut value::Deserializer::new(v.clone())).map(VariadicValue::Multiple)) .or_else(|_| Deserialize::deserialize(&mut value::Deserializer::new(v.clone())).map(VariadicValue::Multiple))
.map_err(|_| Error::syntax("")) // unreachable, but types must match .map_err(|_| Error::custom("")) // unreachable, but types must match
} }
} }
@ -48,6 +48,7 @@ pub type FilterAddress = VariadicValue<Address>;
pub type Topic = VariadicValue<H256>; pub type Topic = VariadicValue<H256>;
#[derive(Debug, PartialEq, Deserialize)] #[derive(Debug, PartialEq, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Filter { pub struct Filter {
#[serde(rename="fromBlock")] #[serde(rename="fromBlock")]
pub from_block: Option<BlockNumber>, pub from_block: Option<BlockNumber>,

View File

@ -30,7 +30,7 @@ impl Index {
impl Deserialize for Index { impl Deserialize for Index {
fn deserialize<D>(deserializer: &mut D) -> Result<Index, D::Error> fn deserialize<D>(deserializer: &mut D) -> Result<Index, D::Error>
where D: Deserializer { where D: Deserializer {
deserializer.visit(IndexVisitor) deserializer.deserialize(IndexVisitor)
} }
} }
@ -41,8 +41,8 @@ impl Visitor for IndexVisitor {
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: Error { fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: Error {
match value { match value {
_ if value.starts_with("0x") => usize::from_str_radix(&value[2..], 16).map(Index).map_err(|_| Error::syntax("invalid index")), _ if value.starts_with("0x") => usize::from_str_radix(&value[2..], 16).map(Index).map_err(|_| Error::custom("invalid index")),
_ => value.parse::<usize>().map(Index).map_err(|_| Error::syntax("invalid index")) _ => value.parse::<usize>().map(Index).map_err(|_| Error::custom("invalid index"))
} }
} }

View File

@ -18,7 +18,7 @@ time = "0.1.34"
tiny-keccak = "1.0" tiny-keccak = "1.0"
rocksdb = { git = "https://github.com/arkpar/rust-rocksdb.git" } rocksdb = { git = "https://github.com/arkpar/rust-rocksdb.git" }
lazy_static = "0.1" lazy_static = "0.1"
eth-secp256k1 = { git = "https://github.com/arkpar/rust-secp256k1.git" } eth-secp256k1 = { git = "https://github.com/ethcore/rust-secp256k1" }
rust-crypto = "0.2.34" rust-crypto = "0.2.34"
elastic-array = "0.4" elastic-array = "0.4"
heapsize = "0.3" heapsize = "0.3"
@ -26,7 +26,7 @@ itertools = "0.4"
crossbeam = "0.2" crossbeam = "0.2"
slab = "0.1" slab = "0.1"
sha3 = { path = "sha3" } sha3 = { path = "sha3" }
serde = "0.6.7" serde = "0.7.0"
clippy = { version = "0.0.44", optional = true } clippy = { version = "0.0.44", optional = true }
json-tests = { path = "json-tests" } json-tests = { path = "json-tests" }
rustc_version = "0.1.0" rustc_version = "0.1.0"

View File

@ -239,7 +239,7 @@ macro_rules! impl_hash {
where S: serde::Serializer { where S: serde::Serializer {
let mut hex = "0x".to_owned(); let mut hex = "0x".to_owned();
hex.push_str(self.to_hex().as_ref()); hex.push_str(self.to_hex().as_ref());
serializer.visit_str(hex.as_ref()) serializer.serialize_str(hex.as_ref())
} }
} }
@ -254,10 +254,10 @@ macro_rules! impl_hash {
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: serde::Error { fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: serde::Error {
// 0x + len // 0x + len
if value.len() != 2 + $size * 2 { if value.len() != 2 + $size * 2 {
return Err(serde::Error::syntax("Invalid length.")); return Err(serde::Error::custom("Invalid length."));
} }
value[2..].from_hex().map(|ref v| $from::from_slice(v)).map_err(|_| serde::Error::syntax("Invalid valid hex.")) value[2..].from_hex().map(|ref v| $from::from_slice(v)).map_err(|_| serde::Error::custom("Invalid valid hex."))
} }
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: serde::Error { fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: serde::Error {
@ -265,7 +265,7 @@ macro_rules! impl_hash {
} }
} }
deserializer.visit(HashVisitor) deserializer.deserialize(HashVisitor)
} }
} }

View File

@ -760,7 +760,7 @@ macro_rules! construct_uint {
self.to_bytes(&mut bytes); self.to_bytes(&mut bytes);
let len = cmp::max((self.bits() + 7) / 8, 1); let len = cmp::max((self.bits() + 7) / 8, 1);
hex.push_str(bytes[bytes.len() - len..].to_hex().as_ref()); hex.push_str(bytes[bytes.len() - len..].to_hex().as_ref());
serializer.visit_str(hex.as_ref()) serializer.serialize_str(hex.as_ref())
} }
} }