migrated ethcore, ethstore, secret_store, updater and hash-fetch to serde 1.0

This commit is contained in:
debris 2017-07-04 17:23:06 +02:00
parent 9c911c7a28
commit 972d30c288
18 changed files with 113 additions and 113 deletions

36
Cargo.lock generated
View File

@ -346,13 +346,13 @@ dependencies = [
[[package]] [[package]]
name = "ethabi" name = "ethabi"
version = "1.0.5" version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tiny-keccak 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -377,7 +377,7 @@ dependencies = [
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ethabi 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethash 1.7.0", "ethash 1.7.0",
"ethcore-bloom-journal 0.1.0", "ethcore-bloom-journal 0.1.0",
"ethcore-devtools 1.7.0", "ethcore-devtools 1.7.0",
@ -583,7 +583,7 @@ name = "ethcore-secretstore"
version = "1.0.0" version = "1.0.0"
dependencies = [ dependencies = [
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethabi 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore 1.7.0", "ethcore 1.7.0",
"ethcore-devtools 1.7.0", "ethcore-devtools 1.7.0",
"ethcore-ipc 1.7.0", "ethcore-ipc 1.7.0",
@ -600,9 +600,9 @@ dependencies = [
"native-contracts 0.1.0", "native-contracts 0.1.0",
"parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-proto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-proto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -730,9 +730,9 @@ dependencies = [
"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)",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1399,7 +1399,7 @@ dependencies = [
name = "native-contract-generator" name = "native-contract-generator"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"ethabi 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heck 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "heck 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1408,7 +1408,7 @@ name = "native-contracts"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethabi 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-util 1.7.0", "ethcore-util 1.7.0",
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"native-contract-generator 0.1.0", "native-contract-generator 0.1.0",
@ -1692,7 +1692,7 @@ dependencies = [
name = "parity-hash-fetch" name = "parity-hash-fetch"
version = "1.7.0" version = "1.7.0"
dependencies = [ dependencies = [
"ethabi 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-util 1.7.0", "ethcore-util 1.7.0",
"fetch 0.1.0", "fetch 0.1.0",
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1852,7 +1852,7 @@ dependencies = [
name = "parity-updater" name = "parity-updater"
version = "1.7.0" version = "1.7.0"
dependencies = [ dependencies = [
"ethabi 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore 1.7.0", "ethcore 1.7.0",
"ethcore-ipc 1.7.0", "ethcore-ipc 1.7.0",
"ethcore-ipc-codegen 1.7.0", "ethcore-ipc-codegen 1.7.0",
@ -2979,7 +2979,7 @@ dependencies = [
"checksum elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "258ff6a9a94f648d0379dbd79110e057edbb53eb85cc237e33eadf8e5a30df85" "checksum elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "258ff6a9a94f648d0379dbd79110e057edbb53eb85cc237e33eadf8e5a30df85"
"checksum env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e3856f1697098606fc6cb97a93de88ca3f3bc35bb878c725920e6e82ecf05e83" "checksum env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e3856f1697098606fc6cb97a93de88ca3f3bc35bb878c725920e6e82ecf05e83"
"checksum eth-secp256k1 0.5.6 (git+https://github.com/paritytech/rust-secp256k1)" = "<none>" "checksum eth-secp256k1 0.5.6 (git+https://github.com/paritytech/rust-secp256k1)" = "<none>"
"checksum ethabi 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "65f71b9ac0b0f8e6230d32dbf5acf7c2c61334af1148175d0a7e72b14c3d475e" "checksum ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0c3d62319ee0f35abf20afe8859dd2668195912614346447bb2dee9fb8da7c62"
"checksum fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1ee15a7050e5580b3712877157068ea713b245b080ff302ae2ca973cfcd9baa" "checksum fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1ee15a7050e5580b3712877157068ea713b245b080ff302ae2ca973cfcd9baa"
"checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb" "checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb"
"checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344" "checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344"

View File

@ -18,7 +18,7 @@ byteorder = "1.0"
clippy = { version = "0.0.103", optional = true} clippy = { version = "0.0.103", optional = true}
crossbeam = "0.2.9" crossbeam = "0.2.9"
env_logger = "0.4" env_logger = "0.4"
ethabi = "1.0" ethabi = "2.0"
ethash = { path = "../ethash" } ethash = { path = "../ethash" }
ethcore-bloom-journal = { path = "../util/bloom" } ethcore-bloom-journal = { path = "../util/bloom" }
ethcore-devtools = { path = "../devtools" } ethcore-devtools = { path = "../devtools" }

View File

@ -6,7 +6,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs" build = "build.rs"
[dependencies] [dependencies]
ethabi = "1.0" ethabi = "2.0"
futures = "0.1" futures = "0.1"
byteorder = "1.0" byteorder = "1.0"
ethcore-util = { path = "../../util" } ethcore-util = { path = "../../util" }

View File

@ -5,5 +5,5 @@ version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
[dependencies] [dependencies]
ethabi = "1.0" ethabi = "2.0"
heck = "0.2" heck = "0.2"

View File

@ -112,7 +112,7 @@ pub fn {snake_name}<F, U>(&self, call: F, {params}) -> BoxFuture<{output_type},
U: IntoFuture<Item=Vec<u8>, Error=String>, U: IntoFuture<Item=Vec<u8>, Error=String>,
U::Future: Send + 'static U::Future: Send + 'static
{{ {{
let function = self.contract.function(r#"{abi_name}"#.to_string()) let function = self.contract.function(r#"{abi_name}"#)
.expect("function existence checked at compile-time; qed"); .expect("function existence checked at compile-time; qed");
let call_addr = self.address; let call_addr = self.address;

View File

@ -8,9 +8,9 @@ log = "0.3"
libc = "0.2" libc = "0.2"
rand = "0.3" rand = "0.3"
ethkey = { path = "../ethkey" } ethkey = { path = "../ethkey" }
serde = "0.9" serde = "1.0"
serde_json = "0.9" serde_json = "1.0"
serde_derive = "0.9" serde_derive = "1.0"
rustc-hex = "1.0" rustc-hex = "1.0"
rust-crypto = "0.2.36" rust-crypto = "0.2.36"
tiny-keccak = "1.0" tiny-keccak = "1.0"

View File

@ -30,9 +30,9 @@ impl ops::Deref for Bytes {
} }
} }
impl Deserialize for Bytes { impl<'a> Deserialize<'a> for Bytes {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer where D: Deserializer<'a>
{ {
let s = String::deserialize(deserializer)?; let s = String::deserialize(deserializer)?;
let data = s.from_hex().map_err(|e| Error::custom(format!("Invalid hex value {}", e)))?; let data = s.from_hex().map_err(|e| Error::custom(format!("Invalid hex value {}", e)))?;

View File

@ -33,16 +33,16 @@ impl Serialize for CipherSer {
} }
} }
impl Deserialize for CipherSer { impl<'a> Deserialize<'a> for CipherSer {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer<'a> {
deserializer.deserialize(CipherSerVisitor) deserializer.deserialize_any(CipherSerVisitor)
} }
} }
struct CipherSerVisitor; struct CipherSerVisitor;
impl Visitor for CipherSerVisitor { impl<'a> Visitor<'a> for CipherSerVisitor {
type Value = CipherSer; type Value = CipherSer;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@ -80,9 +80,9 @@ impl Serialize for CipherSerParams {
} }
} }
impl Deserialize for CipherSerParams { impl<'a> Deserialize<'a> for CipherSerParams {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer<'a> {
Aes128Ctr::deserialize(deserializer) Aes128Ctr::deserialize(deserializer)
.map(CipherSerParams::Aes128Ctr) .map(CipherSerParams::Aes128Ctr)
.map_err(|_| Error::InvalidCipherParams) .map_err(|_| Error::InvalidCipherParams)

View File

@ -17,7 +17,7 @@
use std::{fmt, str}; use std::{fmt, str};
use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde::ser::SerializeStruct; use serde::ser::SerializeStruct;
use serde::de::{Visitor, MapVisitor, Error}; use serde::de::{Visitor, MapAccess, Error};
use serde_json; use serde_json;
use super::{Cipher, CipherSer, CipherSerParams, Kdf, KdfSer, KdfSerParams, H256, Bytes}; use super::{Cipher, CipherSer, CipherSerParams, Kdf, KdfSer, KdfSerParams, H256, Bytes};
@ -54,17 +54,17 @@ enum CryptoField {
Mac, Mac,
} }
impl Deserialize for CryptoField { impl<'a> Deserialize<'a> for CryptoField {
fn deserialize<D>(deserializer: D) -> Result<CryptoField, D::Error> fn deserialize<D>(deserializer: D) -> Result<CryptoField, D::Error>
where D: Deserializer where D: Deserializer<'a>
{ {
deserializer.deserialize(CryptoFieldVisitor) deserializer.deserialize_any(CryptoFieldVisitor)
} }
} }
struct CryptoFieldVisitor; struct CryptoFieldVisitor;
impl Visitor for CryptoFieldVisitor { impl<'a> Visitor<'a> for CryptoFieldVisitor {
type Value = CryptoField; type Value = CryptoField;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@ -86,9 +86,9 @@ impl Visitor for CryptoFieldVisitor {
} }
} }
impl Deserialize for Crypto { impl<'a> Deserialize<'a> for Crypto {
fn deserialize<D>(deserializer: D) -> Result<Crypto, D::Error> fn deserialize<D>(deserializer: D) -> Result<Crypto, D::Error>
where D: Deserializer where D: Deserializer<'a>
{ {
static FIELDS: &'static [&'static str] = &["id", "version", "crypto", "Crypto", "address"]; static FIELDS: &'static [&'static str] = &["id", "version", "crypto", "Crypto", "address"];
deserializer.deserialize_struct("Crypto", FIELDS, CryptoVisitor) deserializer.deserialize_struct("Crypto", FIELDS, CryptoVisitor)
@ -97,7 +97,7 @@ impl Deserialize for Crypto {
struct CryptoVisitor; struct CryptoVisitor;
impl Visitor for CryptoVisitor { impl<'a> Visitor<'a> for CryptoVisitor {
type Value = Crypto; type Value = Crypto;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@ -105,7 +105,7 @@ impl Visitor for CryptoVisitor {
} }
fn visit_map<V>(self, mut visitor: V) -> Result<Self::Value, V::Error> fn visit_map<V>(self, mut visitor: V) -> Result<Self::Value, V::Error>
where V: MapVisitor where V: MapAccess<'a>
{ {
let mut cipher = None; let mut cipher = None;
let mut cipherparams = None; let mut cipherparams = None;
@ -115,13 +115,13 @@ impl Visitor for CryptoVisitor {
let mut mac = None; let mut mac = None;
loop { loop {
match visitor.visit_key()? { match visitor.next_key()? {
Some(CryptoField::Cipher) => { cipher = Some(visitor.visit_value()?); } Some(CryptoField::Cipher) => { cipher = Some(visitor.next_value()?); }
Some(CryptoField::CipherParams) => { cipherparams = Some(visitor.visit_value()?); } Some(CryptoField::CipherParams) => { cipherparams = Some(visitor.next_value()?); }
Some(CryptoField::CipherText) => { ciphertext = Some(visitor.visit_value()?); } Some(CryptoField::CipherText) => { ciphertext = Some(visitor.next_value()?); }
Some(CryptoField::Kdf) => { kdf = Some(visitor.visit_value()?); } Some(CryptoField::Kdf) => { kdf = Some(visitor.next_value()?); }
Some(CryptoField::KdfParams) => { kdfparams = Some(visitor.visit_value()?); } Some(CryptoField::KdfParams) => { kdfparams = Some(visitor.next_value()?); }
Some(CryptoField::Mac) => { mac = Some(visitor.visit_value()?); } Some(CryptoField::Mac) => { mac = Some(visitor.next_value()?); }
None => { break; } None => { break; }
} }
} }

View File

@ -54,12 +54,12 @@ macro_rules! impl_hash {
} }
} }
impl Deserialize for $name { impl<'a> Deserialize<'a> for $name {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer<'a> {
struct HashVisitor; struct HashVisitor;
impl Visitor for HashVisitor { impl<'b> Visitor<'b> for HashVisitor {
type Value = $name; type Value = $name;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@ -75,7 +75,7 @@ macro_rules! impl_hash {
} }
} }
deserializer.deserialize(HashVisitor) deserializer.deserialize_any(HashVisitor)
} }
} }

View File

@ -108,16 +108,16 @@ impl Serialize for Uuid {
} }
} }
impl Deserialize for Uuid { impl<'a> Deserialize<'a> for Uuid {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer<'a> {
deserializer.deserialize(UuidVisitor) deserializer.deserialize_any(UuidVisitor)
} }
} }
struct UuidVisitor; struct UuidVisitor;
impl Visitor for UuidVisitor { impl<'a> Visitor<'a> for UuidVisitor {
type Value = Uuid; type Value = Uuid;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {

View File

@ -35,16 +35,16 @@ impl Serialize for KdfSer {
} }
} }
impl Deserialize for KdfSer { impl<'a> Deserialize<'a> for KdfSer {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer<'a> {
deserializer.deserialize(KdfSerVisitor) deserializer.deserialize_any(KdfSerVisitor)
} }
} }
struct KdfSerVisitor; struct KdfSerVisitor;
impl Visitor for KdfSerVisitor { impl<'a> Visitor<'a> for KdfSerVisitor {
type Value = KdfSer; type Value = KdfSer;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@ -78,16 +78,16 @@ impl Serialize for Prf {
} }
} }
impl Deserialize for Prf { impl<'a> Deserialize<'a> for Prf {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer<'a> {
deserializer.deserialize(PrfVisitor) deserializer.deserialize_any(PrfVisitor)
} }
} }
struct PrfVisitor; struct PrfVisitor;
impl Visitor for PrfVisitor { impl<'a> Visitor<'a> for PrfVisitor {
type Value = Prf; type Value = Prf;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@ -139,9 +139,9 @@ impl Serialize for KdfSerParams {
} }
} }
impl Deserialize for KdfSerParams { impl<'a> Deserialize<'a> for KdfSerParams {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer<'a> {
use serde_json::{Value, from_value}; use serde_json::{Value, from_value};
let v: Value = Deserialize::deserialize(deserializer)?; let v: Value = Deserialize::deserialize(deserializer)?;

View File

@ -17,7 +17,7 @@
use std::fmt; use std::fmt;
use std::io::{Read, Write}; use std::io::{Read, Write};
use serde::{Serialize, Serializer, Deserialize, Deserializer}; use serde::{Serialize, Serializer, Deserialize, Deserializer};
use serde::de::{Error, Visitor, MapVisitor}; use serde::de::{Error, Visitor, MapAccess, DeserializeOwned};
use serde_json; use serde_json;
use super::{Uuid, Version, Crypto, H160}; use super::{Uuid, Version, Crypto, H160};
@ -60,17 +60,17 @@ enum KeyFileField {
Meta, Meta,
} }
impl Deserialize for KeyFileField { impl<'a> Deserialize<'a> for KeyFileField {
fn deserialize<D>(deserializer: D) -> Result<KeyFileField, D::Error> fn deserialize<D>(deserializer: D) -> Result<KeyFileField, D::Error>
where D: Deserializer where D: Deserializer<'a>
{ {
deserializer.deserialize(KeyFileFieldVisitor) deserializer.deserialize_any(KeyFileFieldVisitor)
} }
} }
struct KeyFileFieldVisitor; struct KeyFileFieldVisitor;
impl Visitor for KeyFileFieldVisitor { impl<'a> Visitor<'a> for KeyFileFieldVisitor {
type Value = KeyFileField; type Value = KeyFileField;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@ -93,9 +93,9 @@ impl Visitor for KeyFileFieldVisitor {
} }
} }
impl Deserialize for KeyFile { impl<'a> Deserialize<'a> for KeyFile {
fn deserialize<D>(deserializer: D) -> Result<KeyFile, D::Error> fn deserialize<D>(deserializer: D) -> Result<KeyFile, D::Error>
where D: Deserializer where D: Deserializer<'a>
{ {
static FIELDS: &'static [&'static str] = &["id", "version", "crypto", "Crypto", "address"]; static FIELDS: &'static [&'static str] = &["id", "version", "crypto", "Crypto", "address"];
deserializer.deserialize_struct("KeyFile", FIELDS, KeyFileVisitor) deserializer.deserialize_struct("KeyFile", FIELDS, KeyFileVisitor)
@ -103,8 +103,8 @@ impl Deserialize for KeyFile {
} }
fn none_if_empty<T>(v: Option<serde_json::Value>) -> Option<T> where fn none_if_empty<'a, T>(v: Option<serde_json::Value>) -> Option<T> where
T: Deserialize, T: DeserializeOwned
{ {
v.and_then(|v| if v.is_null() { v.and_then(|v| if v.is_null() {
None None
@ -115,7 +115,7 @@ fn none_if_empty<T>(v: Option<serde_json::Value>) -> Option<T> where
} }
struct KeyFileVisitor; struct KeyFileVisitor;
impl Visitor for KeyFileVisitor { impl<'a> Visitor<'a> for KeyFileVisitor {
type Value = KeyFile; type Value = KeyFile;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@ -123,7 +123,7 @@ impl Visitor for KeyFileVisitor {
} }
fn visit_map<V>(self, mut visitor: V) -> Result<Self::Value, V::Error> fn visit_map<V>(self, mut visitor: V) -> Result<Self::Value, V::Error>
where V: MapVisitor where V: MapAccess<'a>
{ {
let mut id = None; let mut id = None;
let mut version = None; let mut version = None;
@ -133,13 +133,13 @@ impl Visitor for KeyFileVisitor {
let mut meta = None; let mut meta = None;
loop { loop {
match visitor.visit_key()? { match visitor.next_key()? {
Some(KeyFileField::Id) => { id = Some(visitor.visit_value()?); } Some(KeyFileField::Id) => { id = Some(visitor.next_value()?); }
Some(KeyFileField::Version) => { version = Some(visitor.visit_value()?); } Some(KeyFileField::Version) => { version = Some(visitor.next_value()?); }
Some(KeyFileField::Crypto) => { crypto = Some(visitor.visit_value()?); } Some(KeyFileField::Crypto) => { crypto = Some(visitor.next_value()?); }
Some(KeyFileField::Address) => { address = Some(visitor.visit_value()?); } Some(KeyFileField::Address) => { address = Some(visitor.next_value()?); }
Some(KeyFileField::Name) => { name = none_if_empty(visitor.visit_value().ok()) } Some(KeyFileField::Name) => { name = none_if_empty(visitor.next_value().ok()) }
Some(KeyFileField::Meta) => { meta = none_if_empty(visitor.visit_value().ok()) } Some(KeyFileField::Meta) => { meta = none_if_empty(visitor.next_value().ok()) }
None => { break; } None => { break; }
} }
} }

View File

@ -33,16 +33,16 @@ impl Serialize for Version {
} }
} }
impl Deserialize for Version { impl<'a> Deserialize<'a> for Version {
fn deserialize<D>(deserializer: D) -> Result<Version, D::Error> fn deserialize<D>(deserializer: D) -> Result<Version, D::Error>
where D: Deserializer { where D: Deserializer<'a> {
deserializer.deserialize(VersionVisitor) deserializer.deserialize_any(VersionVisitor)
} }
} }
struct VersionVisitor; struct VersionVisitor;
impl Visitor for VersionVisitor { impl<'a> Visitor<'a> for VersionVisitor {
type Value = Version; type Value = Version;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {

View File

@ -7,7 +7,7 @@ version = "1.7.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
[dependencies] [dependencies]
ethabi = "1.0" ethabi = "2.0"
futures = "0.1" futures = "0.1"
log = "0.3" log = "0.3"
mime = "0.2" mime = "0.2"

View File

@ -14,9 +14,9 @@ byteorder = "1.0"
log = "0.3" log = "0.3"
parking_lot = "0.4" parking_lot = "0.4"
hyper = { version = "0.10", default-features = false } hyper = { version = "0.10", default-features = false }
serde = "0.9" serde = "1.0"
serde_json = "0.9" serde_json = "1.0"
serde_derive = "0.9" serde_derive = "1.0"
futures = "0.1" futures = "0.1"
futures-cpupool = "0.1" futures-cpupool = "0.1"
rustc-hex = "1.0" rustc-hex = "1.0"
@ -25,7 +25,7 @@ tokio-io = "0.1.0"
tokio-service = "0.1" tokio-service = "0.1"
tokio-proto = "0.1" tokio-proto = "0.1"
url = "1.0" url = "1.0"
ethabi = "1.0" ethabi = "2.0"
ethcore = { path = "../ethcore" } ethcore = { path = "../ethcore" }
ethcore-devtools = { path = "../devtools" } ethcore-devtools = { path = "../devtools" }
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }

View File

@ -66,9 +66,9 @@ impl Serialize for SerializableBytes {
} }
} }
impl Deserialize for SerializableBytes { impl<'a> Deserialize<'a> for SerializableBytes {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer where D: Deserializer<'a>
{ {
let s = String::deserialize(deserializer)?; let s = String::deserialize(deserializer)?;
if s.len() >= 2 && &s[0..2] == "0x" && s.len() & 1 == 0 { if s.len() >= 2 && &s[0..2] == "0x" && s.len() & 1 == 0 {
@ -112,11 +112,11 @@ impl Serialize for SerializableSignature {
} }
} }
impl Deserialize for SerializableSignature { impl<'a> Deserialize<'a> for SerializableSignature {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer { fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer<'a> {
struct HashVisitor; struct HashVisitor;
impl Visitor for HashVisitor { impl<'b> Visitor<'b> for HashVisitor {
type Value = SerializableSignature; type Value = SerializableSignature;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@ -136,7 +136,7 @@ impl Deserialize for SerializableSignature {
} }
} }
deserializer.deserialize(HashVisitor) deserializer.deserialize_any(HashVisitor)
} }
} }
@ -172,11 +172,11 @@ impl Serialize for SerializableH256 {
} }
} }
impl Deserialize for SerializableH256 { impl<'a> Deserialize<'a> for SerializableH256 {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer { fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer<'a> {
struct HashVisitor; struct HashVisitor;
impl Visitor for HashVisitor { impl<'b> Visitor<'b> for HashVisitor {
type Value = SerializableH256; type Value = SerializableH256;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@ -196,7 +196,7 @@ impl Deserialize for SerializableH256 {
} }
} }
deserializer.deserialize(HashVisitor) deserializer.deserialize_any(HashVisitor)
} }
} }
@ -232,11 +232,11 @@ impl Serialize for SerializableSecret {
} }
} }
impl Deserialize for SerializableSecret { impl<'a> Deserialize<'a> for SerializableSecret {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer { fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer<'a> {
struct HashVisitor; struct HashVisitor;
impl Visitor for HashVisitor { impl<'b> Visitor<'b> for HashVisitor {
type Value = SerializableSecret; type Value = SerializableSecret;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@ -256,7 +256,7 @@ impl Deserialize for SerializableSecret {
} }
} }
deserializer.deserialize(HashVisitor) deserializer.deserialize_any(HashVisitor)
} }
} }
@ -312,11 +312,11 @@ impl Serialize for SerializablePublic {
} }
} }
impl Deserialize for SerializablePublic { impl<'a> Deserialize<'a> for SerializablePublic {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer { fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer<'a> {
struct HashVisitor; struct HashVisitor;
impl Visitor for HashVisitor { impl<'b> Visitor<'b> for HashVisitor {
type Value = SerializablePublic; type Value = SerializablePublic;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@ -336,7 +336,7 @@ impl Deserialize for SerializablePublic {
} }
} }
deserializer.deserialize(HashVisitor) deserializer.deserialize_any(HashVisitor)
} }
} }

View File

@ -11,7 +11,7 @@ ethcore-ipc-codegen = { path = "../ipc/codegen" }
[dependencies] [dependencies]
log = "0.3" log = "0.3"
ethabi = "1.0" ethabi = "2.0"
target_info = "0.1" target_info = "0.1"
ethcore = { path = "../ethcore" } ethcore = { path = "../ethcore" }
ethsync = { path = "../sync" } ethsync = { path = "../sync" }