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
@@ -401,19 +401,13 @@ pub mod pallet {
}
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
pub fellows: Vec<T::AccountId>,
pub allies: Vec<T::AccountId>,
pub phantom: PhantomData<(T, I)>,
}
#[cfg(feature = "std")]
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
fn default() -> Self {
Self { fellows: Vec::new(), allies: Vec::new(), phantom: Default::default() }
}
}
#[pallet::genesis_build]
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
fn build(&self) {
+1 -11
View File
@@ -369,6 +369,7 @@ pub mod pallet {
>;
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
/// Genesis assets: id, owner, is_sufficient, min_balance
pub assets: Vec<(T::AssetId, T::AccountId, bool, T::Balance)>,
@@ -378,17 +379,6 @@ pub mod pallet {
pub accounts: Vec<(T::AssetId, T::AccountId, T::Balance)>,
}
#[cfg(feature = "std")]
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
fn default() -> Self {
Self {
assets: Default::default(),
metadata: Default::default(),
accounts: Default::default(),
}
}
}
#[pallet::genesis_build]
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
fn build(&self) {
+1 -7
View File
@@ -129,17 +129,11 @@ pub mod pallet {
pub(super) type CurrentSlot<T: Config> = StorageValue<_, Slot, ValueQuery>;
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub authorities: Vec<T::AuthorityId>,
}
#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self { authorities: Vec::new() }
}
}
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
@@ -59,7 +59,7 @@ pub mod pallet {
pub(super) type NextKeys<T: Config> =
StorageValue<_, WeakBoundedVec<AuthorityId, T::MaxAuthorities>, ValueQuery>;
#[cfg_attr(feature = "std", derive(Default))]
#[derive(Default)]
#[pallet::genesis_config]
pub struct GenesisConfig {
pub keys: Vec<AuthorityId>,
+1 -1
View File
@@ -314,7 +314,7 @@ pub mod pallet {
pub(super) type SkippedEpochs<T> =
StorageValue<_, BoundedVec<(u64, SessionIndex), ConstU32<100>>, ValueQuery>;
#[cfg_attr(feature = "std", derive(Default))]
#[derive(Default)]
#[pallet::genesis_config]
pub struct GenesisConfig {
pub authorities: Vec<(AuthorityId, BabeAuthorityWeight)>,
+1 -2
View File
@@ -456,7 +456,6 @@ pub mod pallet {
pub balances: Vec<(T::AccountId, T::Balance)>,
}
#[cfg(feature = "std")]
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
fn default() -> Self {
Self { balances: Default::default() }
@@ -483,7 +482,7 @@ pub mod pallet {
.iter()
.map(|(x, _)| x)
.cloned()
.collect::<std::collections::BTreeSet<_>>();
.collect::<sp_std::collections::btree_set::BTreeSet<_>>();
assert!(
endowed_accounts.len() == self.balances.len(),
-1
View File
@@ -166,7 +166,6 @@ pub mod pallet {
pub genesis_block: Option<BlockNumberFor<T>>,
}
#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
// BEEFY genesis will be first BEEFY-MANDATORY block,
+1 -7
View File
@@ -224,18 +224,12 @@ pub mod pallet {
}
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
pub phantom: PhantomData<I>,
pub members: Vec<T::AccountId>,
}
#[cfg(feature = "std")]
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
fn default() -> Self {
Self { phantom: Default::default(), members: Default::default() }
}
}
#[pallet::genesis_build]
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
fn build(&self) {
+1 -7
View File
@@ -439,17 +439,11 @@ pub mod pallet {
pub type MetadataOf<T: Config> = StorageMap<_, Blake2_128Concat, MetadataOwner, PreimageHash>;
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
_phantom: sp_std::marker::PhantomData<T>,
}
#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
GenesisConfig { _phantom: Default::default() }
}
}
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
@@ -711,17 +711,11 @@ pub mod pallet {
StorageMap<_, Twox64Concat, T::AccountId, Voter<T::AccountId, BalanceOf<T>>, ValueQuery>;
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub members: Vec<(T::AccountId, BalanceOf<T>)>,
}
#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self { members: Default::default() }
}
}
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
+1 -8
View File
@@ -618,20 +618,13 @@ pub mod pallet {
// The genesis config type.
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub dummy: T::Balance,
pub bar: Vec<(T::AccountId, T::Balance)>,
pub foo: T::Balance,
}
// The default value for the genesis config type.
#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self { dummy: Default::default(), bar: Default::default(), foo: Default::default() }
}
}
// The build of genesis for the pallet.
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
+1 -1
View File
@@ -333,7 +333,7 @@ pub mod pallet {
#[pallet::getter(fn session_for_set)]
pub(super) type SetIdSession<T: Config> = StorageMap<_, Twox64Concat, SetId, SessionIndex>;
#[cfg_attr(feature = "std", derive(Default))]
#[derive(Default)]
#[pallet::genesis_config]
pub struct GenesisConfig {
pub authorities: AuthorityList,
+1 -7
View File
@@ -442,17 +442,11 @@ pub mod pallet {
>;
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub keys: Vec<T::AuthorityId>,
}
#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
GenesisConfig { keys: Default::default() }
}
}
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
+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) {
+1 -7
View File
@@ -105,18 +105,12 @@ pub mod pallet {
pub type Prime<T: Config<I>, I: 'static = ()> = StorageValue<_, T::AccountId, OptionQuery>;
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
pub members: BoundedVec<T::AccountId, T::MaxMembers>,
pub phantom: PhantomData<I>,
}
#[cfg(feature = "std")]
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
fn default() -> Self {
Self { members: Default::default(), phantom: Default::default() }
}
}
#[pallet::genesis_build]
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
fn build(&self) {
@@ -109,17 +109,11 @@ pub mod pallet {
StorageMap<_, Blake2_128Concat, PeerId, BTreeSet<PeerId>, ValueQuery>;
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub nodes: Vec<(PeerId, T::AccountId)>,
}
#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self { nodes: Vec::new() }
}
}
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
@@ -1659,7 +1659,6 @@ pub mod pallet {
pub global_max_commission: Option<Perbill>,
}
#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self {
+1 -7
View File
@@ -249,18 +249,12 @@ pub mod pallet {
pub(crate) type MemberCount<T, I = ()> = StorageValue<_, u32, ValueQuery>;
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
pub pool: PoolT<T, I>,
pub member_count: u32,
}
#[cfg(feature = "std")]
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
fn default() -> Self {
Self { pool: Default::default(), member_count: Default::default() }
}
}
#[pallet::genesis_build]
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
fn build(&self) {
+1 -7
View File
@@ -414,17 +414,11 @@ pub mod pallet {
}
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub keys: Vec<(T::AccountId, T::ValidatorId, T::Keys)>,
}
#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self { keys: Default::default() }
}
}
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
+1 -11
View File
@@ -643,23 +643,13 @@ pub mod pallet {
}
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
pub pot: BalanceOf<T, I>,
pub members: Vec<T::AccountId>,
pub max_members: u32,
}
#[cfg(feature = "std")]
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
fn default() -> Self {
Self {
pot: Default::default(),
members: Default::default(),
max_members: Default::default(),
}
}
}
#[pallet::genesis_build]
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
fn build(&self) {
+1 -19
View File
@@ -579,6 +579,7 @@ pub mod pallet {
pub(crate) type ChillThreshold<T: Config> = StorageValue<_, Percent, OptionQuery>;
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub validator_count: u32,
pub minimum_validator_count: u32,
@@ -594,25 +595,6 @@ pub mod pallet {
pub max_nominator_count: Option<u32>,
}
#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
GenesisConfig {
validator_count: Default::default(),
minimum_validator_count: Default::default(),
invulnerables: Default::default(),
force_era: Default::default(),
slash_reward_fraction: Default::default(),
canceled_payout: Default::default(),
stakers: Default::default(),
min_nominator_bond: Default::default(),
min_validator_bond: Default::default(),
max_validator_count: None,
max_nominator_count: None,
}
}
}
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
+1 -7
View File
@@ -282,18 +282,12 @@ pub mod pallet {
pub(super) type Key<T: Config> = StorageValue<_, T::AccountId, OptionQuery>;
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
/// The `AccountId` of the sudo key.
pub key: Option<T::AccountId>,
}
#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self { key: None }
}
}
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
@@ -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."
));
};
}
@@ -37,7 +37,7 @@ pub mod pallet {
pub type Value<T> = StorageValue<_, u32>;
#[pallet::genesis_config]
#[cfg_attr(feature = "std", derive(Default))]
#[derive(Default)]
pub struct GenesisConfig {}
#[pallet::genesis_build]
@@ -1,4 +1,4 @@
error: `Pallet` does not have the std feature enabled, this will cause the `test_pallet::GenesisConfig` type to be undefined.
error: `Pallet` does not have the std feature enabled, this will cause the `test_pallet::GenesisConfig` type to not implement serde traits.
--> tests/construct_runtime_ui/no_std_genesis_config.rs:40:1
|
40 | / construct_runtime! {
@@ -12,7 +12,7 @@ error: `Pallet` does not have the std feature enabled, this will cause the `test
|
= note: this error originates in the macro `test_pallet::__substrate_genesis_config_check::is_std_enabled_for_genesis` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `GenesisConfig` in crate `test_pallet`
error[E0277]: the trait bound `frame_support_test_pallet::GenesisConfig: Serialize` is not satisfied
--> tests/construct_runtime_ui/no_std_genesis_config.rs:40:1
|
40 | / construct_runtime! {
@@ -22,10 +22,109 @@ error[E0412]: cannot find type `GenesisConfig` in crate `test_pallet`
... |
48 | | }
49 | | }
| |_^ not found in `test_pallet`
| |_^ the trait `Serialize` is not implemented for `frame_support_test_pallet::GenesisConfig`
|
= help: the following other types implement trait `Serialize`:
&'a T
&'a mut T
()
(T0, T1)
(T0, T1, T2)
(T0, T1, T2, T3)
(T0, T1, T2, T3, T4)
(T0, T1, T2, T3, T4, T5)
and $N others
note: required by a bound in `hidden_include::serde::ser::SerializeStruct::serialize_field`
--> $CARGO/serde-1.0.162/src/ser/mod.rs
|
| T: Serialize;
| ^^^^^^^^^ required by this bound in `SerializeStruct::serialize_field`
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this struct
error[E0277]: the trait bound `frame_support_test_pallet::GenesisConfig: Deserialize<'_>` is not satisfied
--> tests/construct_runtime_ui/no_std_genesis_config.rs:47:3
|
1 | use frame_system::GenesisConfig;
47 | Pallet: test_pallet::{Pallet, Config},
| ^^^^^^ the trait `Deserialize<'_>` is not implemented for `frame_support_test_pallet::GenesisConfig`
|
= help: the following other types implement trait `Deserialize<'de>`:
<&'a [u8] as Deserialize<'de>>
<&'a std::path::Path as Deserialize<'de>>
<&'a str as Deserialize<'de>>
<() as Deserialize<'de>>
<(T0, T1) as Deserialize<'de>>
<(T0, T1, T2) as Deserialize<'de>>
<(T0, T1, T2, T3) as Deserialize<'de>>
<(T0, T1, T2, T3, T4) as Deserialize<'de>>
and $N others
note: required by a bound in `next_element`
--> $CARGO/serde-1.0.162/src/de/mod.rs
|
| T: Deserialize<'de>,
| ^^^^^^^^^^^^^^^^ required by this bound in `SeqAccess::next_element`
error[E0277]: the trait bound `frame_support_test_pallet::GenesisConfig: Deserialize<'_>` is not satisfied
--> tests/construct_runtime_ui/no_std_genesis_config.rs:47:3
|
47 | Pallet: test_pallet::{Pallet, Config},
| ^^^^^^ the trait `Deserialize<'_>` is not implemented for `frame_support_test_pallet::GenesisConfig`
|
= help: the following other types implement trait `Deserialize<'de>`:
<&'a [u8] as Deserialize<'de>>
<&'a std::path::Path as Deserialize<'de>>
<&'a str as Deserialize<'de>>
<() as Deserialize<'de>>
<(T0, T1) as Deserialize<'de>>
<(T0, T1, T2) as Deserialize<'de>>
<(T0, T1, T2, T3) as Deserialize<'de>>
<(T0, T1, T2, T3, T4) as Deserialize<'de>>
and $N others
note: required by a bound in `next_value`
--> $CARGO/serde-1.0.162/src/de/mod.rs
|
| V: Deserialize<'de>,
| ^^^^^^^^^^^^^^^^ required by this bound in `MapAccess::next_value`
error[E0277]: the trait bound `frame_support_test_pallet::GenesisConfig: Deserialize<'_>` is not satisfied
--> tests/construct_runtime_ui/no_std_genesis_config.rs:40:1
|
40 | / construct_runtime! {
41 | | pub struct Runtime where
42 | | Block = Block,
43 | | NodeBlock = Block,
... |
48 | | }
49 | | }
| |_^ the trait `Deserialize<'_>` is not implemented for `frame_support_test_pallet::GenesisConfig`
|
= help: the following other types implement trait `Deserialize<'de>`:
<&'a [u8] as Deserialize<'de>>
<&'a std::path::Path as Deserialize<'de>>
<&'a str as Deserialize<'de>>
<() as Deserialize<'de>>
<(T0, T1) as Deserialize<'de>>
<(T0, T1, T2) as Deserialize<'de>>
<(T0, T1, T2, T3) as Deserialize<'de>>
<(T0, T1, T2, T3, T4) as Deserialize<'de>>
and $N others
note: required by a bound in `hidden_include::serde::__private::de::missing_field`
--> $CARGO/serde-1.0.162/src/private/de.rs
|
| V: Deserialize<'de>,
| ^^^^^^^^^^^^^^^^ required by this bound in `missing_field`
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `frame_support_test_pallet::GenesisConfig: BuildModuleGenesisStorage<Runtime, ()>` is not satisfied
--> tests/construct_runtime_ui/no_std_genesis_config.rs:40:1
|
40 | / construct_runtime! {
41 | | pub struct Runtime where
42 | | Block = Block,
43 | | NodeBlock = Block,
... |
48 | | }
49 | | }
| |_^ the trait `BuildModuleGenesisStorage<Runtime, ()>` is not implemented for `frame_support_test_pallet::GenesisConfig`
|
= help: the trait `BuildModuleGenesisStorage<T, ()>` is implemented for `frame_system::GenesisConfig`
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -28,7 +28,9 @@ error[E0412]: cannot find type `GenesisConfig` in module `pallet`
| |_^ not found in `pallet`
|
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this struct
help: consider importing one of these items
|
1 | use frame_system::GenesisConfig;
|
1 | use test_pallet::GenesisConfig;
|
+2 -2
View File
@@ -630,10 +630,10 @@ pub mod pallet {
#[pallet::whitelist_storage]
pub(super) type ExecutionPhase<T: Config> = StorageValue<_, Phase>;
#[cfg_attr(feature = "std", derive(Default))]
#[derive(Default)]
#[pallet::genesis_config]
pub struct GenesisConfig {
#[serde(with = "sp_core::bytes")]
#[cfg_attr(feature = "std", serde(with = "sp_core::bytes"))]
pub code: Vec<u8>,
}
@@ -362,7 +362,6 @@ pub mod pallet {
pub multiplier: Multiplier,
}
#[cfg(feature = "std")]
impl Default for GenesisConfig {
fn default() -> Self {
Self { multiplier: MULTIPLIER_DEFAULT_VALUE }
@@ -383,7 +383,6 @@ pub mod pallet {
pub storage_period: T::BlockNumber,
}
#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
Self {
+1 -7
View File
@@ -234,15 +234,9 @@ pub mod pallet {
StorageValue<_, BoundedVec<ProposalIndex, T::MaxApprovals>, ValueQuery>;
#[pallet::genesis_config]
#[derive(Default)]
pub struct GenesisConfig;
#[cfg(feature = "std")]
impl Default for GenesisConfig {
fn default() -> Self {
Self
}
}
#[cfg(feature = "std")]
impl GenesisConfig {
/// Direct implementation of `GenesisBuild::assimilate_storage`.
+1 -7
View File
@@ -214,17 +214,11 @@ pub mod pallet {
pub struct Pallet<T>(_);
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub vesting: Vec<(T::AccountId, T::BlockNumber, T::BlockNumber, BalanceOf<T>)>,
}
#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
GenesisConfig { vesting: Default::default() }
}
}
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {