From 982df173190685bb18b7ed46b860e36387b9a7a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 16 Apr 2021 12:42:37 +0200 Subject: [PATCH] Remove `serde` requirement from FRAME macros (#8628) * Remove `serde` requirement from FRAME macros Currently there is some implicit requirement on `serde` being present in the `Cargo.toml` of a pallet when `GenesisConfig` is used. This pr removes this requirement by using the serde attribute `serde(crate = "..")`. * build a unique reexport of serde in impl_opaque_keys, by abusing paste doc concatenation * Optimize Co-authored-by: thiolliere --- Cargo.lock | 36 ------------------- bin/node-template/runtime/Cargo.toml | 2 -- bin/node/runtime/Cargo.toml | 2 -- frame/assets/Cargo.toml | 2 -- frame/atomic-swap/Cargo.toml | 2 -- frame/aura/Cargo.toml | 2 -- frame/authority-discovery/Cargo.toml | 2 -- frame/babe/Cargo.toml | 2 -- frame/balances/Cargo.toml | 2 -- frame/bounties/Cargo.toml | 2 -- frame/collective/Cargo.toml | 2 -- .../election-provider-multi-phase/Cargo.toml | 2 -- frame/elections-phragmen/Cargo.toml | 2 -- frame/elections/Cargo.toml | 2 -- frame/example-offchain-worker/Cargo.toml | 2 -- frame/example/Cargo.toml | 2 -- frame/executive/Cargo.toml | 2 -- frame/gilt/Cargo.toml | 2 -- frame/grandpa/Cargo.toml | 2 -- frame/identity/Cargo.toml | 2 -- frame/im-online/Cargo.toml | 2 -- frame/indices/Cargo.toml | 2 -- frame/membership/Cargo.toml | 2 -- frame/merkle-mountain-range/Cargo.toml | 2 -- frame/multisig/Cargo.toml | 2 -- frame/nicks/Cargo.toml | 2 -- frame/node-authorization/Cargo.toml | 2 -- frame/proxy/Cargo.toml | 2 -- frame/recovery/Cargo.toml | 2 -- frame/scheduler/Cargo.toml | 2 -- frame/scored-pool/Cargo.toml | 2 -- frame/session/Cargo.toml | 2 -- frame/society/Cargo.toml | 2 -- frame/staking/src/lib.rs | 6 ++-- frame/sudo/Cargo.toml | 2 -- .../src/pallet/expand/genesis_config.rs | 3 ++ .../src/storage/genesis_config/mod.rs | 2 ++ frame/support/src/genesis_config.rs | 3 ++ frame/timestamp/Cargo.toml | 2 -- frame/treasury/src/lib.rs | 4 +-- frame/utility/Cargo.toml | 2 -- frame/vesting/Cargo.toml | 2 -- primitives/runtime/src/traits.rs | 31 +++++++++------- 43 files changed, 29 insertions(+), 128 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 14fd4778c639a..cec17f7f96766 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1777,7 +1777,6 @@ dependencies = [ "pallet-indices", "pallet-transaction-payment", "parity-scale-codec", - "serde", "sp-core", "sp-inherents", "sp-io", @@ -4323,7 +4322,6 @@ dependencies = [ "pallet-utility", "pallet-vesting", "parity-scale-codec", - "serde", "sp-api", "sp-authority-discovery", "sp-block-builder", @@ -4402,7 +4400,6 @@ dependencies = [ "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", - "serde", "sp-api", "sp-block-builder", "sp-consensus-aura", @@ -4616,7 +4613,6 @@ dependencies = [ "frame-system", "pallet-balances", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -4631,7 +4627,6 @@ dependencies = [ "frame-system", "pallet-balances", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -4649,7 +4644,6 @@ dependencies = [ "pallet-timestamp", "parity-scale-codec", "parking_lot 0.11.1", - "serde", "sp-application-crypto", "sp-consensus-aura", "sp-core", @@ -4666,7 +4660,6 @@ dependencies = [ "frame-system", "pallet-session", "parity-scale-codec", - "serde", "sp-application-crypto", "sp-authority-discovery", "sp-core", @@ -4710,7 +4703,6 @@ dependencies = [ "pallet-staking-reward-curve", "pallet-timestamp", "parity-scale-codec", - "serde", "sp-application-crypto", "sp-consensus-babe", "sp-consensus-vrf", @@ -4732,7 +4724,6 @@ dependencies = [ "log", "pallet-transaction-payment", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -4749,7 +4740,6 @@ dependencies = [ "pallet-balances", "pallet-treasury", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -4768,7 +4758,6 @@ dependencies = [ "log", "pallet-balances", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -4893,7 +4882,6 @@ dependencies = [ "parking_lot 0.11.1", "paste 1.0.4", "rand 0.7.3", - "serde", "sp-arithmetic", "sp-core", "sp-io", @@ -4914,7 +4902,6 @@ dependencies = [ "hex-literal", "pallet-balances", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -4932,7 +4919,6 @@ dependencies = [ "log", "pallet-balances", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-npos-elections", @@ -4951,7 +4937,6 @@ dependencies = [ "log", "pallet-balances", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -4967,7 +4952,6 @@ dependencies = [ "lite-json", "log", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-keystore", @@ -4999,7 +4983,6 @@ dependencies = [ "frame-system", "pallet-balances", "parity-scale-codec", - "serde", "sp-arithmetic", "sp-core", "sp-io", @@ -5025,7 +5008,6 @@ dependencies = [ "pallet-staking-reward-curve", "pallet-timestamp", "parity-scale-codec", - "serde", "sp-application-crypto", "sp-core", "sp-finality-grandpa", @@ -5047,7 +5029,6 @@ dependencies = [ "frame-system", "pallet-balances", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -5065,7 +5046,6 @@ dependencies = [ "pallet-authorship", "pallet-session", "parity-scale-codec", - "serde", "sp-application-crypto", "sp-core", "sp-io", @@ -5083,7 +5063,6 @@ dependencies = [ "frame-system", "pallet-balances", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-keyring", @@ -5115,7 +5094,6 @@ dependencies = [ "frame-support", "frame-system", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -5134,7 +5112,6 @@ dependencies = [ "hex-literal", "pallet-mmr-primitives", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -5184,7 +5161,6 @@ dependencies = [ "frame-system", "pallet-balances", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -5199,7 +5175,6 @@ dependencies = [ "frame-system", "pallet-balances", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -5214,7 +5189,6 @@ dependencies = [ "frame-system", "log", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -5274,7 +5248,6 @@ dependencies = [ "pallet-balances", "pallet-utility", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -5305,7 +5278,6 @@ dependencies = [ "frame-system", "pallet-balances", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -5321,7 +5293,6 @@ dependencies = [ "frame-system", "log", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -5337,7 +5308,6 @@ dependencies = [ "frame-system", "pallet-balances", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -5354,7 +5324,6 @@ dependencies = [ "lazy_static", "pallet-timestamp", "parity-scale-codec", - "serde", "sp-application-crypto", "sp-core", "sp-io", @@ -5398,7 +5367,6 @@ dependencies = [ "pallet-balances", "parity-scale-codec", "rand_chacha 0.2.2", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -5463,7 +5431,6 @@ dependencies = [ "frame-support", "frame-system", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -5494,7 +5461,6 @@ dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", - "serde", "sp-core", "sp-inherents", "sp-io", @@ -5592,7 +5558,6 @@ dependencies = [ "frame-system", "pallet-balances", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -5610,7 +5575,6 @@ dependencies = [ "hex-literal", "pallet-balances", "parity-scale-codec", - "serde", "sp-core", "sp-io", "sp-runtime", diff --git a/bin/node-template/runtime/Cargo.toml b/bin/node-template/runtime/Cargo.toml index 5bba2a4e970b0..8f7d39f18bc4d 100644 --- a/bin/node-template/runtime/Cargo.toml +++ b/bin/node-template/runtime/Cargo.toml @@ -23,7 +23,6 @@ frame-system = { version = "3.0.0", default-features = false, path = "../../../f pallet-timestamp = { version = "3.0.0", default-features = false, path = "../../../frame/timestamp" } pallet-transaction-payment = { version = "3.0.0", default-features = false, path = "../../../frame/transaction-payment" } frame-executive = { version = "3.0.0", default-features = false, path = "../../../frame/executive" } -serde = { version = "1.0.101", optional = true, features = ["derive"] } sp-api = { version = "3.0.0", default-features = false, path = "../../../primitives/api" } sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "3.0.0"} sp-consensus-aura = { version = "0.9.0", default-features = false, path = "../../../primitives/consensus/aura" } @@ -67,7 +66,6 @@ std = [ "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", - "serde", "sp-api/std", "sp-block-builder/std", "sp-consensus-aura/std", diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index f0cad60f2614d..edf7109bacb77 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -15,7 +15,6 @@ targets = ["x86_64-unknown-linux-gnu"] # third-party dependencies codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.102", optional = true } static_assertions = "1.1.0" hex-literal = { version = "0.3.1", optional = true } log = { version = "0.4.14", default-features = false } @@ -133,7 +132,6 @@ std = [ "sp-core/std", "pallet-randomness-collective-flip/std", "sp-std/std", - "serde", "pallet-session/std", "sp-api/std", "sp-runtime/std", diff --git a/frame/assets/Cargo.toml b/frame/assets/Cargo.toml index b62e8bac8ccc6..7137cf1d789a2 100644 --- a/frame/assets/Cargo.toml +++ b/frame/assets/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } # Needed for various traits. In our case, `OnFinalize`. @@ -33,7 +32,6 @@ pallet-balances = { version = "3.0.0", path = "../balances" } [features] default = ["std"] std = [ - "serde", "codec/std", "sp-std/std", "sp-runtime/std", diff --git a/frame/atomic-swap/Cargo.toml b/frame/atomic-swap/Cargo.toml index a3b62d65e56a3..4fd1284893f99 100644 --- a/frame/atomic-swap/Cargo.toml +++ b/frame/atomic-swap/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } frame-support = { version = "3.0.0", default-features = false, path = "../support" } frame-system = { version = "3.0.0", default-features = false, path = "../system" } @@ -28,7 +27,6 @@ pallet-balances = { version = "3.0.0", path = "../balances" } [features] default = ["std"] std = [ - "serde", "codec/std", "frame-support/std", "frame-system/std", diff --git a/frame/aura/Cargo.toml b/frame/aura/Cargo.toml index 6cae6c94c9a89..5b247b008de2f 100644 --- a/frame/aura/Cargo.toml +++ b/frame/aura/Cargo.toml @@ -16,7 +16,6 @@ targets = ["x86_64-unknown-linux-gnu"] sp-application-crypto = { version = "3.0.0", default-features = false, path = "../../primitives/application-crypto" } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } -serde = { version = "1.0.101", optional = true } pallet-session = { version = "3.0.0", default-features = false, path = "../session" } sp-runtime = { version = "3.0.0", default-features = false, path = "../../primitives/runtime" } frame-support = { version = "3.0.0", default-features = false, path = "../support" } @@ -36,7 +35,6 @@ std = [ "sp-application-crypto/std", "codec/std", "sp-std/std", - "serde", "sp-runtime/std", "frame-support/std", "sp-consensus-aura/std", diff --git a/frame/authority-discovery/Cargo.toml b/frame/authority-discovery/Cargo.toml index 85844cf716f03..25fec9118230e 100644 --- a/frame/authority-discovery/Cargo.toml +++ b/frame/authority-discovery/Cargo.toml @@ -17,7 +17,6 @@ sp-authority-discovery = { version = "3.0.0", default-features = false, path = " sp-application-crypto = { version = "3.0.0", default-features = false, path = "../../primitives/application-crypto" } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } -serde = { version = "1.0.101", optional = true } pallet-session = { version = "3.0.0", features = ["historical" ], path = "../session", default-features = false } sp-runtime = { version = "3.0.0", default-features = false, path = "../../primitives/runtime" } frame-support = { version = "3.0.0", default-features = false, path = "../support" } @@ -35,7 +34,6 @@ std = [ "sp-authority-discovery/std", "codec/std", "sp-std/std", - "serde", "pallet-session/std", "sp-runtime/std", "frame-support/std", diff --git a/frame/babe/Cargo.toml b/frame/babe/Cargo.toml index f7bebce98acf3..64497eafe715c 100644 --- a/frame/babe/Cargo.toml +++ b/frame/babe/Cargo.toml @@ -20,7 +20,6 @@ frame-system = { version = "3.0.0", default-features = false, path = "../system" pallet-authorship = { version = "3.0.0", default-features = false, path = "../authorship" } pallet-session = { version = "3.0.0", default-features = false, path = "../session" } pallet-timestamp = { version = "3.0.0", default-features = false, path = "../timestamp" } -serde = { version = "1.0.101", optional = true } sp-application-crypto = { version = "3.0.0", default-features = false, path = "../../primitives/application-crypto" } sp-consensus-babe = { version = "0.9.0", default-features = false, path = "../../primitives/consensus/babe" } sp-consensus-vrf = { version = "0.9.0", default-features = false, path = "../../primitives/consensus/vrf" } @@ -49,7 +48,6 @@ std = [ "pallet-authorship/std", "pallet-session/std", "pallet-timestamp/std", - "serde", "sp-application-crypto/std", "sp-consensus-babe/std", "sp-consensus-vrf/std", diff --git a/frame/balances/Cargo.toml b/frame/balances/Cargo.toml index 22c4ef0976f5f..116a52151583a 100644 --- a/frame/balances/Cargo.toml +++ b/frame/balances/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } sp-runtime = { version = "3.0.0", default-features = false, path = "../../primitives/runtime" } @@ -30,7 +29,6 @@ pallet-transaction-payment = { version = "3.0.0", path = "../transaction-payment [features] default = ["std"] std = [ - "serde", "codec/std", "sp-std/std", "sp-runtime/std", diff --git a/frame/bounties/Cargo.toml b/frame/bounties/Cargo.toml index ff1a3a6807098..1845f77e97a9a 100644 --- a/frame/bounties/Cargo.toml +++ b/frame/bounties/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } sp-runtime = { version = "3.0.0", default-features = false, path = "../../primitives/runtime" } @@ -32,7 +31,6 @@ pallet-balances = { version = "3.0.0", path = "../balances" } [features] default = ["std"] std = [ - "serde", "codec/std", "sp-std/std", "sp-runtime/std", diff --git a/frame/collective/Cargo.toml b/frame/collective/Cargo.toml index b8f825cc52931..c4940c87f827b 100644 --- a/frame/collective/Cargo.toml +++ b/frame/collective/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } sp-core = { version = "3.0.0", default-features = false, path = "../../primitives/core" } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } @@ -34,7 +33,6 @@ std = [ "codec/std", "sp-core/std", "sp-std/std", - "serde", "sp-io/std", "frame-support/std", "sp-runtime/std", diff --git a/frame/election-provider-multi-phase/Cargo.toml b/frame/election-provider-multi-phase/Cargo.toml index 4b5178faa8e86..dcb9c9b0e75b6 100644 --- a/frame/election-provider-multi-phase/Cargo.toml +++ b/frame/election-provider-multi-phase/Cargo.toml @@ -14,7 +14,6 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] static_assertions = "1.1.0" -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } log = { version = "0.4.14", default-features = false } @@ -48,7 +47,6 @@ frame-benchmarking = { version = "3.1.0", path = "../benchmarking" } [features] default = ["std"] std = [ - "serde", "codec/std", "log/std", diff --git a/frame/elections-phragmen/Cargo.toml b/frame/elections-phragmen/Cargo.toml index 89723cb85fbe1..32ae9968c7bf1 100644 --- a/frame/elections-phragmen/Cargo.toml +++ b/frame/elections-phragmen/Cargo.toml @@ -14,7 +14,6 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.101", optional = true } sp-runtime = { version = "3.0.0", default-features = false, path = "../../primitives/runtime" } sp-npos-elections = { version = "3.0.0", default-features = false, path = "../../primitives/npos-elections" } frame-support = { version = "3.0.0", default-features = false, path = "../support" } @@ -33,7 +32,6 @@ substrate-test-utils = { version = "3.0.0", path = "../../test-utils" } [features] default = ["std"] std = [ - "serde", "codec/std", "frame-support/std", "sp-runtime/std", diff --git a/frame/elections/Cargo.toml b/frame/elections/Cargo.toml index ac3c709300f51..d4b84f5bb1565 100644 --- a/frame/elections/Cargo.toml +++ b/frame/elections/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } sp-core = { version = "3.0.0", default-features = false, path = "../../primitives/core" } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } @@ -32,7 +31,6 @@ std = [ "codec/std", "sp-core/std", "sp-std/std", - "serde", "sp-io/std", "frame-support/std", "sp-runtime/std", diff --git a/frame/example-offchain-worker/Cargo.toml b/frame/example-offchain-worker/Cargo.toml index 3718da643da64..ea9fb9699ec64 100644 --- a/frame/example-offchain-worker/Cargo.toml +++ b/frame/example-offchain-worker/Cargo.toml @@ -16,7 +16,6 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } frame-support = { version = "3.0.0", default-features = false, path = "../support" } frame-system = { version = "3.0.0", default-features = false, path = "../system" } -serde = { version = "1.0.101", optional = true } sp-core = { version = "3.0.0", default-features = false, path = "../../primitives/core" } sp-keystore = { version = "0.9.0", path = "../../primitives/keystore", optional = true } sp-io = { version = "3.0.0", default-features = false, path = "../../primitives/io" } @@ -31,7 +30,6 @@ std = [ "codec/std", "frame-support/std", "frame-system/std", - "serde", "lite-json/std", "sp-core/std", "sp-io/std", diff --git a/frame/example/Cargo.toml b/frame/example/Cargo.toml index e24616bc84cf3..258648b52e5b7 100644 --- a/frame/example/Cargo.toml +++ b/frame/example/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } frame-support = { version = "3.0.0", default-features = false, path = "../support" } frame-system = { version = "3.0.0", default-features = false, path = "../system" } @@ -36,7 +35,6 @@ std = [ "frame-system/std", "log/std", "pallet-balances/std", - "serde", "sp-io/std", "sp-runtime/std", "sp-std/std" diff --git a/frame/executive/Cargo.toml b/frame/executive/Cargo.toml index 97c5a5ffdc765..a923f926a0960 100644 --- a/frame/executive/Cargo.toml +++ b/frame/executive/Cargo.toml @@ -16,7 +16,6 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } frame-support = { version = "3.0.0", default-features = false, path = "../support" } frame-system = { version = "3.0.0", default-features = false, path = "../system" } -serde = { version = "1.0.101", optional = true } sp-runtime = { version = "3.0.0", default-features = false, path = "../../primitives/runtime" } sp-tracing = { version = "3.0.0", default-features = false, path = "../../primitives/tracing" } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } @@ -42,7 +41,6 @@ std = [ "codec/std", "frame-support/std", "frame-system/std", - "serde", "sp-core/std", "sp-runtime/std", "sp-tracing/std", diff --git a/frame/gilt/Cargo.toml b/frame/gilt/Cargo.toml index 4df0dc49aaf93..0b40f6ad4d6da 100644 --- a/frame/gilt/Cargo.toml +++ b/frame/gilt/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } sp-runtime = { version = "3.0.0", default-features = false, path = "../../primitives/runtime" } @@ -30,7 +29,6 @@ pallet-balances = { version = "3.0.0", path = "../balances" } [features] default = ["std"] std = [ - "serde", "codec/std", "sp-std/std", "sp-runtime/std", diff --git a/frame/grandpa/Cargo.toml b/frame/grandpa/Cargo.toml index 547e3966d52a4..a602e8b6daddf 100644 --- a/frame/grandpa/Cargo.toml +++ b/frame/grandpa/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } sp-application-crypto = { version = "3.0.0", default-features = false, path = "../../primitives/application-crypto" } sp-core = { version = "3.0.0", default-features = false, path = "../../primitives/core" } @@ -44,7 +43,6 @@ frame-election-provider-support = { version = "3.0.0", path = "../election-provi [features] default = ["std"] std = [ - "serde", "codec/std", "frame-benchmarking/std", "sp-application-crypto/std", diff --git a/frame/identity/Cargo.toml b/frame/identity/Cargo.toml index 08109fda2584c..fce79c56f80a9 100644 --- a/frame/identity/Cargo.toml +++ b/frame/identity/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } @@ -30,7 +29,6 @@ pallet-balances = { version = "3.0.0", path = "../balances" } [features] default = ["std"] std = [ - "serde", "codec/std", "sp-std/std", "sp-io/std", diff --git a/frame/im-online/Cargo.toml b/frame/im-online/Cargo.toml index 4c5b4a8863bcd..2e816a6bb8564 100644 --- a/frame/im-online/Cargo.toml +++ b/frame/im-online/Cargo.toml @@ -18,7 +18,6 @@ pallet-authorship = { version = "3.0.0", default-features = false, path = "../au codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } sp-core = { version = "3.0.0", default-features = false, path = "../../primitives/core" } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } -serde = { version = "1.0.101", optional = true } sp-io = { version = "3.0.0", default-features = false, path = "../../primitives/io" } sp-runtime = { version = "3.0.0", default-features = false, path = "../../primitives/runtime" } sp-staking = { version = "3.0.0", default-features = false, path = "../../primitives/staking" } @@ -39,7 +38,6 @@ std = [ "codec/std", "sp-core/std", "sp-std/std", - "serde", "sp-io/std", "sp-runtime/std", "sp-staking/std", diff --git a/frame/indices/Cargo.toml b/frame/indices/Cargo.toml index ce9b2053ff184..4b60ec8bc3ca8 100644 --- a/frame/indices/Cargo.toml +++ b/frame/indices/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } sp-keyring = { version = "3.0.0", optional = true, path = "../../primitives/keyring" } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } @@ -31,7 +30,6 @@ pallet-balances = { version = "3.0.0", path = "../balances" } [features] default = ["std"] std = [ - "serde", "sp-keyring", "codec/std", "sp-core/std", diff --git a/frame/membership/Cargo.toml b/frame/membership/Cargo.toml index 37e7aa2cb8248..b11e0a2b68e45 100644 --- a/frame/membership/Cargo.toml +++ b/frame/membership/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } sp-io = { version = "3.0.0", default-features = false, path = "../../primitives/io" } @@ -27,7 +26,6 @@ sp-core = { version = "3.0.0", path = "../../primitives/core" } [features] default = ["std"] std = [ - "serde", "codec/std", "sp-runtime/std", "sp-std/std", diff --git a/frame/merkle-mountain-range/Cargo.toml b/frame/merkle-mountain-range/Cargo.toml index 8861ba5c0c8b9..6ca451c4ab489 100644 --- a/frame/merkle-mountain-range/Cargo.toml +++ b/frame/merkle-mountain-range/Cargo.toml @@ -18,7 +18,6 @@ frame-support = { version = "3.0.0", default-features = false, path = "../suppor frame-system = { version = "3.0.0", default-features = false, path = "../system" } mmr-lib = { package = "ckb-merkle-mountain-range", default-features = false, version = "0.3.1" } pallet-mmr-primitives = { version = "3.0.0", default-features = false, path = "./primitives" } -serde = { version = "1.0.101", optional = true } sp-core = { version = "3.0.0", default-features = false, path = "../../primitives/core" } sp-io = { version = "3.0.0", default-features = false, path = "../../primitives/io" } sp-runtime = { version = "3.0.0", default-features = false, path = "../../primitives/runtime" } @@ -37,7 +36,6 @@ std = [ "frame-system/std", "mmr-lib/std", "pallet-mmr-primitives/std", - "serde", "sp-core/std", "sp-io/std", "sp-runtime/std", diff --git a/frame/multisig/Cargo.toml b/frame/multisig/Cargo.toml index e48f80567f67a..7657f64c819fb 100644 --- a/frame/multisig/Cargo.toml +++ b/frame/multisig/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } frame-support = { version = "3.0.0", default-features = false, path = "../support" } frame-system = { version = "3.0.0", default-features = false, path = "../system" } @@ -31,7 +30,6 @@ pallet-balances = { version = "3.0.0", path = "../balances" } [features] default = ["std"] std = [ - "serde", "codec/std", "sp-runtime/std", "frame-support/std", diff --git a/frame/nicks/Cargo.toml b/frame/nicks/Cargo.toml index 6c8b609b401ca..12db6f905f2ec 100644 --- a/frame/nicks/Cargo.toml +++ b/frame/nicks/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } sp-io = { version = "3.0.0", default-features = false, path = "../../primitives/io" } @@ -28,7 +27,6 @@ pallet-balances = { version = "3.0.0", path = "../balances" } [features] default = ["std"] std = [ - "serde", "codec/std", "sp-std/std", "sp-io/std", diff --git a/frame/node-authorization/Cargo.toml b/frame/node-authorization/Cargo.toml index 786eb84d1e523..6e657758e8e99 100644 --- a/frame/node-authorization/Cargo.toml +++ b/frame/node-authorization/Cargo.toml @@ -12,7 +12,6 @@ description = "FRAME pallet for node authorization" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } frame-support = { version = "3.0.0", default-features = false, path = "../support" } frame-system = { version = "3.0.0", default-features = false, path = "../system" } @@ -25,7 +24,6 @@ log = { version = "0.4.14", default-features = false } [features] default = ["std"] std = [ - "serde", "codec/std", "frame-support/std", "frame-system/std", diff --git a/frame/proxy/Cargo.toml b/frame/proxy/Cargo.toml index 2934b9953b316..d8f7afe433cb3 100644 --- a/frame/proxy/Cargo.toml +++ b/frame/proxy/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } frame-support = { version = "3.0.0", default-features = false, path = "../support" } frame-system = { version = "3.0.0", default-features = false, path = "../system" } @@ -32,7 +31,6 @@ pallet-utility = { version = "3.0.0", path = "../utility" } [features] default = ["std"] std = [ - "serde", "codec/std", "sp-runtime/std", "frame-support/std", diff --git a/frame/recovery/Cargo.toml b/frame/recovery/Cargo.toml index 1f8003bd4d056..acfd2f613f839 100644 --- a/frame/recovery/Cargo.toml +++ b/frame/recovery/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } @@ -29,7 +28,6 @@ pallet-balances = { version = "3.0.0", path = "../balances" } [features] default = ["std"] std = [ - "serde", "codec/std", "sp-std/std", "sp-io/std", diff --git a/frame/scheduler/Cargo.toml b/frame/scheduler/Cargo.toml index 4d82133b6af9d..8fb5d148662b3 100644 --- a/frame/scheduler/Cargo.toml +++ b/frame/scheduler/Cargo.toml @@ -10,7 +10,6 @@ description = "FRAME example pallet" readme = "README.md" [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } frame-support = { version = "3.0.0", default-features = false, path = "../support" } frame-system = { version = "3.0.0", default-features = false, path = "../system" } @@ -28,7 +27,6 @@ substrate-test-utils = { version = "3.0.0", path = "../../test-utils" } [features] default = ["std"] std = [ - "serde", "codec/std", "sp-runtime/std", "frame-benchmarking/std", diff --git a/frame/scored-pool/Cargo.toml b/frame/scored-pool/Cargo.toml index 97e3a954d7e25..0b2f4a8198833 100644 --- a/frame/scored-pool/Cargo.toml +++ b/frame/scored-pool/Cargo.toml @@ -14,7 +14,6 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.101", optional = true } sp-io = { version = "3.0.0", default-features = false, path = "../../primitives/io" } sp-runtime = { version = "3.0.0", default-features = false, path = "../../primitives/runtime" } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } @@ -29,7 +28,6 @@ sp-core = { version = "3.0.0", path = "../../primitives/core" } default = ["std"] std = [ "codec/std", - "serde", "sp-io/std", "sp-runtime/std", "sp-std/std", diff --git a/frame/session/Cargo.toml b/frame/session/Cargo.toml index 52b8ebbdf4780..44e1f2f67858b 100644 --- a/frame/session/Cargo.toml +++ b/frame/session/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } sp-core = { version = "3.0.0", default-features = false, path = "../../primitives/core" } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } @@ -35,7 +34,6 @@ lazy_static = "1.4.0" default = ["std", "historical"] historical = ["sp-trie"] std = [ - "serde", "codec/std", "sp-std/std", "sp-io/std", diff --git a/frame/society/Cargo.toml b/frame/society/Cargo.toml index a3c6dcadab86d..f9c2990061985 100644 --- a/frame/society/Cargo.toml +++ b/frame/society/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } sp-runtime = { version = "3.0.0", default-features = false, path = "../../primitives/runtime" } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } @@ -31,7 +30,6 @@ pallet-balances = { version = "3.0.0", path = "../balances" } default = ["std"] std = [ "codec/std", - "serde", "sp-runtime/std", "rand_chacha/std", "sp-std/std", diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index c28dbc87bccdd..c938dceb76e49 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -313,8 +313,6 @@ use sp_staking::{ SessionIndex, offence::{OnOffenceHandler, OffenceDetails, Offence, ReportOffence, OffenceError}, }; -#[cfg(feature = "std")] -use sp_runtime::{Serialize, Deserialize}; use frame_system::{ self as system, ensure_signed, ensure_root, offchain::SendTransactionTypes, @@ -380,7 +378,7 @@ pub struct EraRewardPoints { /// Indicates the initial status of the staker. #[derive(RuntimeDebug)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub enum StakerStatus { /// Chilling. Idle, @@ -793,7 +791,7 @@ pub trait Config: frame_system::Config + SendTransactionTypes> { /// Mode of era-forcing. #[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub enum Forcing { /// Not forcing anything - just let whatever happen. NotForcing, diff --git a/frame/sudo/Cargo.toml b/frame/sudo/Cargo.toml index c1b841c30c6a3..a73dfaeb1d981 100644 --- a/frame/sudo/Cargo.toml +++ b/frame/sudo/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } sp-io = { version = "3.0.0", default-features = false, path = "../../primitives/io" } @@ -27,7 +26,6 @@ sp-core = { version = "3.0.0", path = "../../primitives/core" } [features] default = ["std"] std = [ - "serde", "codec/std", "sp-std/std", "sp-io/std", diff --git a/frame/support/procedural/src/pallet/expand/genesis_config.rs b/frame/support/procedural/src/pallet/expand/genesis_config.rs index cc35451b646f3..23ccdfa5ddc9a 100644 --- a/frame/support/procedural/src/pallet/expand/genesis_config.rs +++ b/frame/support/procedural/src/pallet/expand/genesis_config.rs @@ -29,6 +29,8 @@ pub fn expand_genesis_config(def: &mut Def) -> proc_macro2::TokenStream { let genesis_config_item = &mut def.item.content.as_mut() .expect("Checked by def parser").1[genesis_config.index]; + let serde_crate = format!("{}::serde", frame_support); + match genesis_config_item { syn::Item::Enum(syn::ItemEnum { attrs, ..}) | syn::Item::Struct(syn::ItemStruct { attrs, .. }) | @@ -50,6 +52,7 @@ pub fn expand_genesis_config(def: &mut Def) -> proc_macro2::TokenStream { attrs.push(syn::parse_quote!( #[serde(deny_unknown_fields)] )); attrs.push(syn::parse_quote!( #[serde(bound(serialize = ""))] )); attrs.push(syn::parse_quote!( #[serde(bound(deserialize = ""))] )); + attrs.push(syn::parse_quote!( #[serde(crate = #serde_crate)] )); }, _ => unreachable!("Checked by genesis_config parser"), } diff --git a/frame/support/procedural/src/storage/genesis_config/mod.rs b/frame/support/procedural/src/storage/genesis_config/mod.rs index 87dfabcefbaaa..6dfa5a13fe5b2 100644 --- a/frame/support/procedural/src/storage/genesis_config/mod.rs +++ b/frame/support/procedural/src/storage/genesis_config/mod.rs @@ -65,6 +65,7 @@ fn decl_genesis_config_and_impl_default( let genesis_struct = &genesis_config.genesis_struct; let genesis_impl = &genesis_config.genesis_impl; let genesis_where_clause = &genesis_config.genesis_where_clause; + let serde_crate = format!("{}::serde", scrate); quote!( /// Genesis config for the module, allow to build genesis storage. @@ -72,6 +73,7 @@ fn decl_genesis_config_and_impl_default( #[cfg(feature = "std")] #[serde(rename_all = "camelCase")] #[serde(deny_unknown_fields)] + #[serde(crate = #serde_crate)] #serde_bug_bound pub struct GenesisConfig#genesis_struct_decl #genesis_where_clause { #( #config_fields )* diff --git a/frame/support/src/genesis_config.rs b/frame/support/src/genesis_config.rs index 3f7f943603e42..e6ba86f9fe922 100644 --- a/frame/support/src/genesis_config.rs +++ b/frame/support/src/genesis_config.rs @@ -76,10 +76,13 @@ macro_rules! impl_outer_config { } $crate::paste::item! { + #[cfg(any(feature = "std", test))] + use $crate::serde as __genesis_config_serde_import__; #[cfg(any(feature = "std", test))] #[derive($crate::serde::Serialize, $crate::serde::Deserialize, Default)] #[serde(rename_all = "camelCase")] #[serde(deny_unknown_fields)] + #[serde(crate = "__genesis_config_serde_import__")] pub struct $main { $( pub [< $snake $(_ $instance )? >]: $config, diff --git a/frame/timestamp/Cargo.toml b/frame/timestamp/Cargo.toml index 01aa6ff3cf261..05ea8e40c6627 100644 --- a/frame/timestamp/Cargo.toml +++ b/frame/timestamp/Cargo.toml @@ -15,7 +15,6 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } sp-io = { version = "3.0.0", default-features = false, path = "../../primitives/io", optional = true } @@ -41,7 +40,6 @@ std = [ "sp-runtime/std", "frame-benchmarking/std", "frame-support/std", - "serde", "frame-system/std", "sp-timestamp/std", "log/std", diff --git a/frame/treasury/src/lib.rs b/frame/treasury/src/lib.rs index bda4c761b55cf..7de193dd69848 100644 --- a/frame/treasury/src/lib.rs +++ b/frame/treasury/src/lib.rs @@ -63,8 +63,6 @@ mod benchmarking; pub mod weights; -#[cfg(feature = "std")] -use serde::{Serialize, Deserialize}; use sp_std::prelude::*; use frame_support::{decl_module, decl_storage, decl_event, ensure, print, decl_error, PalletId}; use frame_support::traits::{ @@ -158,7 +156,7 @@ pub trait SpendFunds, I=DefaultInstance> { pub type ProposalIndex = u32; /// A spending proposal. -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] #[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)] pub struct Proposal { /// The account proposing it. diff --git a/frame/utility/Cargo.toml b/frame/utility/Cargo.toml index f55cff4d653c5..1eb92df4ecaa6 100644 --- a/frame/utility/Cargo.toml +++ b/frame/utility/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } frame-support = { version = "3.0.0", default-features = false, path = "../support" } frame-system = { version = "3.0.0", default-features = false, path = "../system" } @@ -31,7 +30,6 @@ pallet-balances = { version = "3.0.0", path = "../balances" } [features] default = ["std"] std = [ - "serde", "codec/std", "sp-runtime/std", "frame-support/std", diff --git a/frame/vesting/Cargo.toml b/frame/vesting/Cargo.toml index e1335237eb508..25890fea038de 100644 --- a/frame/vesting/Cargo.toml +++ b/frame/vesting/Cargo.toml @@ -13,7 +13,6 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" } @@ -32,7 +31,6 @@ hex-literal = "0.3.1" [features] default = ["std"] std = [ - "serde", "codec/std", "sp-std/std", "sp-runtime/std", diff --git a/primitives/runtime/src/traits.rs b/primitives/runtime/src/traits.rs index 2c4572ac35115..41820d8cb4a1c 100644 --- a/primitives/runtime/src/traits.rs +++ b/primitives/runtime/src/traits.rs @@ -1217,19 +1217,24 @@ macro_rules! impl_opaque_keys { )* } ) => { - $( #[ $attr ] )* - #[derive( - Default, Clone, PartialEq, Eq, - $crate::codec::Encode, - $crate::codec::Decode, - $crate::RuntimeDebug, - )] - #[cfg_attr(feature = "std", derive($crate::serde::Serialize, $crate::serde::Deserialize))] - pub struct $name { - $( - $( #[ $inner_attr ] )* - pub $field: <$type as $crate::BoundToRuntimeAppPublic>::Public, - )* + $crate::paste::paste! { + #[cfg(feature = "std")] + use $crate::serde as [< __opaque_keys_serde_import__ $name >]; + $( #[ $attr ] )* + #[derive( + Default, Clone, PartialEq, Eq, + $crate::codec::Encode, + $crate::codec::Decode, + $crate::RuntimeDebug, + )] + #[cfg_attr(feature = "std", derive($crate::serde::Serialize, $crate::serde::Deserialize))] + #[cfg_attr(feature = "std", serde(crate = "__opaque_keys_serde_import__" $name))] + pub struct $name { + $( + $( #[ $inner_attr ] )* + pub $field: <$type as $crate::BoundToRuntimeAppPublic>::Public, + )* + } } impl $name {