GenesisBuild<T,I> deprecated. BuildGenesisConfig added (#7397)

* GenesisBuild<T,I> deprecated. BuildGenesisConfig added

* fmt

* fixes

* more fixes

* more fixes

* fixes

* update lockfile for {"substrate"}

* fix

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Michal Kucharczyk
2023-07-12 13:04:15 +02:00
committed by GitHub
parent bcb9bd0432
commit 95ba849ee6
32 changed files with 397 additions and 347 deletions
+184 -183
View File
File diff suppressed because it is too large Load Diff
+54 -18
View File
@@ -350,7 +350,7 @@ fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::Runt
const STASH: u128 = 100 * DOT; const STASH: u128 = 100 * DOT;
polkadot::RuntimeGenesisConfig { polkadot::RuntimeGenesisConfig {
system: polkadot::SystemConfig { code: wasm_binary.to_vec() }, system: polkadot::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() },
balances: polkadot::BalancesConfig { balances: polkadot::BalancesConfig {
balances: endowed_accounts balances: endowed_accounts
.iter() .iter()
@@ -401,10 +401,14 @@ fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::Runt
babe: polkadot::BabeConfig { babe: polkadot::BabeConfig {
authorities: Default::default(), authorities: Default::default(),
epoch_config: Some(polkadot::BABE_GENESIS_EPOCH_CONFIG), epoch_config: Some(polkadot::BABE_GENESIS_EPOCH_CONFIG),
..Default::default()
}, },
grandpa: Default::default(), grandpa: Default::default(),
im_online: Default::default(), im_online: Default::default(),
authority_discovery: polkadot::AuthorityDiscoveryConfig { keys: vec![] }, authority_discovery: polkadot::AuthorityDiscoveryConfig {
keys: vec![],
..Default::default()
},
claims: polkadot::ClaimsConfig { claims: vec![], vesting: vec![] }, claims: polkadot::ClaimsConfig { claims: vec![], vesting: vec![] },
vesting: polkadot::VestingConfig { vesting: vec![] }, vesting: polkadot::VestingConfig { vesting: vec![] },
treasury: Default::default(), treasury: Default::default(),
@@ -541,7 +545,7 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Runtim
const STASH: u128 = 100 * WND; const STASH: u128 = 100 * WND;
westend::RuntimeGenesisConfig { westend::RuntimeGenesisConfig {
system: westend::SystemConfig { code: wasm_binary.to_vec() }, system: westend::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() },
balances: westend::BalancesConfig { balances: westend::BalancesConfig {
balances: endowed_accounts balances: endowed_accounts
.iter() .iter()
@@ -584,10 +588,14 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Runtim
babe: westend::BabeConfig { babe: westend::BabeConfig {
authorities: Default::default(), authorities: Default::default(),
epoch_config: Some(westend::BABE_GENESIS_EPOCH_CONFIG), epoch_config: Some(westend::BABE_GENESIS_EPOCH_CONFIG),
..Default::default()
}, },
grandpa: Default::default(), grandpa: Default::default(),
im_online: Default::default(), im_online: Default::default(),
authority_discovery: westend::AuthorityDiscoveryConfig { keys: vec![] }, authority_discovery: westend::AuthorityDiscoveryConfig {
keys: vec![],
..Default::default()
},
vesting: westend::VestingConfig { vesting: vec![] }, vesting: westend::VestingConfig { vesting: vec![] },
sudo: westend::SudoConfig { key: Some(endowed_accounts[0].clone()) }, sudo: westend::SudoConfig { key: Some(endowed_accounts[0].clone()) },
hrmp: Default::default(), hrmp: Default::default(),
@@ -597,6 +605,7 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Runtim
paras: Default::default(), paras: Default::default(),
registrar: westend_runtime::RegistrarConfig { registrar: westend_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID, next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID,
..Default::default()
}, },
xcm_pallet: Default::default(), xcm_pallet: Default::default(),
nomination_pools: Default::default(), nomination_pools: Default::default(),
@@ -731,7 +740,7 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::RuntimeG
const STASH: u128 = 100 * KSM; const STASH: u128 = 100 * KSM;
kusama::RuntimeGenesisConfig { kusama::RuntimeGenesisConfig {
system: kusama::SystemConfig { code: wasm_binary.to_vec() }, system: kusama::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() },
balances: kusama::BalancesConfig { balances: kusama::BalancesConfig {
balances: endowed_accounts balances: endowed_accounts
.iter() .iter()
@@ -774,10 +783,14 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::RuntimeG
babe: kusama::BabeConfig { babe: kusama::BabeConfig {
authorities: Default::default(), authorities: Default::default(),
epoch_config: Some(kusama::BABE_GENESIS_EPOCH_CONFIG), epoch_config: Some(kusama::BABE_GENESIS_EPOCH_CONFIG),
..Default::default()
}, },
grandpa: Default::default(), grandpa: Default::default(),
im_online: Default::default(), im_online: Default::default(),
authority_discovery: kusama::AuthorityDiscoveryConfig { keys: vec![] }, authority_discovery: kusama::AuthorityDiscoveryConfig {
keys: vec![],
..Default::default()
},
claims: kusama::ClaimsConfig { claims: vec![], vesting: vec![] }, claims: kusama::ClaimsConfig { claims: vec![], vesting: vec![] },
vesting: kusama::VestingConfig { vesting: vec![] }, vesting: kusama::VestingConfig { vesting: vec![] },
treasury: Default::default(), treasury: Default::default(),
@@ -1039,7 +1052,7 @@ fn rococo_staging_testnet_config_genesis(
const STASH: u128 = 100 * ROC; const STASH: u128 = 100 * ROC;
rococo_runtime::RuntimeGenesisConfig { rococo_runtime::RuntimeGenesisConfig {
system: rococo_runtime::SystemConfig { code: wasm_binary.to_vec() }, system: rococo_runtime::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() },
balances: rococo_runtime::BalancesConfig { balances: rococo_runtime::BalancesConfig {
balances: endowed_accounts balances: endowed_accounts
.iter() .iter()
@@ -1073,6 +1086,7 @@ fn rococo_staging_testnet_config_genesis(
babe: rococo_runtime::BabeConfig { babe: rococo_runtime::BabeConfig {
authorities: Default::default(), authorities: Default::default(),
epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG), epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG),
..Default::default()
}, },
grandpa: Default::default(), grandpa: Default::default(),
im_online: Default::default(), im_online: Default::default(),
@@ -1084,17 +1098,21 @@ fn rococo_staging_testnet_config_genesis(
}, },
technical_membership: Default::default(), technical_membership: Default::default(),
treasury: Default::default(), treasury: Default::default(),
authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] }, authority_discovery: rococo_runtime::AuthorityDiscoveryConfig {
keys: vec![],
..Default::default()
},
claims: rococo::ClaimsConfig { claims: vec![], vesting: vec![] }, claims: rococo::ClaimsConfig { claims: vec![], vesting: vec![] },
vesting: rococo::VestingConfig { vesting: vec![] }, vesting: rococo::VestingConfig { vesting: vec![] },
sudo: rococo_runtime::SudoConfig { key: Some(endowed_accounts[0].clone()) }, sudo: rococo_runtime::SudoConfig { key: Some(endowed_accounts[0].clone()) },
paras: rococo_runtime::ParasConfig { paras: vec![] }, paras: rococo_runtime::ParasConfig { paras: vec![], ..Default::default() },
hrmp: Default::default(), hrmp: Default::default(),
configuration: rococo_runtime::ConfigurationConfig { configuration: rococo_runtime::ConfigurationConfig {
config: default_parachains_host_configuration(), config: default_parachains_host_configuration(),
}, },
registrar: rococo_runtime::RegistrarConfig { registrar: rococo_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID, next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID,
..Default::default()
}, },
xcm_pallet: Default::default(), xcm_pallet: Default::default(),
nis_counterpart_balances: Default::default(), nis_counterpart_balances: Default::default(),
@@ -1347,7 +1365,7 @@ pub fn polkadot_testnet_genesis(
const STASH: u128 = 100 * DOT; const STASH: u128 = 100 * DOT;
polkadot::RuntimeGenesisConfig { polkadot::RuntimeGenesisConfig {
system: polkadot::SystemConfig { code: wasm_binary.to_vec() }, system: polkadot::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() },
indices: polkadot::IndicesConfig { indices: vec![] }, indices: polkadot::IndicesConfig { indices: vec![] },
balances: polkadot::BalancesConfig { balances: polkadot::BalancesConfig {
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(), balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(),
@@ -1394,10 +1412,14 @@ pub fn polkadot_testnet_genesis(
babe: polkadot::BabeConfig { babe: polkadot::BabeConfig {
authorities: Default::default(), authorities: Default::default(),
epoch_config: Some(polkadot::BABE_GENESIS_EPOCH_CONFIG), epoch_config: Some(polkadot::BABE_GENESIS_EPOCH_CONFIG),
..Default::default()
}, },
grandpa: Default::default(), grandpa: Default::default(),
im_online: Default::default(), im_online: Default::default(),
authority_discovery: polkadot::AuthorityDiscoveryConfig { keys: vec![] }, authority_discovery: polkadot::AuthorityDiscoveryConfig {
keys: vec![],
..Default::default()
},
claims: polkadot::ClaimsConfig { claims: vec![], vesting: vec![] }, claims: polkadot::ClaimsConfig { claims: vec![], vesting: vec![] },
vesting: polkadot::VestingConfig { vesting: vec![] }, vesting: polkadot::VestingConfig { vesting: vec![] },
treasury: Default::default(), treasury: Default::default(),
@@ -1434,7 +1456,7 @@ pub fn kusama_testnet_genesis(
const STASH: u128 = 100 * KSM; const STASH: u128 = 100 * KSM;
kusama::RuntimeGenesisConfig { kusama::RuntimeGenesisConfig {
system: kusama::SystemConfig { code: wasm_binary.to_vec() }, system: kusama::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() },
indices: kusama::IndicesConfig { indices: vec![] }, indices: kusama::IndicesConfig { indices: vec![] },
balances: kusama::BalancesConfig { balances: kusama::BalancesConfig {
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(), balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(),
@@ -1473,10 +1495,14 @@ pub fn kusama_testnet_genesis(
babe: kusama::BabeConfig { babe: kusama::BabeConfig {
authorities: Default::default(), authorities: Default::default(),
epoch_config: Some(kusama::BABE_GENESIS_EPOCH_CONFIG), epoch_config: Some(kusama::BABE_GENESIS_EPOCH_CONFIG),
..Default::default()
}, },
grandpa: Default::default(), grandpa: Default::default(),
im_online: Default::default(), im_online: Default::default(),
authority_discovery: kusama::AuthorityDiscoveryConfig { keys: vec![] }, authority_discovery: kusama::AuthorityDiscoveryConfig {
keys: vec![],
..Default::default()
},
claims: kusama::ClaimsConfig { claims: vec![], vesting: vec![] }, claims: kusama::ClaimsConfig { claims: vec![], vesting: vec![] },
vesting: kusama::VestingConfig { vesting: vec![] }, vesting: kusama::VestingConfig { vesting: vec![] },
treasury: Default::default(), treasury: Default::default(),
@@ -1514,7 +1540,7 @@ pub fn westend_testnet_genesis(
const STASH: u128 = 100 * WND; const STASH: u128 = 100 * WND;
westend::RuntimeGenesisConfig { westend::RuntimeGenesisConfig {
system: westend::SystemConfig { code: wasm_binary.to_vec() }, system: westend::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() },
indices: westend::IndicesConfig { indices: vec![] }, indices: westend::IndicesConfig { indices: vec![] },
balances: westend::BalancesConfig { balances: westend::BalancesConfig {
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(), balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(),
@@ -1553,10 +1579,14 @@ pub fn westend_testnet_genesis(
babe: westend::BabeConfig { babe: westend::BabeConfig {
authorities: Default::default(), authorities: Default::default(),
epoch_config: Some(westend::BABE_GENESIS_EPOCH_CONFIG), epoch_config: Some(westend::BABE_GENESIS_EPOCH_CONFIG),
..Default::default()
}, },
grandpa: Default::default(), grandpa: Default::default(),
im_online: Default::default(), im_online: Default::default(),
authority_discovery: westend::AuthorityDiscoveryConfig { keys: vec![] }, authority_discovery: westend::AuthorityDiscoveryConfig {
keys: vec![],
..Default::default()
},
vesting: westend::VestingConfig { vesting: vec![] }, vesting: westend::VestingConfig { vesting: vec![] },
sudo: westend::SudoConfig { key: Some(root_key) }, sudo: westend::SudoConfig { key: Some(root_key) },
hrmp: Default::default(), hrmp: Default::default(),
@@ -1566,6 +1596,7 @@ pub fn westend_testnet_genesis(
paras: Default::default(), paras: Default::default(),
registrar: westend_runtime::RegistrarConfig { registrar: westend_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID, next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID,
..Default::default()
}, },
xcm_pallet: Default::default(), xcm_pallet: Default::default(),
nomination_pools: Default::default(), nomination_pools: Default::default(),
@@ -1595,7 +1626,7 @@ pub fn rococo_testnet_genesis(
const ENDOWMENT: u128 = 1_000_000 * ROC; const ENDOWMENT: u128 = 1_000_000 * ROC;
rococo_runtime::RuntimeGenesisConfig { rococo_runtime::RuntimeGenesisConfig {
system: rococo_runtime::SystemConfig { code: wasm_binary.to_vec() }, system: rococo_runtime::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() },
beefy: Default::default(), beefy: Default::default(),
indices: rococo_runtime::IndicesConfig { indices: vec![] }, indices: rococo_runtime::IndicesConfig { indices: vec![] },
balances: rococo_runtime::BalancesConfig { balances: rococo_runtime::BalancesConfig {
@@ -1624,6 +1655,7 @@ pub fn rococo_testnet_genesis(
babe: rococo_runtime::BabeConfig { babe: rococo_runtime::BabeConfig {
authorities: Default::default(), authorities: Default::default(),
epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG), epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG),
..Default::default()
}, },
grandpa: Default::default(), grandpa: Default::default(),
im_online: Default::default(), im_online: Default::default(),
@@ -1638,7 +1670,10 @@ pub fn rococo_testnet_genesis(
treasury: Default::default(), treasury: Default::default(),
claims: rococo::ClaimsConfig { claims: vec![], vesting: vec![] }, claims: rococo::ClaimsConfig { claims: vec![], vesting: vec![] },
vesting: rococo::VestingConfig { vesting: vec![] }, vesting: rococo::VestingConfig { vesting: vec![] },
authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] }, authority_discovery: rococo_runtime::AuthorityDiscoveryConfig {
keys: vec![],
..Default::default()
},
sudo: rococo_runtime::SudoConfig { key: Some(root_key.clone()) }, sudo: rococo_runtime::SudoConfig { key: Some(root_key.clone()) },
hrmp: Default::default(), hrmp: Default::default(),
configuration: rococo_runtime::ConfigurationConfig { configuration: rococo_runtime::ConfigurationConfig {
@@ -1647,9 +1682,10 @@ pub fn rococo_testnet_genesis(
..default_parachains_host_configuration() ..default_parachains_host_configuration()
}, },
}, },
paras: rococo_runtime::ParasConfig { paras: vec![] }, paras: rococo_runtime::ParasConfig { paras: vec![], ..Default::default() },
registrar: rococo_runtime::RegistrarConfig { registrar: rococo_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID, next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID,
..Default::default()
}, },
xcm_pallet: Default::default(), xcm_pallet: Default::default(),
nis_counterpart_balances: Default::default(), nis_counterpart_balances: Default::default(),
+5 -1
View File
@@ -156,9 +156,13 @@ fn polkadot_testnet_genesis(
babe: runtime::BabeConfig { babe: runtime::BabeConfig {
authorities: vec![], authorities: vec![],
epoch_config: Some(BABE_GENESIS_EPOCH_CONFIG), epoch_config: Some(BABE_GENESIS_EPOCH_CONFIG),
..Default::default()
}, },
grandpa: Default::default(), grandpa: Default::default(),
authority_discovery: runtime::AuthorityDiscoveryConfig { keys: vec![] }, authority_discovery: runtime::AuthorityDiscoveryConfig {
keys: vec![],
..Default::default()
},
claims: runtime::ClaimsConfig { claims: vec![], vesting: vec![] }, claims: runtime::ClaimsConfig { claims: vec![], vesting: vec![] },
vesting: runtime::VestingConfig { vesting: vec![] }, vesting: runtime::VestingConfig { vesting: vec![] },
sudo: runtime::SudoConfig { key: Some(root_key) }, sudo: runtime::SudoConfig { key: Some(root_key) },
@@ -557,6 +557,7 @@ mod tests {
use sp_runtime::{ use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup}, traits::{BlakeTwo256, IdentityLookup},
transaction_validity::TransactionPriority, transaction_validity::TransactionPriority,
BuildStorage,
DispatchError::BadOrigin, DispatchError::BadOrigin,
}; };
@@ -569,11 +570,11 @@ mod tests {
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, 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>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>}, Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>},
ParasShared: parachains_shared::{Pallet, Call, Storage}, ParasShared: parachains_shared::{Pallet, Call, Storage},
Parachains: parachains_paras::{Pallet, Call, Storage, Config, Event}, Parachains: parachains_paras::{Pallet, Call, Storage, Config<T>, Event},
Slots: slots::{Pallet, Call, Storage, Event<T>}, Slots: slots::{Pallet, Call, Storage, Event<T>},
AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event<T>}, AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event<T>},
} }
@@ -693,7 +694,7 @@ mod tests {
// This function basically just builds a genesis storage key/value store according to // This function basically just builds a genesis storage key/value store according to
// our desired mock up. // our desired mock up.
pub fn new_test_ext() -> sp_io::TestExternalities { 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> { pallet_balances::GenesisConfig::<Test> {
balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)], balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)],
} }
+6 -3
View File
@@ -685,7 +685,10 @@ mod tests {
use pallet_balances; use pallet_balances;
use primitives::{BlockNumber, Header, Id as ParaId}; use primitives::{BlockNumber, Header, Id as ParaId};
use sp_core::H256; use sp_core::H256;
use sp_runtime::traits::{BlakeTwo256, IdentityLookup}; use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup},
BuildStorage,
};
use std::{cell::RefCell, collections::BTreeMap}; use std::{cell::RefCell, collections::BTreeMap};
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
@@ -697,7 +700,7 @@ mod tests {
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, 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>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Auctions: auctions::{Pallet, Call, Storage, Event<T>}, Auctions: auctions::{Pallet, Call, Storage, Event<T>},
} }
@@ -886,7 +889,7 @@ mod tests {
// This function basically just builds a genesis storage key/value store according to // This function basically just builds a genesis storage key/value store according to
// our desired mock up. // our desired mock up.
pub fn new_test_ext() -> sp_io::TestExternalities { 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> { pallet_balances::GenesisConfig::<Test> {
balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)], balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)],
} }
+5 -5
View File
@@ -236,7 +236,7 @@ pub mod pallet {
} }
#[pallet::genesis_build] #[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> { impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) { fn build(&self) {
// build `Claims` // build `Claims`
self.claims.iter().map(|(a, b, _, _)| (*a, *b)).for_each(|(a, b)| { self.claims.iter().map(|(a, b, _, _)| (*a, *b)).for_each(|(a, b)| {
@@ -710,14 +710,14 @@ mod tests {
assert_err, assert_noop, assert_ok, assert_err, assert_noop, assert_ok,
dispatch::{DispatchError::BadOrigin, GetDispatchInfo, Pays}, dispatch::{DispatchError::BadOrigin, GetDispatchInfo, Pays},
ord_parameter_types, parameter_types, ord_parameter_types, parameter_types,
traits::{ConstU32, ExistenceRequirement, GenesisBuild, WithdrawReasons}, traits::{ConstU32, ExistenceRequirement, WithdrawReasons},
}; };
use pallet_balances; use pallet_balances;
use sp_runtime::{ use sp_runtime::{
testing::Header, testing::Header,
traits::{BlakeTwo256, Identity, IdentityLookup}, traits::{BlakeTwo256, Identity, IdentityLookup},
transaction_validity::TransactionLongevity, transaction_validity::TransactionLongevity,
TokenError, BuildStorage, TokenError,
}; };
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
@@ -729,7 +729,7 @@ mod tests {
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, 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>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Vesting: pallet_vesting::{Pallet, Call, Storage, Config<T>, Event<T>}, Vesting: pallet_vesting::{Pallet, Call, Storage, Config<T>, Event<T>},
Claims: claims::{Pallet, Call, Storage, Config<T>, Event<T>, ValidateUnsigned}, Claims: claims::{Pallet, Call, Storage, Config<T>, Event<T>, ValidateUnsigned},
@@ -836,7 +836,7 @@ mod tests {
// This function basically just builds a genesis storage key/value store according to // This function basically just builds a genesis storage key/value store according to
// our desired mockup. // our desired mockup.
pub fn new_test_ext() -> sp_io::TestExternalities { 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();
// We use default for brevity, but you can configure as desired if needed. // We use default for brevity, but you can configure as desired if needed.
pallet_balances::GenesisConfig::<Test>::default() pallet_balances::GenesisConfig::<Test>::default()
.assimilate_storage(&mut t) .assimilate_storage(&mut t)
+3 -3
View File
@@ -880,7 +880,7 @@ mod tests {
use sp_runtime::{ use sp_runtime::{
testing::Header, testing::Header,
traits::{BlakeTwo256, IdentityLookup, TrailingZeroInput}, traits::{BlakeTwo256, IdentityLookup, TrailingZeroInput},
DispatchResult, BuildStorage, DispatchResult,
}; };
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
@@ -892,7 +892,7 @@ mod tests {
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, 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>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>}, Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>},
} }
@@ -1110,7 +1110,7 @@ mod tests {
// This function basically just builds a genesis storage key/value store according to // This function basically just builds a genesis storage key/value store according to
// our desired mockup. // our desired mockup.
pub fn new_test_ext() -> sp_io::TestExternalities { 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> { pallet_balances::GenesisConfig::<Test> {
balances: vec![(1, 1000), (2, 2000), (3, 3000), (4, 4000)], balances: vec![(1, 1000), (2, 2000), (3, 3000), (4, 4000)],
} }
+4 -4
View File
@@ -114,7 +114,7 @@ mod tests {
use sp_runtime::{ use sp_runtime::{
testing::Header, testing::Header,
traits::{BlakeTwo256, IdentityLookup}, traits::{BlakeTwo256, IdentityLookup},
Perbill, BuildStorage, Perbill,
}; };
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
@@ -127,10 +127,10 @@ mod tests {
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, 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}, Authorship: pallet_authorship::{Pallet, Storage},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>}, Treasury: pallet_treasury::{Pallet, Call, Storage, Config<T>, Event<T>},
} }
); );
@@ -231,7 +231,7 @@ mod tests {
} }
pub fn new_test_ext() -> sp_io::TestExternalities { 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();
// We use default for brevity, but you can configure as desired if needed. // We use default for brevity, but you can configure as desired if needed.
pallet_balances::GenesisConfig::<Test>::default() pallet_balances::GenesisConfig::<Test>::default()
.assimilate_storage(&mut t) .assimilate_storage(&mut t)
@@ -26,7 +26,7 @@ use crate::{
}; };
use frame_support::{ use frame_support::{
assert_noop, assert_ok, parameter_types, assert_noop, assert_ok, parameter_types,
traits::{ConstU32, Currency, GenesisBuild, OnFinalize, OnInitialize}, traits::{ConstU32, Currency, OnFinalize, OnInitialize},
weights::Weight, weights::Weight,
PalletId, PalletId,
}; };
@@ -46,7 +46,7 @@ use sp_keystore::{testing::MemoryKeystore, KeystoreExt};
use sp_runtime::{ use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup, One}, traits::{BlakeTwo256, IdentityLookup, One},
transaction_validity::TransactionPriority, transaction_validity::TransactionPriority,
AccountId32, AccountId32, BuildStorage,
}; };
use sp_std::sync::Arc; use sp_std::sync::Arc;
@@ -76,13 +76,13 @@ frame_support::construct_runtime!(
UncheckedExtrinsic = UncheckedExtrinsic, UncheckedExtrinsic = UncheckedExtrinsic,
{ {
// System Stuff // System Stuff
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>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned}, Babe: pallet_babe::{Pallet, Call, Storage, Config<T>, ValidateUnsigned},
// Parachains Runtime // Parachains Runtime
Configuration: configuration::{Pallet, Call, Storage, Config<T>}, Configuration: configuration::{Pallet, Call, Storage, Config<T>},
Paras: paras::{Pallet, Call, Storage, Event, Config}, Paras: paras::{Pallet, Call, Storage, Event, Config<T>},
ParasShared: shared::{Pallet, Call, Storage}, ParasShared: shared::{Pallet, Call, Storage},
ParachainsOrigin: origin::{Pallet, Origin}, ParachainsOrigin: origin::{Pallet, Origin},
@@ -277,17 +277,15 @@ impl crowdloan::Config for Test {
/// Create a new set of test externalities. /// Create a new set of test externalities.
pub fn new_test_ext() -> TestExternalities { pub fn new_test_ext() -> TestExternalities {
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( configuration::GenesisConfig::<Test> {
&configuration::GenesisConfig {
config: configuration::HostConfiguration { config: configuration::HostConfiguration {
max_code_size: 2 * 1024 * 1024, // 2 MB max_code_size: 2 * 1024 * 1024, // 2 MB
max_head_data_size: 1 * 1024 * 1024, // 1 MB max_head_data_size: 1 * 1024 * 1024, // 1 MB
..Default::default() ..Default::default()
}, },
}, }
&mut t, .assimilate_storage(&mut t)
)
.unwrap(); .unwrap();
let keystore = MemoryKeystore::new(); let keystore = MemoryKeystore::new();
let mut ext: sp_io::TestExternalities = t.into(); let mut ext: sp_io::TestExternalities = t.into();
+14 -14
View File
@@ -191,18 +191,20 @@ pub mod pallet {
pub type NextFreeParaId<T> = StorageValue<_, ParaId, ValueQuery>; pub type NextFreeParaId<T> = StorageValue<_, ParaId, ValueQuery>;
#[pallet::genesis_config] #[pallet::genesis_config]
pub struct GenesisConfig { pub struct GenesisConfig<T: Config> {
#[serde(skip)]
pub _config: sp_std::marker::PhantomData<T>,
pub next_free_para_id: ParaId, pub next_free_para_id: ParaId,
} }
impl Default for GenesisConfig { impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self { fn default() -> Self {
GenesisConfig { next_free_para_id: LOWEST_PUBLIC_ID } GenesisConfig { next_free_para_id: LOWEST_PUBLIC_ID, _config: Default::default() }
} }
} }
#[pallet::genesis_build] #[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig { impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) { fn build(&self) {
NextFreeParaId::<T>::put(self.next_free_para_id); NextFreeParaId::<T>::put(self.next_free_para_id);
} }
@@ -661,7 +663,7 @@ mod tests {
assert_noop, assert_ok, assert_noop, assert_ok,
error::BadOrigin, error::BadOrigin,
parameter_types, parameter_types,
traits::{ConstU32, GenesisBuild, OnFinalize, OnInitialize}, traits::{ConstU32, OnFinalize, OnInitialize},
}; };
use frame_system::limits; use frame_system::limits;
use pallet_balances::Error as BalancesError; use pallet_balances::Error as BalancesError;
@@ -673,7 +675,7 @@ mod tests {
use sp_runtime::{ use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup}, traits::{BlakeTwo256, IdentityLookup},
transaction_validity::TransactionPriority, transaction_validity::TransactionPriority,
Perbill, BuildStorage, Perbill,
}; };
use sp_std::collections::btree_map::BTreeMap; use sp_std::collections::btree_map::BTreeMap;
@@ -686,10 +688,10 @@ mod tests {
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, 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>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Configuration: configuration::{Pallet, Call, Storage, Config<T>}, Configuration: configuration::{Pallet, Call, Storage, Config<T>},
Parachains: paras::{Pallet, Call, Storage, Config, Event}, Parachains: paras::{Pallet, Call, Storage, Config<T>, Event},
ParasShared: shared::{Pallet, Call, Storage}, ParasShared: shared::{Pallet, Call, Storage},
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>}, Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>},
ParachainsOrigin: origin::{Pallet, Origin}, ParachainsOrigin: origin::{Pallet, Origin},
@@ -797,18 +799,16 @@ mod tests {
} }
pub fn new_test_ext() -> TestExternalities { pub fn new_test_ext() -> TestExternalities {
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( configuration::GenesisConfig::<Test> {
&configuration::GenesisConfig {
config: configuration::HostConfiguration { config: configuration::HostConfiguration {
max_code_size: 2 * 1024 * 1024, // 2 MB max_code_size: 2 * 1024 * 1024, // 2 MB
max_head_data_size: 1 * 1024 * 1024, // 1 MB max_head_data_size: 1 * 1024 * 1024, // 1 MB
..Default::default() ..Default::default()
}, },
}, }
&mut t, .assimilate_storage(&mut t)
)
.unwrap(); .unwrap();
pallet_balances::GenesisConfig::<Test> { pallet_balances::GenesisConfig::<Test> {
+3 -3
View File
@@ -488,7 +488,7 @@ mod tests {
use sp_runtime::{ use sp_runtime::{
testing::Header, testing::Header,
traits::{BlakeTwo256, Dispatchable, IdentifyAccount, Identity, IdentityLookup, Verify}, traits::{BlakeTwo256, Dispatchable, IdentifyAccount, Identity, IdentityLookup, Verify},
ArithmeticError, MultiSignature, ArithmeticError, BuildStorage, MultiSignature,
}; };
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
@@ -500,7 +500,7 @@ mod tests {
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, 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>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Vesting: pallet_vesting::{Pallet, Call, Storage, Config<T>, Event<T>}, Vesting: pallet_vesting::{Pallet, Call, Storage, Config<T>, Event<T>},
Purchase: purchase::{Pallet, Call, Storage, Event<T>}, Purchase: purchase::{Pallet, Call, Storage, Event<T>},
@@ -601,7 +601,7 @@ mod tests {
// This function basically just builds a genesis storage key/value store according to // This function basically just builds a genesis storage key/value store according to
// our desired mockup. It also executes our `setup` function which sets up this pallet for use. // our desired mockup. It also executes our `setup` function which sets up this pallet for use.
pub fn new_test_ext() -> sp_io::TestExternalities { 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); let mut ext = sp_io::TestExternalities::new(t);
ext.execute_with(|| setup()); ext.execute_with(|| setup());
ext ext
+6 -3
View File
@@ -507,7 +507,10 @@ mod tests {
use pallet_balances; use pallet_balances;
use primitives::{BlockNumber, Header}; use primitives::{BlockNumber, Header};
use sp_core::H256; use sp_core::H256;
use sp_runtime::traits::{BlakeTwo256, IdentityLookup}; use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup},
BuildStorage,
};
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>; type Block = frame_system::mocking::MockBlock<Test>;
@@ -518,7 +521,7 @@ mod tests {
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, 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>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Slots: slots::{Pallet, Call, Storage, Event<T>}, Slots: slots::{Pallet, Call, Storage, Event<T>},
} }
@@ -593,7 +596,7 @@ mod tests {
// This function basically just builds a genesis storage key/value store according to // This function basically just builds a genesis storage key/value store according to
// our desired mock up. // our desired mock up.
pub fn new_test_ext() -> sp_io::TestExternalities { 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> { pallet_balances::GenesisConfig::<Test> {
balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)], balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)],
} }
+14 -14
View File
@@ -1369,10 +1369,10 @@ construct_runtime! {
UncheckedExtrinsic = UncheckedExtrinsic UncheckedExtrinsic = UncheckedExtrinsic
{ {
// Basic stuff; balances is uncallable initially. // Basic stuff; balances is uncallable initially.
System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 0, System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>} = 0,
// Babe must be before session. // Babe must be before session.
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1, Babe: pallet_babe::{Pallet, Call, Storage, Config<T>, ValidateUnsigned} = 1,
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2,
Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>} = 3, Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>} = 3,
@@ -1387,12 +1387,12 @@ construct_runtime! {
Offences: pallet_offences::{Pallet, Storage, Event} = 7, Offences: pallet_offences::{Pallet, Storage, Event} = 7,
Historical: session_historical::{Pallet} = 34, Historical: session_historical::{Pallet} = 34,
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 8, Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 8,
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config<T>, Event, ValidateUnsigned} = 10,
ImOnline: pallet_im_online::{Pallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>} = 11, ImOnline: pallet_im_online::{Pallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>} = 11,
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 12, AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config<T>} = 12,
// Governance stuff. // Governance stuff.
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 18, Treasury: pallet_treasury::{Pallet, Call, Storage, Config<T>, Event<T>} = 18,
ConvictionVoting: pallet_conviction_voting::{Pallet, Call, Storage, Event<T>} = 20, ConvictionVoting: pallet_conviction_voting::{Pallet, Call, Storage, Event<T>} = 20,
Referenda: pallet_referenda::{Pallet, Call, Storage, Event<T>} = 21, Referenda: pallet_referenda::{Pallet, Call, Storage, Event<T>} = 21,
// pub type FellowshipCollectiveInstance = pallet_ranked_collective::Instance1; // pub type FellowshipCollectiveInstance = pallet_ranked_collective::Instance1;
@@ -1464,10 +1464,10 @@ construct_runtime! {
ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 53, ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 53,
ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54, ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54,
ParaScheduler: parachains_scheduler::{Pallet, Storage} = 55, ParaScheduler: parachains_scheduler::{Pallet, Storage} = 55,
Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 56, Paras: parachains_paras::{Pallet, Call, Storage, Event, Config<T>, ValidateUnsigned} = 56,
Initializer: parachains_initializer::{Pallet, Call, Storage} = 57, Initializer: parachains_initializer::{Pallet, Call, Storage} = 57,
Dmp: parachains_dmp::{Pallet, Storage} = 58, Dmp: parachains_dmp::{Pallet, Storage} = 58,
Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event<T>, Config} = 60, Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event<T>, Config<T>} = 60,
ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 61, ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 61,
ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event<T>} = 62, ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event<T>} = 62,
ParasSlashing: parachains_slashing::{Pallet, Call, Storage, ValidateUnsigned} = 63, ParasSlashing: parachains_slashing::{Pallet, Call, Storage, ValidateUnsigned} = 63,
@@ -1482,7 +1482,7 @@ construct_runtime! {
StateTrieMigration: pallet_state_trie_migration = 98, StateTrieMigration: pallet_state_trie_migration = 98,
// Pallet for sending XCM. // Pallet for sending XCM.
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 99, XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config<T>} = 99,
// Generalized message queue // Generalized message queue
MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>} = 100, MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>} = 100,
@@ -2321,8 +2321,8 @@ mod multiplier_tests {
where where
F: FnMut() -> (), F: FnMut() -> (),
{ {
let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::<Runtime>::default()
.build_storage::<Runtime>() .build_storage()
.unwrap() .unwrap()
.into(); .into();
t.execute_with(|| { t.execute_with(|| {
@@ -2370,8 +2370,8 @@ mod multiplier_tests {
frame_system::Pallet::<Runtime>::set_block_consumed_resources(Weight::MAX, 0); frame_system::Pallet::<Runtime>::set_block_consumed_resources(Weight::MAX, 0);
let info = DispatchInfo { weight: Weight::MAX, ..Default::default() }; let info = DispatchInfo { weight: Weight::MAX, ..Default::default() };
let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::<Runtime>::default()
.build_storage::<Runtime>() .build_storage()
.unwrap() .unwrap()
.into(); .into();
// set the minimum // set the minimum
@@ -2413,8 +2413,8 @@ mod multiplier_tests {
let mut multiplier = Multiplier::from_u32(2); let mut multiplier = Multiplier::from_u32(2);
let mut blocks = 0; let mut blocks = 0;
let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::<Runtime>::default()
.build_storage::<Runtime>() .build_storage()
.unwrap() .unwrap()
.into(); .into();
// set the minimum // set the minimum
@@ -528,7 +528,7 @@ pub mod pallet {
} }
#[pallet::genesis_build] #[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> { impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) { fn build(&self) {
self.config.panic_if_not_consistent(); self.config.panic_if_not_consistent();
ActiveConfig::<T>::put(&self.config); ActiveConfig::<T>::put(&self.config);
+4 -2
View File
@@ -436,12 +436,14 @@ pub mod pallet {
/// 2. `sender` and `recipient` must be valid paras. /// 2. `sender` and `recipient` must be valid paras.
#[pallet::genesis_config] #[pallet::genesis_config]
#[derive(DefaultNoBound)] #[derive(DefaultNoBound)]
pub struct GenesisConfig { pub struct GenesisConfig<T: Config> {
#[serde(skip)]
_config: sp_std::marker::PhantomData<T>,
preopen_hrmp_channels: Vec<(ParaId, ParaId, u32, u32)>, preopen_hrmp_channels: Vec<(ParaId, ParaId, u32, u32)>,
} }
#[pallet::genesis_build] #[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig { impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) { fn build(&self) {
initialize_storage::<T>(&self.preopen_hrmp_channels); initialize_storage::<T>(&self.preopen_hrmp_channels);
} }
+6 -7
View File
@@ -27,8 +27,7 @@ use crate::{
use frame_support::{ use frame_support::{
assert_ok, parameter_types, assert_ok, parameter_types,
traits::{ traits::{
Currency, GenesisBuild, ProcessMessage, ProcessMessageError, ValidatorSet, Currency, ProcessMessage, ProcessMessageError, ValidatorSet, ValidatorSetWithIdentification,
ValidatorSetWithIdentification,
}, },
weights::{Weight, WeightMeter}, weights::{Weight, WeightMeter},
}; };
@@ -43,7 +42,7 @@ use sp_io::TestExternalities;
use sp_runtime::{ use sp_runtime::{
traits::{AccountIdConversion, BlakeTwo256, IdentityLookup}, traits::{AccountIdConversion, BlakeTwo256, IdentityLookup},
transaction_validity::TransactionPriority, transaction_validity::TransactionPriority,
Permill, BuildStorage, Permill,
}; };
use std::{cell::RefCell, collections::HashMap}; use std::{cell::RefCell, collections::HashMap};
@@ -485,9 +484,9 @@ pub fn new_test_ext(state: MockGenesisConfig) -> TestExternalities {
BACKING_REWARDS.with(|r| r.borrow_mut().clear()); BACKING_REWARDS.with(|r| r.borrow_mut().clear());
AVAILABILITY_REWARDS.with(|r| r.borrow_mut().clear()); AVAILABILITY_REWARDS.with(|r| r.borrow_mut().clear());
let mut t = state.system.build_storage::<Test>().unwrap(); let mut t = state.system.build_storage().unwrap();
state.configuration.assimilate_storage(&mut t).unwrap(); state.configuration.assimilate_storage(&mut t).unwrap();
GenesisBuild::<Test>::assimilate_storage(&state.paras, &mut t).unwrap(); state.paras.assimilate_storage(&mut t).unwrap();
let mut ext: TestExternalities = t.into(); let mut ext: TestExternalities = t.into();
ext.register_extension(KeystoreExt(Arc::new(MemoryKeystore::new()) as KeystorePtr)); ext.register_extension(KeystoreExt(Arc::new(MemoryKeystore::new()) as KeystorePtr));
@@ -497,9 +496,9 @@ pub fn new_test_ext(state: MockGenesisConfig) -> TestExternalities {
#[derive(Default)] #[derive(Default)]
pub struct MockGenesisConfig { pub struct MockGenesisConfig {
pub system: frame_system::GenesisConfig, pub system: frame_system::GenesisConfig<Test>,
pub configuration: crate::configuration::GenesisConfig<Test>, pub configuration: crate::configuration::GenesisConfig<Test>,
pub paras: crate::paras::GenesisConfig, pub paras: crate::paras::GenesisConfig<Test>,
} }
pub fn assert_last_event(generic_event: RuntimeEvent) { pub fn assert_last_event(generic_event: RuntimeEvent) {
+4 -2
View File
@@ -768,12 +768,14 @@ pub mod pallet {
#[pallet::genesis_config] #[pallet::genesis_config]
#[derive(DefaultNoBound)] #[derive(DefaultNoBound)]
pub struct GenesisConfig { pub struct GenesisConfig<T: Config> {
#[serde(skip)]
pub _config: sp_std::marker::PhantomData<T>,
pub paras: Vec<(ParaId, ParaGenesisArgs)>, pub paras: Vec<(ParaId, ParaGenesisArgs)>,
} }
#[pallet::genesis_build] #[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig { impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) { fn build(&self) {
let mut parachains = ParachainsCache::new(); let mut parachains = ParachainsCache::new();
for (id, genesis_args) in &self.paras { for (id, genesis_args) in &self.paras {
+14 -14
View File
@@ -1346,12 +1346,12 @@ construct_runtime! {
UncheckedExtrinsic = UncheckedExtrinsic UncheckedExtrinsic = UncheckedExtrinsic
{ {
// Basic stuff; balances is uncallable initially. // Basic stuff; balances is uncallable initially.
System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 0, System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>} = 0,
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 1, Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 1,
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 10, Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 10,
// Babe must be before session. // Babe must be before session.
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 2, Babe: pallet_babe::{Pallet, Call, Storage, Config<T>, ValidateUnsigned} = 2,
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3,
Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>} = 4, Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>} = 4,
@@ -1366,9 +1366,9 @@ construct_runtime! {
Offences: pallet_offences::{Pallet, Storage, Event} = 8, Offences: pallet_offences::{Pallet, Storage, Event} = 8,
Historical: session_historical::{Pallet} = 33, Historical: session_historical::{Pallet} = 33,
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 9, Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 9,
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 11, Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config<T>, Event, ValidateUnsigned} = 11,
ImOnline: pallet_im_online::{Pallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>} = 12, ImOnline: pallet_im_online::{Pallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>} = 12,
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 13, AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config<T>} = 13,
// Old governance stuff. // Old governance stuff.
Democracy: pallet_democracy::{Pallet, Call, Storage, Config<T>, Event<T>} = 14, Democracy: pallet_democracy::{Pallet, Call, Storage, Config<T>, Event<T>} = 14,
@@ -1376,7 +1376,7 @@ construct_runtime! {
TechnicalCommittee: pallet_collective::<Instance2>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 16, TechnicalCommittee: pallet_collective::<Instance2>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 16,
PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event<T>, Config<T>} = 17, PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event<T>, Config<T>} = 17,
TechnicalMembership: pallet_membership::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 18, TechnicalMembership: pallet_membership::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 18,
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 19, Treasury: pallet_treasury::{Pallet, Call, Storage, Config<T>, Event<T>} = 19,
// OpenGov stuff. // OpenGov stuff.
ConvictionVoting: pallet_conviction_voting::{Pallet, Call, Storage, Event<T>} = 20, ConvictionVoting: pallet_conviction_voting::{Pallet, Call, Storage, Event<T>} = 20,
@@ -1426,11 +1426,11 @@ construct_runtime! {
ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 53, ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 53,
ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54, ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54,
ParaScheduler: parachains_scheduler::{Pallet, Storage} = 55, ParaScheduler: parachains_scheduler::{Pallet, Storage} = 55,
Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 56, Paras: parachains_paras::{Pallet, Call, Storage, Event, Config<T>, ValidateUnsigned} = 56,
Initializer: parachains_initializer::{Pallet, Call, Storage} = 57, Initializer: parachains_initializer::{Pallet, Call, Storage} = 57,
Dmp: parachains_dmp::{Pallet, Storage} = 58, Dmp: parachains_dmp::{Pallet, Storage} = 58,
// Ump 59 // Ump 59
Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event<T>, Config} = 60, Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event<T>, Config<T>} = 60,
ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 61, ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 61,
ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event<T>} = 62, ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event<T>} = 62,
ParasSlashing: parachains_slashing::{Pallet, Call, Storage, ValidateUnsigned} = 63, ParasSlashing: parachains_slashing::{Pallet, Call, Storage, ValidateUnsigned} = 63,
@@ -1442,7 +1442,7 @@ construct_runtime! {
Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>} = 73, Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>} = 73,
// Pallet for sending XCM. // Pallet for sending XCM.
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 99, XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config<T>} = 99,
// Generalized message queue // Generalized message queue
MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>} = 100, MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>} = 100,
@@ -2377,8 +2377,8 @@ mod multiplier_tests {
where where
F: FnMut() -> (), F: FnMut() -> (),
{ {
let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::<Runtime>::default()
.build_storage::<Runtime>() .build_storage()
.unwrap() .unwrap()
.into(); .into();
t.execute_with(|| { t.execute_with(|| {
@@ -2426,8 +2426,8 @@ mod multiplier_tests {
frame_system::Pallet::<Runtime>::set_block_consumed_resources(Weight::MAX, 0); frame_system::Pallet::<Runtime>::set_block_consumed_resources(Weight::MAX, 0);
let info = DispatchInfo { weight: Weight::MAX, ..Default::default() }; let info = DispatchInfo { weight: Weight::MAX, ..Default::default() };
let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::<Runtime>::default()
.build_storage::<Runtime>() .build_storage()
.unwrap() .unwrap()
.into(); .into();
// set the minimum // set the minimum
@@ -2469,8 +2469,8 @@ mod multiplier_tests {
let mut multiplier = Multiplier::from_u32(2); let mut multiplier = Multiplier::from_u32(2);
let mut blocks = 0; let mut blocks = 0;
let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::<Runtime>::default()
.build_storage::<Runtime>() .build_storage()
.unwrap() .unwrap()
.into(); .into();
// set the minimum // set the minimum
+9 -9
View File
@@ -1365,10 +1365,10 @@ construct_runtime! {
UncheckedExtrinsic = UncheckedExtrinsic UncheckedExtrinsic = UncheckedExtrinsic
{ {
// Basic stuff; balances is uncallable initially. // Basic stuff; balances is uncallable initially.
System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 0, System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>} = 0,
// Babe must be before session. // Babe must be before session.
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1, Babe: pallet_babe::{Pallet, Call, Storage, Config<T>, ValidateUnsigned} = 1,
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2,
Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>} = 3, Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>} = 3,
@@ -1385,9 +1385,9 @@ construct_runtime! {
// refer to block<N-1> consistently. see substrate issue #11797 for details. // refer to block<N-1> consistently. see substrate issue #11797 for details.
Mmr: pallet_mmr::{Pallet, Storage} = 241, Mmr: pallet_mmr::{Pallet, Storage} = 241,
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 8, Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 8,
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config<T>, Event, ValidateUnsigned} = 10,
ImOnline: pallet_im_online::{Pallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>} = 11, ImOnline: pallet_im_online::{Pallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>} = 11,
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 12, AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config<T>} = 12,
// Governance stuff; uncallable initially. // Governance stuff; uncallable initially.
Democracy: pallet_democracy::{Pallet, Call, Storage, Config<T>, Event<T>} = 13, Democracy: pallet_democracy::{Pallet, Call, Storage, Config<T>, Event<T>} = 13,
@@ -1395,7 +1395,7 @@ construct_runtime! {
TechnicalCommittee: pallet_collective::<Instance2>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 15, TechnicalCommittee: pallet_collective::<Instance2>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 15,
PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event<T>, Config<T>} = 16, PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event<T>, Config<T>} = 16,
TechnicalMembership: pallet_membership::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 17, TechnicalMembership: pallet_membership::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 17,
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 18, Treasury: pallet_treasury::{Pallet, Call, Storage, Config<T>, Event<T>} = 18,
// Claims. Usable initially. // Claims. Usable initially.
Claims: claims::{Pallet, Call, Storage, Event<T>, Config<T>, ValidateUnsigned} = 19, Claims: claims::{Pallet, Call, Storage, Event<T>, Config<T>, ValidateUnsigned} = 19,
@@ -1446,23 +1446,23 @@ construct_runtime! {
ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 53, ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 53,
ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54, ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54,
ParaScheduler: parachains_scheduler::{Pallet, Storage} = 55, ParaScheduler: parachains_scheduler::{Pallet, Storage} = 55,
Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 56, Paras: parachains_paras::{Pallet, Call, Storage, Event, Config<T>, ValidateUnsigned} = 56,
Initializer: parachains_initializer::{Pallet, Call, Storage} = 57, Initializer: parachains_initializer::{Pallet, Call, Storage} = 57,
Dmp: parachains_dmp::{Pallet, Storage} = 58, Dmp: parachains_dmp::{Pallet, Storage} = 58,
Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event<T>, Config} = 60, Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event<T>, Config<T>} = 60,
ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 61, ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 61,
ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event<T>} = 62, ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event<T>} = 62,
ParasSlashing: parachains_slashing::{Pallet, Call, Storage, ValidateUnsigned} = 63, ParasSlashing: parachains_slashing::{Pallet, Call, Storage, ValidateUnsigned} = 63,
MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>} = 64, MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>} = 64,
// Parachain Onboarding Pallets. Start indices at 70 to leave room. // Parachain Onboarding Pallets. Start indices at 70 to leave room.
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>, Config} = 70, Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>, Config<T>} = 70,
Slots: slots::{Pallet, Call, Storage, Event<T>} = 71, Slots: slots::{Pallet, Call, Storage, Event<T>} = 71,
Auctions: auctions::{Pallet, Call, Storage, Event<T>} = 72, Auctions: auctions::{Pallet, Call, Storage, Event<T>} = 72,
Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>} = 73, Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>} = 73,
// Pallet for sending XCM. // Pallet for sending XCM.
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 99, XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config<T>} = 99,
// Rococo specific pallets (not included in Kusama). Start indices at 240 // Rococo specific pallets (not included in Kusama). Start indices at 240
// //
+4 -4
View File
@@ -652,10 +652,10 @@ construct_runtime! {
UncheckedExtrinsic = UncheckedExtrinsic UncheckedExtrinsic = UncheckedExtrinsic
{ {
// Basic stuff; balances is uncallable initially. // Basic stuff; balances is uncallable initially.
System: frame_system::{Pallet, Call, Storage, Config, Event<T>}, System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
// Must be before session. // Must be before session.
Babe: pallet_babe::{Pallet, Call, Storage, Config}, Babe: pallet_babe::{Pallet, Call, Storage, Config<T>},
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>}, Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>},
@@ -668,8 +668,8 @@ construct_runtime! {
Offences: pallet_offences::{Pallet, Storage, Event}, Offences: pallet_offences::{Pallet, Storage, Event},
Historical: session_historical::{Pallet}, Historical: session_historical::{Pallet},
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>}, Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event}, Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config<T>, Event},
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config}, AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config<T>},
// Claims. Usable initially. // Claims. Usable initially.
Claims: claims::{Pallet, Call, Storage, Event<T>, Config<T>, ValidateUnsigned}, Claims: claims::{Pallet, Call, Storage, Event<T>, Config<T>, ValidateUnsigned},
+8 -8
View File
@@ -1150,10 +1150,10 @@ construct_runtime! {
UncheckedExtrinsic = UncheckedExtrinsic UncheckedExtrinsic = UncheckedExtrinsic
{ {
// Basic stuff; balances is uncallable initially. // Basic stuff; balances is uncallable initially.
System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 0, System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>} = 0,
// Babe must be before session. // Babe must be before session.
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1, Babe: pallet_babe::{Pallet, Call, Storage, Config<T>, ValidateUnsigned} = 1,
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2,
Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>} = 3, Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>} = 3,
@@ -1168,9 +1168,9 @@ construct_runtime! {
Offences: pallet_offences::{Pallet, Storage, Event} = 7, Offences: pallet_offences::{Pallet, Storage, Event} = 7,
Historical: session_historical::{Pallet} = 27, Historical: session_historical::{Pallet} = 27,
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 8, Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 8,
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config<T>, Event, ValidateUnsigned} = 10,
ImOnline: pallet_im_online::{Pallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>} = 11, ImOnline: pallet_im_online::{Pallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>} = 11,
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 12, AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config<T>} = 12,
// Utility module. // Utility module.
Utility: pallet_utility::{Pallet, Call, Event} = 16, Utility: pallet_utility::{Pallet, Call, Event} = 16,
@@ -1218,17 +1218,17 @@ construct_runtime! {
ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 44, ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 44,
ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 45, ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 45,
ParaScheduler: parachains_scheduler::{Pallet, Storage} = 46, ParaScheduler: parachains_scheduler::{Pallet, Storage} = 46,
Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 47, Paras: parachains_paras::{Pallet, Call, Storage, Event, Config<T>, ValidateUnsigned} = 47,
Initializer: parachains_initializer::{Pallet, Call, Storage} = 48, Initializer: parachains_initializer::{Pallet, Call, Storage} = 48,
Dmp: parachains_dmp::{Pallet, Storage} = 49, Dmp: parachains_dmp::{Pallet, Storage} = 49,
// RIP Ump 50 // RIP Ump 50
Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event<T>, Config} = 51, Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event<T>, Config<T>} = 51,
ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 52, ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 52,
ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event<T>} = 53, ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event<T>} = 53,
ParasSlashing: parachains_slashing::{Pallet, Call, Storage, ValidateUnsigned} = 54, ParasSlashing: parachains_slashing::{Pallet, Call, Storage, ValidateUnsigned} = 54,
// Parachain Onboarding Pallets. Start indices at 60 to leave room. // Parachain Onboarding Pallets. Start indices at 60 to leave room.
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>, Config} = 60, Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>, Config<T>} = 60,
Slots: slots::{Pallet, Call, Storage, Event<T>} = 61, Slots: slots::{Pallet, Call, Storage, Event<T>} = 61,
ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call} = 62, ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call} = 62,
Auctions: auctions::{Pallet, Call, Storage, Event<T>} = 63, Auctions: auctions::{Pallet, Call, Storage, Event<T>} = 63,
@@ -1236,7 +1236,7 @@ construct_runtime! {
AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event<T>} = 65, AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event<T>} = 65,
// Pallet for sending XCM. // Pallet for sending XCM.
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 99, XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config<T>} = 99,
// Generalized message queue // Generalized message queue
MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>} = 100, MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>} = 100,
@@ -41,7 +41,7 @@ frame_support::construct_runtime!(
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, 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>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
XcmBalancesBenchmark: xcm_balances_benchmark::{Pallet}, XcmBalancesBenchmark: xcm_balances_benchmark::{Pallet},
} }
@@ -46,7 +46,7 @@ frame_support::construct_runtime!(
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, UncheckedExtrinsic = UncheckedExtrinsic,
{ {
System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
XcmGenericBenchmarks: generic::{Pallet}, XcmGenericBenchmarks: generic::{Pallet},
} }
); );
+6 -4
View File
@@ -633,19 +633,21 @@ pub mod pallet {
pub(super) type XcmExecutionSuspended<T: Config> = StorageValue<_, bool, ValueQuery>; pub(super) type XcmExecutionSuspended<T: Config> = StorageValue<_, bool, ValueQuery>;
#[pallet::genesis_config] #[pallet::genesis_config]
pub struct GenesisConfig { pub struct GenesisConfig<T: Config> {
#[serde(skip)]
pub _config: sp_std::marker::PhantomData<T>,
/// The default version to encode outgoing XCM messages with. /// The default version to encode outgoing XCM messages with.
pub safe_xcm_version: Option<XcmVersion>, pub safe_xcm_version: Option<XcmVersion>,
} }
impl Default for GenesisConfig { impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self { fn default() -> Self {
Self { safe_xcm_version: Some(XCM_VERSION) } Self { safe_xcm_version: Some(XCM_VERSION), _config: Default::default() }
} }
} }
#[pallet::genesis_build] #[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig { impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) { fn build(&self) {
SafeXcmVersion::<T>::set(self.safe_xcm_version); SafeXcmVersion::<T>::set(self.safe_xcm_version);
} }
+6 -8
View File
@@ -24,7 +24,7 @@ use frame_system::EnsureRoot;
use polkadot_parachain::primitives::Id as ParaId; use polkadot_parachain::primitives::Id as ParaId;
use polkadot_runtime_parachains::origin; use polkadot_runtime_parachains::origin;
use sp_core::H256; use sp_core::H256;
use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32}; use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32, BuildStorage};
pub use sp_std::{cell::RefCell, fmt::Debug, marker::PhantomData}; pub use sp_std::{cell::RefCell, fmt::Debug, marker::PhantomData};
use xcm::prelude::*; use xcm::prelude::*;
use xcm_builder::{ use xcm_builder::{
@@ -137,10 +137,10 @@ construct_runtime!(
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, UncheckedExtrinsic = UncheckedExtrinsic,
{ {
System: frame_system::{Pallet, Call, Storage, Config, Event<T>}, System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
ParasOrigin: origin::{Pallet, Origin}, ParasOrigin: origin::{Pallet, Origin},
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config}, XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config<T>},
TestNotifier: pallet_test_notifier::{Pallet, Call, Event<T>}, TestNotifier: pallet_test_notifier::{Pallet, Call, Event<T>},
} }
); );
@@ -384,16 +384,14 @@ pub(crate) fn buy_limited_execution<C>(
pub(crate) fn new_test_ext_with_balances( pub(crate) fn new_test_ext_with_balances(
balances: Vec<(AccountId, Balance)>, balances: Vec<(AccountId, Balance)>,
) -> sp_io::TestExternalities { ) -> 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 } pallet_balances::GenesisConfig::<Test> { balances }
.assimilate_storage(&mut t) .assimilate_storage(&mut t)
.unwrap(); .unwrap();
<pallet_xcm::GenesisConfig as frame_support::traits::GenesisBuild<Test>>::assimilate_storage( pallet_xcm::GenesisConfig::<Test> { safe_xcm_version: Some(2), ..Default::default() }
&pallet_xcm::GenesisConfig { safe_xcm_version: Some(2) }, .assimilate_storage(&mut t)
&mut t,
)
.unwrap(); .unwrap();
let mut ext = sp_io::TestExternalities::new(t); let mut ext = sp_io::TestExternalities::new(t);
+3 -3
View File
@@ -22,7 +22,7 @@ use frame_support::{
use frame_system::EnsureRoot; use frame_system::EnsureRoot;
use parity_scale_codec::Encode; use parity_scale_codec::Encode;
use primitive_types::H256; use primitive_types::H256;
use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32}; use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32, BuildStorage};
use sp_std::cell::RefCell; use sp_std::cell::RefCell;
use polkadot_parachain::primitives::Id as ParaId; use polkadot_parachain::primitives::Id as ParaId;
@@ -253,7 +253,7 @@ construct_runtime!(
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, UncheckedExtrinsic = UncheckedExtrinsic,
{ {
System: frame_system::{Pallet, Call, Storage, Config, Event<T>}, System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
ParasOrigin: origin::{Pallet, Origin}, ParasOrigin: origin::{Pallet, Origin},
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin}, XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin},
@@ -261,7 +261,7 @@ construct_runtime!(
); );
pub fn kusama_like_with_balances(balances: Vec<(AccountId, Balance)>) -> sp_io::TestExternalities { pub fn kusama_like_with_balances(balances: Vec<(AccountId, 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 } pallet_balances::GenesisConfig::<Runtime> { balances }
.assimilate_storage(&mut t) .assimilate_storage(&mut t)
@@ -18,6 +18,7 @@ mod parachain;
mod relay_chain; mod relay_chain;
use frame_support::sp_tracing; use frame_support::sp_tracing;
use sp_runtime::BuildStorage;
use xcm::prelude::*; use xcm::prelude::*;
use xcm_executor::traits::ConvertLocation; use xcm_executor::traits::ConvertLocation;
use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt};
@@ -93,7 +94,7 @@ pub fn parent_account_account_id(who: sp_runtime::AccountId32) -> parachain::Acc
pub fn para_ext(para_id: u32) -> sp_io::TestExternalities { pub fn para_ext(para_id: u32) -> sp_io::TestExternalities {
use parachain::{MsgQueue, Runtime, System}; use parachain::{MsgQueue, Runtime, System};
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> { pallet_balances::GenesisConfig::<Runtime> {
balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)],
@@ -113,7 +114,7 @@ pub fn para_ext(para_id: u32) -> sp_io::TestExternalities {
pub fn relay_ext() -> sp_io::TestExternalities { pub fn relay_ext() -> sp_io::TestExternalities {
use relay_chain::{Runtime, RuntimeOrigin, System, Uniques}; use relay_chain::{Runtime, RuntimeOrigin, System, Uniques};
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> { pallet_balances::GenesisConfig::<Runtime> {
balances: vec![ balances: vec![
@@ -458,7 +458,7 @@ construct_runtime!(
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, UncheckedExtrinsic = UncheckedExtrinsic,
{ {
System: frame_system::{Pallet, Call, Storage, Config, Event<T>}, System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
MsgQueue: mock_msg_queue::{Pallet, Storage, Event<T>}, MsgQueue: mock_msg_queue::{Pallet, Storage, Event<T>},
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin}, PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin},
@@ -289,7 +289,7 @@ construct_runtime!(
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, UncheckedExtrinsic = UncheckedExtrinsic,
{ {
System: frame_system::{Pallet, Call, Storage, Config, Event<T>}, System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
ParasOrigin: origin::{Pallet, Origin}, ParasOrigin: origin::{Pallet, Origin},
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin}, XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin},
@@ -20,7 +20,7 @@ mod relay_chain;
use codec::DecodeLimit; use codec::DecodeLimit;
use polkadot_core_primitives::AccountId; use polkadot_core_primitives::AccountId;
use polkadot_parachain::primitives::Id as ParaId; use polkadot_parachain::primitives::Id as ParaId;
use sp_runtime::traits::AccountIdConversion; use sp_runtime::{traits::AccountIdConversion, BuildStorage};
use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt};
use frame_support::assert_ok; use frame_support::assert_ok;
@@ -111,7 +111,7 @@ pub fn para_account_id(id: u32) -> relay_chain::AccountId {
pub fn para_ext(para_id: u32) -> sp_io::TestExternalities { pub fn para_ext(para_id: u32) -> sp_io::TestExternalities {
use parachain::{MsgQueue, Runtime, System}; use parachain::{MsgQueue, Runtime, System};
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> { pallet_balances::GenesisConfig::<Runtime> {
balances: (0..6).map(|i| ([i; 32].into(), INITIAL_BALANCE)).collect(), balances: (0..6).map(|i| ([i; 32].into(), INITIAL_BALANCE)).collect(),
@@ -130,7 +130,7 @@ pub fn para_ext(para_id: u32) -> sp_io::TestExternalities {
pub fn relay_ext() -> sp_io::TestExternalities { pub fn relay_ext() -> sp_io::TestExternalities {
use relay_chain::{Runtime, System}; use relay_chain::{Runtime, System};
let mut t = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap(); let mut t = frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
let mut balances: Vec<(AccountId, u128)> = vec![]; let mut balances: Vec<(AccountId, u128)> = vec![];
balances.append(&mut (1..=3).map(|i| (para_account_id(i), INITIAL_BALANCE)).collect()); balances.append(&mut (1..=3).map(|i| (para_account_id(i), INITIAL_BALANCE)).collect());
@@ -356,7 +356,7 @@ construct_runtime!(
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, UncheckedExtrinsic = UncheckedExtrinsic,
{ {
System: frame_system::{Pallet, Call, Storage, Config, Event<T>}, System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
MsgQueue: mock_msg_queue::{Pallet, Storage, Event<T>}, MsgQueue: mock_msg_queue::{Pallet, Storage, Event<T>},
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin}, PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin},
@@ -257,7 +257,7 @@ construct_runtime!(
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, UncheckedExtrinsic = UncheckedExtrinsic,
{ {
System: frame_system::{Pallet, Call, Storage, Config, Event<T>}, System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
ParasOrigin: origin::{Pallet, Origin}, ParasOrigin: origin::{Pallet, Origin},
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin}, XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin},