Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

udpated serde to version 0.7.0 #526

Merged
merged 1 commit into from
Feb 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 24 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ build = "build.rs"
[lib]

[dependencies]
serde = "0.6.7"
serde_json = "0.6.0"
jsonrpc-core = "1.1"
jsonrpc-http-server = "2.0"
serde = "0.7.0"
serde_json = "0.7.0"
jsonrpc-core = "1.2"
jsonrpc-http-server = "2.1"
ethcore-util = { path = "../util" }
ethcore = { path = "../ethcore" }
ethsync = { path = "../sync" }
clippy = { version = "0.0.44", optional = true }
rustc-serialize = "0.3"
serde_macros = { version = "0.6.13", optional = true }
serde_macros = { version = "0.7.0", optional = true }

[build-dependencies]
serde_codegen = { version = "0.6.13", optional = true }
serde_codegen = { version = "0.7.0", optional = true }
syntex = "0.29.0"

[features]
Expand Down
4 changes: 2 additions & 2 deletions rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

//! Ethcore rpc.
#![warn(missing_docs)]
#![cfg_attr(nightly, feature(custom_derive, custom_attribute, plugin))]
#![cfg_attr(nightly, plugin(serde_macros, clippy))]
#![cfg_attr(feature="nightly", feature(custom_derive, custom_attribute, plugin))]
#![cfg_attr(feature="nightly", plugin(serde_macros, clippy))]

extern crate rustc_serialize;
extern crate serde;
Expand Down
6 changes: 3 additions & 3 deletions rpc/src/v1/types/block_number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub enum BlockNumber {
impl Deserialize for BlockNumber {
fn deserialize<D>(deserializer: &mut D) -> Result<BlockNumber, D::Error>
where D: Deserializer {
deserializer.visit(BlockNumberVisitor)
deserializer.deserialize(BlockNumberVisitor)
}
}

Expand All @@ -44,8 +44,8 @@ impl Visitor for BlockNumberVisitor {
"latest" => Ok(BlockNumber::Latest),
"earliest" => Ok(BlockNumber::Earliest),
"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")),
_ => value.parse::<u64>().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::custom("invalid block number"))
}
}

Expand Down
2 changes: 1 addition & 1 deletion rpc/src/v1/types/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Serialize for Bytes {
where S: Serializer {
let mut serialized = "0x".to_owned();
serialized.push_str(self.0.to_hex().as_ref());
serializer.visit_str(serialized.as_ref())
serializer.serialize_str(serialized.as_ref())
}
}

Expand Down
3 changes: 2 additions & 1 deletion rpc/src/v1/types/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ impl<T> Deserialize for VariadicValue<T> where T: Deserialize {

Deserialize::deserialize(&mut value::Deserializer::new(v.clone())).map(VariadicValue::Single)
.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
}
}

pub type FilterAddress = VariadicValue<Address>;
pub type Topic = VariadicValue<H256>;

#[derive(Debug, PartialEq, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Filter {
#[serde(rename="fromBlock")]
pub from_block: Option<BlockNumber>,
Expand Down
6 changes: 3 additions & 3 deletions rpc/src/v1/types/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Index {
impl Deserialize for Index {
fn deserialize<D>(deserializer: &mut D) -> Result<Index, D::Error>
where D: Deserializer {
deserializer.visit(IndexVisitor)
deserializer.deserialize(IndexVisitor)
}
}

Expand All @@ -41,8 +41,8 @@ impl Visitor for IndexVisitor {

fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: Error {
match value {
_ if value.starts_with("0x") => usize::from_str_radix(&value[2..], 16).map(Index).map_err(|_| Error::syntax("invalid index")),
_ => value.parse::<usize>().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::custom("invalid index"))
}
}

Expand Down
4 changes: 2 additions & 2 deletions util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ time = "0.1.34"
tiny-keccak = "1.0"
rocksdb = { git = "https://github.com/arkpar/rust-rocksdb.git" }
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"
elastic-array = "0.4"
heapsize = "0.3"
itertools = "0.4"
crossbeam = "0.2"
slab = "0.1"
sha3 = { path = "sha3" }
serde = "0.6.7"
serde = "0.7.0"
clippy = { version = "0.0.44", optional = true }
json-tests = { path = "json-tests" }
rustc_version = "0.1.0"
Expand Down
8 changes: 4 additions & 4 deletions util/src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ macro_rules! impl_hash {
where S: serde::Serializer {
let mut hex = "0x".to_owned();
hex.push_str(self.to_hex().as_ref());
serializer.visit_str(hex.as_ref())
serializer.serialize_str(hex.as_ref())
}
}

Expand All @@ -254,18 +254,18 @@ macro_rules! impl_hash {
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: serde::Error {
// 0x + len
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 {
self.visit_str(value.as_ref())
}
}

deserializer.visit(HashVisitor)
deserializer.deserialize(HashVisitor)
}
}

Expand Down
2 changes: 1 addition & 1 deletion util/src/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ macro_rules! construct_uint {
self.to_bytes(&mut bytes);
let len = cmp::max((self.bits() + 7) / 8, 1);
hex.push_str(bytes[bytes.len() - len..].to_hex().as_ref());
serializer.visit_str(hex.as_ref())
serializer.serialize_str(hex.as_ref())
}
}

Expand Down