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 <gui.thiolliere@gmail.com>
This commit is contained in:
Bastian Köcher
2021-04-16 12:42:37 +02:00
committed by GitHub
parent 7527bd758c
commit c8136bd1df
43 changed files with 29 additions and 128 deletions
+1 -3
View File
@@ -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<T: Config<I>, 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<AccountId, Balance> {
/// The account proposing it.