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:
Michal Kucharczyk
2023-05-20 09:34:23 +02:00
committed by GitHub
parent 5100a0376e
commit 613420a035
31 changed files with 149 additions and 173 deletions
+1 -7
View File
@@ -263,17 +263,11 @@ pub mod pallet {
StorageMap<_, Blake2_128Concat, T::AccountIndex, (T::AccountId, BalanceOf<T>, bool)>;
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub indices: Vec<(T::AccountIndex, T::AccountId)>,
}
#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self { indices: Default::default() }
}
}
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {