pallets: implement Default for GenesisConfig in no_std (#7271)

* pallets: implement Default for GenesisConfig in no_std

This change is follow-up of: https://github.com/paritytech/substrate/pull/14108

It is a step towards: https://github.com/paritytech/substrate/issues/13334

* Cargo.lock updated

* update lockfile for {"substrate"}

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Michal Kucharczyk
2023-05-26 00:26:02 +02:00
committed by GitHub
parent 9535bc9437
commit 3d008cd074
7 changed files with 194 additions and 223 deletions
+2 -10
View File
@@ -18,7 +18,7 @@ use crate::{
configuration::{self, HostConfiguration},
dmp, ensure_parachain, initializer, paras,
};
use frame_support::{pallet_prelude::*, traits::ReservableCurrency};
use frame_support::{pallet_prelude::*, traits::ReservableCurrency, DefaultNoBound};
use frame_system::pallet_prelude::*;
use parity_scale_codec::{Decode, Encode};
use polkadot_parachain::primitives::HorizontalMessages;
@@ -435,17 +435,11 @@ pub mod pallet {
/// configuration pallet.
/// 2. `sender` and `recipient` must be valid paras.
#[pallet::genesis_config]
#[derive(DefaultNoBound)]
pub struct GenesisConfig {
preopen_hrmp_channels: Vec<(ParaId, ParaId, u32, u32)>,
}
#[cfg(feature = "std")]
impl Default for GenesisConfig {
fn default() -> Self {
GenesisConfig { preopen_hrmp_channels: Default::default() }
}
}
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig {
fn build(&self) {
@@ -621,7 +615,6 @@ pub mod pallet {
}
}
#[cfg(feature = "std")]
fn initialize_storage<T: Config>(preopen_hrmp_channels: &[(ParaId, ParaId, u32, u32)]) {
let host_config = configuration::Pallet::<T>::config();
for &(sender, recipient, max_capacity, max_message_size) in preopen_hrmp_channels {
@@ -634,7 +627,6 @@ fn initialize_storage<T: Config>(preopen_hrmp_channels: &[(ParaId, ParaId, u32,
<Pallet<T>>::process_hrmp_open_channel_requests(&host_config);
}
#[cfg(feature = "std")]
fn preopen_hrmp_channel<T: Config>(
sender: ParaId,
recipient: ParaId,