mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +00:00
Soft deprecate GenesisConfig (#14210)
* soft deprecate genesisconfig * temporarily add a deprecation attr * update tests * update mocks * update genesis config * update genesis config * update genesis config * update genesis config * remove deprecation warning * update deprecation comment --------- Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -372,7 +372,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
pub fn new_bench_ext() -> sp_io::TestExternalities {
|
||||
GenesisConfig::default().build_storage().unwrap().into()
|
||||
RuntimeGenesisConfig::default().build_storage().unwrap().into()
|
||||
}
|
||||
|
||||
pub fn test_cid() -> Cid {
|
||||
|
||||
@@ -118,7 +118,7 @@ impl pallet_test::Config for Test {
|
||||
}
|
||||
|
||||
fn new_test_ext() -> sp_io::TestExternalities {
|
||||
GenesisConfig::default().build_storage().unwrap().into()
|
||||
RuntimeGenesisConfig::default().build_storage().unwrap().into()
|
||||
}
|
||||
|
||||
thread_local! {
|
||||
|
||||
@@ -128,7 +128,7 @@ impl pallet_test::OtherConfig for Test {
|
||||
}
|
||||
|
||||
fn new_test_ext() -> sp_io::TestExternalities {
|
||||
GenesisConfig::default().build_storage().unwrap().into()
|
||||
RuntimeGenesisConfig::default().build_storage().unwrap().into()
|
||||
}
|
||||
|
||||
mod benchmarks {
|
||||
|
||||
@@ -194,7 +194,7 @@ type TreasuryError = pallet_treasury::Error<Test>;
|
||||
type TreasuryError1 = pallet_treasury::Error<Test, Instance1>;
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut ext: sp_io::TestExternalities = GenesisConfig {
|
||||
let mut ext: sp_io::TestExternalities = RuntimeGenesisConfig {
|
||||
system: frame_system::GenesisConfig::default(),
|
||||
balances: pallet_balances::GenesisConfig { balances: vec![(0, 100), (1, 98), (2, 1)] },
|
||||
treasury: Default::default(),
|
||||
|
||||
@@ -177,7 +177,7 @@ impl ExtBuilder {
|
||||
}
|
||||
|
||||
pub fn build(self) -> sp_io::TestExternalities {
|
||||
let mut ext: sp_io::TestExternalities = GenesisConfig {
|
||||
let mut ext: sp_io::TestExternalities = RuntimeGenesisConfig {
|
||||
collective: pallet_collective::GenesisConfig {
|
||||
members: self.collective_members,
|
||||
phantom: Default::default(),
|
||||
|
||||
@@ -1503,7 +1503,7 @@ mod tests {
|
||||
MEMBERS.with(|m| {
|
||||
*m.borrow_mut() = self.genesis_members.iter().map(|(m, _)| *m).collect::<Vec<_>>()
|
||||
});
|
||||
let mut ext: sp_io::TestExternalities = GenesisConfig {
|
||||
let mut ext: sp_io::TestExternalities = RuntimeGenesisConfig {
|
||||
balances: pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![
|
||||
(1, 10 * self.balance_factor),
|
||||
|
||||
@@ -102,7 +102,7 @@ impl Config for Test {
|
||||
// This function basically just builds a genesis storage key/value store according to
|
||||
// our desired mockup.
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = GenesisConfig {
|
||||
let t = RuntimeGenesisConfig {
|
||||
// We use default for brevity, but you can configure as desired if needed.
|
||||
system: Default::default(),
|
||||
balances: Default::default(),
|
||||
|
||||
@@ -94,7 +94,7 @@ impl Config for Test {
|
||||
// This function basically just builds a genesis storage key/value store according to
|
||||
// our desired mockup.
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = GenesisConfig {
|
||||
let t = RuntimeGenesisConfig {
|
||||
// We use default for brevity, but you can configure as desired if needed.
|
||||
system: Default::default(),
|
||||
balances: Default::default(),
|
||||
|
||||
@@ -74,6 +74,6 @@ impl pallet_remark::Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = GenesisConfig { system: Default::default() }.build_storage().unwrap();
|
||||
let t = RuntimeGenesisConfig { system: Default::default() }.build_storage().unwrap();
|
||||
t.into()
|
||||
}
|
||||
|
||||
@@ -74,12 +74,16 @@ pub fn expand_outer_config(
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[serde(deny_unknown_fields)]
|
||||
#[serde(crate = "__genesis_config_serde_import__")]
|
||||
pub struct GenesisConfig {
|
||||
pub struct RuntimeGenesisConfig {
|
||||
#fields
|
||||
}
|
||||
|
||||
// GenesisConfig is in the process of being deprecated [https://github.com/paritytech/substrate/issues/14065]
|
||||
#[cfg(any(feature = "std", test))]
|
||||
impl #scrate::sp_runtime::BuildStorage for GenesisConfig {
|
||||
pub type GenesisConfig = RuntimeGenesisConfig;
|
||||
|
||||
#[cfg(any(feature = "std", test))]
|
||||
impl #scrate::sp_runtime::BuildStorage for RuntimeGenesisConfig {
|
||||
fn assimilate_storage(
|
||||
&self,
|
||||
storage: &mut #scrate::sp_runtime::Storage,
|
||||
|
||||
@@ -980,7 +980,7 @@ pub mod tests {
|
||||
}
|
||||
|
||||
fn new_test_ext() -> TestExternalities {
|
||||
GenesisConfig::default().build_storage().unwrap().into()
|
||||
RuntimeGenesisConfig::default().build_storage().unwrap().into()
|
||||
}
|
||||
|
||||
trait Sorted {
|
||||
|
||||
@@ -148,7 +148,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn value_translate_works() {
|
||||
let t = GenesisConfig::default().build_storage().unwrap();
|
||||
let t = RuntimeGenesisConfig::default().build_storage().unwrap();
|
||||
TestExternalities::new(t).execute_with(|| {
|
||||
type Value = self::frame_system::Value<Runtime>;
|
||||
|
||||
@@ -170,7 +170,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn map_translate_works() {
|
||||
let t = GenesisConfig::default().build_storage().unwrap();
|
||||
let t = RuntimeGenesisConfig::default().build_storage().unwrap();
|
||||
TestExternalities::new(t).execute_with(|| {
|
||||
type NumberMap = self::frame_system::NumberMap<Runtime>;
|
||||
|
||||
@@ -201,7 +201,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn try_mutate_works() {
|
||||
let t = GenesisConfig::default().build_storage().unwrap();
|
||||
let t = RuntimeGenesisConfig::default().build_storage().unwrap();
|
||||
TestExternalities::new(t).execute_with(|| {
|
||||
type Value = self::frame_system::Value<Runtime>;
|
||||
type NumberMap = self::frame_system::NumberMap<Runtime>;
|
||||
|
||||
@@ -352,7 +352,7 @@ impl module3::Config for Runtime {
|
||||
}
|
||||
|
||||
fn new_test_ext() -> sp_io::TestExternalities {
|
||||
GenesisConfig {
|
||||
RuntimeGenesisConfig {
|
||||
module_1_1: module1::GenesisConfig { value: 3, test: 2 },
|
||||
module_1_2: module1::GenesisConfig { value: 4, test: 5 },
|
||||
module_2: module2::GenesisConfig {
|
||||
|
||||
@@ -186,7 +186,7 @@ frame_support::construct_runtime!(
|
||||
|
||||
#[test]
|
||||
fn create_genesis_config() {
|
||||
let config = GenesisConfig {
|
||||
let config = RuntimeGenesisConfig {
|
||||
module: module::GenesisConfig { request_life_time: 0, enable_storage_role: true },
|
||||
};
|
||||
assert_eq!(config.module.request_life_time, 0);
|
||||
|
||||
@@ -126,7 +126,7 @@ pub const CALL: &<Test as Config>::RuntimeCall =
|
||||
/// Create new externalities for `System` module tests.
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut ext: sp_io::TestExternalities =
|
||||
GenesisConfig::default().build_storage().unwrap().into();
|
||||
RuntimeGenesisConfig::default().build_storage().unwrap().into();
|
||||
// Add to each test the initial weight of a block
|
||||
ext.execute_with(|| {
|
||||
System::register_extra_weight_unchecked(
|
||||
|
||||
@@ -196,7 +196,7 @@ impl Config<Instance1> for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut ext: sp_io::TestExternalities = GenesisConfig {
|
||||
let mut ext: sp_io::TestExternalities = RuntimeGenesisConfig {
|
||||
system: frame_system::GenesisConfig::default(),
|
||||
balances: pallet_balances::GenesisConfig { balances: vec![(0, 100), (1, 98), (2, 1)] },
|
||||
treasury: Default::default(),
|
||||
|
||||
@@ -101,7 +101,7 @@ impl pallet_transaction_storage::Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = GenesisConfig {
|
||||
let t = RuntimeGenesisConfig {
|
||||
system: Default::default(),
|
||||
balances: pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![(1, 1000000000), (2, 100), (3, 100), (4, 100)],
|
||||
|
||||
@@ -111,7 +111,7 @@ impl pallet_whitelist::Config for Test {
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = GenesisConfig::default().build_storage().unwrap();
|
||||
let t = RuntimeGenesisConfig::default().build_storage().unwrap();
|
||||
let mut ext = sp_io::TestExternalities::new(t);
|
||||
ext.execute_with(|| System::set_block_number(1));
|
||||
ext
|
||||
|
||||
Reference in New Issue
Block a user