mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 06:55:42 +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:
@@ -1,6 +1,6 @@
|
|||||||
use node_template_runtime::{
|
use node_template_runtime::{
|
||||||
AccountId, AuraConfig, BalancesConfig, GenesisConfig, GrandpaConfig, Signature, SudoConfig,
|
AccountId, AuraConfig, BalancesConfig, GrandpaConfig, RuntimeGenesisConfig, Signature,
|
||||||
SystemConfig, WASM_BINARY,
|
SudoConfig, SystemConfig, WASM_BINARY,
|
||||||
};
|
};
|
||||||
use sc_service::ChainType;
|
use sc_service::ChainType;
|
||||||
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
|
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
|
||||||
@@ -12,7 +12,7 @@ use sp_runtime::traits::{IdentifyAccount, Verify};
|
|||||||
// const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
|
// const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
|
||||||
|
|
||||||
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
|
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
|
||||||
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig>;
|
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig>;
|
||||||
|
|
||||||
/// Generate a crypto pair from seed.
|
/// Generate a crypto pair from seed.
|
||||||
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||||
@@ -131,8 +131,8 @@ fn testnet_genesis(
|
|||||||
root_key: AccountId,
|
root_key: AccountId,
|
||||||
endowed_accounts: Vec<AccountId>,
|
endowed_accounts: Vec<AccountId>,
|
||||||
_enable_println: bool,
|
_enable_println: bool,
|
||||||
) -> GenesisConfig {
|
) -> RuntimeGenesisConfig {
|
||||||
GenesisConfig {
|
RuntimeGenesisConfig {
|
||||||
system: SystemConfig {
|
system: SystemConfig {
|
||||||
// Add Wasm runtime to storage.
|
// Add Wasm runtime to storage.
|
||||||
code: wasm_binary.to_vec(),
|
code: wasm_binary.to_vec(),
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ use sp_runtime::{
|
|||||||
Perbill,
|
Perbill,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use kitchensink_runtime::GenesisConfig;
|
pub use kitchensink_runtime::RuntimeGenesisConfig;
|
||||||
pub use node_primitives::{AccountId, Balance, Signature};
|
pub use node_primitives::{AccountId, Balance, Signature};
|
||||||
|
|
||||||
type AccountPublic = <Signature as Verify>::Signer;
|
type AccountPublic = <Signature as Verify>::Signer;
|
||||||
@@ -62,7 +62,7 @@ pub struct Extensions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Specialized `ChainSpec`.
|
/// Specialized `ChainSpec`.
|
||||||
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig, Extensions>;
|
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig, Extensions>;
|
||||||
/// Flaming Fir testnet generator
|
/// Flaming Fir testnet generator
|
||||||
pub fn flaming_fir_config() -> Result<ChainSpec, String> {
|
pub fn flaming_fir_config() -> Result<ChainSpec, String> {
|
||||||
ChainSpec::from_json_bytes(&include_bytes!("../res/flaming-fir.json")[..])
|
ChainSpec::from_json_bytes(&include_bytes!("../res/flaming-fir.json")[..])
|
||||||
@@ -77,7 +77,7 @@ fn session_keys(
|
|||||||
SessionKeys { grandpa, babe, im_online, authority_discovery }
|
SessionKeys { grandpa, babe, im_online, authority_discovery }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn staging_testnet_config_genesis() -> GenesisConfig {
|
fn staging_testnet_config_genesis() -> RuntimeGenesisConfig {
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
// stash, controller, session-key
|
// stash, controller, session-key
|
||||||
// generated with secret:
|
// generated with secret:
|
||||||
@@ -229,7 +229,7 @@ pub fn authority_keys_from_seed(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper function to create GenesisConfig for testing
|
/// Helper function to create RuntimeGenesisConfig for testing
|
||||||
pub fn testnet_genesis(
|
pub fn testnet_genesis(
|
||||||
initial_authorities: Vec<(
|
initial_authorities: Vec<(
|
||||||
AccountId,
|
AccountId,
|
||||||
@@ -242,7 +242,7 @@ pub fn testnet_genesis(
|
|||||||
initial_nominators: Vec<AccountId>,
|
initial_nominators: Vec<AccountId>,
|
||||||
root_key: AccountId,
|
root_key: AccountId,
|
||||||
endowed_accounts: Option<Vec<AccountId>>,
|
endowed_accounts: Option<Vec<AccountId>>,
|
||||||
) -> GenesisConfig {
|
) -> RuntimeGenesisConfig {
|
||||||
let mut endowed_accounts: Vec<AccountId> = endowed_accounts.unwrap_or_else(|| {
|
let mut endowed_accounts: Vec<AccountId> = endowed_accounts.unwrap_or_else(|| {
|
||||||
vec![
|
vec![
|
||||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||||
@@ -294,7 +294,7 @@ pub fn testnet_genesis(
|
|||||||
const ENDOWMENT: Balance = 10_000_000 * DOLLARS;
|
const ENDOWMENT: Balance = 10_000_000 * DOLLARS;
|
||||||
const STASH: Balance = ENDOWMENT / 1000;
|
const STASH: Balance = ENDOWMENT / 1000;
|
||||||
|
|
||||||
GenesisConfig {
|
RuntimeGenesisConfig {
|
||||||
system: SystemConfig { code: wasm_binary_unwrap().to_vec() },
|
system: SystemConfig { code: wasm_binary_unwrap().to_vec() },
|
||||||
balances: BalancesConfig {
|
balances: BalancesConfig {
|
||||||
balances: endowed_accounts.iter().cloned().map(|x| (x, ENDOWMENT)).collect(),
|
balances: endowed_accounts.iter().cloned().map(|x| (x, ENDOWMENT)).collect(),
|
||||||
@@ -381,7 +381,7 @@ pub fn testnet_genesis(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn development_config_genesis() -> GenesisConfig {
|
fn development_config_genesis() -> RuntimeGenesisConfig {
|
||||||
testnet_genesis(
|
testnet_genesis(
|
||||||
vec![authority_keys_from_seed("Alice")],
|
vec![authority_keys_from_seed("Alice")],
|
||||||
vec![],
|
vec![],
|
||||||
@@ -406,7 +406,7 @@ pub fn development_config() -> ChainSpec {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn local_testnet_genesis() -> GenesisConfig {
|
fn local_testnet_genesis() -> RuntimeGenesisConfig {
|
||||||
testnet_genesis(
|
testnet_genesis(
|
||||||
vec![authority_keys_from_seed("Alice"), authority_keys_from_seed("Bob")],
|
vec![authority_keys_from_seed("Alice"), authority_keys_from_seed("Bob")],
|
||||||
vec![],
|
vec![],
|
||||||
@@ -438,7 +438,7 @@ pub(crate) mod tests {
|
|||||||
use sc_service_test;
|
use sc_service_test;
|
||||||
use sp_runtime::BuildStorage;
|
use sp_runtime::BuildStorage;
|
||||||
|
|
||||||
fn local_testnet_genesis_instant_single() -> GenesisConfig {
|
fn local_testnet_genesis_instant_single() -> RuntimeGenesisConfig {
|
||||||
testnet_genesis(
|
testnet_genesis(
|
||||||
vec![authority_keys_from_seed("Alice")],
|
vec![authority_keys_from_seed("Alice")],
|
||||||
vec![],
|
vec![],
|
||||||
|
|||||||
@@ -603,7 +603,7 @@ impl BenchKeyring {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Generate genesis with accounts from this keyring endowed with some balance.
|
/// Generate genesis with accounts from this keyring endowed with some balance.
|
||||||
pub fn generate_genesis(&self) -> kitchensink_runtime::GenesisConfig {
|
pub fn generate_genesis(&self) -> kitchensink_runtime::RuntimeGenesisConfig {
|
||||||
crate::genesis::config_endowed(
|
crate::genesis::config_endowed(
|
||||||
Some(kitchensink_runtime::wasm_binary_unwrap()),
|
Some(kitchensink_runtime::wasm_binary_unwrap()),
|
||||||
self.collect_account_ids(),
|
self.collect_account_ids(),
|
||||||
|
|||||||
@@ -21,20 +21,21 @@
|
|||||||
use crate::keyring::*;
|
use crate::keyring::*;
|
||||||
use kitchensink_runtime::{
|
use kitchensink_runtime::{
|
||||||
constants::currency::*, wasm_binary_unwrap, AccountId, AssetsConfig, BabeConfig,
|
constants::currency::*, wasm_binary_unwrap, AccountId, AssetsConfig, BabeConfig,
|
||||||
BalancesConfig, GenesisConfig, GluttonConfig, GrandpaConfig, IndicesConfig, SessionConfig,
|
BalancesConfig, GluttonConfig, GrandpaConfig, IndicesConfig, RuntimeGenesisConfig,
|
||||||
SocietyConfig, StakerStatus, StakingConfig, SystemConfig, BABE_GENESIS_EPOCH_CONFIG,
|
SessionConfig, SocietyConfig, StakerStatus, StakingConfig, SystemConfig,
|
||||||
|
BABE_GENESIS_EPOCH_CONFIG,
|
||||||
};
|
};
|
||||||
use sp_keyring::{Ed25519Keyring, Sr25519Keyring};
|
use sp_keyring::{Ed25519Keyring, Sr25519Keyring};
|
||||||
use sp_runtime::Perbill;
|
use sp_runtime::Perbill;
|
||||||
|
|
||||||
/// Create genesis runtime configuration for tests.
|
/// Create genesis runtime configuration for tests.
|
||||||
pub fn config(code: Option<&[u8]>) -> GenesisConfig {
|
pub fn config(code: Option<&[u8]>) -> RuntimeGenesisConfig {
|
||||||
config_endowed(code, Default::default())
|
config_endowed(code, Default::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create genesis runtime configuration for tests with some extra
|
/// Create genesis runtime configuration for tests with some extra
|
||||||
/// endowed accounts.
|
/// endowed accounts.
|
||||||
pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec<AccountId>) -> GenesisConfig {
|
pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec<AccountId>) -> RuntimeGenesisConfig {
|
||||||
let mut endowed = vec![
|
let mut endowed = vec![
|
||||||
(alice(), 111 * DOLLARS),
|
(alice(), 111 * DOLLARS),
|
||||||
(bob(), 100 * DOLLARS),
|
(bob(), 100 * DOLLARS),
|
||||||
@@ -46,7 +47,7 @@ pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec<AccountId>) -> Gen
|
|||||||
|
|
||||||
endowed.extend(extra_endowed.into_iter().map(|endowed| (endowed, 100 * DOLLARS)));
|
endowed.extend(extra_endowed.into_iter().map(|endowed| (endowed, 100 * DOLLARS)));
|
||||||
|
|
||||||
GenesisConfig {
|
RuntimeGenesisConfig {
|
||||||
system: SystemConfig {
|
system: SystemConfig {
|
||||||
code: code.map(|x| x.to_vec()).unwrap_or_else(|| wasm_binary_unwrap().to_vec()),
|
code: code.map(|x| x.to_vec()).unwrap_or_else(|| wasm_binary_unwrap().to_vec()),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ fn genesis_constructor(
|
|||||||
nominator_accounts: &[AccountId],
|
nominator_accounts: &[AccountId],
|
||||||
endowed_accounts: &[AccountId],
|
endowed_accounts: &[AccountId],
|
||||||
sudo_account: &AccountId,
|
sudo_account: &AccountId,
|
||||||
) -> chain_spec::GenesisConfig {
|
) -> chain_spec::RuntimeGenesisConfig {
|
||||||
let authorities = authority_seeds
|
let authorities = authority_seeds
|
||||||
.iter()
|
.iter()
|
||||||
.map(AsRef::as_ref)
|
.map(AsRef::as_ref)
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
|
|||||||
|
|
||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
pub fn new_bench_ext() -> sp_io::TestExternalities {
|
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 {
|
pub fn test_cid() -> Cid {
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ impl pallet_test::Config for Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn new_test_ext() -> sp_io::TestExternalities {
|
fn new_test_ext() -> sp_io::TestExternalities {
|
||||||
GenesisConfig::default().build_storage().unwrap().into()
|
RuntimeGenesisConfig::default().build_storage().unwrap().into()
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ impl pallet_test::OtherConfig for Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn new_test_ext() -> sp_io::TestExternalities {
|
fn new_test_ext() -> sp_io::TestExternalities {
|
||||||
GenesisConfig::default().build_storage().unwrap().into()
|
RuntimeGenesisConfig::default().build_storage().unwrap().into()
|
||||||
}
|
}
|
||||||
|
|
||||||
mod benchmarks {
|
mod benchmarks {
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ type TreasuryError = pallet_treasury::Error<Test>;
|
|||||||
type TreasuryError1 = pallet_treasury::Error<Test, Instance1>;
|
type TreasuryError1 = pallet_treasury::Error<Test, Instance1>;
|
||||||
|
|
||||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
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(),
|
system: frame_system::GenesisConfig::default(),
|
||||||
balances: pallet_balances::GenesisConfig { balances: vec![(0, 100), (1, 98), (2, 1)] },
|
balances: pallet_balances::GenesisConfig { balances: vec![(0, 100), (1, 98), (2, 1)] },
|
||||||
treasury: Default::default(),
|
treasury: Default::default(),
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ impl ExtBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn build(self) -> sp_io::TestExternalities {
|
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 {
|
collective: pallet_collective::GenesisConfig {
|
||||||
members: self.collective_members,
|
members: self.collective_members,
|
||||||
phantom: Default::default(),
|
phantom: Default::default(),
|
||||||
|
|||||||
@@ -1503,7 +1503,7 @@ mod tests {
|
|||||||
MEMBERS.with(|m| {
|
MEMBERS.with(|m| {
|
||||||
*m.borrow_mut() = self.genesis_members.iter().map(|(m, _)| *m).collect::<Vec<_>>()
|
*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: pallet_balances::GenesisConfig::<Test> {
|
||||||
balances: vec![
|
balances: vec![
|
||||||
(1, 10 * self.balance_factor),
|
(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
|
// 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 t = GenesisConfig {
|
let t = RuntimeGenesisConfig {
|
||||||
// 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.
|
||||||
system: Default::default(),
|
system: Default::default(),
|
||||||
balances: 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
|
// 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 t = GenesisConfig {
|
let t = RuntimeGenesisConfig {
|
||||||
// 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.
|
||||||
system: Default::default(),
|
system: Default::default(),
|
||||||
balances: Default::default(),
|
balances: Default::default(),
|
||||||
|
|||||||
@@ -74,6 +74,6 @@ impl pallet_remark::Config for Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
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()
|
t.into()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,12 +74,16 @@ pub fn expand_outer_config(
|
|||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
#[serde(crate = "__genesis_config_serde_import__")]
|
#[serde(crate = "__genesis_config_serde_import__")]
|
||||||
pub struct GenesisConfig {
|
pub struct RuntimeGenesisConfig {
|
||||||
#fields
|
#fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GenesisConfig is in the process of being deprecated [https://github.com/paritytech/substrate/issues/14065]
|
||||||
#[cfg(any(feature = "std", test))]
|
#[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(
|
fn assimilate_storage(
|
||||||
&self,
|
&self,
|
||||||
storage: &mut #scrate::sp_runtime::Storage,
|
storage: &mut #scrate::sp_runtime::Storage,
|
||||||
|
|||||||
@@ -980,7 +980,7 @@ pub mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn new_test_ext() -> TestExternalities {
|
fn new_test_ext() -> TestExternalities {
|
||||||
GenesisConfig::default().build_storage().unwrap().into()
|
RuntimeGenesisConfig::default().build_storage().unwrap().into()
|
||||||
}
|
}
|
||||||
|
|
||||||
trait Sorted {
|
trait Sorted {
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn value_translate_works() {
|
fn value_translate_works() {
|
||||||
let t = GenesisConfig::default().build_storage().unwrap();
|
let t = RuntimeGenesisConfig::default().build_storage().unwrap();
|
||||||
TestExternalities::new(t).execute_with(|| {
|
TestExternalities::new(t).execute_with(|| {
|
||||||
type Value = self::frame_system::Value<Runtime>;
|
type Value = self::frame_system::Value<Runtime>;
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn map_translate_works() {
|
fn map_translate_works() {
|
||||||
let t = GenesisConfig::default().build_storage().unwrap();
|
let t = RuntimeGenesisConfig::default().build_storage().unwrap();
|
||||||
TestExternalities::new(t).execute_with(|| {
|
TestExternalities::new(t).execute_with(|| {
|
||||||
type NumberMap = self::frame_system::NumberMap<Runtime>;
|
type NumberMap = self::frame_system::NumberMap<Runtime>;
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn try_mutate_works() {
|
fn try_mutate_works() {
|
||||||
let t = GenesisConfig::default().build_storage().unwrap();
|
let t = RuntimeGenesisConfig::default().build_storage().unwrap();
|
||||||
TestExternalities::new(t).execute_with(|| {
|
TestExternalities::new(t).execute_with(|| {
|
||||||
type Value = self::frame_system::Value<Runtime>;
|
type Value = self::frame_system::Value<Runtime>;
|
||||||
type NumberMap = self::frame_system::NumberMap<Runtime>;
|
type NumberMap = self::frame_system::NumberMap<Runtime>;
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ impl module3::Config for Runtime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn new_test_ext() -> sp_io::TestExternalities {
|
fn new_test_ext() -> sp_io::TestExternalities {
|
||||||
GenesisConfig {
|
RuntimeGenesisConfig {
|
||||||
module_1_1: module1::GenesisConfig { value: 3, test: 2 },
|
module_1_1: module1::GenesisConfig { value: 3, test: 2 },
|
||||||
module_1_2: module1::GenesisConfig { value: 4, test: 5 },
|
module_1_2: module1::GenesisConfig { value: 4, test: 5 },
|
||||||
module_2: module2::GenesisConfig {
|
module_2: module2::GenesisConfig {
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ frame_support::construct_runtime!(
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn create_genesis_config() {
|
fn create_genesis_config() {
|
||||||
let config = GenesisConfig {
|
let config = RuntimeGenesisConfig {
|
||||||
module: module::GenesisConfig { request_life_time: 0, enable_storage_role: true },
|
module: module::GenesisConfig { request_life_time: 0, enable_storage_role: true },
|
||||||
};
|
};
|
||||||
assert_eq!(config.module.request_life_time, 0);
|
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.
|
/// Create new externalities for `System` module tests.
|
||||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||||
let mut 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
|
// Add to each test the initial weight of a block
|
||||||
ext.execute_with(|| {
|
ext.execute_with(|| {
|
||||||
System::register_extra_weight_unchecked(
|
System::register_extra_weight_unchecked(
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ impl Config<Instance1> for Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
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(),
|
system: frame_system::GenesisConfig::default(),
|
||||||
balances: pallet_balances::GenesisConfig { balances: vec![(0, 100), (1, 98), (2, 1)] },
|
balances: pallet_balances::GenesisConfig { balances: vec![(0, 100), (1, 98), (2, 1)] },
|
||||||
treasury: Default::default(),
|
treasury: Default::default(),
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ impl pallet_transaction_storage::Config for Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||||
let t = GenesisConfig {
|
let t = RuntimeGenesisConfig {
|
||||||
system: Default::default(),
|
system: Default::default(),
|
||||||
balances: pallet_balances::GenesisConfig::<Test> {
|
balances: pallet_balances::GenesisConfig::<Test> {
|
||||||
balances: vec![(1, 1000000000), (2, 100), (3, 100), (4, 100)],
|
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 {
|
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);
|
let mut ext = sp_io::TestExternalities::new(t);
|
||||||
ext.execute_with(|| System::set_block_number(1));
|
ext.execute_with(|| System::set_block_number(1));
|
||||||
ext
|
ext
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
//! Tool for creating the genesis block.
|
//! Tool for creating the genesis block.
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
currency, substrate_test_pallet, wasm_binary_unwrap, AccountId, Balance, GenesisConfig,
|
currency, substrate_test_pallet, wasm_binary_unwrap, AccountId, Balance, RuntimeGenesisConfig,
|
||||||
};
|
};
|
||||||
use codec::Encode;
|
use codec::Encode;
|
||||||
use sc_service::construct_genesis_block;
|
use sc_service::construct_genesis_block;
|
||||||
@@ -116,7 +116,7 @@ impl GenesisStorageBuilder {
|
|||||||
.map(|id| sr25519::Public::from(id))
|
.map(|id| sr25519::Public::from(id))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let genesis_config = GenesisConfig {
|
let genesis_config = RuntimeGenesisConfig {
|
||||||
system: frame_system::GenesisConfig {
|
system: frame_system::GenesisConfig {
|
||||||
code: self.wasm_code.clone().unwrap_or(wasm_binary_unwrap().to_vec()),
|
code: self.wasm_code.clone().unwrap_or(wasm_binary_unwrap().to_vec()),
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user