Skip to content

Commit

Permalink
Remove serde requirement from FRAME macros (paritytech#8628)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
bkchr and gui1117 authored Apr 16, 2021
1 parent 0ce623a commit 982df17
Show file tree
Hide file tree
Showing 43 changed files with 29 additions and 128 deletions.
36 changes: 0 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions bin/node-template/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions bin/node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions frame/assets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand All @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions frame/atomic-swap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions frame/aura/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions frame/authority-discovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -35,7 +34,6 @@ std = [
"sp-authority-discovery/std",
"codec/std",
"sp-std/std",
"serde",
"pallet-session/std",
"sp-runtime/std",
"frame-support/std",
Expand Down
2 changes: 0 additions & 2 deletions frame/babe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down Expand Up @@ -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",
Expand Down
Loading

0 comments on commit 982df17

Please sign in to comment.