Use serde derive feature. (#2351)

* core/primitives

* sr-primitives

* sr-primitives

* srml-treasury

* substrate-executor

* substrate-keystore

* network-libp2p

* substrate-service

* srml-system

* substrate-rpc

* sr-version

* substrate-telemetry

* substrate-test-runtime

* substrate-transaction-pool

* node-template-runtime

* node-primitives

* srml-consensus

* srml-contract

* srml-democracy

* srml-finality-tracker

* srml-grandpa

* srml-metadata

* srml-support

* Clean

* Update locks
This commit is contained in:
Sergei Pepyakin
2019-04-23 18:42:42 +02:00
committed by Bastian Köcher
parent 08fda211d8
commit e2bb429711
57 changed files with 116 additions and 173 deletions
-2
View File
@@ -14,8 +14,6 @@ serializer = { package = "substrate-serializer", path = "../serializer" }
state_machine = { package = "substrate-state-machine", path = "../state-machine" }
runtime_version = { package = "sr-version", path = "../sr-version" }
panic-handler = { package = "substrate-panic-handler", path = "../panic-handler" }
serde = "1.0"
serde_derive = "1.0"
wasmi = { version = "0.4.3" }
byteorder = "1.1"
lazy_static = "1.0"
-2
View File
@@ -11,8 +11,6 @@ error-chain = "0.12"
hex = "0.3"
rand = "0.6"
serde_json = "1.0"
serde = "1.0"
serde_derive = "1.0"
subtle = "2.0"
[dev-dependencies]
+1 -2
View File
@@ -18,8 +18,7 @@ parking_lot = "0.7.1"
lazy_static = "1.2"
log = "0.4"
rand = "0.6"
serde = "1.0.70"
serde_derive = "1.0.70"
serde = { version = "1.0.70", features = ["derive"] }
serde_json = "1.0.24"
smallvec = "0.6"
substrate-peerset = { path = "../peerset" }
+1 -1
View File
@@ -34,7 +34,7 @@ pub use libp2p::{Multiaddr, multiaddr, build_multiaddr};
pub use libp2p::{identity, PeerId, core::PublicKey};
use libp2p::core::nodes::ConnectedPoint;
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use slog_derive::SerdeValue;
use std::{collections::{HashMap, HashSet}, error, fmt, time::Duration};
+2 -3
View File
@@ -8,8 +8,7 @@ edition = "2018"
rstd = { package = "sr-std", path = "../sr-std", default-features = false }
parity-codec = { version = "3.4.0", default-features = false, features = ["derive"] }
rustc-hex = { version = "2.0", default-features = false }
serde = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true }
serde = { version = "1.0", optional = true, features = ["derive"] }
twox-hash = { version = "1.2.0", optional = true }
byteorder = { version = "1.3.1", default-features = false }
primitive-types = { version = "0.2", default-features = false, features = ["codec"] }
@@ -61,7 +60,7 @@ std = [
"base58",
"substrate-bip39",
"tiny-bip39",
"serde_derive",
"serde",
"byteorder/std",
"rand",
"sha2",
@@ -17,7 +17,7 @@
//! Substrate changes trie configuration.
#[cfg(any(feature = "std", test))]
use serde_derive::{Serialize, Deserialize};
use serde::{Serialize, Deserialize};
use parity_codec::{Encode, Decode};
/// Substrate changes trie configuration.
+1 -1
View File
@@ -38,7 +38,7 @@ use parity_codec::{Encode, Decode};
#[cfg(feature = "std")]
use std::borrow::Cow;
#[cfg(feature = "std")]
use serde_derive::{Serialize, Deserialize};
use serde::{Serialize, Deserialize};
#[cfg(feature = "std")]
pub use impl_serde::serialize as bytes;
+1 -1
View File
@@ -17,7 +17,7 @@
//! Contract execution data.
#[cfg(feature = "std")]
use serde_derive::{Serialize, Deserialize};
use serde::{Serialize, Deserialize};
#[cfg(feature = "std")]
use crate::bytes;
use rstd::vec::Vec;
+1 -2
View File
@@ -12,8 +12,7 @@ jsonrpc-derive = "10.0.2"
log = "0.4"
parking_lot = "0.7.1"
parity-codec = "3.3"
serde = "1.0"
serde_derive = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
client = { package = "substrate-client", path = "../client" }
substrate-executor = { path = "../executor" }
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use serde_derive::Deserialize;
use serde::Deserialize;
use primitives::U256;
use runtime_primitives::traits;
+1 -1
View File
@@ -17,7 +17,7 @@
//! Substrate system API helpers.
use std::fmt;
use serde_derive::{Serialize};
use serde::Serialize;
use serde_json::{Value, map::Map};
/// Node properties
+1 -2
View File
@@ -13,9 +13,8 @@ log = "0.4"
slog = {version = "^2", features = ["nested-values"]}
tokio = "0.1.7"
exit-future = "0.1"
serde = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_derive = "1.0"
target_info = "0.1"
inherents = { package = "substrate-inherents", path = "../../core/inherents" }
keystore = { package = "substrate-keystore", path = "../../core/keystore" }
+1 -1
View File
@@ -19,7 +19,7 @@
use std::collections::HashMap;
use std::fs::File;
use std::path::PathBuf;
use serde_derive::{Serialize, Deserialize};
use serde::{Serialize, Deserialize};
use primitives::storage::{StorageKey, StorageData};
use runtime_primitives::{BuildStorage, StorageOverlay, ChildrenStorageOverlay};
use serde_json as json;
+1 -3
View File
@@ -7,8 +7,7 @@ edition = "2018"
[dependencies]
num-traits = { version = "0.2", default-features = false }
integer-sqrt = { version = "0.1.2" }
serde = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true }
serde = { version = "1.0", optional = true, features = ["derive"] }
parity-codec = { version = "3.3", default-features = false, features = ["derive"] }
substrate-primitives = { path = "../primitives", default-features = false }
rstd = { package = "sr-std", path = "../sr-std", default-features = false }
@@ -23,7 +22,6 @@ default = ["std"]
std = [
"num-traits/std",
"serde",
"serde_derive",
"log",
"rstd/std",
"runtime_io/std",
@@ -20,7 +20,7 @@
use std::fmt;
#[cfg(feature = "std")]
use serde_derive::Serialize;
use serde::Serialize;
use rstd::prelude::*;
use crate::codec::{Codec, Encode, Decode};
@@ -17,7 +17,7 @@
//! Generic implementation of a digest.
#[cfg(feature = "std")]
use serde_derive::Serialize;
use serde::Serialize;
use rstd::prelude::*;
@@ -17,7 +17,7 @@
//! Generic implementation of an unchecked (pre-verification) extrinsic.
#[cfg(feature = "std")]
use serde_derive::{Serialize, Deserialize};
use serde::{Serialize, Deserialize};
use crate::codec::{Decode, Encode, Input, Output};
@@ -17,7 +17,7 @@
//! Generic implementation of a block header.
#[cfg(feature = "std")]
use serde_derive::Serialize;
use serde::Serialize;
use crate::codec::{Decode, Encode, Codec, Input, Output, HasCompact, EncodeAsRef};
use crate::traits::{self, Member, SimpleArithmetic, SimpleBitOps, MaybeDisplay,
Hash as HashT, DigestItem as DigestItemT, MaybeSerializeDebug, MaybeSerializeDebugButNotDeserialize};
@@ -191,7 +191,7 @@ mod tests {
use super::*;
use runtime_io::blake2_256;
use crate::codec::{Encode, Decode};
use serde_derive::{Serialize, Deserialize};
use serde::{Serialize, Deserialize};
struct TestContext;
impl Lookup for TestContext {
@@ -190,7 +190,7 @@ mod tests {
use super::*;
use runtime_io::blake2_256;
use crate::codec::{Encode, Decode};
use serde_derive::{Serialize, Deserialize};
use serde::{Serialize, Deserialize};
struct TestContext;
impl Lookup for TestContext {
+7 -9
View File
@@ -24,7 +24,7 @@
pub use parity_codec as codec;
#[cfg(feature = "std")]
#[doc(hidden)]
pub use serde_derive;
pub use serde;
#[cfg(feature = "std")]
pub use runtime_io::{StorageOverlay, ChildrenStorageOverlay};
@@ -83,9 +83,7 @@ macro_rules! create_runtime_str {
}
#[cfg(feature = "std")]
pub use serde::{Serialize, de::DeserializeOwned};
#[cfg(feature = "std")]
pub use serde_derive::{Serialize, Deserialize};
pub use serde::{Serialize, Deserialize, de::DeserializeOwned};
/// Complex storage builder stuff.
#[cfg(feature = "std")]
@@ -528,7 +526,7 @@ macro_rules! impl_outer_config {
) => {
$crate::__impl_outer_config_types! { $concrete $( $config $snake $( < $generic $(, $instance)? > )* )* }
#[cfg(any(feature = "std", test))]
#[derive($crate::serde_derive::Serialize, $crate::serde_derive::Deserialize)]
#[derive($crate::serde::Serialize, $crate::serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct $main {
@@ -576,7 +574,7 @@ macro_rules! impl_outer_log {
/// Wrapper for all possible log entries for the `$trait` runtime. Provides binary-compatible
/// `Encode`/`Decode` implementations with the corresponding `generic::DigestItem`.
#[derive(Clone, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Debug, $crate::serde_derive::Serialize))]
#[cfg_attr(feature = "std", derive(Debug, $crate::serde::Serialize))]
$(#[$attr])*
#[allow(non_camel_case_types)]
pub struct $name($internal);
@@ -584,7 +582,7 @@ macro_rules! impl_outer_log {
/// All possible log entries for the `$trait` runtime. `Encode`/`Decode` implementations
/// are auto-generated => it is not binary-compatible with `generic::DigestItem`.
#[derive(Clone, PartialEq, Eq, $crate::codec::Encode, $crate::codec::Decode)]
#[cfg_attr(feature = "std", derive(Debug, $crate::serde_derive::Serialize))]
#[cfg_attr(feature = "std", derive(Debug, $crate::serde::Serialize))]
$(#[$attr])*
#[allow(non_camel_case_types)]
pub enum InternalLog {
@@ -728,7 +726,7 @@ mod tests {
mod a {
use super::RuntimeT;
use crate::codec::{Encode, Decode};
use serde_derive::Serialize;
use serde::Serialize;
pub type Log<R> = RawLog<<R as RuntimeT>::AuthorityId>;
#[derive(Serialize, Debug, Encode, Decode, PartialEq, Eq, Clone)]
@@ -738,7 +736,7 @@ mod tests {
mod b {
use super::RuntimeT;
use crate::codec::{Encode, Decode};
use serde_derive::Serialize;
use serde::Serialize;
pub type Log<R> = RawLog<<R as RuntimeT>::AuthorityId>;
#[derive(Serialize, Debug, Encode, Decode, PartialEq, Eq, Clone)]
@@ -17,9 +17,6 @@
//! Testing utilities.
use serde::{Serialize, Serializer, Deserialize, de::Error as DeError, Deserializer};
use serde_derive::Serialize;
#[cfg(feature = "std")]
use serde_derive::Deserialize;
use std::{fmt::Debug, ops::Deref, fmt};
use crate::codec::{Codec, Encode, Decode};
use crate::traits::{self, Checkable, Applyable, BlakeTwo256, Convert};
+1 -3
View File
@@ -20,9 +20,7 @@ use rstd::prelude::*;
use rstd::{self, result, marker::PhantomData};
use runtime_io;
#[cfg(feature = "std")] use std::fmt::{Debug, Display};
#[cfg(feature = "std")] use serde::{Serialize, de::DeserializeOwned};
#[cfg(feature = "std")]
use serde_derive::{Serialize, Deserialize};
#[cfg(feature = "std")] use serde::{Serialize, Deserialize, de::DeserializeOwned};
use substrate_primitives::{self, Hasher, Blake2Hasher};
use crate::codec::{Codec, Encode, HasCompact};
pub use integer_sqrt::IntegerSquareRoot;
+1 -3
View File
@@ -6,8 +6,7 @@ edition = "2018"
[dependencies]
impl-serde = { version = "0.1", optional = true }
serde = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true }
serde = { version = "1.0", optional = true, features = ["derive"] }
parity-codec = { version = "3.3", default-features = false, features = ["derive"] }
rstd = { package = "sr-std", path = "../sr-std", default-features = false }
runtime_primitives = { package = "sr-primitives", path = "../sr-primitives", default-features = false }
@@ -17,7 +16,6 @@ default = ["std"]
std = [
"impl-serde",
"serde",
"serde_derive",
"parity-codec/std",
"rstd/std",
"runtime_primitives/std",
+1 -1
View File
@@ -19,7 +19,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(feature = "std")]
use serde_derive::Serialize;
use serde::Serialize;
#[cfg(feature = "std")]
use std::fmt;
#[cfg(feature = "std")]
+1 -2
View File
@@ -10,8 +10,7 @@ parking_lot = "0.7.1"
lazy_static = "1.0"
log = "0.4"
rand = "0.6"
serde = "1.0.81"
serde_derive = "1.0"
serde = { version = "1.0.81", features = ["derive"] }
serde_json = "1.0"
slog = { version = "^2", features = ["nested-values"] }
slog-json = { version = "^2", features = ["nested-values"] }
+1 -1
View File
@@ -29,7 +29,7 @@ use log::trace;
use rand::{thread_rng, Rng};
pub use slog_scope::with_logger;
pub use slog;
use serde_derive::{Serialize, Deserialize};
use serde::{Serialize, Deserialize};
use core::result;
/// Configuration for telemetry.
+1 -3
View File
@@ -7,8 +7,7 @@ edition = "2018"
[dependencies]
log = { version = "0.4", optional = true }
hex-literal = { version = "0.1.0", optional = true }
serde = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true }
serde = { version = "1.0", optional = true, features = ["derive"] }
parity-codec = { version = "3.3", default-features = false, features = ["derive"] }
keyring = { package = "substrate-keyring", path = "../keyring", optional = true }
substrate-client = { path = "../client", default-features = false }
@@ -38,7 +37,6 @@ std = [
"log",
"hex-literal",
"serde",
"serde_derive",
"substrate-client/std",
"keyring",
"parity-codec/std",
+16 -6
View File
@@ -506,6 +506,14 @@ name = "environmental"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "erased-serde"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "error-chain"
version = "0.12.0"
@@ -1892,6 +1900,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "serde"
version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_derive"
@@ -1962,6 +1973,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "slog"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "slog-async"
@@ -1979,6 +1993,7 @@ version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
"slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2057,7 +2072,6 @@ dependencies = [
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 1.0.0",
"sr-std 1.0.0",
"substrate-primitives 1.0.0",
@@ -2077,7 +2091,6 @@ dependencies = [
"impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-primitives 1.0.0",
"sr-std 1.0.0",
]
@@ -2164,7 +2177,6 @@ dependencies = [
"parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 1.0.0",
"sr-primitives 1.0.0",
"sr-std 1.0.0",
@@ -2344,8 +2356,6 @@ dependencies = [
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 1.0.0",
"sr-version 1.0.0",
"substrate-panic-handler 1.0.0",
@@ -2415,7 +2425,6 @@ dependencies = [
"rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"schnorrkel 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-std 1.0.0",
"substrate-bip39 0.2.0 (git+https://github.com/paritytech/substrate-bip39)",
@@ -3073,6 +3082,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum either 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c67353c641dc847124ea1902d69bd753dee9bb3beff9aa3662ecf86c971d1fac"
"checksum elastic-array 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "073be79b6538296faf81c631872676600616073817dd9a440c477ad09b408983"
"checksum environmental 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c7464757b80de8930c91c9afe77ddce501826bf9d134a87db2c67d9dc177e2c"
"checksum erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3beee4bc16478a1b26f2e80ad819a52d24745e292f521a63c16eea5f74b7eb60"
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"
@@ -9,8 +9,7 @@ error-chain = "0.12"
futures = "0.1"
log = "0.4"
parking_lot = "0.7.1"
serde = "1.0"
serde_derive = "1.0"
serde = { version = "1.0", features = ["derive"] }
substrate-primitives = { path = "../../primitives" }
sr-primitives = { path = "../../sr-primitives" }
@@ -20,7 +20,7 @@ use futures::{
Stream,
sync::mpsc,
};
use serde_derive::{Serialize, Deserialize};
use serde::{Serialize, Deserialize};
/// Possible extrinsic status events
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]