mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 06:01:06 +00:00
GenesisBuild<T,I> deprecated. BuildGenesisConfig added. (#14306)
* frame::support: GenesisConfig types for Runtime enabled * frame::support: macro generating GenesisBuild::build for RuntimeGenesisConfig * frame: ambiguity BuildStorage vs GenesisBuild fixed * fix * RuntimeGenesisBuild added * Revert "frame: ambiguity BuildStorage vs GenesisBuild fixed" This reverts commit 950f3d019d0e21c55a739c44cc19cdabd3ff0293. * Revert "fix" This reverts commit a2f76dd24e9a16cf9230d45825ed28787211118b. * Revert "RuntimeGenesisBuild added" This reverts commit 3c131b618138ced29c01ab8d15d8c6410c9e128b. * Revert "Revert "frame: ambiguity BuildStorage vs GenesisBuild fixed"" This reverts commit 2b1ecd467231eddec69f8d328039ba48a380da3d. * Revert "Revert "fix"" This reverts commit fd7fa629adf579d83e30e6ae9fd162637fc45e30. * Code review suggestions * frame: BuildGenesisConfig added, BuildGenesis deprecated * frame: some pallets updated with BuildGenesisConfig * constuct_runtime: support for BuildGenesisConfig * frame::support: genesis_build macro supports BuildGenesisConfig * frame: BuildGenesisConfig added, BuildGenesis deprecated * Cargo.lock update * test-runtime: fixes * Revert "fix" This reverts commit a2f76dd24e9a16cf9230d45825ed28787211118b. * Revert "frame: ambiguity BuildStorage vs GenesisBuild fixed" This reverts commit 950f3d019d0e21c55a739c44cc19cdabd3ff0293. * self review * doc fixed * ui tests fixed * fmt * tests fixed * genesis_build macrto fixed for non-generic GenesisConfig * BuildGenesisConfig constraints added * warning fixed * some duplication removed * fmt * fix * doc tests fix * doc fix * cleanup: remove BuildModuleGenesisStorage * self review comments * fix * Update frame/treasury/src/tests.rs Co-authored-by: Sebastian Kunert <skunert49@gmail.com> * Update frame/support/src/traits/hooks.rs Co-authored-by: Sebastian Kunert <skunert49@gmail.com> * doc fix: GenesisBuild exposed * ".git/.scripts/commands/fmt/fmt.sh" * frame: more serde(skip) + cleanup * Update frame/support/src/traits/hooks.rs Co-authored-by: Davide Galassi <davxy@datawok.net> * frame: phantom fields moved to the end of structs * chain-spec: Default::default cleanup * test-runtime: phantom at the end * merge master fixes * fix * fix * fix * fix * fix (facepalm) * Update frame/support/procedural/src/pallet/expand/genesis_build.rs Co-authored-by: Bastian Köcher <git@kchr.de> * fmt * fix * fix --------- Co-authored-by: parity-processbot <> Co-authored-by: Sebastian Kunert <skunert49@gmail.com> Co-authored-by: Davide Galassi <davxy@datawok.net> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
committed by
GitHub
parent
49150ee583
commit
87d41d0a89
Generated
+1
@@ -2921,6 +2921,7 @@ dependencies = [
|
||||
"parity-scale-codec",
|
||||
"scale-info",
|
||||
"serde",
|
||||
"sp-runtime",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -136,6 +136,7 @@ fn testnet_genesis(
|
||||
system: SystemConfig {
|
||||
// Add Wasm runtime to storage.
|
||||
code: wasm_binary.to_vec(),
|
||||
..Default::default()
|
||||
},
|
||||
balances: BalancesConfig {
|
||||
// Configure endowed accounts with initial balance of 1 << 60.
|
||||
@@ -146,6 +147,7 @@ fn testnet_genesis(
|
||||
},
|
||||
grandpa: GrandpaConfig {
|
||||
authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect(),
|
||||
..Default::default()
|
||||
},
|
||||
sudo: SudoConfig {
|
||||
// Assign network admin rights.
|
||||
|
||||
@@ -4,6 +4,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -55,5 +56,5 @@ impl pallet_template::Config for Test {
|
||||
|
||||
// Build genesis storage according to the mock runtime.
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
frame_system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
|
||||
frame_system::GenesisConfig::<Test>::default().build_storage().unwrap().into()
|
||||
}
|
||||
|
||||
@@ -20,11 +20,10 @@
|
||||
|
||||
use grandpa_primitives::AuthorityId as GrandpaId;
|
||||
use kitchensink_runtime::{
|
||||
constants::currency::*, wasm_binary_unwrap, AuthorityDiscoveryConfig, BabeConfig,
|
||||
BalancesConfig, Block, CouncilConfig, DemocracyConfig, ElectionsConfig, GluttonConfig,
|
||||
GrandpaConfig, ImOnlineConfig, IndicesConfig, MaxNominations, NominationPoolsConfig,
|
||||
SessionConfig, SessionKeys, SocietyConfig, StakerStatus, StakingConfig, SudoConfig,
|
||||
SystemConfig, TechnicalCommitteeConfig,
|
||||
constants::currency::*, wasm_binary_unwrap, BabeConfig, BalancesConfig, Block, CouncilConfig,
|
||||
DemocracyConfig, ElectionsConfig, ImOnlineConfig, IndicesConfig, MaxNominations,
|
||||
NominationPoolsConfig, SessionConfig, SessionKeys, SocietyConfig, StakerStatus, StakingConfig,
|
||||
SudoConfig, SystemConfig, TechnicalCommitteeConfig,
|
||||
};
|
||||
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
|
||||
use sc_chain_spec::ChainSpecExtension;
|
||||
@@ -295,7 +294,7 @@ pub fn testnet_genesis(
|
||||
const STASH: Balance = ENDOWMENT / 1000;
|
||||
|
||||
RuntimeGenesisConfig {
|
||||
system: SystemConfig { code: wasm_binary_unwrap().to_vec() },
|
||||
system: SystemConfig { code: wasm_binary_unwrap().to_vec(), ..Default::default() },
|
||||
balances: BalancesConfig {
|
||||
balances: endowed_accounts.iter().cloned().map(|x| (x, ENDOWMENT)).collect(),
|
||||
},
|
||||
@@ -340,12 +339,12 @@ pub fn testnet_genesis(
|
||||
},
|
||||
sudo: SudoConfig { key: Some(root_key) },
|
||||
babe: BabeConfig {
|
||||
authorities: vec![],
|
||||
epoch_config: Some(kitchensink_runtime::BABE_GENESIS_EPOCH_CONFIG),
|
||||
..Default::default()
|
||||
},
|
||||
im_online: ImOnlineConfig { keys: vec![] },
|
||||
authority_discovery: AuthorityDiscoveryConfig { keys: vec![] },
|
||||
grandpa: GrandpaConfig { authorities: vec![] },
|
||||
authority_discovery: Default::default(),
|
||||
grandpa: Default::default(),
|
||||
technical_membership: Default::default(),
|
||||
treasury: Default::default(),
|
||||
society: SocietyConfig { pot: 0 },
|
||||
@@ -365,11 +364,7 @@ pub fn testnet_genesis(
|
||||
min_join_bond: 1 * DOLLARS,
|
||||
..Default::default()
|
||||
},
|
||||
glutton: GluttonConfig {
|
||||
compute: Default::default(),
|
||||
storage: Default::default(),
|
||||
trash_data_count: Default::default(),
|
||||
},
|
||||
glutton: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ mod multiplier_tests {
|
||||
use sp_runtime::{
|
||||
assert_eq_error_rate,
|
||||
traits::{Convert, One, Zero},
|
||||
FixedPointNumber,
|
||||
BuildStorage, FixedPointNumber,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@@ -197,8 +197,8 @@ mod multiplier_tests {
|
||||
where
|
||||
F: Fn() -> (),
|
||||
{
|
||||
let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default()
|
||||
.build_storage::<Runtime>()
|
||||
let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::<Runtime>::default()
|
||||
.build_storage()
|
||||
.unwrap()
|
||||
.into();
|
||||
t.execute_with(|| {
|
||||
|
||||
@@ -50,6 +50,7 @@ pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec<AccountId>) -> Run
|
||||
RuntimeGenesisConfig {
|
||||
system: SystemConfig {
|
||||
code: code.map(|x| x.to_vec()).unwrap_or_else(|| wasm_binary_unwrap().to_vec()),
|
||||
..Default::default()
|
||||
},
|
||||
indices: IndicesConfig { indices: vec![] },
|
||||
balances: BalancesConfig { balances: endowed },
|
||||
@@ -76,8 +77,12 @@ pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec<AccountId>) -> Run
|
||||
invulnerables: vec![alice(), bob(), charlie()],
|
||||
..Default::default()
|
||||
},
|
||||
babe: BabeConfig { authorities: vec![], epoch_config: Some(BABE_GENESIS_EPOCH_CONFIG) },
|
||||
grandpa: GrandpaConfig { authorities: vec![] },
|
||||
babe: BabeConfig {
|
||||
authorities: vec![],
|
||||
epoch_config: Some(BABE_GENESIS_EPOCH_CONFIG),
|
||||
..Default::default()
|
||||
},
|
||||
grandpa: GrandpaConfig { authorities: vec![], _config: Default::default() },
|
||||
im_online: Default::default(),
|
||||
authority_discovery: Default::default(),
|
||||
democracy: Default::default(),
|
||||
@@ -100,6 +105,7 @@ pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec<AccountId>) -> Run
|
||||
compute: Default::default(),
|
||||
storage: Default::default(),
|
||||
trash_data_count: Default::default(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,11 +405,12 @@ pub mod pallet {
|
||||
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
|
||||
pub fellows: Vec<T::AccountId>,
|
||||
pub allies: Vec<T::AccountId>,
|
||||
#[serde(skip)]
|
||||
pub phantom: PhantomData<(T, I)>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {
|
||||
for m in self.fellows.iter().chain(self.allies.iter()) {
|
||||
assert!(Pallet::<T, I>::has_identity(m).is_ok(), "Member does not set identity!");
|
||||
|
||||
@@ -28,7 +28,7 @@ use sp_std::convert::{TryFrom, TryInto};
|
||||
|
||||
pub use frame_support::{
|
||||
assert_noop, assert_ok, ord_parameter_types, parameter_types,
|
||||
traits::{EitherOfDiverse, GenesisBuild, SortedMembers},
|
||||
traits::{EitherOfDiverse, SortedMembers},
|
||||
BoundedVec,
|
||||
};
|
||||
use frame_system::{EnsureRoot, EnsureSignedBy};
|
||||
@@ -256,7 +256,7 @@ frame_support::construct_runtime!(
|
||||
);
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![
|
||||
@@ -274,14 +274,12 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
|
||||
GenesisBuild::<Test>::assimilate_storage(
|
||||
&pallet_alliance::GenesisConfig {
|
||||
fellows: vec![],
|
||||
allies: vec![],
|
||||
phantom: Default::default(),
|
||||
},
|
||||
&mut t,
|
||||
)
|
||||
pallet_alliance::GenesisConfig::<Test> {
|
||||
fellows: vec![],
|
||||
allies: vec![],
|
||||
phantom: Default::default(),
|
||||
}
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
|
||||
let mut ext = sp_io::TestExternalities::new(t);
|
||||
|
||||
@@ -33,8 +33,8 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{AccountIdConversion, BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
type Block = frame_system::mocking::MockBlock<Test>;
|
||||
|
||||
@@ -183,7 +183,7 @@ impl Config for Test {
|
||||
}
|
||||
|
||||
pub(crate) fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![(1, 10000), (2, 20000), (3, 30000), (4, 40000)],
|
||||
|
||||
@@ -23,6 +23,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -96,5 +97,5 @@ impl pallet_asset_rate::Config for Test {
|
||||
|
||||
// Build genesis storage according to the mock runtime.
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
frame_system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
|
||||
frame_system::GenesisConfig::<Test>::default().build_storage().unwrap().into()
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {
|
||||
for (id, owner, is_sufficient, min_balance) in &self.assets {
|
||||
assert!(!Asset::<T, I>::contains_key(id), "Asset id already in use");
|
||||
|
||||
@@ -23,13 +23,14 @@ use crate as pallet_assets;
|
||||
use codec::Encode;
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{AsEnsureOriginWithArg, ConstU32, ConstU64, GenesisBuild},
|
||||
traits::{AsEnsureOriginWithArg, ConstU32, ConstU64},
|
||||
};
|
||||
use sp_core::H256;
|
||||
use sp_io::storage;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -41,7 +42,7 @@ construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Assets: pallet_assets::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
@@ -205,7 +206,7 @@ pub(crate) fn take_hooks() -> Vec<Hook> {
|
||||
}
|
||||
|
||||
pub(crate) fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut storage = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut storage = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
|
||||
let config: pallet_assets::GenesisConfig<Test> = pallet_assets::GenesisConfig {
|
||||
assets: vec![
|
||||
|
||||
@@ -8,6 +8,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -19,7 +20,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
AtomicSwap: pallet_atomic_swap::{Pallet, Call, Event<T>},
|
||||
}
|
||||
@@ -78,7 +79,7 @@ const A: u64 = 1;
|
||||
const B: u64 = 2;
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let genesis = pallet_balances::GenesisConfig::<Test> { balances: vec![(A, 100), (B, 200)] };
|
||||
genesis.assimilate_storage(&mut t).unwrap();
|
||||
t.into()
|
||||
|
||||
@@ -159,7 +159,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
Pallet::<T>::initialize_authorities(&self.authorities);
|
||||
}
|
||||
|
||||
@@ -22,13 +22,14 @@
|
||||
use crate as pallet_aura;
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
traits::{ConstU32, ConstU64, DisabledValidators, GenesisBuild},
|
||||
traits::{ConstU32, ConstU64, DisabledValidators},
|
||||
};
|
||||
use sp_consensus_aura::{ed25519::AuthorityId, AuthorityIndex};
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::{Header, UintAuthorityId},
|
||||
traits::IdentityLookup,
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -40,7 +41,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
|
||||
Aura: pallet_aura::{Pallet, Storage, Config<T>},
|
||||
}
|
||||
@@ -111,7 +112,7 @@ impl pallet_aura::Config for Test {
|
||||
}
|
||||
|
||||
fn build_ext(authorities: Vec<u64>) -> sp_io::TestExternalities {
|
||||
let mut storage = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut storage = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_aura::GenesisConfig::<Test> {
|
||||
authorities: authorities.into_iter().map(|a| UintAuthorityId(a).to_public_key()).collect(),
|
||||
}
|
||||
|
||||
@@ -59,14 +59,16 @@ pub mod pallet {
|
||||
pub(super) type NextKeys<T: Config> =
|
||||
StorageValue<_, WeakBoundedVec<AuthorityId, T::MaxAuthorities>, ValueQuery>;
|
||||
|
||||
#[derive(Default)]
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
#[pallet::genesis_config]
|
||||
pub struct GenesisConfig {
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
pub keys: Vec<AuthorityId>,
|
||||
#[serde(skip)]
|
||||
pub _config: sp_std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
Pallet::<T>::initialize_keys(&self.keys)
|
||||
}
|
||||
@@ -168,7 +170,7 @@ mod tests {
|
||||
use crate as pallet_authority_discovery;
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
traits::{ConstU32, ConstU64, GenesisBuild},
|
||||
traits::{ConstU32, ConstU64},
|
||||
};
|
||||
use sp_application_crypto::Pair;
|
||||
use sp_authority_discovery::AuthorityPair;
|
||||
@@ -177,7 +179,7 @@ mod tests {
|
||||
use sp_runtime::{
|
||||
testing::{Header, UintAuthorityId},
|
||||
traits::{ConvertInto, IdentityLookup, OpaqueKeys},
|
||||
KeyTypeId, Perbill,
|
||||
BuildStorage, KeyTypeId, Perbill,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -189,9 +191,9 @@ mod tests {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
|
||||
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config},
|
||||
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config<T>},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -308,13 +310,11 @@ mod tests {
|
||||
.collect::<Vec<(&AuthorityId, AuthorityId)>>();
|
||||
|
||||
// Build genesis.
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
|
||||
GenesisBuild::<Test>::assimilate_storage(
|
||||
&pallet_authority_discovery::GenesisConfig { keys: vec![] },
|
||||
&mut t,
|
||||
)
|
||||
.unwrap();
|
||||
pallet_authority_discovery::GenesisConfig::<Test> { keys: vec![], ..Default::default() }
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
|
||||
// Create externalities.
|
||||
let mut externalities = TestExternalities::new(t);
|
||||
|
||||
@@ -106,6 +106,7 @@ mod tests {
|
||||
generic::DigestItem,
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, Header as HeaderT, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -117,7 +118,7 @@ mod tests {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Authorship: pallet_authorship::{Pallet, Storage},
|
||||
}
|
||||
);
|
||||
@@ -188,7 +189,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
t.into()
|
||||
}
|
||||
|
||||
|
||||
@@ -314,15 +314,17 @@ pub mod pallet {
|
||||
pub(super) type SkippedEpochs<T> =
|
||||
StorageValue<_, BoundedVec<(u64, SessionIndex), ConstU32<100>>, ValueQuery>;
|
||||
|
||||
#[derive(Default)]
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
#[pallet::genesis_config]
|
||||
pub struct GenesisConfig {
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
pub authorities: Vec<(AuthorityId, BabeAuthorityWeight)>,
|
||||
pub epoch_config: Option<BabeEpochConfiguration>,
|
||||
#[serde(skip)]
|
||||
pub _config: sp_std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
SegmentIndex::<T>::put(0);
|
||||
Pallet::<T>::initialize_genesis_authorities(&self.authorities);
|
||||
|
||||
@@ -22,7 +22,7 @@ use codec::Encode;
|
||||
use frame_election_provider_support::{onchain, SequentialPhragmen};
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
traits::{ConstU128, ConstU32, ConstU64, GenesisBuild, KeyOwnerProofSystem, OnInitialize},
|
||||
traits::{ConstU128, ConstU32, ConstU64, KeyOwnerProofSystem, OnInitialize},
|
||||
};
|
||||
use pallet_session::historical as pallet_session_historical;
|
||||
use sp_consensus_babe::{AuthorityId, AuthorityPair, Randomness, Slot, VrfSignature};
|
||||
@@ -36,7 +36,7 @@ use sp_runtime::{
|
||||
impl_opaque_keys,
|
||||
testing::{Digest, DigestItem, Header, TestXt},
|
||||
traits::{Header as _, IdentityLookup, OpaqueKeys},
|
||||
Perbill,
|
||||
BuildStorage, Perbill,
|
||||
};
|
||||
use sp_staking::{EraIndex, SessionIndex};
|
||||
|
||||
@@ -345,7 +345,7 @@ pub fn new_test_ext_with_pairs(
|
||||
}
|
||||
|
||||
pub fn new_test_ext_raw_authorities(authorities: Vec<AuthorityId>) -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
|
||||
let balances: Vec<_> = (0..authorities.len()).map(|i| (i as u64, 10_000_000)).collect();
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ use super::*;
|
||||
use crate::{self as bags_list};
|
||||
use frame_election_provider_support::VoteWeight;
|
||||
use frame_support::parameter_types;
|
||||
use sp_runtime::BuildStorage;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub type AccountId = u32;
|
||||
@@ -94,7 +95,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Event<T>, Config},
|
||||
System: frame_system::{Pallet, Call, Storage, Event<T>, Config<T>},
|
||||
BagsList: bags_list::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
@@ -127,7 +128,7 @@ impl ExtBuilder {
|
||||
|
||||
pub(crate) fn build(self) -> sp_io::TestExternalities {
|
||||
sp_tracing::try_init_simple();
|
||||
let storage = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
let storage = frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
|
||||
|
||||
let ids_with_weight: Vec<_> = if self.skip_genesis_ids {
|
||||
self.ids.iter().collect()
|
||||
|
||||
@@ -166,8 +166,6 @@ mod types;
|
||||
pub mod weights;
|
||||
|
||||
use codec::{Codec, MaxEncodedLen};
|
||||
#[cfg(feature = "std")]
|
||||
use frame_support::traits::GenesisBuild;
|
||||
use frame_support::{
|
||||
ensure,
|
||||
pallet_prelude::DispatchResult,
|
||||
@@ -465,7 +463,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {
|
||||
let total = self.balances.iter().fold(Zero::zero(), |acc: T::Balance, &(_, n)| acc + n);
|
||||
|
||||
@@ -499,23 +497,6 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<T: Config<I>, I: 'static> GenesisConfig<T, I> {
|
||||
/// Direct implementation of `GenesisBuild::build_storage`.
|
||||
///
|
||||
/// Kept in order not to break dependency.
|
||||
pub fn build_storage(&self) -> Result<sp_runtime::Storage, String> {
|
||||
<Self as GenesisBuild<T, I>>::build_storage(self)
|
||||
}
|
||||
|
||||
/// Direct implementation of `GenesisBuild::assimilate_storage`.
|
||||
///
|
||||
/// Kept in order not to break dependency.
|
||||
pub fn assimilate_storage(&self, storage: &mut sp_runtime::Storage) -> Result<(), String> {
|
||||
<Self as GenesisBuild<T, I>>::assimilate_storage(self, storage)
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config<I>, I: 'static> Hooks<T::BlockNumber> for Pallet<T, I> {
|
||||
#[cfg(not(feature = "insecure_zero_ed"))]
|
||||
|
||||
@@ -666,7 +666,7 @@ fn burn_must_work() {
|
||||
#[should_panic = "the balance of any account should always be at least the existential deposit."]
|
||||
fn cannot_set_genesis_value_below_ed() {
|
||||
EXISTENTIAL_DEPOSIT.with(|v| *v.borrow_mut() = 11);
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let _ = crate::GenesisConfig::<Test> { balances: vec![(1, 10)] }
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
@@ -675,7 +675,7 @@ fn cannot_set_genesis_value_below_ed() {
|
||||
#[test]
|
||||
#[should_panic = "duplicate balances in genesis."]
|
||||
fn cannot_set_genesis_value_twice() {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let _ = crate::GenesisConfig::<Test> { balances: vec![(1, 10), (2, 20), (1, 15)] }
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
|
||||
@@ -40,7 +40,7 @@ use sp_io;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BadOrigin, IdentityLookup, SignedExtension, Zero},
|
||||
ArithmeticError, DispatchError, DispatchResult, FixedPointNumber, TokenError,
|
||||
ArithmeticError, BuildStorage, DispatchError, DispatchResult, FixedPointNumber, TokenError,
|
||||
};
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
@@ -78,7 +78,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>},
|
||||
}
|
||||
@@ -176,7 +176,7 @@ impl ExtBuilder {
|
||||
}
|
||||
pub fn build(self) -> sp_io::TestExternalities {
|
||||
self.set_associated_consts();
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: if self.monied {
|
||||
vec![
|
||||
|
||||
@@ -21,7 +21,7 @@ use codec::Encode;
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
sp_io::TestExternalities,
|
||||
traits::{ConstU16, ConstU32, ConstU64, GenesisBuild},
|
||||
traits::{ConstU16, ConstU32, ConstU64},
|
||||
BasicExternalities,
|
||||
};
|
||||
use sp_consensus_beefy::mmr::MmrLeafVersion;
|
||||
@@ -31,6 +31,7 @@ use sp_runtime::{
|
||||
impl_opaque_keys,
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, ConvertInto, IdentityLookup, Keccak256, OpaqueKeys},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
use crate as pallet_beefy_mmr;
|
||||
@@ -54,7 +55,7 @@ construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
|
||||
Mmr: pallet_mmr::{Pallet, Storage},
|
||||
Beefy: pallet_beefy::{Pallet, Config<T>, Storage},
|
||||
@@ -193,7 +194,7 @@ pub fn new_test_ext(ids: Vec<u8>) -> TestExternalities {
|
||||
}
|
||||
|
||||
pub fn new_test_ext_raw_authorities(authorities: Vec<(u64, BeefyId)>) -> TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
|
||||
let session_keys: Vec<_> = authorities
|
||||
.iter()
|
||||
|
||||
@@ -176,7 +176,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
Pallet::<T>::initialize(&self.authorities)
|
||||
// we panic here as runtime maintainers can simply reconfigure genesis and restart
|
||||
|
||||
@@ -21,9 +21,7 @@ use frame_election_provider_support::{onchain, SequentialPhragmen};
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
sp_io::TestExternalities,
|
||||
traits::{
|
||||
ConstU16, ConstU32, ConstU64, GenesisBuild, KeyOwnerProofSystem, OnFinalize, OnInitialize,
|
||||
},
|
||||
traits::{ConstU16, ConstU32, ConstU64, KeyOwnerProofSystem, OnFinalize, OnInitialize},
|
||||
BasicExternalities,
|
||||
};
|
||||
use pallet_session::historical as pallet_session_historical;
|
||||
@@ -34,7 +32,7 @@ use sp_runtime::{
|
||||
impl_opaque_keys,
|
||||
testing::{Header, TestXt},
|
||||
traits::{BlakeTwo256, IdentityLookup, OpaqueKeys},
|
||||
Perbill,
|
||||
BuildStorage, Perbill,
|
||||
};
|
||||
use sp_staking::{EraIndex, SessionIndex};
|
||||
|
||||
@@ -260,7 +258,7 @@ pub fn new_test_ext(ids: Vec<u8>) -> TestExternalities {
|
||||
}
|
||||
|
||||
pub fn new_test_ext_raw_authorities(authorities: Vec<BeefyId>) -> TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
|
||||
let balances: Vec<_> = (0..authorities.len()).map(|i| (i as u64, 10_000_000)).collect();
|
||||
|
||||
|
||||
@@ -339,7 +339,7 @@ frame_benchmarking::benchmarks! {
|
||||
|
||||
#[cfg(test)]
|
||||
mod mock {
|
||||
use sp_runtime::testing::H256;
|
||||
use sp_runtime::{testing::H256, BuildStorage};
|
||||
|
||||
type AccountId = u64;
|
||||
type AccountIndex = u32;
|
||||
@@ -354,7 +354,7 @@ mod mock {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Baseline: crate::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
@@ -391,6 +391,6 @@ mod mock {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
frame_system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
|
||||
frame_system::GenesisConfig::<Test>::default().build_storage().unwrap().into()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ mod mock {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Baseline: crate::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -111,7 +111,7 @@ benchmarks! {
|
||||
#[cfg(test)]
|
||||
pub mod mock {
|
||||
use super::*;
|
||||
use sp_runtime::testing::H256;
|
||||
use sp_runtime::{testing::H256, BuildStorage};
|
||||
|
||||
type AccountId = u64;
|
||||
type AccountIndex = u32;
|
||||
@@ -126,7 +126,7 @@ pub mod mock {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -162,7 +162,7 @@ pub mod mock {
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
use sp_keystore::{testing::MemoryKeystore, KeystoreExt};
|
||||
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let mut ext = sp_io::TestExternalities::new(t);
|
||||
ext.register_extension(KeystoreExt::new(MemoryKeystore::new()));
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
TestPallet: pallet_test::{Pallet, Call, Storage},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -85,7 +85,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
TestPallet: pallet_test::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -23,9 +23,7 @@ use super::*;
|
||||
use crate as pallet_bounties;
|
||||
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok,
|
||||
pallet_prelude::GenesisBuild,
|
||||
parameter_types,
|
||||
assert_noop, assert_ok, parameter_types,
|
||||
traits::{ConstU32, ConstU64, OnInitialize},
|
||||
PalletId,
|
||||
};
|
||||
@@ -48,12 +46,12 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Bounties: pallet_bounties::{Pallet, Call, Storage, Event<T>},
|
||||
Bounties1: pallet_bounties::<Instance1>::{Pallet, Call, Storage, Event<T>},
|
||||
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>},
|
||||
Treasury1: pallet_treasury::<Instance1>::{Pallet, Call, Storage, Config, Event<T>},
|
||||
Treasury: pallet_treasury::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Treasury1: pallet_treasury::<Instance1>::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -412,7 +410,7 @@ fn treasury_account_doesnt_get_deleted() {
|
||||
// This is useful for chain that will just update runtime.
|
||||
#[test]
|
||||
fn inexistent_account_works() {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test> { balances: vec![(0, 100), (1, 99), (2, 1)] }
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
@@ -1073,7 +1071,7 @@ fn test_migration_v4() {
|
||||
|
||||
#[test]
|
||||
fn genesis_funding_works() {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let initial_funding = 100;
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
// Total issuance will be 200 with treasury account initialized with 100.
|
||||
@@ -1081,7 +1079,9 @@ fn genesis_funding_works() {
|
||||
}
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
GenesisBuild::<Test>::assimilate_storage(&pallet_treasury::GenesisConfig, &mut t).unwrap();
|
||||
pallet_treasury::GenesisConfig::<Test>::default()
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
let mut t: sp_io::TestExternalities = t.into();
|
||||
|
||||
t.execute_with(|| {
|
||||
|
||||
@@ -23,9 +23,7 @@ use super::*;
|
||||
use crate as pallet_child_bounties;
|
||||
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok,
|
||||
pallet_prelude::GenesisBuild,
|
||||
parameter_types,
|
||||
assert_noop, assert_ok, parameter_types,
|
||||
traits::{ConstU32, ConstU64, OnInitialize},
|
||||
weights::Weight,
|
||||
PalletId,
|
||||
@@ -35,7 +33,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BadOrigin, BlakeTwo256, IdentityLookup},
|
||||
Perbill, Permill, TokenError,
|
||||
BuildStorage, Perbill, Permill, TokenError,
|
||||
};
|
||||
|
||||
use super::Event as ChildBountiesEvent;
|
||||
@@ -50,10 +48,10 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Bounties: pallet_bounties::{Pallet, Call, Storage, Event<T>},
|
||||
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>},
|
||||
Treasury: pallet_treasury::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
ChildBounties: pallet_child_bounties::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
@@ -162,14 +160,16 @@ impl pallet_child_bounties::Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
// Total issuance will be 200 with treasury account initialized at ED.
|
||||
balances: vec![(0, 100), (1, 98), (2, 1)],
|
||||
}
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
GenesisBuild::<Test>::assimilate_storage(&pallet_treasury::GenesisConfig, &mut t).unwrap();
|
||||
pallet_treasury::GenesisConfig::<Test>::default()
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
t.into()
|
||||
}
|
||||
|
||||
|
||||
@@ -230,12 +230,13 @@ pub mod pallet {
|
||||
#[pallet::genesis_config]
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
|
||||
#[serde(skip)]
|
||||
pub phantom: PhantomData<I>,
|
||||
pub members: Vec<T::AccountId>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {
|
||||
use sp_std::collections::btree_set::BTreeSet;
|
||||
let members_set: BTreeSet<_> = self.members.iter().collect();
|
||||
|
||||
@@ -21,7 +21,7 @@ use frame_support::{
|
||||
assert_noop, assert_ok,
|
||||
dispatch::Pays,
|
||||
parameter_types,
|
||||
traits::{ConstU32, ConstU64, GenesisBuild, StorageVersion},
|
||||
traits::{ConstU32, ConstU64, StorageVersion},
|
||||
Hashable,
|
||||
};
|
||||
use frame_system::{EnsureRoot, EventRecord, Phase};
|
||||
|
||||
@@ -52,7 +52,7 @@ use sp_keystore::{testing::MemoryKeystore, KeystoreExt};
|
||||
use sp_runtime::{
|
||||
testing::{Header, H256},
|
||||
traits::{BlakeTwo256, Convert, Hash, IdentityLookup},
|
||||
AccountId32, TokenError,
|
||||
AccountId32, BuildStorage, TokenError,
|
||||
};
|
||||
use std::ops::Deref;
|
||||
|
||||
@@ -65,7 +65,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
|
||||
Randomness: pallet_insecure_randomness_collective_flip::{Pallet, Storage},
|
||||
@@ -486,7 +486,7 @@ impl ExtBuilder {
|
||||
let env = Env::new().default_filter_or("runtime=debug");
|
||||
let _ = Builder::from_env(env).is_test(true).try_init();
|
||||
self.set_associated_consts();
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test> { balances: vec![] }
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
|
||||
@@ -27,6 +27,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
use super::*;
|
||||
@@ -41,7 +42,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Voting: pallet_conviction_voting::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
@@ -196,7 +197,7 @@ impl Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)],
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup, TryMorphInto},
|
||||
DispatchError, DispatchResult,
|
||||
BuildStorage, DispatchError, DispatchResult,
|
||||
};
|
||||
use sp_std::cell::RefCell;
|
||||
|
||||
@@ -46,7 +46,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
CoreFellowship: pallet_core_fellowship::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
@@ -149,7 +149,7 @@ impl Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let mut ext = sp_io::TestExternalities::new(t);
|
||||
ext.execute_with(|| {
|
||||
let params = ParamsType {
|
||||
|
||||
@@ -441,11 +441,12 @@ pub mod pallet {
|
||||
#[pallet::genesis_config]
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
_phantom: sp_std::marker::PhantomData<T>,
|
||||
#[serde(skip)]
|
||||
_config: sp_std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
PublicPropCount::<T>::put(0 as PropIndex);
|
||||
ReferendumCount::<T>::put(0 as ReferendumIndex);
|
||||
|
||||
@@ -22,8 +22,8 @@ use crate as pallet_democracy;
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok, ord_parameter_types, parameter_types,
|
||||
traits::{
|
||||
ConstU32, ConstU64, Contains, EqualPrivilegeOnly, GenesisBuild, OnInitialize,
|
||||
SortedMembers, StorePreimage,
|
||||
ConstU32, ConstU64, Contains, EqualPrivilegeOnly, OnInitialize, SortedMembers,
|
||||
StorePreimage,
|
||||
},
|
||||
weights::Weight,
|
||||
};
|
||||
@@ -33,7 +33,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BadOrigin, BlakeTwo256, Hash, IdentityLookup},
|
||||
Perbill,
|
||||
BuildStorage, Perbill,
|
||||
};
|
||||
mod cancellation;
|
||||
mod decoders;
|
||||
@@ -60,7 +60,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Preimage: pallet_preimage,
|
||||
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>},
|
||||
@@ -203,7 +203,7 @@ impl Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)],
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ use sp_npos_elections::{
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
PerU16,
|
||||
BuildStorage, PerU16,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -59,7 +59,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Event<T>, Config},
|
||||
System: frame_system::{Pallet, Call, Event<T>, Config<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Event<T>, Config<T>},
|
||||
MultiPhase: multi_phase::{Pallet, Call, Event<T>},
|
||||
}
|
||||
@@ -574,7 +574,7 @@ impl ExtBuilder {
|
||||
pub fn build(self) -> sp_io::TestExternalities {
|
||||
sp_tracing::try_init_simple();
|
||||
let mut storage =
|
||||
frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
|
||||
|
||||
let _ = pallet_balances::GenesisConfig::<Runtime> {
|
||||
balances: vec![
|
||||
|
||||
@@ -18,18 +18,14 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use _feps::ExtendedBalance;
|
||||
use frame_support::{
|
||||
parameter_types, traits,
|
||||
traits::{GenesisBuild, Hooks},
|
||||
weights::constants,
|
||||
};
|
||||
use frame_support::{parameter_types, traits, traits::Hooks, weights::constants};
|
||||
use frame_system::EnsureRoot;
|
||||
use sp_core::{ConstU32, Get, H256};
|
||||
use sp_npos_elections::{ElectionScore, VoteWeight};
|
||||
use sp_runtime::{
|
||||
testing,
|
||||
traits::{IdentityLookup, Zero},
|
||||
transaction_validity, PerU16, Perbill,
|
||||
transaction_validity, BuildStorage, PerU16, Perbill,
|
||||
};
|
||||
use sp_staking::{
|
||||
offence::{DisableStrategy, OffenceDetails, OnOffenceHandler},
|
||||
@@ -490,7 +486,7 @@ impl ExtBuilder {
|
||||
pub fn build(self) -> sp_io::TestExternalities {
|
||||
sp_tracing::try_init_simple();
|
||||
let mut storage =
|
||||
frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
|
||||
|
||||
let _ =
|
||||
pallet_balances::GenesisConfig::<Runtime> { balances: self.balances_builder.balances }
|
||||
|
||||
@@ -721,7 +721,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
assert!(
|
||||
self.members.len() as u32 <= T::DesiredMembers::get(),
|
||||
|
||||
@@ -627,7 +627,7 @@ pub mod pallet {
|
||||
|
||||
// The build of genesis for the pallet.
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
<Dummy<T>>::put(&self.dummy);
|
||||
for (a, b) in &self.bar {
|
||||
|
||||
@@ -44,7 +44,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Example: pallet_example_basic::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Example: pallet_dev_mode::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ pub mod pallet {
|
||||
|
||||
/// Allows you to define how `genesis_configuration is built.
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
Foo::<T>::put(self.foo);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Kitchensink: pallet_example_kitchensink::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Example: example_offchain_worker::{Pallet, Call, Storage, Event<T>, ValidateUnsigned},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use crate as pallet_template;
|
||||
use frame_support::derive_impl;
|
||||
use frame_support::{derive_impl, sp_runtime::BuildStorage};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
type Block = frame_system::mocking::MockBlock<Test>;
|
||||
@@ -52,5 +52,5 @@ impl pallet_template::Config for Test {
|
||||
|
||||
// Build genesis storage according to the mock runtime.
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
frame_system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
|
||||
frame_system::GenesisConfig::<Test>::default().build_storage().unwrap().into()
|
||||
}
|
||||
|
||||
@@ -689,7 +689,7 @@ mod tests {
|
||||
transaction_validity::{
|
||||
InvalidTransaction, TransactionValidityError, UnknownTransaction, ValidTransaction,
|
||||
},
|
||||
DispatchError,
|
||||
BuildStorage, DispatchError,
|
||||
};
|
||||
|
||||
use frame_support::{
|
||||
@@ -833,7 +833,7 @@ mod tests {
|
||||
NodeBlock = TestBlock,
|
||||
UncheckedExtrinsic = TestUncheckedExtrinsic
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>},
|
||||
Custom: custom::{Pallet, Call, ValidateUnsigned, Inherent},
|
||||
@@ -972,7 +972,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn balance_transfer_dispatch_works() {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Runtime> { balances: vec![(1, 211)] }
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
@@ -1000,7 +1000,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn new_test_ext(balance_factor: Balance) -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Runtime> { balances: vec![(1, 111 * balance_factor)] }
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
@@ -1008,7 +1008,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn new_test_ext_v0(balance_factor: Balance) -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Runtime> { balances: vec![(1, 111 * balance_factor)] }
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
|
||||
@@ -23,7 +23,10 @@ use frame_support::{
|
||||
traits::{ConstU64, Currency},
|
||||
weights::constants::WEIGHT_REF_TIME_PER_SECOND,
|
||||
};
|
||||
use sp_runtime::traits::{Convert, IdentityLookup};
|
||||
use sp_runtime::{
|
||||
traits::{Convert, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
use pallet_staking::{Exposure, IndividualExposure, StakerStatus};
|
||||
use sp_std::prelude::*;
|
||||
@@ -278,7 +281,7 @@ impl ExtBuilder {
|
||||
pub(crate) fn build(self) -> sp_io::TestExternalities {
|
||||
sp_tracing::try_init_simple();
|
||||
let mut storage =
|
||||
frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
|
||||
|
||||
let validators_range = VALIDATOR_PREFIX..VALIDATOR_PREFIX + VALIDATORS_PER_ERA;
|
||||
let nominators_range =
|
||||
|
||||
@@ -130,14 +130,16 @@ pub mod pallet {
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(DefaultNoBound)]
|
||||
pub struct GenesisConfig {
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
pub compute: FixedU64,
|
||||
pub storage: FixedU64,
|
||||
pub trash_data_count: u32,
|
||||
#[serde(skip)]
|
||||
pub _config: sp_std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
assert!(
|
||||
self.trash_data_count <= MAX_TRASH_DATA_ENTRIES,
|
||||
|
||||
@@ -26,6 +26,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -37,7 +38,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Glutton: pallet_glutton::{Pallet, Event},
|
||||
}
|
||||
);
|
||||
@@ -76,7 +77,7 @@ impl Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
|
||||
let mut ext = sp_io::TestExternalities::new(t);
|
||||
ext.execute_with(|| System::set_block_number(1));
|
||||
|
||||
@@ -333,14 +333,16 @@ pub mod pallet {
|
||||
#[pallet::getter(fn session_for_set)]
|
||||
pub(super) type SetIdSession<T: Config> = StorageMap<_, Twox64Concat, SetId, SessionIndex>;
|
||||
|
||||
#[derive(Default)]
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
#[pallet::genesis_config]
|
||||
pub struct GenesisConfig {
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
pub authorities: AuthorityList,
|
||||
#[serde(skip)]
|
||||
pub _config: sp_std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
CurrentSetId::<T>::put(SetId::default());
|
||||
Pallet::<T>::initialize(&self.authorities)
|
||||
|
||||
@@ -25,9 +25,7 @@ use codec::Encode;
|
||||
use frame_election_provider_support::{onchain, SequentialPhragmen};
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
traits::{
|
||||
ConstU128, ConstU32, ConstU64, GenesisBuild, KeyOwnerProofSystem, OnFinalize, OnInitialize,
|
||||
},
|
||||
traits::{ConstU128, ConstU32, ConstU64, KeyOwnerProofSystem, OnFinalize, OnInitialize},
|
||||
};
|
||||
use pallet_session::historical as pallet_session_historical;
|
||||
use sp_consensus_grandpa::{RoundNumber, SetId, GRANDPA_ENGINE_ID};
|
||||
@@ -38,7 +36,7 @@ use sp_runtime::{
|
||||
impl_opaque_keys,
|
||||
testing::{Header, TestXt, UintAuthorityId},
|
||||
traits::{IdentityLookup, OpaqueKeys},
|
||||
DigestItem, Perbill,
|
||||
BuildStorage, DigestItem, Perbill,
|
||||
};
|
||||
use sp_staking::{EraIndex, SessionIndex};
|
||||
|
||||
@@ -257,7 +255,7 @@ pub fn new_test_ext(vec: Vec<(u64, u64)>) -> sp_io::TestExternalities {
|
||||
}
|
||||
|
||||
pub fn new_test_ext_raw_authorities(authorities: AuthorityList) -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
|
||||
let balances: Vec<_> = (0..authorities.len()).map(|i| (i as u64, 10_000_000)).collect();
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BadOrigin, BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -42,7 +43,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Identity: pallet_identity::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
@@ -118,7 +119,7 @@ impl pallet_identity::Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![(1, 10), (2, 10), (3, 10), (10, 100), (20, 100), (30, 100)],
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
Pallet::<T>::initialize_keys(&self.keys);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::{Header, TestXt, UintAuthorityId},
|
||||
traits::{BlakeTwo256, ConvertInto, IdentityLookup},
|
||||
Permill,
|
||||
BuildStorage, Permill,
|
||||
};
|
||||
use sp_staking::{
|
||||
offence::{OffenceError, ReportOffence},
|
||||
@@ -48,7 +48,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
|
||||
ImOnline: imonline::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Historical: pallet_session_historical::{Pallet},
|
||||
@@ -105,7 +105,7 @@ impl ReportOffence<u64, IdentificationTuple, Offence> for OffenceHandler {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
let t = frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
|
||||
let mut result: sp_io::TestExternalities = t.into();
|
||||
// Set the default keys, otherwise session will discard the validator.
|
||||
result.execute_with(|| {
|
||||
|
||||
@@ -269,7 +269,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
for (a, b) in &self.indices {
|
||||
<Accounts<T>>::insert(a, (b, <BalanceOf<T>>::zero(), false))
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
use crate::{self as pallet_indices, Config};
|
||||
use frame_support::traits::{ConstU32, ConstU64};
|
||||
use sp_core::H256;
|
||||
use sp_runtime::testing::Header;
|
||||
use sp_runtime::{testing::Header, BuildStorage};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
type Block = frame_system::mocking::MockBlock<Test>;
|
||||
@@ -33,7 +33,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
}
|
||||
@@ -91,7 +91,7 @@ impl Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)],
|
||||
}
|
||||
|
||||
@@ -166,6 +166,7 @@ mod tests {
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, Header as _, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
use frame_support::{
|
||||
@@ -183,7 +184,7 @@ mod tests {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
CollectiveFlip: pallet_insecure_randomness_collective_flip::{Pallet, Storage},
|
||||
}
|
||||
);
|
||||
@@ -223,7 +224,7 @@ mod tests {
|
||||
impl pallet_insecure_randomness_collective_flip::Config for Test {}
|
||||
|
||||
fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
t.into()
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
Perbill,
|
||||
BuildStorage, Perbill,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -42,7 +42,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Lottery: pallet_lottery::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
@@ -116,7 +116,7 @@ pub type SystemCall = frame_system::Call<Test>;
|
||||
pub type BalancesCall = pallet_balances::Call<Test>;
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![(1, 100), (2, 100), (3, 100), (4, 100), (5, 100)],
|
||||
}
|
||||
|
||||
@@ -108,11 +108,12 @@ pub mod pallet {
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
|
||||
pub members: BoundedVec<T::AccountId, T::MaxMembers>,
|
||||
#[serde(skip)]
|
||||
pub phantom: PhantomData<I>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {
|
||||
use sp_std::collections::btree_set::BTreeSet;
|
||||
let members_set: BTreeSet<_> = self.members.iter().collect();
|
||||
@@ -526,11 +527,12 @@ mod tests {
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BadOrigin, BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok, bounded_vec, ord_parameter_types, parameter_types,
|
||||
traits::{ConstU32, ConstU64, GenesisBuild, StorageVersion},
|
||||
traits::{ConstU32, ConstU64, StorageVersion},
|
||||
};
|
||||
use frame_system::EnsureSignedBy;
|
||||
|
||||
@@ -543,7 +545,7 @@ mod tests {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Membership: pallet_membership::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
}
|
||||
);
|
||||
@@ -629,7 +631,7 @@ mod tests {
|
||||
}
|
||||
|
||||
pub(crate) fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
// We use default for brevity, but you can configure as desired if needed.
|
||||
pallet_membership::GenesisConfig::<Test> {
|
||||
members: bounded_vec![10, 20, 30],
|
||||
@@ -642,7 +644,7 @@ mod tests {
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
pub(crate) fn new_bench_ext() -> sp_io::TestExternalities {
|
||||
frame_system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
|
||||
frame_system::GenesisConfig::<Test>::default().build_storage().unwrap().into()
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
|
||||
@@ -39,7 +39,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
MMR: pallet_mmr::{Pallet, Storage},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -23,9 +23,10 @@ use sp_core::{
|
||||
H256,
|
||||
};
|
||||
use sp_mmr_primitives::{mmr_lib::helper, utils, Compact, Proof};
|
||||
use sp_runtime::BuildStorage;
|
||||
|
||||
pub(crate) fn new_test_ext() -> sp_io::TestExternalities {
|
||||
frame_system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
|
||||
frame_system::GenesisConfig::<Test>::default().build_storage().unwrap().into()
|
||||
}
|
||||
|
||||
fn register_offchain_ext(ext: &mut sp_io::TestExternalities) {
|
||||
|
||||
@@ -52,7 +52,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -31,6 +31,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
use sp_std::collections::btree_map::BTreeMap;
|
||||
|
||||
@@ -43,7 +44,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
@@ -294,7 +295,7 @@ where
|
||||
WeightForCall::take();
|
||||
QueueChanges::take();
|
||||
NumMessagesErrored::take();
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<T>().unwrap();
|
||||
let t = frame_system::GenesisConfig::<T>::default().build_storage().unwrap();
|
||||
let mut ext = sp_io::TestExternalities::new(t);
|
||||
ext.execute_with(|| frame_system::Pallet::<T>::set_block_number(1.into()));
|
||||
ext
|
||||
|
||||
@@ -30,7 +30,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
TokenError,
|
||||
BuildStorage, TokenError,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -42,7 +42,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
@@ -115,7 +115,7 @@ impl Config for Test {
|
||||
use pallet_balances::Call as BalancesCall;
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![(1, 10), (2, 10), (3, 10), (4, 10), (5, 2)],
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify},
|
||||
MultiSignature,
|
||||
BuildStorage, MultiSignature,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -184,7 +184,7 @@ impl Config for Test {
|
||||
|
||||
// Build genesis storage according to the mock runtime.
|
||||
pub(crate) fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
|
||||
let mut ext = sp_io::TestExternalities::new(t);
|
||||
ext.execute_with(|| System::set_block_number(1));
|
||||
|
||||
@@ -29,7 +29,7 @@ use sp_keystore::{testing::MemoryKeystore, KeystoreExt};
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify},
|
||||
MultiSignature,
|
||||
BuildStorage, MultiSignature,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -41,7 +41,7 @@ construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Nfts: pallet_nfts::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
@@ -131,7 +131,7 @@ impl Config for Test {
|
||||
}
|
||||
|
||||
pub(crate) fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
|
||||
let mut ext = sp_io::TestExternalities::new(t);
|
||||
ext.register_extension(KeystoreExt::new(MemoryKeystore::new()));
|
||||
|
||||
@@ -241,6 +241,7 @@ mod tests {
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BadOrigin, BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -315,7 +316,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test> { balances: vec![(1, 10), (2, 10)] }
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
|
||||
@@ -33,6 +33,7 @@ use sp_core::{ConstU128, H256};
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -157,7 +158,7 @@ impl pallet_nis::Config for Test {
|
||||
// This function basically just builds a genesis storage key/value store according to
|
||||
// our desired mockup.
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test, Instance1> {
|
||||
balances: vec![(1, 100), (2, 100), (3, 100), (4, 100)],
|
||||
}
|
||||
@@ -170,7 +171,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
// our desired mockup, but without any balances.
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
pub fn new_test_ext_empty() -> sp_io::TestExternalities {
|
||||
frame_system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
|
||||
frame_system::GenesisConfig::<Test>::default().build_storage().unwrap().into()
|
||||
}
|
||||
|
||||
pub fn run_to_block(n: u64) {
|
||||
|
||||
@@ -115,7 +115,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
Pallet::<T>::initialize_nodes(&self.nodes);
|
||||
}
|
||||
|
||||
@@ -22,13 +22,14 @@ use crate as pallet_node_authorization;
|
||||
|
||||
use frame_support::{
|
||||
ord_parameter_types,
|
||||
traits::{ConstU32, ConstU64, GenesisBuild},
|
||||
traits::{ConstU32, ConstU64},
|
||||
};
|
||||
use frame_system::EnsureSignedBy;
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -40,7 +41,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
NodeAuthorization: pallet_node_authorization::{
|
||||
Pallet, Call, Storage, Config<T>, Event<T>,
|
||||
},
|
||||
@@ -97,7 +98,7 @@ pub fn test_node(id: u8) -> PeerId {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_node_authorization::GenesisConfig::<Test> {
|
||||
nodes: vec![(test_node(10), 10), (test_node(20), 20), (test_node(30), 30)],
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ use frame_election_provider_support::VoteWeight;
|
||||
use frame_support::{pallet_prelude::*, parameter_types, traits::ConstU64, PalletId};
|
||||
use sp_runtime::{
|
||||
traits::{Convert, IdentityLookup},
|
||||
FixedU128, Perbill,
|
||||
BuildStorage, FixedU128, Perbill,
|
||||
};
|
||||
|
||||
type AccountId = u128;
|
||||
@@ -192,7 +192,7 @@ frame_support::construct_runtime!(
|
||||
);
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut storage = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
let mut storage = frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
|
||||
let _ = pallet_nomination_pools::GenesisConfig::<Runtime> {
|
||||
min_join_bond: 2,
|
||||
min_create_bond: 2,
|
||||
|
||||
@@ -1680,7 +1680,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
MinJoinBond::<T>::put(self.min_join_bond);
|
||||
MinCreateBond::<T>::put(self.min_create_bond);
|
||||
|
||||
@@ -2,7 +2,7 @@ use super::*;
|
||||
use crate::{self as pools};
|
||||
use frame_support::{assert_ok, parameter_types, PalletId};
|
||||
use frame_system::RawOrigin;
|
||||
use sp_runtime::FixedU128;
|
||||
use sp_runtime::{BuildStorage, FixedU128};
|
||||
use sp_staking::Stake;
|
||||
|
||||
pub type BlockNumber = u64;
|
||||
@@ -254,7 +254,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Event<T>, Config},
|
||||
System: frame_system::{Pallet, Call, Storage, Event<T>, Config<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pools: pools::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
@@ -324,7 +324,7 @@ impl ExtBuilder {
|
||||
pub fn build(self) -> sp_io::TestExternalities {
|
||||
sp_tracing::try_init_simple();
|
||||
let mut storage =
|
||||
frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
|
||||
|
||||
let _ = crate::GenesisConfig::<Runtime> {
|
||||
min_join_bond: MinJoinBondConfig::get(),
|
||||
|
||||
@@ -25,7 +25,7 @@ use frame_support::{
|
||||
};
|
||||
use sp_runtime::{
|
||||
traits::{Convert, IdentityLookup},
|
||||
FixedU128, Perbill,
|
||||
BuildStorage, FixedU128, Perbill,
|
||||
};
|
||||
|
||||
type AccountId = u128;
|
||||
@@ -206,7 +206,7 @@ frame_support::construct_runtime!(
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
sp_tracing::try_init_simple();
|
||||
let mut storage = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
let mut storage = frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
|
||||
let _ = pallet_nomination_pools::GenesisConfig::<Runtime> {
|
||||
min_join_bond: 2,
|
||||
min_create_bond: 2,
|
||||
|
||||
@@ -30,6 +30,7 @@ use pallet_session::historical as pallet_session_historical;
|
||||
use sp_runtime::{
|
||||
testing::{Header, UintAuthorityId},
|
||||
traits::IdentityLookup,
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type AccountId = u64;
|
||||
@@ -235,6 +236,6 @@ frame_support::construct_runtime!(
|
||||
);
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
sp_io::TestExternalities::new(t)
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
Perbill,
|
||||
BuildStorage, Perbill,
|
||||
};
|
||||
use sp_staking::{
|
||||
offence::{self, DisableStrategy, Kind, OffenceDetails},
|
||||
@@ -75,7 +75,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Offences: offences::{Pallet, Storage, Event},
|
||||
}
|
||||
);
|
||||
@@ -114,7 +114,7 @@ impl Config for Runtime {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
let t = frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
|
||||
let mut ext = sp_io::TestExternalities::new(t);
|
||||
ext.execute_with(|| System::set_block_number(1));
|
||||
ext
|
||||
|
||||
@@ -30,6 +30,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -104,7 +105,7 @@ impl Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let balances = pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![(1, 100), (2, 100), (3, 100), (4, 100), (5, 100)],
|
||||
};
|
||||
|
||||
@@ -33,6 +33,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -44,7 +45,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Proxy: proxy::{Pallet, Call, Storage, Event<T>},
|
||||
Utility: pallet_utility::{Pallet, Call, Event},
|
||||
@@ -174,7 +175,7 @@ use pallet_utility::{Call as UtilityCall, Event as UtilityEvent};
|
||||
type SystemError = frame_system::Error<Test>;
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![(1, 10), (2, 10), (3, 10), (4, 10), (5, 3)],
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ use sp_core::{Get, H256};
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup, ReduceBy},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
use super::*;
|
||||
@@ -44,7 +45,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Club: pallet_ranked_collective::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
@@ -199,7 +200,7 @@ impl Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let mut ext = sp_io::TestExternalities::new(t);
|
||||
ext.execute_with(|| System::set_block_number(1));
|
||||
ext
|
||||
|
||||
@@ -28,6 +28,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -39,7 +40,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Recovery: recovery::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
@@ -115,7 +116,7 @@ pub type BalancesCall = pallet_balances::Call<Test>;
|
||||
pub type RecoveryCall = super::Call<Test>;
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![(1, 100), (2, 100), (3, 100), (4, 100), (5, 100)],
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, Hash, IdentityLookup},
|
||||
DispatchResult, Perbill,
|
||||
BuildStorage, DispatchResult, Perbill,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -233,7 +233,7 @@ impl Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let balances = vec![(1, 100), (2, 100), (3, 100), (4, 100), (5, 100), (6, 100)];
|
||||
pallet_balances::GenesisConfig::<Test> { balances }
|
||||
.assimilate_storage(&mut t)
|
||||
|
||||
@@ -36,7 +36,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Remark: pallet_remark::{ Pallet, Call, Event<T> },
|
||||
}
|
||||
);
|
||||
|
||||
@@ -21,7 +21,7 @@ use crate as root_offences;
|
||||
use frame_election_provider_support::{onchain, SequentialPhragmen};
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
traits::{ConstU32, ConstU64, GenesisBuild, Hooks, OneSessionHandler},
|
||||
traits::{ConstU32, ConstU64, Hooks, OneSessionHandler},
|
||||
};
|
||||
use pallet_staking::StakerStatus;
|
||||
use sp_core::H256;
|
||||
@@ -29,6 +29,7 @@ use sp_runtime::{
|
||||
curve::PiecewiseLinear,
|
||||
testing::{Header, UintAuthorityId},
|
||||
traits::{BlakeTwo256, IdentityLookup, Zero},
|
||||
BuildStorage,
|
||||
};
|
||||
use sp_staking::{EraIndex, SessionIndex};
|
||||
use sp_std::collections::btree_map::BTreeMap;
|
||||
@@ -48,7 +49,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Staking: pallet_staking::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
@@ -244,7 +245,7 @@ impl Default for ExtBuilder {
|
||||
|
||||
impl ExtBuilder {
|
||||
fn build(self) -> sp_io::TestExternalities {
|
||||
let mut storage = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut storage = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![
|
||||
|
||||
@@ -29,7 +29,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, Identity, IdentityLookup},
|
||||
DispatchResult,
|
||||
BuildStorage, DispatchResult,
|
||||
};
|
||||
use sp_std::cell::RefCell;
|
||||
|
||||
@@ -45,7 +45,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Salary: pallet_salary::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
@@ -187,7 +187,7 @@ impl Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let mut ext = sp_io::TestExternalities::new(t);
|
||||
ext.execute_with(|| System::set_block_number(1));
|
||||
ext
|
||||
|
||||
@@ -32,7 +32,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
Perbill,
|
||||
BuildStorage, Perbill,
|
||||
};
|
||||
|
||||
// Logger module to track execution.
|
||||
@@ -102,7 +102,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Logger: logger::{Pallet, Call, Event<T>},
|
||||
Scheduler: scheduler::{Pallet, Call, Storage, Event<T>},
|
||||
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>},
|
||||
@@ -225,7 +225,7 @@ impl Config for Test {
|
||||
pub type LoggerCall = logger::Call<Test>;
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let t = system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
t.into()
|
||||
}
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {
|
||||
let mut pool = self.pool.clone();
|
||||
|
||||
|
||||
@@ -22,13 +22,14 @@ use crate as pallet_scored_pool;
|
||||
|
||||
use frame_support::{
|
||||
bounded_vec, construct_runtime, ord_parameter_types, parameter_types,
|
||||
traits::{ConstU32, ConstU64, GenesisBuild},
|
||||
traits::{ConstU32, ConstU64},
|
||||
};
|
||||
use frame_system::EnsureSignedBy;
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -40,7 +41,7 @@ construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
ScoredPool: pallet_scored_pool::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
}
|
||||
@@ -140,7 +141,7 @@ impl Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let mut balances = vec![];
|
||||
for i in 1..31 {
|
||||
balances.push((i, 500_000));
|
||||
|
||||
@@ -24,7 +24,7 @@ use frame_support::{
|
||||
parameter_types,
|
||||
traits::{ConstU32, ConstU64},
|
||||
};
|
||||
use sp_runtime::traits::IdentityLookup;
|
||||
use sp_runtime::{traits::IdentityLookup, BuildStorage};
|
||||
|
||||
type AccountId = u64;
|
||||
type AccountIndex = u32;
|
||||
@@ -40,7 +40,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Staking: pallet_staking::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
|
||||
@@ -192,6 +192,6 @@ impl pallet_staking::Config for Test {
|
||||
impl crate::Config for Test {}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
sp_io::TestExternalities::new(t)
|
||||
}
|
||||
|
||||
@@ -377,17 +377,17 @@ pub(crate) mod tests {
|
||||
force_new_session, set_next_validators, NextValidators, Session, System, Test,
|
||||
};
|
||||
|
||||
use sp_runtime::{key_types::DUMMY, testing::UintAuthorityId};
|
||||
use sp_runtime::{key_types::DUMMY, testing::UintAuthorityId, BuildStorage};
|
||||
|
||||
use frame_support::{
|
||||
traits::{GenesisBuild, KeyOwnerProofSystem, OnInitialize},
|
||||
traits::{KeyOwnerProofSystem, OnInitialize},
|
||||
BasicExternalities,
|
||||
};
|
||||
|
||||
type Historical = Pallet<Test>;
|
||||
|
||||
pub(crate) fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let keys: Vec<_> = NextValidators::get()
|
||||
.iter()
|
||||
.cloned()
|
||||
|
||||
@@ -149,18 +149,18 @@ mod tests {
|
||||
crypto::key_types::DUMMY,
|
||||
offchain::{testing::TestOffchainExt, OffchainDbExt, OffchainWorkerExt, StorageKind},
|
||||
};
|
||||
use sp_runtime::testing::UintAuthorityId;
|
||||
use sp_runtime::{testing::UintAuthorityId, BuildStorage};
|
||||
|
||||
use frame_support::{
|
||||
traits::{GenesisBuild, KeyOwnerProofSystem, OnInitialize},
|
||||
traits::{KeyOwnerProofSystem, OnInitialize},
|
||||
BasicExternalities,
|
||||
};
|
||||
|
||||
type Historical = Pallet<Test>;
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default()
|
||||
.build_storage::<Test>()
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default()
|
||||
.build_storage()
|
||||
.expect("Failed to create test externalities.");
|
||||
|
||||
let keys: Vec<_> = NextValidators::get()
|
||||
|
||||
@@ -420,7 +420,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
if T::SessionHandler::KEY_TYPE_IDS.len() != T::Keys::key_ids().len() {
|
||||
panic!("Number of keys in session handler and session keys does not match");
|
||||
|
||||
@@ -29,12 +29,13 @@ use sp_runtime::{
|
||||
impl_opaque_keys,
|
||||
testing::{Header, UintAuthorityId},
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
use sp_staking::SessionIndex;
|
||||
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
traits::{ConstU32, ConstU64, GenesisBuild},
|
||||
traits::{ConstU32, ConstU64},
|
||||
BasicExternalities,
|
||||
};
|
||||
|
||||
@@ -85,7 +86,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
|
||||
Historical: pallet_session_historical::{Pallet},
|
||||
}
|
||||
@@ -98,7 +99,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
|
||||
}
|
||||
);
|
||||
@@ -215,7 +216,7 @@ pub fn reset_before_session_end_called() {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let keys: Vec<_> = NextValidators::get()
|
||||
.iter()
|
||||
.cloned()
|
||||
|
||||
@@ -370,7 +370,10 @@ benchmarks_instance_pallet! {
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Society,
|
||||
sp_io::TestExternalities::from(frame_system::GenesisConfig::default().build_storage::<crate::mock::Test>().unwrap()),
|
||||
sp_io::TestExternalities::from(
|
||||
<frame_system::GenesisConfig::<crate::mock::Test> as sp_runtime::BuildStorage>::build_storage(
|
||||
&frame_system::GenesisConfig::default()).unwrap()
|
||||
),
|
||||
crate::mock::Test
|
||||
);
|
||||
}
|
||||
|
||||
@@ -798,7 +798,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {
|
||||
Pot::<T, I>::put(self.pot);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
use RuntimeOrigin as Origin;
|
||||
@@ -43,7 +44,7 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Society: pallet_society::{Pallet, Call, Storage, Event<T>, Config<T>},
|
||||
}
|
||||
@@ -150,7 +151,7 @@ impl EnvBuilder {
|
||||
}
|
||||
|
||||
pub fn execute<R, F: FnOnce() -> R>(mut self, f: F) -> R {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
self.balances.push((Society::account_id(), self.balance.max(self.pot)));
|
||||
pallet_balances::GenesisConfig::<Test> { balances: self.balances }
|
||||
.assimilate_storage(&mut t)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user