mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 03:31:05 +00:00
pallets: implement Default for GenesisConfig in no_std (#2624)
* 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 * ".git/.scripts/commands/fmt/fmt.sh" * update lockfile for {"substrate", "polkadot"} --------- Co-authored-by: command-bot <>
This commit is contained in:
committed by
GitHub
parent
972814a2be
commit
4909cbb5b1
Generated
+261
-261
File diff suppressed because it is too large
Load Diff
@@ -44,7 +44,7 @@ use bp_header_chain::{
|
||||
};
|
||||
use bp_runtime::{BlockNumberOf, HashOf, HasherOf, HeaderId, HeaderOf, OwnedBridgeModule};
|
||||
use finality_grandpa::voter_set::VoterSet;
|
||||
use frame_support::{dispatch::PostDispatchInfo, ensure};
|
||||
use frame_support::{dispatch::PostDispatchInfo, ensure, DefaultNoBound};
|
||||
use sp_consensus_grandpa::{ConsensusLog, GRANDPA_ENGINE_ID};
|
||||
use sp_runtime::{
|
||||
traits::{Header as HeaderT, Zero},
|
||||
@@ -370,6 +370,7 @@ pub mod pallet {
|
||||
StorageValue<_, BasicOperatingMode, ValueQuery>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
|
||||
/// Optional module owner account.
|
||||
pub owner: Option<T::AccountId>,
|
||||
@@ -377,13 +378,6 @@ pub mod pallet {
|
||||
pub init_data: Option<super::InitializationData<BridgedHeader<T, I>>>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
|
||||
fn default() -> Self {
|
||||
Self { owner: None, init_data: None }
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
fn build(&self) {
|
||||
|
||||
@@ -65,7 +65,7 @@ use bp_messages::{
|
||||
};
|
||||
use bp_runtime::{BasicOperatingMode, ChainId, OwnedBridgeModule, PreComputedSize, Size};
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use frame_support::{dispatch::PostDispatchInfo, ensure, fail, traits::Get};
|
||||
use frame_support::{dispatch::PostDispatchInfo, ensure, fail, traits::Get, DefaultNoBound};
|
||||
use sp_runtime::traits::UniqueSaturatedFrom;
|
||||
use sp_std::{marker::PhantomData, prelude::*};
|
||||
|
||||
@@ -586,6 +586,7 @@ pub mod pallet {
|
||||
StorageMap<_, Blake2_128Concat, MessageKey, StoredMessagePayload<T, I>>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
|
||||
/// Initial pallet operating mode.
|
||||
pub operating_mode: MessagesOperatingMode,
|
||||
@@ -595,17 +596,6 @@ pub mod pallet {
|
||||
pub phantom: sp_std::marker::PhantomData<I>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
operating_mode: Default::default(),
|
||||
owner: Default::default(),
|
||||
phantom: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
fn build(&self) {
|
||||
|
||||
@@ -30,7 +30,7 @@ use bp_header_chain::{HeaderChain, HeaderChainError};
|
||||
use bp_parachains::{parachain_head_storage_key_at_source, ParaInfo, ParaStoredHeaderData};
|
||||
use bp_polkadot_core::parachains::{ParaHash, ParaHead, ParaHeadsProof, ParaId};
|
||||
use bp_runtime::{Chain, HashOf, HeaderId, HeaderIdOf, Parachain, StorageProofError};
|
||||
use frame_support::dispatch::PostDispatchInfo;
|
||||
use frame_support::{dispatch::PostDispatchInfo, DefaultNoBound};
|
||||
use sp_std::{marker::PhantomData, vec::Vec};
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
@@ -611,6 +611,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
|
||||
/// Initial pallet operating mode.
|
||||
pub operating_mode: BasicOperatingMode,
|
||||
@@ -620,17 +621,6 @@ pub mod pallet {
|
||||
pub phantom: sp_std::marker::PhantomData<I>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
operating_mode: Default::default(),
|
||||
owner: Default::default(),
|
||||
phantom: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
fn build(&self) {
|
||||
|
||||
@@ -88,7 +88,7 @@ pub mod pallet {
|
||||
Currency, EnsureOrigin, ExistenceRequirement::KeepAlive, ReservableCurrency,
|
||||
ValidatorRegistration,
|
||||
},
|
||||
BoundedVec, PalletId,
|
||||
BoundedVec, DefaultNoBound, PalletId,
|
||||
};
|
||||
use frame_system::{pallet_prelude::*, Config as SystemConfig};
|
||||
use pallet_session::SessionManager;
|
||||
@@ -203,28 +203,20 @@ pub mod pallet {
|
||||
pub type CandidacyBond<T> = StorageValue<_, BalanceOf<T>, ValueQuery>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
pub invulnerables: Vec<T::AccountId>,
|
||||
pub candidacy_bond: BalanceOf<T>,
|
||||
pub desired_candidates: u32,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<T: Config> Default for GenesisConfig<T> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
invulnerables: Default::default(),
|
||||
candidacy_bond: Default::default(),
|
||||
desired_candidates: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
let duplicate_invulnerables =
|
||||
self.invulnerables.iter().collect::<std::collections::BTreeSet<_>>();
|
||||
let duplicate_invulnerables = self
|
||||
.invulnerables
|
||||
.iter()
|
||||
.collect::<sp_std::collections::btree_set::BTreeSet<_>>();
|
||||
assert!(
|
||||
duplicate_invulnerables.len() == self.invulnerables.len(),
|
||||
"duplicate invulnerables in genesis."
|
||||
|
||||
@@ -43,7 +43,6 @@ pub mod pallet {
|
||||
pub parachain_id: ParaId,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl Default for GenesisConfig {
|
||||
fn default() -> Self {
|
||||
Self { parachain_id: 100.into() }
|
||||
|
||||
Reference in New Issue
Block a user