mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 11:27:58 +00:00
frame: Enable GenesisConfig in no_std (#14108)
* frame: Default for GenesisConfig in no_std
`Default` for `GenesisConfig` will be required for no_std in no native
runtime world. It must be possible to instantiate default GenesisConfig
for pallets and runtime.
* ".git/.scripts/commands/fmt/fmt.sh"
* hash69 in no_std reverted
* derive(DefaultNoBound) for GenesisConfig used when possible
* treasury: derive(Default)
* Cargo.lock update
* genesis_config: compiler error improved
When std feature is not enabled for pallet, the GenesisConfig will be
defined, but serde::{Serialize,Deserialize} traits will not be
implemented.
The compiler error indicates the reason of latter errors.
This is temporary and serde traits will be enabled with together with
`serde` support in frame.
---------
Co-authored-by: command-bot <>
This commit is contained in:
committed by
GitHub
parent
5100a0376e
commit
613420a035
@@ -94,15 +94,24 @@ pub fn expand_genesis_config(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
"]
|
||||
));
|
||||
}
|
||||
attrs.push(syn::parse_quote!( #[cfg(feature = "std")] ));
|
||||
attrs.push(syn::parse_quote!(
|
||||
#[derive(#frame_support::Serialize, #frame_support::Deserialize)]
|
||||
#[cfg_attr(feature = "std", derive(#frame_support::Serialize, #frame_support::Deserialize))]
|
||||
));
|
||||
attrs.push(syn::parse_quote!( #[serde(rename_all = "camelCase")] ));
|
||||
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)] ));
|
||||
attrs.push(
|
||||
syn::parse_quote!( #[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] ),
|
||||
);
|
||||
attrs.push(
|
||||
syn::parse_quote!( #[cfg_attr(feature = "std", serde(deny_unknown_fields))] ),
|
||||
);
|
||||
attrs.push(
|
||||
syn::parse_quote!( #[cfg_attr(feature = "std", serde(bound(serialize = "")))] ),
|
||||
);
|
||||
attrs.push(
|
||||
syn::parse_quote!( #[cfg_attr(feature = "std", serde(bound(deserialize = "")))] ),
|
||||
);
|
||||
attrs.push(
|
||||
syn::parse_quote!( #[cfg_attr(feature = "std", serde(crate = #serde_crate))] ),
|
||||
);
|
||||
},
|
||||
_ => unreachable!("Checked by genesis_config parser"),
|
||||
}
|
||||
@@ -126,7 +135,7 @@ pub fn expand_genesis_config(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
stringify!($pallet_name),
|
||||
"` does not have the std feature enabled, this will cause the `",
|
||||
$pallet_path,
|
||||
"::GenesisConfig` type to be undefined."
|
||||
"::GenesisConfig` type to not implement serde traits."
|
||||
));
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user