From 084b158031f75a10927cf0668873db177d8d9e7e Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Fri, 1 Nov 2019 22:22:37 +0100 Subject: [PATCH] Optional serde for phragmen support (#3994) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add serde to phragmen * Update lock file * and bump a version * and bump a version again * Apply suggestions from code review Co-Authored-By: Bastian Köcher * revert impl-tarit for tuple update * revert session. * Revert "revert session." This reverts commit 98086c9db56677068db85f74320868b2c10d1c00. * Revert "revert impl-tarit for tuple update" This reverts commit 28a7fddee2e09c5785b19883f743065e0be8f331. --- substrate/Cargo.lock | 1 + substrate/core/chain-spec/Cargo.toml | 2 +- substrate/core/phragmen/Cargo.toml | 4 +++- substrate/core/phragmen/src/lib.rs | 1 + substrate/core/sr-primitives/Cargo.toml | 2 +- substrate/srml/authorship/Cargo.toml | 2 +- substrate/srml/finality-tracker/Cargo.toml | 2 +- substrate/srml/support/Cargo.toml | 2 +- substrate/srml/system/Cargo.toml | 2 +- substrate/srml/timestamp/Cargo.toml | 2 +- 10 files changed, 12 insertions(+), 8 deletions(-) diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index e002312288..897a0701f9 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -5748,6 +5748,7 @@ name = "substrate-phragmen" version = "2.0.0" dependencies = [ "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", "sr-std 2.0.0", diff --git a/substrate/core/chain-spec/Cargo.toml b/substrate/core/chain-spec/Cargo.toml index b4d9d004e4..1ab78a18dd 100644 --- a/substrate/core/chain-spec/Cargo.toml +++ b/substrate/core/chain-spec/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] substrate-chain-spec-derive = { path = "./derive" } -impl-trait-for-tuples = "0.1.2" +impl-trait-for-tuples = "0.1.3" network = { package = "substrate-network", path = "../../core/network" } primitives = { package = "substrate-primitives", path = "../primitives" } serde = { version = "1.0.101", features = ["derive"] } diff --git a/substrate/core/phragmen/Cargo.toml b/substrate/core/phragmen/Cargo.toml index e10be1d92d..5ee6d3b3c2 100644 --- a/substrate/core/phragmen/Cargo.toml +++ b/substrate/core/phragmen/Cargo.toml @@ -5,8 +5,9 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -sr-primitives = { path = "../sr-primitives", default-features = false } +serde = { version = "1.0.101", optional = true, features = ["derive"] } rstd = { package = "sr-std", path = "../sr-std", default-features = false } +sr-primitives = { path = "../sr-primitives", default-features = false } [dev-dependencies] runtime-io ={ package = "sr-io", path = "../sr-io" } @@ -16,6 +17,7 @@ rand = "0.7.2" [features] default = ["std"] std = [ + "serde", "rstd/std", "sr-primitives/std", ] diff --git a/substrate/core/phragmen/src/lib.rs b/substrate/core/phragmen/src/lib.rs index 8c8401bed6..a4287773b5 100644 --- a/substrate/core/phragmen/src/lib.rs +++ b/substrate/core/phragmen/src/lib.rs @@ -116,6 +116,7 @@ pub struct PhragmenResult { /// This, at the current version, resembles the `Exposure` defined in the staking SRML module, yet /// they do not necessarily have to be the same. #[derive(Default, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct Support { /// The amount of support as the effect of self-vote. pub own: ExtendedBalance, diff --git a/substrate/core/sr-primitives/Cargo.toml b/substrate/core/sr-primitives/Cargo.toml index d330301426..1b1434b919 100644 --- a/substrate/core/sr-primitives/Cargo.toml +++ b/substrate/core/sr-primitives/Cargo.toml @@ -15,7 +15,7 @@ runtime_io = { package = "sr-io", path = "../sr-io", default-features = false } log = { version = "0.4.8", optional = true } paste = "0.1.6" rand = { version = "0.7.2", optional = true } -impl-trait-for-tuples = "0.1.2" +impl-trait-for-tuples = "0.1.3" [dev-dependencies] serde_json = "1.0.41" diff --git a/substrate/srml/authorship/Cargo.toml b/substrate/srml/authorship/Cargo.toml index e860be2f64..a59976c699 100644 --- a/substrate/srml/authorship/Cargo.toml +++ b/substrate/srml/authorship/Cargo.toml @@ -14,7 +14,7 @@ sr-primitives = { path = "../../core/sr-primitives", default-features = false } support = { package = "srml-support", path = "../support", default-features = false } system = { package = "srml-system", path = "../system", default-features = false } runtime-io ={ package = "sr-io", path = "../../core/sr-io", default-features = false } -impl-trait-for-tuples = "0.1.2" +impl-trait-for-tuples = "0.1.3" [features] default = ["std"] diff --git a/substrate/srml/finality-tracker/Cargo.toml b/substrate/srml/finality-tracker/Cargo.toml index 7e3439e0fe..a881b2906f 100644 --- a/substrate/srml/finality-tracker/Cargo.toml +++ b/substrate/srml/finality-tracker/Cargo.toml @@ -12,7 +12,7 @@ rstd = { package = "sr-std", path = "../../core/sr-std", default-features = fals sr-primitives = { path = "../../core/sr-primitives", default-features = false } support = { package = "srml-support", path = "../support", default-features = false } srml-system = { path = "../system", default-features = false } -impl-trait-for-tuples = "0.1.2" +impl-trait-for-tuples = "0.1.3" [dev-dependencies] primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false } diff --git a/substrate/srml/support/Cargo.toml b/substrate/srml/support/Cargo.toml index 2b8c4cb9f9..46ebebc7d3 100644 --- a/substrate/srml/support/Cargo.toml +++ b/substrate/srml/support/Cargo.toml @@ -18,7 +18,7 @@ srml-support-procedural = { package = "srml-support-procedural", path = "./proce paste = "0.1.6" once_cell = { version = "0.2.4", default-features = false, optional = true } bitmask = { version = "0.5.0", default-features = false } -impl-trait-for-tuples = "0.1.2" +impl-trait-for-tuples = "0.1.3" [dev-dependencies] pretty_assertions = "0.6.1" diff --git a/substrate/srml/system/Cargo.toml b/substrate/srml/system/Cargo.toml index a9ce6b3f8c..52570617a1 100644 --- a/substrate/srml/system/Cargo.toml +++ b/substrate/srml/system/Cargo.toml @@ -14,7 +14,7 @@ runtime-io ={ package = "sr-io", path = "../../core/sr-io", default-features = f sr-primitives = { path = "../../core/sr-primitives", default-features = false } sr-version = { path = "../../core/sr-version", default-features = false } support = { package = "srml-support", path = "../support", default-features = false } -impl-trait-for-tuples = "0.1.2" +impl-trait-for-tuples = "0.1.3" [dev-dependencies] criterion = "0.2.11" diff --git a/substrate/srml/timestamp/Cargo.toml b/substrate/srml/timestamp/Cargo.toml index 939fb72566..d8eab64f9f 100644 --- a/substrate/srml/timestamp/Cargo.toml +++ b/substrate/srml/timestamp/Cargo.toml @@ -12,7 +12,7 @@ sr-primitives = { path = "../../core/sr-primitives", default-features = false } inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false } support = { package = "srml-support", path = "../support", default-features = false } system = { package = "srml-system", path = "../system", default-features = false } -impl-trait-for-tuples = "0.1.2" +impl-trait-for-tuples = "0.1.3" [dev-dependencies] runtime-io ={ package = "sr-io", path = "../../core/sr-io" }