mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 18:35:41 +00:00
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:
committed by
GitHub
parent
bcb9bd0432
commit
95ba849ee6
@@ -557,6 +557,7 @@ mod tests {
|
||||
use sp_runtime::{
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
transaction_validity::TransactionPriority,
|
||||
BuildStorage,
|
||||
DispatchError::BadOrigin,
|
||||
};
|
||||
|
||||
@@ -569,11 +570,11 @@ 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>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>},
|
||||
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>},
|
||||
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
|
||||
// our desired mock up.
|
||||
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)],
|
||||
}
|
||||
|
||||
@@ -685,7 +685,10 @@ mod tests {
|
||||
use pallet_balances;
|
||||
use primitives::{BlockNumber, Header, Id as ParaId};
|
||||
use sp_core::H256;
|
||||
use sp_runtime::traits::{BlakeTwo256, IdentityLookup};
|
||||
use sp_runtime::{
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
use std::{cell::RefCell, collections::BTreeMap};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -697,7 +700,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>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, 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
|
||||
// our desired mock up.
|
||||
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)],
|
||||
}
|
||||
|
||||
@@ -236,7 +236,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) {
|
||||
// build `Claims`
|
||||
self.claims.iter().map(|(a, b, _, _)| (*a, *b)).for_each(|(a, b)| {
|
||||
@@ -710,14 +710,14 @@ mod tests {
|
||||
assert_err, assert_noop, assert_ok,
|
||||
dispatch::{DispatchError::BadOrigin, GetDispatchInfo, Pays},
|
||||
ord_parameter_types, parameter_types,
|
||||
traits::{ConstU32, ExistenceRequirement, GenesisBuild, WithdrawReasons},
|
||||
traits::{ConstU32, ExistenceRequirement, WithdrawReasons},
|
||||
};
|
||||
use pallet_balances;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, Identity, IdentityLookup},
|
||||
transaction_validity::TransactionLongevity,
|
||||
TokenError,
|
||||
BuildStorage, TokenError,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -729,7 +729,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>},
|
||||
Balances: pallet_balances::{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},
|
||||
@@ -836,7 +836,7 @@ mod tests {
|
||||
// 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();
|
||||
// We use default for brevity, but you can configure as desired if needed.
|
||||
pallet_balances::GenesisConfig::<Test>::default()
|
||||
.assimilate_storage(&mut t)
|
||||
|
||||
@@ -880,7 +880,7 @@ mod tests {
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup, TrailingZeroInput},
|
||||
DispatchResult,
|
||||
BuildStorage, DispatchResult,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -892,7 +892,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>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, 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
|
||||
// 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> {
|
||||
balances: vec![(1, 1000), (2, 2000), (3, 3000), (4, 4000)],
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ mod tests {
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
Perbill,
|
||||
BuildStorage, Perbill,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -127,10 +127,10 @@ 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},
|
||||
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 {
|
||||
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_balances::GenesisConfig::<Test>::default()
|
||||
.assimilate_storage(&mut t)
|
||||
|
||||
@@ -26,7 +26,7 @@ use crate::{
|
||||
};
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok, parameter_types,
|
||||
traits::{ConstU32, Currency, GenesisBuild, OnFinalize, OnInitialize},
|
||||
traits::{ConstU32, Currency, OnFinalize, OnInitialize},
|
||||
weights::Weight,
|
||||
PalletId,
|
||||
};
|
||||
@@ -46,7 +46,7 @@ use sp_keystore::{testing::MemoryKeystore, KeystoreExt};
|
||||
use sp_runtime::{
|
||||
traits::{BlakeTwo256, IdentityLookup, One},
|
||||
transaction_validity::TransactionPriority,
|
||||
AccountId32,
|
||||
AccountId32, BuildStorage,
|
||||
};
|
||||
use sp_std::sync::Arc;
|
||||
|
||||
@@ -76,13 +76,13 @@ frame_support::construct_runtime!(
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
// 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>},
|
||||
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned},
|
||||
Babe: pallet_babe::{Pallet, Call, Storage, Config<T>, ValidateUnsigned},
|
||||
|
||||
// Parachains Runtime
|
||||
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},
|
||||
ParachainsOrigin: origin::{Pallet, Origin},
|
||||
|
||||
@@ -277,17 +277,15 @@ impl crowdloan::Config for Test {
|
||||
|
||||
/// Create a new set of test externalities.
|
||||
pub fn new_test_ext() -> TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
GenesisBuild::<Test>::assimilate_storage(
|
||||
&configuration::GenesisConfig {
|
||||
config: configuration::HostConfiguration {
|
||||
max_code_size: 2 * 1024 * 1024, // 2 MB
|
||||
max_head_data_size: 1 * 1024 * 1024, // 1 MB
|
||||
..Default::default()
|
||||
},
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
configuration::GenesisConfig::<Test> {
|
||||
config: configuration::HostConfiguration {
|
||||
max_code_size: 2 * 1024 * 1024, // 2 MB
|
||||
max_head_data_size: 1 * 1024 * 1024, // 1 MB
|
||||
..Default::default()
|
||||
},
|
||||
&mut t,
|
||||
)
|
||||
}
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
let keystore = MemoryKeystore::new();
|
||||
let mut ext: sp_io::TestExternalities = t.into();
|
||||
|
||||
@@ -191,18 +191,20 @@ pub mod pallet {
|
||||
pub type NextFreeParaId<T> = StorageValue<_, ParaId, ValueQuery>;
|
||||
|
||||
#[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,
|
||||
}
|
||||
|
||||
impl Default for GenesisConfig {
|
||||
impl<T: Config> Default for GenesisConfig<T> {
|
||||
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]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
NextFreeParaId::<T>::put(self.next_free_para_id);
|
||||
}
|
||||
@@ -661,7 +663,7 @@ mod tests {
|
||||
assert_noop, assert_ok,
|
||||
error::BadOrigin,
|
||||
parameter_types,
|
||||
traits::{ConstU32, GenesisBuild, OnFinalize, OnInitialize},
|
||||
traits::{ConstU32, OnFinalize, OnInitialize},
|
||||
};
|
||||
use frame_system::limits;
|
||||
use pallet_balances::Error as BalancesError;
|
||||
@@ -673,7 +675,7 @@ mod tests {
|
||||
use sp_runtime::{
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
transaction_validity::TransactionPriority,
|
||||
Perbill,
|
||||
BuildStorage, Perbill,
|
||||
};
|
||||
use sp_std::collections::btree_map::BTreeMap;
|
||||
|
||||
@@ -686,10 +688,10 @@ 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>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<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},
|
||||
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>},
|
||||
ParachainsOrigin: origin::{Pallet, Origin},
|
||||
@@ -797,18 +799,16 @@ mod tests {
|
||||
}
|
||||
|
||||
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 {
|
||||
config: configuration::HostConfiguration {
|
||||
max_code_size: 2 * 1024 * 1024, // 2 MB
|
||||
max_head_data_size: 1 * 1024 * 1024, // 1 MB
|
||||
..Default::default()
|
||||
},
|
||||
configuration::GenesisConfig::<Test> {
|
||||
config: configuration::HostConfiguration {
|
||||
max_code_size: 2 * 1024 * 1024, // 2 MB
|
||||
max_head_data_size: 1 * 1024 * 1024, // 1 MB
|
||||
..Default::default()
|
||||
},
|
||||
&mut t,
|
||||
)
|
||||
}
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
|
||||
@@ -488,7 +488,7 @@ mod tests {
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, Dispatchable, IdentifyAccount, Identity, IdentityLookup, Verify},
|
||||
ArithmeticError, MultiSignature,
|
||||
ArithmeticError, BuildStorage, MultiSignature,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -500,7 +500,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>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Vesting: pallet_vesting::{Pallet, Call, Storage, Config<T>, 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
|
||||
// our desired mockup. It also executes our `setup` function which sets up this pallet for use.
|
||||
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(|| setup());
|
||||
ext
|
||||
|
||||
@@ -507,7 +507,10 @@ mod tests {
|
||||
use pallet_balances;
|
||||
use primitives::{BlockNumber, Header};
|
||||
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 Block = frame_system::mocking::MockBlock<Test>;
|
||||
@@ -518,7 +521,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>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, 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
|
||||
// our desired mock up.
|
||||
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)],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user