diff --git a/Cargo.lock b/Cargo.lock index ec2d1ec88..cddda146c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -685,9 +685,9 @@ dependencies = [ "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-util 1.7.0", "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_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.4 (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 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/json/Cargo.toml b/json/Cargo.toml index d0fec9933..81af58ac7 100644 --- a/json/Cargo.toml +++ b/json/Cargo.toml @@ -6,8 +6,8 @@ authors = ["Parity Technologies "] [dependencies] ethcore-util = { path = "../util" } rustc-hex = "1.0" -serde = "0.9" -serde_json = "0.9" -serde_derive = "0.9" +serde = "1.0" +serde_json = "1.0" +serde_derive = "1.0" clippy = { version = "0.0.103", optional = true} diff --git a/json/src/bytes.rs b/json/src/bytes.rs index 5b474ba7d..79ba4f896 100644 --- a/json/src/bytes.rs +++ b/json/src/bytes.rs @@ -67,16 +67,16 @@ impl FromStr for Bytes { } } -impl Deserialize for Bytes { +impl<'a> Deserialize<'a> for Bytes { fn deserialize(deserializer: D) -> Result - where D: Deserializer { - deserializer.deserialize(BytesVisitor) + where D: Deserializer<'a> { + deserializer.deserialize_any(BytesVisitor) } } struct BytesVisitor; -impl Visitor for BytesVisitor { +impl<'a> Visitor<'a> for BytesVisitor { type Value = Bytes; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { diff --git a/json/src/hash.rs b/json/src/hash.rs index 6a2df6515..64da93e1c 100644 --- a/json/src/hash.rs +++ b/json/src/hash.rs @@ -42,13 +42,13 @@ macro_rules! impl_hash { } } - impl Deserialize for $name { + impl<'a> Deserialize<'a> for $name { fn deserialize(deserializer: D) -> Result - where D: Deserializer { + where D: Deserializer<'a> { struct HashVisitor; - impl Visitor for HashVisitor { + impl<'b> Visitor<'b> for HashVisitor { type Value = $name; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { @@ -75,7 +75,7 @@ macro_rules! impl_hash { } } - deserializer.deserialize(HashVisitor) + deserializer.deserialize_any(HashVisitor) } } diff --git a/json/src/maybe.rs b/json/src/maybe.rs index 16a01dc44..075aaefbd 100644 --- a/json/src/maybe.rs +++ b/json/src/maybe.rs @@ -4,8 +4,7 @@ use std::fmt; use std::marker::PhantomData; use serde::{Deserialize, Deserializer}; -use serde::de::{Error, Visitor}; -use serde::de::value::ValueDeserializer; +use serde::de::{Error, Visitor, IntoDeserializer}; /// Deserializer of empty string values into optionals. #[derive(Debug, PartialEq, Clone)] @@ -16,10 +15,10 @@ pub enum MaybeEmpty { None, } -impl Deserialize for MaybeEmpty where T: Deserialize { +impl<'a, T> Deserialize<'a> for MaybeEmpty where T: Deserialize<'a> { fn deserialize(deserializer: D) -> Result - where D: Deserializer { - deserializer.deserialize(MaybeEmptyVisitor::new()) + where D: Deserializer<'a> { + deserializer.deserialize_any(MaybeEmptyVisitor::new()) } } @@ -35,7 +34,7 @@ impl MaybeEmptyVisitor { } } -impl Visitor for MaybeEmptyVisitor where T: Deserialize { +impl<'a, T> Visitor<'a> for MaybeEmptyVisitor where T: Deserialize<'a> { type Value = MaybeEmpty; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { diff --git a/json/src/spec/ethash.rs b/json/src/spec/ethash.rs index 44edb5288..f3391e067 100644 --- a/json/src/spec/ethash.rs +++ b/json/src/spec/ethash.rs @@ -236,6 +236,7 @@ mod tests { eip161d_transition: Some(Uint(U256::from(0x47))), ecip1010_pause_transition: None, ecip1010_continue_transition: None, + ecip1017_era_rounds: None, max_code_size: None, max_gas_limit_transition: None, max_gas_limit: None, @@ -282,6 +283,7 @@ mod tests { eip161d_transition: None, ecip1010_pause_transition: None, ecip1010_continue_transition: None, + ecip1017_era_rounds: None, max_code_size: None, max_gas_limit_transition: None, max_gas_limit: None, diff --git a/json/src/trie/input.rs b/json/src/trie/input.rs index 86614294e..c84f1aa1e 100644 --- a/json/src/trie/input.rs +++ b/json/src/trie/input.rs @@ -21,7 +21,7 @@ use std::collections::BTreeMap; use std::str::FromStr; use bytes::Bytes; use serde::{Deserialize, Deserializer}; -use serde::de::{Error as ErrorTrait, Visitor, MapVisitor, SeqVisitor}; +use serde::de::{Error as ErrorTrait, Visitor, MapAccess, SeqAccess}; /// Trie test input. #[derive(Debug, PartialEq)] @@ -30,35 +30,35 @@ pub struct Input { pub data: BTreeMap>, } -impl Deserialize for Input { +impl<'a> Deserialize<'a> for Input { fn deserialize(deserializer: D) -> Result - where D: Deserializer + where D: Deserializer<'a> { - deserializer.deserialize(InputVisitor) + deserializer.deserialize_any(InputVisitor) } } struct InputVisitor; -impl Visitor for InputVisitor { +impl<'a> Visitor<'a> for InputVisitor { type Value = Input; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { write!(formatter, "a map of bytes into bytes") } - fn visit_map(self, mut visitor: V) -> Result where V: MapVisitor { + fn visit_map(self, mut visitor: V) -> Result where V: MapAccess<'a> { let mut result = BTreeMap::new(); loop { - let key_str: Option = visitor.visit_key()?; + let key_str: Option = visitor.next_key()?; let key = match key_str { Some(ref k) if k.starts_with("0x") => Bytes::from_str(k).map_err(V::Error::custom)?, Some(k) => Bytes::new(k.into_bytes()), None => { break; } }; - let val_str: Option = visitor.visit_value()?; + let val_str: Option = visitor.next_value()?; let val = match val_str { Some(ref v) if v.starts_with("0x") => Some(Bytes::from_str(v).map_err(V::Error::custom)?), Some(v) => Some(Bytes::new(v.into_bytes())), @@ -75,11 +75,11 @@ impl Visitor for InputVisitor { Ok(input) } - fn visit_seq(self, mut visitor: V) -> Result where V: SeqVisitor { + fn visit_seq(self, mut visitor: V) -> Result where V: SeqAccess<'a> { let mut result = BTreeMap::new(); loop { - let keyval: Option>> = visitor.visit()?; + let keyval: Option>> = visitor.next_element()?; let keyval = match keyval { Some(k) => k, _ => { break; }, diff --git a/json/src/uint.rs b/json/src/uint.rs index d408b76dc..5e98a9dca 100644 --- a/json/src/uint.rs +++ b/json/src/uint.rs @@ -50,16 +50,16 @@ impl Into for Uint { } } -impl Deserialize for Uint { +impl<'a> Deserialize<'a> for Uint { fn deserialize(deserializer: D) -> Result - where D: Deserializer { - deserializer.deserialize(UintVisitor) + where D: Deserializer<'a> { + deserializer.deserialize_any(UintVisitor) } } struct UintVisitor; -impl Visitor for UintVisitor { +impl<'a> Visitor<'a> for UintVisitor { type Value = Uint; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {