mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 18:41:05 +00:00
GenesisBuild<T,I> deprecated. BuildGenesisConfig added (#2757)
* GenesisBuild<T,I> deprecated. BuildGenesisConfig added
* ".git/.scripts/commands/fmt/fmt.sh"
* integration-tests/emulated: ..Default::default added to genesis configs
* Cargo.lock updated
* Cargo.lock updated
* update lockfile for {"polkadot", "substrate"}
* clippy fixes
* clippy fixes
* clippy fixes again
---------
Co-authored-by: command-bot <>
This commit is contained in:
committed by
GitHub
parent
f3ada7b81f
commit
94d2e4bc28
@@ -85,11 +85,14 @@ pub mod pallet {
|
||||
>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(Default)]
|
||||
pub struct GenesisConfig;
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
#[serde(skip)]
|
||||
pub _config: sp_std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
let authorities = Aura::<T>::authorities();
|
||||
|
||||
|
||||
@@ -220,7 +220,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) {
|
||||
let duplicate_invulnerables = self
|
||||
.invulnerables
|
||||
|
||||
@@ -17,7 +17,7 @@ use super::*;
|
||||
use crate as collator_selection;
|
||||
use frame_support::{
|
||||
ord_parameter_types, parameter_types,
|
||||
traits::{ConstBool, ConstU32, ConstU64, FindAuthor, GenesisBuild, ValidatorRegistration},
|
||||
traits::{ConstBool, ConstU32, ConstU64, FindAuthor, ValidatorRegistration},
|
||||
PalletId,
|
||||
};
|
||||
use frame_system as system;
|
||||
@@ -26,7 +26,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::{Header, UintAuthorityId},
|
||||
traits::{BlakeTwo256, IdentityLookup, OpaqueKeys},
|
||||
RuntimeAppPublic,
|
||||
BuildStorage, RuntimeAppPublic,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
@@ -214,7 +214,7 @@ impl Config for Test {
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
sp_tracing::try_init_simple();
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let invulnerables = vec![2, 1]; // unsorted
|
||||
|
||||
let balances = vec![(1, 100), (2, 100), (3, 100), (4, 100), (5, 100)];
|
||||
|
||||
@@ -17,10 +17,10 @@ use crate as collator_selection;
|
||||
use crate::{mock::*, CandidateInfo, Error};
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok,
|
||||
traits::{Currency, GenesisBuild, OnInitialize},
|
||||
traits::{Currency, OnInitialize},
|
||||
};
|
||||
use pallet_balances::Error as BalancesError;
|
||||
use sp_runtime::{testing::UintAuthorityId, traits::BadOrigin};
|
||||
use sp_runtime::{testing::UintAuthorityId, traits::BadOrigin, BuildStorage};
|
||||
|
||||
#[test]
|
||||
fn basic_setup_works() {
|
||||
@@ -627,7 +627,7 @@ fn should_kick_invulnerables_from_candidates_on_session_change() {
|
||||
#[should_panic = "duplicate invulnerables in genesis."]
|
||||
fn cannot_set_genesis_value_twice() {
|
||||
sp_tracing::try_init_simple();
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let invulnerables = vec![1, 1];
|
||||
|
||||
let collator_selection = collator_selection::GenesisConfig::<Test> {
|
||||
|
||||
@@ -416,6 +416,7 @@ mod tests {
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
DispatchError::BadOrigin,
|
||||
};
|
||||
use sp_version::RuntimeVersion;
|
||||
@@ -432,7 +433,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>},
|
||||
DmpQueue: dmp_queue::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
@@ -542,7 +543,7 @@ mod tests {
|
||||
}
|
||||
|
||||
pub(crate) fn new_test_ext() -> sp_io::TestExternalities {
|
||||
frame_system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
|
||||
frame_system::GenesisConfig::<Test>::default().build_storage().unwrap().into()
|
||||
}
|
||||
|
||||
fn enqueue(enqueued: &[Xcm]) {
|
||||
|
||||
@@ -714,11 +714,14 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(Default)]
|
||||
pub struct GenesisConfig;
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
#[serde(skip)]
|
||||
pub _config: sp_std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
// TODO: Remove after https://github.com/paritytech/cumulus/issues/479
|
||||
sp_io::storage::set(b":c", &[]);
|
||||
|
||||
@@ -36,7 +36,7 @@ use sp_core::{blake2_256, H256};
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
DispatchErrorWithPostInfo,
|
||||
BuildStorage, DispatchErrorWithPostInfo,
|
||||
};
|
||||
use sp_version::RuntimeVersion;
|
||||
use std::cell::RefCell;
|
||||
@@ -52,8 +52,8 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
ParachainSystem: parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
ParachainSystem: parachain_system::{Pallet, Call, Config<T>, Storage, Inherent, Event<T>, ValidateUnsigned},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -181,7 +181,7 @@ fn new_test_ext() -> sp_io::TestExternalities {
|
||||
HANDLED_DMP_MESSAGES.with(|m| m.borrow_mut().clear());
|
||||
HANDLED_XCMP_MESSAGES.with(|m| m.borrow_mut().clear());
|
||||
|
||||
frame_system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
|
||||
frame_system::GenesisConfig::<Test>::default().build_storage().unwrap().into()
|
||||
}
|
||||
|
||||
struct ReadRuntimeVersion(Vec<u8>);
|
||||
|
||||
@@ -27,6 +27,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
use xcm::prelude::*;
|
||||
use xcm_builder::{CurrencyAdapter, FixedWeightBounds, IsConcrete, NativeAsset, ParentIsPreset};
|
||||
@@ -42,10 +43,10 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{
|
||||
Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned,
|
||||
Pallet, Call, Config<T>, Storage, Inherent, Event<T>, ValidateUnsigned,
|
||||
},
|
||||
XcmpQueue: xcmp_queue::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
@@ -213,6 +214,6 @@ impl Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
t.into()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user