From e2bb429711747a62ef41ef492f7ee2b1cd397df8 Mon Sep 17 00:00:00 2001 From: Sergei Pepyakin Date: Tue, 23 Apr 2019 18:42:42 +0200 Subject: [PATCH] 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 --- substrate/Cargo.lock | 28 ++------------ substrate/core/executor/Cargo.toml | 2 - substrate/core/keystore/Cargo.toml | 2 - substrate/core/network-libp2p/Cargo.toml | 3 +- substrate/core/network-libp2p/src/lib.rs | 2 +- substrate/core/primitives/Cargo.toml | 5 +-- substrate/core/primitives/src/changes_trie.rs | 2 +- substrate/core/primitives/src/lib.rs | 2 +- substrate/core/primitives/src/storage.rs | 2 +- substrate/core/rpc/Cargo.toml | 3 +- substrate/core/rpc/src/chain/number.rs | 2 +- substrate/core/rpc/src/system/helpers.rs | 2 +- substrate/core/service/Cargo.toml | 3 +- substrate/core/service/src/chain_spec.rs | 2 +- substrate/core/sr-primitives/Cargo.toml | 4 +- .../core/sr-primitives/src/generic/block.rs | 2 +- .../core/sr-primitives/src/generic/digest.rs | 2 +- .../core/sr-primitives/src/generic/era.rs | 2 +- .../core/sr-primitives/src/generic/header.rs | 2 +- .../unchecked_mortal_compact_extrinsic.rs | 2 +- .../src/generic/unchecked_mortal_extrinsic.rs | 2 +- substrate/core/sr-primitives/src/lib.rs | 16 ++++---- substrate/core/sr-primitives/src/testing.rs | 3 -- substrate/core/sr-primitives/src/traits.rs | 4 +- substrate/core/sr-version/Cargo.toml | 4 +- substrate/core/sr-version/src/lib.rs | 2 +- substrate/core/telemetry/Cargo.toml | 3 +- substrate/core/telemetry/src/lib.rs | 2 +- substrate/core/test-runtime/Cargo.toml | 4 +- substrate/core/test-runtime/wasm/Cargo.lock | 22 ++++++++--- .../core/transaction-pool/graph/Cargo.toml | 3 +- .../transaction-pool/graph/src/watcher.rs | 2 +- substrate/node-template/runtime/Cargo.toml | 4 +- substrate/node-template/runtime/src/lib.rs | 2 +- .../node-template/runtime/wasm/Cargo.lock | 28 ++++++++------ substrate/node/primitives/Cargo.toml | 4 +- substrate/node/runtime/wasm/Cargo.lock | 38 ++++++++++--------- substrate/srml/consensus/Cargo.toml | 4 +- substrate/srml/consensus/src/lib.rs | 2 +- substrate/srml/contract/Cargo.toml | 4 +- substrate/srml/contract/src/lib.rs | 2 +- substrate/srml/democracy/Cargo.toml | 4 +- .../srml/democracy/src/vote_threshold.rs | 2 +- substrate/srml/finality-tracker/Cargo.toml | 4 +- substrate/srml/grandpa/Cargo.toml | 5 +-- substrate/srml/grandpa/src/lib.rs | 2 +- substrate/srml/metadata/Cargo.toml | 4 +- substrate/srml/metadata/src/lib.rs | 2 +- substrate/srml/support/Cargo.toml | 4 +- substrate/srml/support/src/event.rs | 8 +--- substrate/srml/support/src/lib.rs | 2 +- substrate/srml/support/test/Cargo.toml | 3 +- substrate/srml/support/test/tests/instance.rs | 6 +-- substrate/srml/system/Cargo.toml | 6 +-- substrate/srml/system/src/lib.rs | 2 +- substrate/srml/treasury/Cargo.toml | 4 +- substrate/srml/treasury/src/lib.rs | 2 +- 57 files changed, 116 insertions(+), 173 deletions(-) diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index 15d0f29513..88bf21fd7e 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -1980,7 +1980,6 @@ dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", "sr-std 1.0.0", "substrate-primitives 1.0.0", @@ -2062,7 +2061,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.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -2926,6 +2924,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "serde" version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "serde_derive" @@ -3123,7 +3124,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.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-std 1.0.0", @@ -3157,7 +3157,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.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", "sr-std 1.0.0", ] @@ -3223,7 +3222,6 @@ dependencies = [ "hex-literal 0.1.2 (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.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3243,7 +3241,6 @@ dependencies = [ "parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)", "pwasm-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-sandbox 1.0.0", @@ -3284,7 +3281,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.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3335,7 +3331,6 @@ dependencies = [ "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.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3351,7 +3346,6 @@ version = "1.0.0" dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3388,7 +3382,6 @@ version = "1.0.0" dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 1.0.0", "substrate-primitives 1.0.0", ] @@ -3460,7 +3453,6 @@ dependencies = [ "paste 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3506,7 +3498,6 @@ version = "0.1.0" dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "srml-support 1.0.0", "substrate-inherents 1.0.0", @@ -3522,7 +3513,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.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3553,7 +3543,6 @@ dependencies = [ "hex-literal 0.1.2 (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.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3988,8 +3977,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.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (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", @@ -4071,8 +4058,6 @@ dependencies = [ "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-crypto 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-primitives 1.0.0", "subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4124,7 +4109,6 @@ dependencies = [ "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4207,7 +4191,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.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (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)", @@ -4234,7 +4217,6 @@ dependencies = [ "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", @@ -4284,7 +4266,6 @@ dependencies = [ "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.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", @@ -4361,7 +4342,6 @@ dependencies = [ "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4397,7 +4377,6 @@ dependencies = [ "memory-db 0.12.2 (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.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -4429,7 +4408,6 @@ dependencies = [ "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.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", "substrate-primitives 1.0.0", "substrate-test-runtime 1.0.0", diff --git a/substrate/core/executor/Cargo.toml b/substrate/core/executor/Cargo.toml index baa4e3546d..0278c1704d 100644 --- a/substrate/core/executor/Cargo.toml +++ b/substrate/core/executor/Cargo.toml @@ -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" diff --git a/substrate/core/keystore/Cargo.toml b/substrate/core/keystore/Cargo.toml index d0c8a93473..775ae61758 100644 --- a/substrate/core/keystore/Cargo.toml +++ b/substrate/core/keystore/Cargo.toml @@ -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] diff --git a/substrate/core/network-libp2p/Cargo.toml b/substrate/core/network-libp2p/Cargo.toml index 5ae7db4a3a..3ac9f835e3 100644 --- a/substrate/core/network-libp2p/Cargo.toml +++ b/substrate/core/network-libp2p/Cargo.toml @@ -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" } diff --git a/substrate/core/network-libp2p/src/lib.rs b/substrate/core/network-libp2p/src/lib.rs index d279eac4b9..8c8b471931 100644 --- a/substrate/core/network-libp2p/src/lib.rs +++ b/substrate/core/network-libp2p/src/lib.rs @@ -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}; diff --git a/substrate/core/primitives/Cargo.toml b/substrate/core/primitives/Cargo.toml index a72f8232b8..5a8468b436 100644 --- a/substrate/core/primitives/Cargo.toml +++ b/substrate/core/primitives/Cargo.toml @@ -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", diff --git a/substrate/core/primitives/src/changes_trie.rs b/substrate/core/primitives/src/changes_trie.rs index c8776a6f08..9cf0066d71 100644 --- a/substrate/core/primitives/src/changes_trie.rs +++ b/substrate/core/primitives/src/changes_trie.rs @@ -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. diff --git a/substrate/core/primitives/src/lib.rs b/substrate/core/primitives/src/lib.rs index f078b5446f..eb309c04a3 100644 --- a/substrate/core/primitives/src/lib.rs +++ b/substrate/core/primitives/src/lib.rs @@ -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; diff --git a/substrate/core/primitives/src/storage.rs b/substrate/core/primitives/src/storage.rs index 3203fdb1ba..4746d230d0 100644 --- a/substrate/core/primitives/src/storage.rs +++ b/substrate/core/primitives/src/storage.rs @@ -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; diff --git a/substrate/core/rpc/Cargo.toml b/substrate/core/rpc/Cargo.toml index ec8b3318fb..600cd9ac48 100644 --- a/substrate/core/rpc/Cargo.toml +++ b/substrate/core/rpc/Cargo.toml @@ -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" } diff --git a/substrate/core/rpc/src/chain/number.rs b/substrate/core/rpc/src/chain/number.rs index 35daf26a76..2e5af190ea 100644 --- a/substrate/core/rpc/src/chain/number.rs +++ b/substrate/core/rpc/src/chain/number.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -use serde_derive::Deserialize; +use serde::Deserialize; use primitives::U256; use runtime_primitives::traits; diff --git a/substrate/core/rpc/src/system/helpers.rs b/substrate/core/rpc/src/system/helpers.rs index 9f64318d5d..82c7773b5b 100644 --- a/substrate/core/rpc/src/system/helpers.rs +++ b/substrate/core/rpc/src/system/helpers.rs @@ -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 diff --git a/substrate/core/service/Cargo.toml b/substrate/core/service/Cargo.toml index 7e53b74fd7..e657826b50 100644 --- a/substrate/core/service/Cargo.toml +++ b/substrate/core/service/Cargo.toml @@ -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" } diff --git a/substrate/core/service/src/chain_spec.rs b/substrate/core/service/src/chain_spec.rs index 78aad64dd0..6af0f5766e 100644 --- a/substrate/core/service/src/chain_spec.rs +++ b/substrate/core/service/src/chain_spec.rs @@ -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; diff --git a/substrate/core/sr-primitives/Cargo.toml b/substrate/core/sr-primitives/Cargo.toml index dfd47f097c..5e4a13f0fe 100644 --- a/substrate/core/sr-primitives/Cargo.toml +++ b/substrate/core/sr-primitives/Cargo.toml @@ -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", diff --git a/substrate/core/sr-primitives/src/generic/block.rs b/substrate/core/sr-primitives/src/generic/block.rs index 5fb83a2a4f..f0f3c88fe7 100644 --- a/substrate/core/sr-primitives/src/generic/block.rs +++ b/substrate/core/sr-primitives/src/generic/block.rs @@ -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}; diff --git a/substrate/core/sr-primitives/src/generic/digest.rs b/substrate/core/sr-primitives/src/generic/digest.rs index 48f1941d69..265ceb5941 100644 --- a/substrate/core/sr-primitives/src/generic/digest.rs +++ b/substrate/core/sr-primitives/src/generic/digest.rs @@ -17,7 +17,7 @@ //! Generic implementation of a digest. #[cfg(feature = "std")] -use serde_derive::Serialize; +use serde::Serialize; use rstd::prelude::*; diff --git a/substrate/core/sr-primitives/src/generic/era.rs b/substrate/core/sr-primitives/src/generic/era.rs index e5a7b24f0c..22f47b6769 100644 --- a/substrate/core/sr-primitives/src/generic/era.rs +++ b/substrate/core/sr-primitives/src/generic/era.rs @@ -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}; diff --git a/substrate/core/sr-primitives/src/generic/header.rs b/substrate/core/sr-primitives/src/generic/header.rs index 60ccd93b3d..efcc7614ed 100644 --- a/substrate/core/sr-primitives/src/generic/header.rs +++ b/substrate/core/sr-primitives/src/generic/header.rs @@ -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}; diff --git a/substrate/core/sr-primitives/src/generic/unchecked_mortal_compact_extrinsic.rs b/substrate/core/sr-primitives/src/generic/unchecked_mortal_compact_extrinsic.rs index 243747092c..ea9dad2a50 100644 --- a/substrate/core/sr-primitives/src/generic/unchecked_mortal_compact_extrinsic.rs +++ b/substrate/core/sr-primitives/src/generic/unchecked_mortal_compact_extrinsic.rs @@ -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 { diff --git a/substrate/core/sr-primitives/src/generic/unchecked_mortal_extrinsic.rs b/substrate/core/sr-primitives/src/generic/unchecked_mortal_extrinsic.rs index 93eeb55884..a91f4461ff 100644 --- a/substrate/core/sr-primitives/src/generic/unchecked_mortal_extrinsic.rs +++ b/substrate/core/sr-primitives/src/generic/unchecked_mortal_extrinsic.rs @@ -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 { diff --git a/substrate/core/sr-primitives/src/lib.rs b/substrate/core/sr-primitives/src/lib.rs index 0f221bf08e..32d59b6b5a 100644 --- a/substrate/core/sr-primitives/src/lib.rs +++ b/substrate/core/sr-primitives/src/lib.rs @@ -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 = RawLog<::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 = RawLog<::AuthorityId>; #[derive(Serialize, Debug, Encode, Decode, PartialEq, Eq, Clone)] diff --git a/substrate/core/sr-primitives/src/testing.rs b/substrate/core/sr-primitives/src/testing.rs index 2711c0e623..763b68b180 100644 --- a/substrate/core/sr-primitives/src/testing.rs +++ b/substrate/core/sr-primitives/src/testing.rs @@ -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}; diff --git a/substrate/core/sr-primitives/src/traits.rs b/substrate/core/sr-primitives/src/traits.rs index b62bc067b6..4c9bf9f95e 100644 --- a/substrate/core/sr-primitives/src/traits.rs +++ b/substrate/core/sr-primitives/src/traits.rs @@ -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; diff --git a/substrate/core/sr-version/Cargo.toml b/substrate/core/sr-version/Cargo.toml index 111e6f101f..b35052e109 100644 --- a/substrate/core/sr-version/Cargo.toml +++ b/substrate/core/sr-version/Cargo.toml @@ -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", diff --git a/substrate/core/sr-version/src/lib.rs b/substrate/core/sr-version/src/lib.rs index 3d1dfb4313..071b893404 100644 --- a/substrate/core/sr-version/src/lib.rs +++ b/substrate/core/sr-version/src/lib.rs @@ -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")] diff --git a/substrate/core/telemetry/Cargo.toml b/substrate/core/telemetry/Cargo.toml index 959349f74f..d626e9fcdf 100644 --- a/substrate/core/telemetry/Cargo.toml +++ b/substrate/core/telemetry/Cargo.toml @@ -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"] } diff --git a/substrate/core/telemetry/src/lib.rs b/substrate/core/telemetry/src/lib.rs index a993b50a17..bc295f2a8c 100644 --- a/substrate/core/telemetry/src/lib.rs +++ b/substrate/core/telemetry/src/lib.rs @@ -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. diff --git a/substrate/core/test-runtime/Cargo.toml b/substrate/core/test-runtime/Cargo.toml index e2d4bdc2d8..2a4540090e 100644 --- a/substrate/core/test-runtime/Cargo.toml +++ b/substrate/core/test-runtime/Cargo.toml @@ -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", diff --git a/substrate/core/test-runtime/wasm/Cargo.lock b/substrate/core/test-runtime/wasm/Cargo.lock index f040fa9c83..1b99472452 100644 --- a/substrate/core/test-runtime/wasm/Cargo.lock +++ b/substrate/core/test-runtime/wasm/Cargo.lock @@ -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" diff --git a/substrate/core/transaction-pool/graph/Cargo.toml b/substrate/core/transaction-pool/graph/Cargo.toml index 1b6e328290..9090ef18b9 100644 --- a/substrate/core/transaction-pool/graph/Cargo.toml +++ b/substrate/core/transaction-pool/graph/Cargo.toml @@ -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" } diff --git a/substrate/core/transaction-pool/graph/src/watcher.rs b/substrate/core/transaction-pool/graph/src/watcher.rs index 5516d8c43c..44ab8431e8 100644 --- a/substrate/core/transaction-pool/graph/src/watcher.rs +++ b/substrate/core/transaction-pool/graph/src/watcher.rs @@ -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)] diff --git a/substrate/node-template/runtime/Cargo.toml b/substrate/node-template/runtime/Cargo.toml index 3622fa34b1..df45166bd3 100644 --- a/substrate/node-template/runtime/Cargo.toml +++ b/substrate/node-template/runtime/Cargo.toml @@ -5,8 +5,7 @@ authors = ["Anonymous"] edition = "2018" [dependencies] -serde = { version = "1.0", optional = true } -serde_derive = { version = "1.0", optional = true } +serde = { version = "1.0", optional = true, features = ["derive"] } safe-mix = { version = "1.0", default-features = false } parity-codec = { version = "3.3", default-features = false, features = ["derive"] } rstd = { package = "sr-std", path = "../../core/sr-std", default_features = false } @@ -46,7 +45,6 @@ std = [ "timestamp/std", "sudo/std", "version/std", - "serde_derive", "serde", "safe-mix/std", "consensus-aura/std", diff --git a/substrate/node-template/runtime/src/lib.rs b/substrate/node-template/runtime/src/lib.rs index a4866b127d..f7325923c7 100644 --- a/substrate/node-template/runtime/src/lib.rs +++ b/substrate/node-template/runtime/src/lib.rs @@ -6,7 +6,7 @@ #![recursion_limit="256"] #[cfg(feature = "std")] -use serde_derive::{Serialize, Deserialize}; +use serde::{Serialize, Deserialize}; use parity_codec::{Encode, Decode}; use rstd::prelude::*; #[cfg(feature = "std")] diff --git a/substrate/node-template/runtime/wasm/Cargo.lock b/substrate/node-template/runtime/wasm/Cargo.lock index 5334b38b43..99fc275c0a 100644 --- a/substrate/node-template/runtime/wasm/Cargo.lock +++ b/substrate/node-template/runtime/wasm/Cargo.lock @@ -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" @@ -1275,7 +1283,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", @@ -1927,6 +1934,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" @@ -1997,6 +2007,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" @@ -2014,6 +2027,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)", @@ -2092,7 +2106,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", @@ -2112,7 +2125,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", ] @@ -2156,7 +2168,6 @@ dependencies = [ "hex-literal 0.1.3 (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", "srml-support 1.0.0", @@ -2201,7 +2212,6 @@ version = "1.0.0" dependencies = [ "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-std 1.0.0", "substrate-primitives 1.0.0", ] @@ -2264,7 +2274,6 @@ dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.4 (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", @@ -2312,7 +2321,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", @@ -2506,8 +2514,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", @@ -2577,7 +2583,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)", @@ -2621,7 +2626,7 @@ dependencies = [ "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (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)", + "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)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3200,6 +3205,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" diff --git a/substrate/node/primitives/Cargo.toml b/substrate/node/primitives/Cargo.toml index b51528c80a..1141a2455e 100644 --- a/substrate/node/primitives/Cargo.toml +++ b/substrate/node/primitives/Cargo.toml @@ -5,8 +5,7 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -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"] } primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false } rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } @@ -23,6 +22,5 @@ std = [ "primitives/std", "rstd/std", "runtime_primitives/std", - "serde_derive", "serde", ] diff --git a/substrate/node/runtime/wasm/Cargo.lock b/substrate/node/runtime/wasm/Cargo.lock index 6dc918f413..84b0d2d067 100644 --- a/substrate/node/runtime/wasm/Cargo.lock +++ b/substrate/node/runtime/wasm/Cargo.lock @@ -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" @@ -1274,7 +1282,6 @@ version = "1.0.0" dependencies = [ "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", "substrate-primitives 1.0.0", @@ -1960,6 +1967,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" @@ -2030,6 +2040,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" @@ -2047,6 +2060,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)", @@ -2125,7 +2139,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", @@ -2156,7 +2169,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", ] @@ -2200,7 +2212,6 @@ dependencies = [ "hex-literal 0.1.3 (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", "srml-support 1.0.0", @@ -2217,7 +2228,6 @@ dependencies = [ "parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)", "pwasm-utils 0.6.2 (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-sandbox 1.0.0", @@ -2226,7 +2236,7 @@ dependencies = [ "srml-system 1.0.0", "srml-timestamp 1.0.0", "substrate-primitives 1.0.0", - "wasmi-validation 0.1.0", + "wasmi-validation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2253,7 +2263,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", @@ -2281,7 +2290,6 @@ dependencies = [ "hex-literal 0.1.3 (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", "srml-support 1.0.0", @@ -2295,7 +2303,6 @@ version = "1.0.0" dependencies = [ "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", "srml-consensus 1.0.0", @@ -2330,7 +2337,6 @@ version = "1.0.0" dependencies = [ "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-std 1.0.0", "substrate-primitives 1.0.0", ] @@ -2393,7 +2399,6 @@ dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.4 (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", @@ -2441,7 +2446,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", @@ -2470,7 +2474,6 @@ dependencies = [ "hex-literal 0.1.3 (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", "srml-balances 1.0.0", @@ -2650,8 +2653,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", @@ -2732,7 +2733,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)", @@ -2776,7 +2776,7 @@ dependencies = [ "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (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)", + "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)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3208,9 +3208,9 @@ dependencies = [ [[package]] name = "wasmi-validation" version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3364,6 +3364,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" @@ -3576,6 +3577,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum wasmi 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "21ef487a11df1ed468cf613c78798c26282da5c30e9d49f824872d4c77b47d1d" +"checksum wasmi-validation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab380192444b3e8522ae79c0a1976e42a82920916ccdfbce3def89f456ea33f3" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" diff --git a/substrate/srml/consensus/Cargo.toml b/substrate/srml/consensus/Cargo.toml index 560ad046fb..ef3e943c8d 100644 --- a/substrate/srml/consensus/Cargo.toml +++ b/substrate/srml/consensus/Cargo.toml @@ -6,8 +6,7 @@ edition = "2018" [dependencies] hex-literal = "0.1.0" -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 = "../../core/primitives", default-features = false } inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false } @@ -23,7 +22,6 @@ runtime_io = { package = "sr-io", path = "../../core/sr-io" } default = ["std"] std = [ "serde", - "serde_derive", "parity-codec/std", "substrate-primitives/std", "rstd/std", diff --git a/substrate/srml/consensus/src/lib.rs b/substrate/srml/consensus/src/lib.rs index 5637f458c1..ba56e6e4e3 100644 --- a/substrate/srml/consensus/src/lib.rs +++ b/substrate/srml/consensus/src/lib.rs @@ -127,7 +127,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #[cfg(feature = "std")] -use serde_derive::Serialize; +use serde::Serialize; use rstd::prelude::*; use parity_codec as codec; use codec::{Encode, Decode}; diff --git a/substrate/srml/contract/Cargo.toml b/substrate/srml/contract/Cargo.toml index be4034c849..28ca8f9eb9 100644 --- a/substrate/srml/contract/Cargo.toml +++ b/substrate/srml/contract/Cargo.toml @@ -5,8 +5,7 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -serde = { version = "1.0", optional = true } -serde_derive = { version = "1.0", optional = true } +serde = { version = "1.0", optional = true, features = ["derive"] } pwasm-utils = { version = "0.6.1", default-features = false } parity-codec = { version = "3.3", default-features = false, features = ["derive"] } parity-wasm = { version = "0.31", default-features = false } @@ -34,7 +33,6 @@ core = [ ] std = [ "serde", - "serde_derive", "parity-codec/std", "substrate-primitives/std", "runtime-primitives/std", diff --git a/substrate/srml/contract/src/lib.rs b/substrate/srml/contract/src/lib.rs index 5b52a31150..a5fa62f7ec 100644 --- a/substrate/srml/contract/src/lib.rs +++ b/substrate/srml/contract/src/lib.rs @@ -91,7 +91,7 @@ use crate::exec::ExecutionContext; use crate::account_db::{AccountDb, DirectAccountDb}; #[cfg(feature = "std")] -use serde_derive::{Serialize, Deserialize}; +use serde::{Serialize, Deserialize}; use substrate_primitives::crypto::UncheckedFrom; use rstd::prelude::*; use rstd::marker::PhantomData; diff --git a/substrate/srml/democracy/Cargo.toml b/substrate/srml/democracy/Cargo.toml index 0e514cd2df..e789c733d6 100644 --- a/substrate/srml/democracy/Cargo.toml +++ b/substrate/srml/democracy/Cargo.toml @@ -6,8 +6,7 @@ edition = "2018" [dependencies] hex-literal = "0.1.0" -serde = { version = "1.0", optional = true } -serde_derive = { version = "1.0", optional = true } +serde = { version = "1.0", optional = true, features = ["derive"] } safe-mix = { version = "1.0", default-features = false} parity-codec = { version = "3.3", default-features = false, features = ["derive"] } rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } @@ -24,7 +23,6 @@ balances = { package = "srml-balances", path = "../balances" } default = ["std"] std = [ "serde", - "serde_derive", "safe-mix/std", "parity-codec/std", "rstd/std", diff --git a/substrate/srml/democracy/src/vote_threshold.rs b/substrate/srml/democracy/src/vote_threshold.rs index 5d9b2b742e..ee42363d47 100644 --- a/substrate/srml/democracy/src/vote_threshold.rs +++ b/substrate/srml/democracy/src/vote_threshold.rs @@ -17,7 +17,7 @@ //! Voting thresholds. #[cfg(feature = "std")] -use serde_derive::{Serialize, Deserialize}; +use serde::{Serialize, Deserialize}; use parity_codec::{Encode, Decode}; use primitives::traits::{Zero, IntegerSquareRoot}; use rstd::ops::{Add, Mul, Div, Rem}; diff --git a/substrate/srml/finality-tracker/Cargo.toml b/substrate/srml/finality-tracker/Cargo.toml index b23afc58f4..c85534f1eb 100644 --- a/substrate/srml/finality-tracker/Cargo.toml +++ b/substrate/srml/finality-tracker/Cargo.toml @@ -6,8 +6,7 @@ edition = "2018" [dependencies] hex-literal = "0.1.0" -serde = { version = "1.0", default-features = false } -serde_derive = { version = "1.0", optional = true } +serde = { version = "1.0", default-features = false, features = ["derive"] } parity-codec = { version = "3.3", default-features = false } inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false } rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } @@ -25,7 +24,6 @@ parking_lot = "0.7" default = ["std"] std = [ "serde/std", - "serde_derive", "parity-codec/std", "rstd/std", "srml-support/std", diff --git a/substrate/srml/grandpa/Cargo.toml b/substrate/srml/grandpa/Cargo.toml index a4cf9c9bd0..49906e699a 100644 --- a/substrate/srml/grandpa/Cargo.toml +++ b/substrate/srml/grandpa/Cargo.toml @@ -5,9 +5,7 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -#hex-literal = "0.1.0" -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 = "../../core/primitives", default-features = false } substrate-finality-grandpa-primitives = { path = "../../core/finality-grandpa/primitives", default-features = false } @@ -26,7 +24,6 @@ runtime_io = { package = "sr-io", path = "../../core/sr-io" } default = ["std"] std = [ "serde", - "serde_derive", "parity-codec/std", "substrate-primitives/std", "substrate-finality-grandpa-primitives/std", diff --git a/substrate/srml/grandpa/src/lib.rs b/substrate/srml/grandpa/src/lib.rs index e9b00662d6..e9886eddb1 100644 --- a/substrate/srml/grandpa/src/lib.rs +++ b/substrate/srml/grandpa/src/lib.rs @@ -31,7 +31,7 @@ pub use substrate_finality_grandpa_primitives as fg_primitives; #[cfg(feature = "std")] -use serde_derive::Serialize; +use serde::Serialize; use rstd::prelude::*; use parity_codec as codec; use codec::{Encode, Decode}; diff --git a/substrate/srml/metadata/Cargo.toml b/substrate/srml/metadata/Cargo.toml index 1dc8180829..aeac0148b4 100644 --- a/substrate/srml/metadata/Cargo.toml +++ b/substrate/srml/metadata/Cargo.toml @@ -6,8 +6,7 @@ edition = "2018" [dependencies] parity-codec = { version = "3.3", default-features = false, features = ["derive"] } -serde = { version = "1.0", optional = true } -serde_derive = { version = "1.0", optional = true } +serde = { version = "1.0", optional = true, features = ["derive"] } rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false } @@ -18,5 +17,4 @@ std = [ "rstd/std", "primitives/std", "serde", - "serde_derive" ] diff --git a/substrate/srml/metadata/src/lib.rs b/substrate/srml/metadata/src/lib.rs index 9b03daafa6..254e72cb11 100644 --- a/substrate/srml/metadata/src/lib.rs +++ b/substrate/srml/metadata/src/lib.rs @@ -23,7 +23,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #[cfg(feature = "std")] -use serde_derive::Serialize; +use serde::Serialize; #[cfg(feature = "std")] use parity_codec::{Decode, Input}; use parity_codec::{Encode, Output}; diff --git a/substrate/srml/support/Cargo.toml b/substrate/srml/support/Cargo.toml index 8b74b564ba..3cb358a4e1 100644 --- a/substrate/srml/support/Cargo.toml +++ b/substrate/srml/support/Cargo.toml @@ -6,8 +6,7 @@ edition = "2018" [dependencies] 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.5.1", default-features = false, features = ["derive"] } srml-metadata = { path = "../metadata", default-features = false } sr-std = { path = "../../core/sr-std", default-features = false } @@ -29,7 +28,6 @@ std = [ "once_cell", "bitmask/std", "serde", - "serde_derive", "runtime_io/std", "parity-codec/std", "sr-std/std", diff --git a/substrate/srml/support/src/event.rs b/substrate/srml/support/src/event.rs index c03482f225..e4168c318a 100644 --- a/substrate/srml/support/src/event.rs +++ b/substrate/srml/support/src/event.rs @@ -28,8 +28,6 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn /// extern crate srml_support; /// #[macro_use] /// extern crate parity_codec as codec; -/// #[macro_use] -/// extern crate serde_derive; /// /// decl_event!( /// pub enum Event { @@ -48,8 +46,6 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn /// extern crate parity_codec as codec; /// #[macro_use] /// extern crate parity_codec; -/// #[macro_use] -/// extern crate serde_derive; /// /// trait Trait { /// type Balance; @@ -97,8 +93,6 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn /// extern crate parity_codec as codec; /// #[macro_use] /// extern crate parity_codec; -/// #[macro_use] -/// extern crate serde_derive; /// ///# struct DefaultInstance; ///# trait Instance {} @@ -509,7 +503,7 @@ macro_rules! __impl_outer_event_json_metadata { #[allow(dead_code)] mod tests { use super::*; - use serde_derive::Serialize; + use serde::Serialize; use parity_codec::{Encode, Decode}; mod system { diff --git a/substrate/srml/support/src/lib.rs b/substrate/srml/support/src/lib.rs index d99db6ddb8..26ed857058 100644 --- a/substrate/srml/support/src/lib.rs +++ b/substrate/srml/support/src/lib.rs @@ -159,7 +159,7 @@ pub enum Void {} #[cfg(feature = "std")] #[doc(hidden)] -pub use serde_derive::*; +pub use serde::{Serialize, Deserialize}; /// Programatically create derivations for tuples of up to 19 elements. You provide a second macro /// which is called once per tuple size, along with a number of identifiers, one for each element diff --git a/substrate/srml/support/test/Cargo.toml b/substrate/srml/support/test/Cargo.toml index 46a6d32068..de54bbd3d4 100644 --- a/substrate/srml/support/test/Cargo.toml +++ b/substrate/srml/support/test/Cargo.toml @@ -5,8 +5,7 @@ authors = ["thiolliere "] edition = "2018" [dev-dependencies] -serde = { version = "1.0", default-features = false } -serde_derive = { version = "1.0" } +serde = { version = "1.0", default-features = false, features = ["derive"] } parity-codec = { version = "3.3", default-features = false, features = ["derive"] } runtime_io = { package = "sr-io", path = "../../../core/sr-io", default-features = false } srml-support = { path = "../", default-features = false } diff --git a/substrate/srml/support/test/tests/instance.rs b/substrate/srml/support/test/tests/instance.rs index d5171f6ac7..b958de8377 100644 --- a/substrate/srml/support/test/tests/instance.rs +++ b/substrate/srml/support/test/tests/instance.rs @@ -17,7 +17,7 @@ #![recursion_limit="128"] #[cfg(feature = "std")] -use serde_derive::Serialize; +use serde::Serialize; use runtime_io::{with_externalities, Blake2Hasher}; use srml_support::rstd::prelude::*; use srml_support::rstd as rstd; @@ -168,7 +168,7 @@ mod module1 { >; /// A logs in this module. - #[cfg_attr(feature = "std", derive(serde_derive::Serialize, Debug))] + #[cfg_attr(feature = "std", derive(serde::Serialize, Debug))] #[derive(parity_codec::Encode, parity_codec::Decode, PartialEq, Eq, Clone)] pub enum RawLog { _Phantom(rstd::marker::PhantomData<(T, I)>), @@ -242,7 +242,7 @@ mod module2 { >; /// A logs in this module. - #[cfg_attr(feature = "std", derive(serde_derive::Serialize, Debug))] + #[cfg_attr(feature = "std", derive(serde::Serialize, Debug))] #[derive(parity_codec::Encode, parity_codec::Decode, PartialEq, Eq, Clone)] pub enum RawLog { _Phantom(rstd::marker::PhantomData<(T, I)>), diff --git a/substrate/srml/system/Cargo.toml b/substrate/srml/system/Cargo.toml index 0b91fd3c5d..0effeae251 100644 --- a/substrate/srml/system/Cargo.toml +++ b/substrate/srml/system/Cargo.toml @@ -6,8 +6,7 @@ edition = "2018" [dependencies] hex-literal = "0.1.0" -serde = { version = "1.0", optional = true } -serde_derive = { version = "1.0", optional = true } +serde = { version = "1.0", optional = true, features = ["derive"] } safe-mix = { version = "1.0", default-features = false} parity-codec = { version = "3.5", default-features = false, features = ["derive"] } substrate-primitives = { path = "../../core/primitives", default-features = false } @@ -23,7 +22,6 @@ criterion = "0.2" default = ["std"] std = [ "serde", - "serde_derive", "safe-mix/std", "parity-codec/std", "substrate-primitives/std", @@ -35,4 +33,4 @@ std = [ [[bench]] name = "bench" -harness = false \ No newline at end of file +harness = false diff --git a/substrate/srml/system/src/lib.rs b/substrate/srml/system/src/lib.rs index c410afd9ce..92e7b6e73e 100644 --- a/substrate/srml/system/src/lib.rs +++ b/substrate/srml/system/src/lib.rs @@ -72,7 +72,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #[cfg(feature = "std")] -use serde_derive::Serialize; +use serde::Serialize; use rstd::prelude::*; #[cfg(any(feature = "std", test))] use rstd::map; diff --git a/substrate/srml/treasury/Cargo.toml b/substrate/srml/treasury/Cargo.toml index d4bbcf4f4f..a4f3960edd 100644 --- a/substrate/srml/treasury/Cargo.toml +++ b/substrate/srml/treasury/Cargo.toml @@ -6,8 +6,7 @@ edition = "2018" [dependencies] hex-literal = "0.1.0" -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 = "../../core/sr-std", default-features = false } runtime_primitives = { package = "sr-primitives", path = "../../core/sr-primitives", default-features = false } @@ -23,7 +22,6 @@ substrate-primitives = { path = "../../core/primitives" } default = ["std"] std = [ "serde", - "serde_derive", "parity-codec/std", "rstd/std", "runtime_primitives/std", diff --git a/substrate/srml/treasury/src/lib.rs b/substrate/srml/treasury/src/lib.rs index b96928d7f8..4c2bd0ede6 100644 --- a/substrate/srml/treasury/src/lib.rs +++ b/substrate/srml/treasury/src/lib.rs @@ -19,7 +19,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #[cfg(feature = "std")] -use serde_derive::{Serialize, Deserialize}; +use serde::{Serialize, Deserialize}; use rstd::prelude::*; use srml_support::{StorageValue, StorageMap, decl_module, decl_storage, decl_event, ensure}; use srml_support::traits::{Currency, ReservableCurrency, OnDilution, OnUnbalanced, Imbalance};