mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11: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:
@@ -39,7 +39,7 @@ use sp_runtime::{
|
||||
Perbill,
|
||||
};
|
||||
|
||||
pub use kitchensink_runtime::GenesisConfig;
|
||||
pub use kitchensink_runtime::RuntimeGenesisConfig;
|
||||
pub use node_primitives::{AccountId, Balance, Signature};
|
||||
|
||||
type AccountPublic = <Signature as Verify>::Signer;
|
||||
@@ -62,7 +62,7 @@ pub struct Extensions {
|
||||
}
|
||||
|
||||
/// Specialized `ChainSpec`.
|
||||
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig, Extensions>;
|
||||
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig, Extensions>;
|
||||
/// Flaming Fir testnet generator
|
||||
pub fn flaming_fir_config() -> Result<ChainSpec, String> {
|
||||
ChainSpec::from_json_bytes(&include_bytes!("../res/flaming-fir.json")[..])
|
||||
@@ -77,7 +77,7 @@ fn session_keys(
|
||||
SessionKeys { grandpa, babe, im_online, authority_discovery }
|
||||
}
|
||||
|
||||
fn staging_testnet_config_genesis() -> GenesisConfig {
|
||||
fn staging_testnet_config_genesis() -> RuntimeGenesisConfig {
|
||||
#[rustfmt::skip]
|
||||
// stash, controller, session-key
|
||||
// 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(
|
||||
initial_authorities: Vec<(
|
||||
AccountId,
|
||||
@@ -242,7 +242,7 @@ pub fn testnet_genesis(
|
||||
initial_nominators: Vec<AccountId>,
|
||||
root_key: AccountId,
|
||||
endowed_accounts: Option<Vec<AccountId>>,
|
||||
) -> GenesisConfig {
|
||||
) -> RuntimeGenesisConfig {
|
||||
let mut endowed_accounts: Vec<AccountId> = endowed_accounts.unwrap_or_else(|| {
|
||||
vec![
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
@@ -294,7 +294,7 @@ pub fn testnet_genesis(
|
||||
const ENDOWMENT: Balance = 10_000_000 * DOLLARS;
|
||||
const STASH: Balance = ENDOWMENT / 1000;
|
||||
|
||||
GenesisConfig {
|
||||
RuntimeGenesisConfig {
|
||||
system: SystemConfig { code: wasm_binary_unwrap().to_vec() },
|
||||
balances: BalancesConfig {
|
||||
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(
|
||||
vec![authority_keys_from_seed("Alice")],
|
||||
vec![],
|
||||
@@ -406,7 +406,7 @@ pub fn development_config() -> ChainSpec {
|
||||
)
|
||||
}
|
||||
|
||||
fn local_testnet_genesis() -> GenesisConfig {
|
||||
fn local_testnet_genesis() -> RuntimeGenesisConfig {
|
||||
testnet_genesis(
|
||||
vec![authority_keys_from_seed("Alice"), authority_keys_from_seed("Bob")],
|
||||
vec![],
|
||||
@@ -438,7 +438,7 @@ pub(crate) mod tests {
|
||||
use sc_service_test;
|
||||
use sp_runtime::BuildStorage;
|
||||
|
||||
fn local_testnet_genesis_instant_single() -> GenesisConfig {
|
||||
fn local_testnet_genesis_instant_single() -> RuntimeGenesisConfig {
|
||||
testnet_genesis(
|
||||
vec![authority_keys_from_seed("Alice")],
|
||||
vec![],
|
||||
|
||||
@@ -603,7 +603,7 @@ impl BenchKeyring {
|
||||
}
|
||||
|
||||
/// 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(
|
||||
Some(kitchensink_runtime::wasm_binary_unwrap()),
|
||||
self.collect_account_ids(),
|
||||
|
||||
@@ -21,20 +21,21 @@
|
||||
use crate::keyring::*;
|
||||
use kitchensink_runtime::{
|
||||
constants::currency::*, wasm_binary_unwrap, AccountId, AssetsConfig, BabeConfig,
|
||||
BalancesConfig, GenesisConfig, GluttonConfig, GrandpaConfig, IndicesConfig, SessionConfig,
|
||||
SocietyConfig, StakerStatus, StakingConfig, SystemConfig, BABE_GENESIS_EPOCH_CONFIG,
|
||||
BalancesConfig, GluttonConfig, GrandpaConfig, IndicesConfig, RuntimeGenesisConfig,
|
||||
SessionConfig, SocietyConfig, StakerStatus, StakingConfig, SystemConfig,
|
||||
BABE_GENESIS_EPOCH_CONFIG,
|
||||
};
|
||||
use sp_keyring::{Ed25519Keyring, Sr25519Keyring};
|
||||
use sp_runtime::Perbill;
|
||||
|
||||
/// 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())
|
||||
}
|
||||
|
||||
/// Create genesis runtime configuration for tests with some extra
|
||||
/// 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![
|
||||
(alice(), 111 * 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)));
|
||||
|
||||
GenesisConfig {
|
||||
RuntimeGenesisConfig {
|
||||
system: SystemConfig {
|
||||
code: code.map(|x| x.to_vec()).unwrap_or_else(|| wasm_binary_unwrap().to_vec()),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user