Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Serialize & Deserialize to umbrella crate derive module #7764

Merged
1 change: 1 addition & 0 deletions Cargo.lock

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

17 changes: 17 additions & 0 deletions prdoc/pr_7764.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: Add Serialize & Deserialize to umbrella crate derive module

doc:
- audience: Runtime Dev
description: |
This PR adds serde::Serialize and serde::Deserialize to the frame umbrella crate
`derive` and indirectly `prelude` modules. They can now be accessed through those.
Note: serde will still need to be added as a dependency in consuming crates. That or
you'll need to specify th `#[serde(crate = "PATH_TO_SERDE::serde")]` attribute at the
location where Serialize/Deserialize are used.

crates:
- name: polkadot-sdk-frame
bump: patch
2 changes: 2 additions & 0 deletions substrate/frame/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ codec = { features = [
scale-info = { features = [
"derive",
], workspace = true }
serde = { workspace = true }

# primitive deps, used for developing FRAME pallets.
sp-arithmetic = { workspace = true }
Expand Down Expand Up @@ -95,6 +96,7 @@ std = [
"frame-try-runtime?/std",
"log/std",
"scale-info/std",
"serde/std",
"sp-api?/std",
"sp-arithmetic/std",
"sp-block-builder?/std",
Expand Down
7 changes: 7 additions & 0 deletions substrate/frame/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,13 @@ pub mod derive {
PartialOrdNoBound, RuntimeDebugNoBound,
};
pub use scale_info::TypeInfo;
pub use serde;
/// The `serde` `Serialize`/`Deserialize` derive macros and traits.
///
/// You will either need to add `serde` as a dependency in your crate's `Cargo.toml`
/// or specify the `#[serde(crate = "PATH_TO_THIS_CRATE::serde")]` attribute that points
/// to the path where serde can be found.
pub use serde::{Deserialize, Serialize};
pub use sp_runtime::RuntimeDebug;
}

Expand Down
Loading