mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 15:11:02 +00:00
Rename Statemint to Asset Hub (#2633)
* change dir names * cargo toml updates * fix crate imports for build * change chain spec names and PR review rule * update cli to accept asset-hub * find/replace benchmark commands * integration tests * bridges docs * more integration tests * AuraId * other statemint tidying * rename statemint mod * chain spec mod * rename e2e test dirs * one more Runtime::Statemine * benchmark westmint * rename chain spec name and id * rename chain spec files * more tidying in scripts/docs/tests * rename old dir if exists * Force people to manually do the move. (Safer as there could be additional considerations with their setup) * review touchups * more renaming * Update polkadot-parachain/src/command.rs Co-authored-by: Bastian Köcher <git@kchr.de> * better error message * do not break on-chain spec_name * log info message that path has been renamed * better penpal docs --------- Co-authored-by: gilescope <gilescope@gmail.com> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -25,9 +25,9 @@ rococo-parachain-runtime = { path = "../parachains/runtimes/testing/rococo-parac
|
||||
shell-runtime = { path = "../parachains/runtimes/starters/shell" }
|
||||
glutton-runtime = { path = "../parachains/runtimes/glutton/glutton-kusama" }
|
||||
seedling-runtime = { path = "../parachains/runtimes/starters/seedling" }
|
||||
statemint-runtime = { path = "../parachains/runtimes/assets/statemint" }
|
||||
statemine-runtime = { path = "../parachains/runtimes/assets/statemine" }
|
||||
westmint-runtime = { path = "../parachains/runtimes/assets/westmint" }
|
||||
asset-hub-polkadot-runtime = { path = "../parachains/runtimes/assets/asset-hub-polkadot" }
|
||||
asset-hub-kusama-runtime = { path = "../parachains/runtimes/assets/asset-hub-kusama" }
|
||||
asset-hub-westend-runtime = { path = "../parachains/runtimes/assets/asset-hub-westend" }
|
||||
collectives-polkadot-runtime = { path = "../parachains/runtimes/collectives/collectives-polkadot" }
|
||||
contracts-rococo-runtime = { path = "../parachains/runtimes/contracts/contracts-rococo" }
|
||||
bridge-hub-rococo-runtime = { path = "../parachains/runtimes/bridge-hubs/bridge-hub-rococo" }
|
||||
@@ -106,9 +106,9 @@ polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "maste
|
||||
default = []
|
||||
runtime-benchmarks = [
|
||||
"polkadot-service/runtime-benchmarks",
|
||||
"statemint-runtime/runtime-benchmarks",
|
||||
"statemine-runtime/runtime-benchmarks",
|
||||
"westmint-runtime/runtime-benchmarks",
|
||||
"asset-hub-polkadot-runtime/runtime-benchmarks",
|
||||
"asset-hub-kusama-runtime/runtime-benchmarks",
|
||||
"asset-hub-westend-runtime/runtime-benchmarks",
|
||||
"bridge-hub-rococo-runtime/runtime-benchmarks",
|
||||
"bridge-hub-kusama-runtime/runtime-benchmarks",
|
||||
"bridge-hub-polkadot-runtime/runtime-benchmarks",
|
||||
@@ -119,9 +119,9 @@ runtime-benchmarks = [
|
||||
"penpal-runtime/runtime-benchmarks",
|
||||
]
|
||||
try-runtime = [
|
||||
"statemint-runtime/try-runtime",
|
||||
"statemine-runtime/try-runtime",
|
||||
"westmint-runtime/try-runtime",
|
||||
"asset-hub-polkadot-runtime/try-runtime",
|
||||
"asset-hub-kusama-runtime/try-runtime",
|
||||
"asset-hub-westend-runtime/try-runtime",
|
||||
"shell-runtime/try-runtime",
|
||||
"try-runtime-cli/try-runtime",
|
||||
]
|
||||
|
||||
+123
-110
@@ -19,61 +19,66 @@ use crate::chain_spec::{
|
||||
};
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use hex_literal::hex;
|
||||
use parachains_common::{AccountId, AuraId, Balance as StatemintBalance, StatemintAuraId};
|
||||
use parachains_common::{AccountId, AssetHubPolkadotAuraId, AuraId, Balance as AssetHubBalance};
|
||||
use sc_service::ChainType;
|
||||
use sp_core::{crypto::UncheckedInto, sr25519};
|
||||
|
||||
/// Specialized `ChainSpec` for the normal parachain runtime.
|
||||
pub type StatemintChainSpec =
|
||||
sc_service::GenericChainSpec<statemint_runtime::GenesisConfig, Extensions>;
|
||||
pub type StatemineChainSpec =
|
||||
sc_service::GenericChainSpec<statemine_runtime::GenesisConfig, Extensions>;
|
||||
pub type WestmintChainSpec =
|
||||
sc_service::GenericChainSpec<westmint_runtime::GenesisConfig, Extensions>;
|
||||
pub type AssetHubPolkadotChainSpec =
|
||||
sc_service::GenericChainSpec<asset_hub_polkadot_runtime::GenesisConfig, Extensions>;
|
||||
pub type AssetHubKusamaChainSpec =
|
||||
sc_service::GenericChainSpec<asset_hub_kusama_runtime::GenesisConfig, Extensions>;
|
||||
pub type AssetHubWestendChainSpec =
|
||||
sc_service::GenericChainSpec<asset_hub_westend_runtime::GenesisConfig, Extensions>;
|
||||
|
||||
const STATEMINT_ED: StatemintBalance = statemint_runtime::constants::currency::EXISTENTIAL_DEPOSIT;
|
||||
const STATEMINE_ED: StatemintBalance = statemine_runtime::constants::currency::EXISTENTIAL_DEPOSIT;
|
||||
const WESTMINT_ED: StatemintBalance = westmint_runtime::constants::currency::EXISTENTIAL_DEPOSIT;
|
||||
const ASSET_HUB_POLKADOT_ED: AssetHubBalance =
|
||||
asset_hub_polkadot_runtime::constants::currency::EXISTENTIAL_DEPOSIT;
|
||||
const ASSET_HUB_KUSAMA_ED: AssetHubBalance =
|
||||
asset_hub_kusama_runtime::constants::currency::EXISTENTIAL_DEPOSIT;
|
||||
const ASSET_HUB_WESTEND_ED: AssetHubBalance =
|
||||
asset_hub_westend_runtime::constants::currency::EXISTENTIAL_DEPOSIT;
|
||||
|
||||
/// Generate the session keys from individual elements.
|
||||
///
|
||||
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
|
||||
pub fn statemint_session_keys(keys: StatemintAuraId) -> statemint_runtime::SessionKeys {
|
||||
statemint_runtime::SessionKeys { aura: keys }
|
||||
pub fn asset_hub_polkadot_session_keys(
|
||||
keys: AssetHubPolkadotAuraId,
|
||||
) -> asset_hub_polkadot_runtime::SessionKeys {
|
||||
asset_hub_polkadot_runtime::SessionKeys { aura: keys }
|
||||
}
|
||||
|
||||
/// Generate the session keys from individual elements.
|
||||
///
|
||||
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
|
||||
pub fn statemine_session_keys(keys: AuraId) -> statemine_runtime::SessionKeys {
|
||||
statemine_runtime::SessionKeys { aura: keys }
|
||||
pub fn asset_hub_kusama_session_keys(keys: AuraId) -> asset_hub_kusama_runtime::SessionKeys {
|
||||
asset_hub_kusama_runtime::SessionKeys { aura: keys }
|
||||
}
|
||||
|
||||
/// Generate the session keys from individual elements.
|
||||
///
|
||||
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
|
||||
pub fn westmint_session_keys(keys: AuraId) -> westmint_runtime::SessionKeys {
|
||||
westmint_runtime::SessionKeys { aura: keys }
|
||||
pub fn asset_hub_westend_session_keys(keys: AuraId) -> asset_hub_westend_runtime::SessionKeys {
|
||||
asset_hub_westend_runtime::SessionKeys { aura: keys }
|
||||
}
|
||||
|
||||
pub fn statemint_development_config() -> StatemintChainSpec {
|
||||
pub fn asset_hub_polkadot_development_config() -> AssetHubPolkadotChainSpec {
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("ss58Format".into(), 0.into());
|
||||
properties.insert("tokenSymbol".into(), "DOT".into());
|
||||
properties.insert("tokenDecimals".into(), 10.into());
|
||||
|
||||
StatemintChainSpec::from_genesis(
|
||||
AssetHubPolkadotChainSpec::from_genesis(
|
||||
// Name
|
||||
"Statemint Development",
|
||||
"Polkadot Asset Hub Development",
|
||||
// ID
|
||||
"statemint_dev",
|
||||
"asset-hub-polkadot-dev",
|
||||
ChainType::Local,
|
||||
move || {
|
||||
statemint_genesis(
|
||||
asset_hub_polkadot_genesis(
|
||||
// initial collators.
|
||||
vec![(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_collator_keys_from_seed::<StatemintAuraId>("Alice"),
|
||||
get_collator_keys_from_seed::<AssetHubPolkadotAuraId>("Alice"),
|
||||
)],
|
||||
vec![
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
@@ -93,29 +98,29 @@ pub fn statemint_development_config() -> StatemintChainSpec {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn statemint_local_config() -> StatemintChainSpec {
|
||||
pub fn asset_hub_polkadot_local_config() -> AssetHubPolkadotChainSpec {
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("ss58Format".into(), 0.into());
|
||||
properties.insert("tokenSymbol".into(), "DOT".into());
|
||||
properties.insert("tokenDecimals".into(), 10.into());
|
||||
|
||||
StatemintChainSpec::from_genesis(
|
||||
AssetHubPolkadotChainSpec::from_genesis(
|
||||
// Name
|
||||
"Statemint Local",
|
||||
"Polkadot Asset Hub Local",
|
||||
// ID
|
||||
"statemint_local",
|
||||
"asset-hub-polkadot-local",
|
||||
ChainType::Local,
|
||||
move || {
|
||||
statemint_genesis(
|
||||
asset_hub_polkadot_genesis(
|
||||
// initial collators.
|
||||
vec![
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_collator_keys_from_seed::<StatemintAuraId>("Alice"),
|
||||
get_collator_keys_from_seed::<AssetHubPolkadotAuraId>("Alice"),
|
||||
),
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_collator_keys_from_seed::<StatemintAuraId>("Bob"),
|
||||
get_collator_keys_from_seed::<AssetHubPolkadotAuraId>("Bob"),
|
||||
),
|
||||
],
|
||||
vec![
|
||||
@@ -145,20 +150,20 @@ pub fn statemint_local_config() -> StatemintChainSpec {
|
||||
}
|
||||
|
||||
// Not used for syncing, but just to determine the genesis values set for the upgrade from shell.
|
||||
pub fn statemint_config() -> StatemintChainSpec {
|
||||
pub fn asset_hub_polkadot_config() -> AssetHubPolkadotChainSpec {
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("ss58Format".into(), 0.into());
|
||||
properties.insert("tokenSymbol".into(), "DOT".into());
|
||||
properties.insert("tokenDecimals".into(), 10.into());
|
||||
|
||||
StatemintChainSpec::from_genesis(
|
||||
AssetHubPolkadotChainSpec::from_genesis(
|
||||
// Name
|
||||
"Statemint",
|
||||
"Polkadot Asset Hub",
|
||||
// ID
|
||||
"statemint",
|
||||
"asset-hub-polkadot",
|
||||
ChainType::Live,
|
||||
move || {
|
||||
statemint_genesis(
|
||||
asset_hub_polkadot_genesis(
|
||||
// initial collators.
|
||||
vec![
|
||||
(
|
||||
@@ -204,34 +209,38 @@ pub fn statemint_config() -> StatemintChainSpec {
|
||||
)
|
||||
}
|
||||
|
||||
fn statemint_genesis(
|
||||
invulnerables: Vec<(AccountId, StatemintAuraId)>,
|
||||
fn asset_hub_polkadot_genesis(
|
||||
invulnerables: Vec<(AccountId, AssetHubPolkadotAuraId)>,
|
||||
endowed_accounts: Vec<AccountId>,
|
||||
id: ParaId,
|
||||
) -> statemint_runtime::GenesisConfig {
|
||||
statemint_runtime::GenesisConfig {
|
||||
system: statemint_runtime::SystemConfig {
|
||||
code: statemint_runtime::WASM_BINARY
|
||||
) -> asset_hub_polkadot_runtime::GenesisConfig {
|
||||
asset_hub_polkadot_runtime::GenesisConfig {
|
||||
system: asset_hub_polkadot_runtime::SystemConfig {
|
||||
code: asset_hub_polkadot_runtime::WASM_BINARY
|
||||
.expect("WASM binary was not build, please build it!")
|
||||
.to_vec(),
|
||||
},
|
||||
balances: statemint_runtime::BalancesConfig {
|
||||
balances: endowed_accounts.iter().cloned().map(|k| (k, STATEMINT_ED * 4096)).collect(),
|
||||
balances: asset_hub_polkadot_runtime::BalancesConfig {
|
||||
balances: endowed_accounts
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|k| (k, ASSET_HUB_POLKADOT_ED * 4096))
|
||||
.collect(),
|
||||
},
|
||||
parachain_info: statemint_runtime::ParachainInfoConfig { parachain_id: id },
|
||||
collator_selection: statemint_runtime::CollatorSelectionConfig {
|
||||
parachain_info: asset_hub_polkadot_runtime::ParachainInfoConfig { parachain_id: id },
|
||||
collator_selection: asset_hub_polkadot_runtime::CollatorSelectionConfig {
|
||||
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
|
||||
candidacy_bond: STATEMINT_ED * 16,
|
||||
candidacy_bond: ASSET_HUB_POLKADOT_ED * 16,
|
||||
..Default::default()
|
||||
},
|
||||
session: statemint_runtime::SessionConfig {
|
||||
session: asset_hub_polkadot_runtime::SessionConfig {
|
||||
keys: invulnerables
|
||||
.into_iter()
|
||||
.map(|(acc, aura)| {
|
||||
(
|
||||
acc.clone(), // account id
|
||||
acc, // validator id
|
||||
statemint_session_keys(aura), // session keys
|
||||
acc.clone(), // account id
|
||||
acc, // validator id
|
||||
asset_hub_polkadot_session_keys(aura), // session keys
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
@@ -241,26 +250,26 @@ fn statemint_genesis(
|
||||
aura: Default::default(),
|
||||
aura_ext: Default::default(),
|
||||
parachain_system: Default::default(),
|
||||
polkadot_xcm: statemint_runtime::PolkadotXcmConfig {
|
||||
polkadot_xcm: asset_hub_polkadot_runtime::PolkadotXcmConfig {
|
||||
safe_xcm_version: Some(SAFE_XCM_VERSION),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn statemine_development_config() -> StatemineChainSpec {
|
||||
pub fn asset_hub_kusama_development_config() -> AssetHubKusamaChainSpec {
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("ss58Format".into(), 2.into());
|
||||
properties.insert("tokenSymbol".into(), "KSM".into());
|
||||
properties.insert("tokenDecimals".into(), 12.into());
|
||||
|
||||
StatemineChainSpec::from_genesis(
|
||||
AssetHubKusamaChainSpec::from_genesis(
|
||||
// Name
|
||||
"Statemine Development",
|
||||
"Kusama Asset Hub Development",
|
||||
// ID
|
||||
"statemine_dev",
|
||||
"asset-hub-kusama-dev",
|
||||
ChainType::Local,
|
||||
move || {
|
||||
statemine_genesis(
|
||||
asset_hub_kusama_genesis(
|
||||
// initial collators.
|
||||
vec![(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
@@ -284,20 +293,20 @@ pub fn statemine_development_config() -> StatemineChainSpec {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn statemine_local_config() -> StatemineChainSpec {
|
||||
pub fn asset_hub_kusama_local_config() -> AssetHubKusamaChainSpec {
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("ss58Format".into(), 2.into());
|
||||
properties.insert("tokenSymbol".into(), "KSM".into());
|
||||
properties.insert("tokenDecimals".into(), 12.into());
|
||||
|
||||
StatemineChainSpec::from_genesis(
|
||||
AssetHubKusamaChainSpec::from_genesis(
|
||||
// Name
|
||||
"Statemine Local",
|
||||
"Kusama Asset Hub Local",
|
||||
// ID
|
||||
"statemine_local",
|
||||
"asset-hub-kusama-local",
|
||||
ChainType::Local,
|
||||
move || {
|
||||
statemine_genesis(
|
||||
asset_hub_kusama_genesis(
|
||||
// initial collators.
|
||||
vec![
|
||||
(
|
||||
@@ -335,20 +344,20 @@ pub fn statemine_local_config() -> StatemineChainSpec {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn statemine_config() -> StatemineChainSpec {
|
||||
pub fn asset_hub_kusama_config() -> AssetHubKusamaChainSpec {
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("ss58Format".into(), 2.into());
|
||||
properties.insert("tokenSymbol".into(), "KSM".into());
|
||||
properties.insert("tokenDecimals".into(), 12.into());
|
||||
|
||||
StatemineChainSpec::from_genesis(
|
||||
AssetHubKusamaChainSpec::from_genesis(
|
||||
// Name
|
||||
"Statemine",
|
||||
"Kusama Asset Hub",
|
||||
// ID
|
||||
"statemine",
|
||||
"asset-hub-kusama",
|
||||
ChainType::Live,
|
||||
move || {
|
||||
statemine_genesis(
|
||||
asset_hub_kusama_genesis(
|
||||
// initial collators.
|
||||
vec![
|
||||
(
|
||||
@@ -389,38 +398,38 @@ pub fn statemine_config() -> StatemineChainSpec {
|
||||
)
|
||||
}
|
||||
|
||||
fn statemine_genesis(
|
||||
fn asset_hub_kusama_genesis(
|
||||
invulnerables: Vec<(AccountId, AuraId)>,
|
||||
endowed_accounts: Vec<AccountId>,
|
||||
id: ParaId,
|
||||
) -> statemine_runtime::GenesisConfig {
|
||||
statemine_runtime::GenesisConfig {
|
||||
system: statemine_runtime::SystemConfig {
|
||||
code: statemine_runtime::WASM_BINARY
|
||||
) -> asset_hub_kusama_runtime::GenesisConfig {
|
||||
asset_hub_kusama_runtime::GenesisConfig {
|
||||
system: asset_hub_kusama_runtime::SystemConfig {
|
||||
code: asset_hub_kusama_runtime::WASM_BINARY
|
||||
.expect("WASM binary was not build, please build it!")
|
||||
.to_vec(),
|
||||
},
|
||||
balances: statemine_runtime::BalancesConfig {
|
||||
balances: asset_hub_kusama_runtime::BalancesConfig {
|
||||
balances: endowed_accounts
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|k| (k, STATEMINE_ED * 524_288))
|
||||
.map(|k| (k, ASSET_HUB_KUSAMA_ED * 524_288))
|
||||
.collect(),
|
||||
},
|
||||
parachain_info: statemine_runtime::ParachainInfoConfig { parachain_id: id },
|
||||
collator_selection: statemine_runtime::CollatorSelectionConfig {
|
||||
parachain_info: asset_hub_kusama_runtime::ParachainInfoConfig { parachain_id: id },
|
||||
collator_selection: asset_hub_kusama_runtime::CollatorSelectionConfig {
|
||||
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
|
||||
candidacy_bond: STATEMINE_ED * 16,
|
||||
candidacy_bond: ASSET_HUB_KUSAMA_ED * 16,
|
||||
..Default::default()
|
||||
},
|
||||
session: statemine_runtime::SessionConfig {
|
||||
session: asset_hub_kusama_runtime::SessionConfig {
|
||||
keys: invulnerables
|
||||
.into_iter()
|
||||
.map(|(acc, aura)| {
|
||||
(
|
||||
acc.clone(), // account id
|
||||
acc, // validator id
|
||||
statemine_session_keys(aura), // session keys
|
||||
acc.clone(), // account id
|
||||
acc, // validator id
|
||||
asset_hub_kusama_session_keys(aura), // session keys
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
@@ -428,25 +437,25 @@ fn statemine_genesis(
|
||||
aura: Default::default(),
|
||||
aura_ext: Default::default(),
|
||||
parachain_system: Default::default(),
|
||||
polkadot_xcm: statemine_runtime::PolkadotXcmConfig {
|
||||
polkadot_xcm: asset_hub_kusama_runtime::PolkadotXcmConfig {
|
||||
safe_xcm_version: Some(SAFE_XCM_VERSION),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn westmint_development_config() -> WestmintChainSpec {
|
||||
pub fn asset_hub_westend_development_config() -> AssetHubWestendChainSpec {
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("tokenSymbol".into(), "WND".into());
|
||||
properties.insert("tokenDecimals".into(), 12.into());
|
||||
|
||||
WestmintChainSpec::from_genesis(
|
||||
AssetHubWestendChainSpec::from_genesis(
|
||||
// Name
|
||||
"Westmint Development",
|
||||
"Westend Asset Hub Development",
|
||||
// ID
|
||||
"westmint_dev",
|
||||
"asset-hub-westend-dev",
|
||||
ChainType::Local,
|
||||
move || {
|
||||
westmint_genesis(
|
||||
asset_hub_westend_genesis(
|
||||
// initial collators.
|
||||
vec![(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
@@ -470,19 +479,19 @@ pub fn westmint_development_config() -> WestmintChainSpec {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn westmint_local_config() -> WestmintChainSpec {
|
||||
pub fn asset_hub_westend_local_config() -> AssetHubWestendChainSpec {
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("tokenSymbol".into(), "WND".into());
|
||||
properties.insert("tokenDecimals".into(), 12.into());
|
||||
|
||||
WestmintChainSpec::from_genesis(
|
||||
AssetHubWestendChainSpec::from_genesis(
|
||||
// Name
|
||||
"Westmint Local",
|
||||
"Westend Asset Hub Local",
|
||||
// ID
|
||||
"westmint_local",
|
||||
"asset-hub-westend-local",
|
||||
ChainType::Local,
|
||||
move || {
|
||||
westmint_genesis(
|
||||
asset_hub_westend_genesis(
|
||||
// initial collators.
|
||||
vec![
|
||||
(
|
||||
@@ -520,19 +529,19 @@ pub fn westmint_local_config() -> WestmintChainSpec {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn westmint_config() -> WestmintChainSpec {
|
||||
pub fn asset_hub_westend_config() -> AssetHubWestendChainSpec {
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("tokenSymbol".into(), "WND".into());
|
||||
properties.insert("tokenDecimals".into(), 12.into());
|
||||
|
||||
WestmintChainSpec::from_genesis(
|
||||
AssetHubWestendChainSpec::from_genesis(
|
||||
// Name
|
||||
"Westmint",
|
||||
"Westend Asset Hub",
|
||||
// ID
|
||||
"westmint",
|
||||
"asset-hub-westend",
|
||||
ChainType::Live,
|
||||
move || {
|
||||
westmint_genesis(
|
||||
asset_hub_westend_genesis(
|
||||
// initial collators.
|
||||
vec![
|
||||
(
|
||||
@@ -573,34 +582,38 @@ pub fn westmint_config() -> WestmintChainSpec {
|
||||
)
|
||||
}
|
||||
|
||||
fn westmint_genesis(
|
||||
fn asset_hub_westend_genesis(
|
||||
invulnerables: Vec<(AccountId, AuraId)>,
|
||||
endowed_accounts: Vec<AccountId>,
|
||||
id: ParaId,
|
||||
) -> westmint_runtime::GenesisConfig {
|
||||
westmint_runtime::GenesisConfig {
|
||||
system: westmint_runtime::SystemConfig {
|
||||
code: westmint_runtime::WASM_BINARY
|
||||
) -> asset_hub_westend_runtime::GenesisConfig {
|
||||
asset_hub_westend_runtime::GenesisConfig {
|
||||
system: asset_hub_westend_runtime::SystemConfig {
|
||||
code: asset_hub_westend_runtime::WASM_BINARY
|
||||
.expect("WASM binary was not build, please build it!")
|
||||
.to_vec(),
|
||||
},
|
||||
balances: westmint_runtime::BalancesConfig {
|
||||
balances: endowed_accounts.iter().cloned().map(|k| (k, WESTMINT_ED * 4096)).collect(),
|
||||
balances: asset_hub_westend_runtime::BalancesConfig {
|
||||
balances: endowed_accounts
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|k| (k, ASSET_HUB_WESTEND_ED * 4096))
|
||||
.collect(),
|
||||
},
|
||||
parachain_info: westmint_runtime::ParachainInfoConfig { parachain_id: id },
|
||||
collator_selection: westmint_runtime::CollatorSelectionConfig {
|
||||
parachain_info: asset_hub_westend_runtime::ParachainInfoConfig { parachain_id: id },
|
||||
collator_selection: asset_hub_westend_runtime::CollatorSelectionConfig {
|
||||
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
|
||||
candidacy_bond: WESTMINT_ED * 16,
|
||||
candidacy_bond: ASSET_HUB_WESTEND_ED * 16,
|
||||
..Default::default()
|
||||
},
|
||||
session: westmint_runtime::SessionConfig {
|
||||
session: asset_hub_westend_runtime::SessionConfig {
|
||||
keys: invulnerables
|
||||
.into_iter()
|
||||
.map(|(acc, aura)| {
|
||||
(
|
||||
acc.clone(), // account id
|
||||
acc, // validator id
|
||||
westmint_session_keys(aura), // session keys
|
||||
acc.clone(), // account id
|
||||
acc, // validator id
|
||||
asset_hub_westend_session_keys(aura), // session keys
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
@@ -610,7 +623,7 @@ fn westmint_genesis(
|
||||
aura: Default::default(),
|
||||
aura_ext: Default::default(),
|
||||
parachain_system: Default::default(),
|
||||
polkadot_xcm: westmint_runtime::PolkadotXcmConfig {
|
||||
polkadot_xcm: asset_hub_westend_runtime::PolkadotXcmConfig {
|
||||
safe_xcm_version: Some(SAFE_XCM_VERSION),
|
||||
},
|
||||
}
|
||||
@@ -20,6 +20,7 @@ use serde::{Deserialize, Serialize};
|
||||
use sp_core::{Pair, Public};
|
||||
use sp_runtime::traits::{IdentifyAccount, Verify};
|
||||
|
||||
pub mod asset_hubs;
|
||||
pub mod bridge_hubs;
|
||||
pub mod collectives;
|
||||
pub mod contracts;
|
||||
@@ -28,7 +29,6 @@ pub mod penpal;
|
||||
pub mod rococo_parachain;
|
||||
pub mod seedling;
|
||||
pub mod shell;
|
||||
pub mod statemint;
|
||||
|
||||
/// The default XCM version to set in genesis config.
|
||||
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
|
||||
|
||||
@@ -66,10 +66,10 @@ pub enum Subcommand {
|
||||
|
||||
const AFTER_HELP_EXAMPLE: &str = color_print::cstr!(
|
||||
r#"<bold><underline>Examples:</></>
|
||||
<bold>polkadot-parachain --chain statemint --sync warp -- --chain polkadot --sync warp</>
|
||||
Launch a warp-syncing full node of the <italic>statemint</> parachain on the <italic>polkadot</> relay chain.
|
||||
<bold>polkadot-parachain --chain statemint --sync warp --relay-chain-rpc-url ws://rpc.example.com -- --chain polkadot</>
|
||||
Launch a warp-syncing full node of the <italic>statemint</> parachain on the <italic>polkadot</> relay chain.
|
||||
<bold>polkadot-parachain --chain asset-hub-polkadot --sync warp -- --chain polkadot --sync warp</>
|
||||
Launch a warp-syncing full node of the <italic>Asset Hub</> parachain on the <italic>Polkadot</> Relay Chain.
|
||||
<bold>polkadot-parachain --chain asset-hub-polkadot --sync warp --relay-chain-rpc-url ws://rpc.example.com -- --chain polkadot</>
|
||||
Launch a warp-syncing full node of the <italic>Asset Hub</> parachain on the <italic>Polkadot</> Relay Chain.
|
||||
Uses <italic>ws://rpc.example.com</> as remote relay chain node.
|
||||
"#
|
||||
);
|
||||
|
||||
@@ -18,9 +18,10 @@ use crate::{
|
||||
chain_spec,
|
||||
cli::{Cli, RelayChainCli, Subcommand},
|
||||
service::{
|
||||
new_partial, Block, BridgeHubKusamaRuntimeExecutor, BridgeHubPolkadotRuntimeExecutor,
|
||||
BridgeHubRococoRuntimeExecutor, CollectivesPolkadotRuntimeExecutor, GluttonRuntimeExecutor,
|
||||
StatemineRuntimeExecutor, StatemintRuntimeExecutor, WestmintRuntimeExecutor,
|
||||
new_partial, AssetHubKusamaExecutor, AssetHubPolkadotRuntimeExecutor,
|
||||
AssetHubWestendExecutor, Block, BridgeHubKusamaRuntimeExecutor,
|
||||
BridgeHubPolkadotRuntimeExecutor, BridgeHubRococoRuntimeExecutor,
|
||||
CollectivesPolkadotRuntimeExecutor, GluttonRuntimeExecutor,
|
||||
},
|
||||
};
|
||||
use codec::Encode;
|
||||
@@ -28,7 +29,7 @@ use cumulus_client_cli::generate_genesis_block;
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
|
||||
use log::{info, warn};
|
||||
use parachains_common::{AuraId, StatemintAuraId};
|
||||
use parachains_common::{AssetHubPolkadotAuraId, AuraId};
|
||||
use sc_cli::{
|
||||
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
|
||||
NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli,
|
||||
@@ -47,9 +48,9 @@ enum Runtime {
|
||||
Default,
|
||||
Shell,
|
||||
Seedling,
|
||||
Statemint,
|
||||
Statemine,
|
||||
Westmint,
|
||||
AssetHubPolkadot,
|
||||
AssetHubKusama,
|
||||
AssetHubWestend,
|
||||
Penpal(ParaId),
|
||||
ContractsRococo,
|
||||
CollectivesPolkadot,
|
||||
@@ -93,12 +94,12 @@ fn runtime(id: &str) -> Runtime {
|
||||
Runtime::Shell
|
||||
} else if id.starts_with("seedling") {
|
||||
Runtime::Seedling
|
||||
} else if id.starts_with("statemint") {
|
||||
Runtime::Statemint
|
||||
} else if id.starts_with("statemine") {
|
||||
Runtime::Statemine
|
||||
} else if id.starts_with("westmint") {
|
||||
Runtime::Westmint
|
||||
} else if id.starts_with("asset-hub-polkadot") | id.starts_with("statemint") {
|
||||
Runtime::AssetHubPolkadot
|
||||
} else if id.starts_with("asset-hub-kusama") | id.starts_with("statemine") {
|
||||
Runtime::AssetHubKusama
|
||||
} else if id.starts_with("asset-hub-westend") | id.starts_with("westmint") {
|
||||
Runtime::AssetHubWestend
|
||||
} else if id.starts_with("penpal") {
|
||||
Runtime::Penpal(para_id.unwrap_or(ParaId::new(0)))
|
||||
} else if id.starts_with("contracts-rococo") {
|
||||
@@ -143,35 +144,47 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
"shell" => Box::new(chain_spec::shell::get_shell_chain_spec()),
|
||||
"seedling" => Box::new(chain_spec::seedling::get_seedling_chain_spec()),
|
||||
|
||||
// -- Statemint
|
||||
"statemint-dev" => Box::new(chain_spec::statemint::statemint_development_config()),
|
||||
"statemint-local" => Box::new(chain_spec::statemint::statemint_local_config()),
|
||||
// -- Asset Hub Polkadot
|
||||
"asset-hub-polkadot-dev" | "statemint-dev" =>
|
||||
Box::new(chain_spec::asset_hubs::asset_hub_polkadot_development_config()),
|
||||
"asset-hub-polkadot-local" | "statemint-local" =>
|
||||
Box::new(chain_spec::asset_hubs::asset_hub_polkadot_local_config()),
|
||||
// the chain spec as used for generating the upgrade genesis values
|
||||
"statemint-genesis" => Box::new(chain_spec::statemint::statemint_config()),
|
||||
"asset-hub-polkadot-genesis" | "statemint-genesis" =>
|
||||
Box::new(chain_spec::asset_hubs::asset_hub_polkadot_config()),
|
||||
// the shell-based chain spec as used for syncing
|
||||
"statemint" => Box::new(chain_spec::statemint::StatemintChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/statemint.json")[..],
|
||||
)?),
|
||||
"asset-hub-polkadot" | "statemint" =>
|
||||
Box::new(chain_spec::asset_hubs::AssetHubPolkadotChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/asset-hub-polkadot.json")[..],
|
||||
)?),
|
||||
|
||||
// -- Statemine
|
||||
"statemine-dev" => Box::new(chain_spec::statemint::statemine_development_config()),
|
||||
"statemine-local" => Box::new(chain_spec::statemint::statemine_local_config()),
|
||||
// -- Asset Hub Kusama
|
||||
"asset-hub-kusama-dev" | "statemine-dev" =>
|
||||
Box::new(chain_spec::asset_hubs::asset_hub_kusama_development_config()),
|
||||
"asset-hub-kusama-local" | "statemine-local" =>
|
||||
Box::new(chain_spec::asset_hubs::asset_hub_kusama_local_config()),
|
||||
// the chain spec as used for generating the upgrade genesis values
|
||||
"statemine-genesis" => Box::new(chain_spec::statemint::statemine_config()),
|
||||
"asset-hub-kusama-genesis" | "statemine-genesis" =>
|
||||
Box::new(chain_spec::asset_hubs::asset_hub_kusama_config()),
|
||||
// the shell-based chain spec as used for syncing
|
||||
"statemine" => Box::new(chain_spec::statemint::StatemineChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/statemine.json")[..],
|
||||
)?),
|
||||
"asset-hub-kusama" | "statemine" =>
|
||||
Box::new(chain_spec::asset_hubs::AssetHubKusamaChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/asset-hub-kusama.json")[..],
|
||||
)?),
|
||||
|
||||
// -- Westmint
|
||||
"westmint-dev" => Box::new(chain_spec::statemint::westmint_development_config()),
|
||||
"westmint-local" => Box::new(chain_spec::statemint::westmint_local_config()),
|
||||
// -- Asset Hub Westend
|
||||
"asset-hub-westend-dev" | "westmint-dev" =>
|
||||
Box::new(chain_spec::asset_hubs::asset_hub_westend_development_config()),
|
||||
"asset-hub-westend-local" | "westmint-local" =>
|
||||
Box::new(chain_spec::asset_hubs::asset_hub_westend_local_config()),
|
||||
// the chain spec as used for generating the upgrade genesis values
|
||||
"westmint-genesis" => Box::new(chain_spec::statemint::westmint_config()),
|
||||
"asset-hub-westend-genesis" | "westmint-genesis" =>
|
||||
Box::new(chain_spec::asset_hubs::asset_hub_westend_config()),
|
||||
// the shell-based chain spec as used for syncing
|
||||
"westmint" => Box::new(chain_spec::statemint::WestmintChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/westmint.json")[..],
|
||||
)?),
|
||||
"asset-hub-westend" | "westmint" =>
|
||||
Box::new(chain_spec::asset_hubs::AssetHubWestendChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/asset-hub-westend.json")[..],
|
||||
)?),
|
||||
|
||||
// -- Polkadot Collectives
|
||||
"collectives-polkadot-dev" =>
|
||||
@@ -239,12 +252,14 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
path => {
|
||||
let path: PathBuf = path.into();
|
||||
match path.runtime() {
|
||||
Runtime::Statemint =>
|
||||
Box::new(chain_spec::statemint::StatemintChainSpec::from_json_file(path)?),
|
||||
Runtime::Statemine =>
|
||||
Box::new(chain_spec::statemint::StatemineChainSpec::from_json_file(path)?),
|
||||
Runtime::Westmint =>
|
||||
Box::new(chain_spec::statemint::WestmintChainSpec::from_json_file(path)?),
|
||||
Runtime::AssetHubPolkadot => Box::new(
|
||||
chain_spec::asset_hubs::AssetHubPolkadotChainSpec::from_json_file(path)?,
|
||||
),
|
||||
Runtime::AssetHubKusama =>
|
||||
Box::new(chain_spec::asset_hubs::AssetHubKusamaChainSpec::from_json_file(path)?),
|
||||
Runtime::AssetHubWestend => Box::new(
|
||||
chain_spec::asset_hubs::AssetHubWestendChainSpec::from_json_file(path)?,
|
||||
),
|
||||
Runtime::CollectivesPolkadot | Runtime::CollectivesWestend => Box::new(
|
||||
chain_spec::collectives::CollectivesPolkadotChainSpec::from_json_file(path)?,
|
||||
),
|
||||
@@ -338,9 +353,9 @@ impl SubstrateCli for Cli {
|
||||
|
||||
fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
|
||||
match chain_spec.runtime() {
|
||||
Runtime::Statemint => &statemint_runtime::VERSION,
|
||||
Runtime::Statemine => &statemine_runtime::VERSION,
|
||||
Runtime::Westmint => &westmint_runtime::VERSION,
|
||||
Runtime::AssetHubPolkadot => &asset_hub_polkadot_runtime::VERSION,
|
||||
Runtime::AssetHubKusama => &asset_hub_kusama_runtime::VERSION,
|
||||
Runtime::AssetHubWestend => &asset_hub_westend_runtime::VERSION,
|
||||
Runtime::CollectivesPolkadot | Runtime::CollectivesWestend =>
|
||||
&collectives_polkadot_runtime::VERSION,
|
||||
Runtime::Shell => &shell_runtime::VERSION,
|
||||
@@ -399,24 +414,24 @@ impl SubstrateCli for RelayChainCli {
|
||||
macro_rules! construct_benchmark_partials {
|
||||
($config:expr, |$partials:ident| $code:expr) => {
|
||||
match $config.chain_spec.runtime() {
|
||||
Runtime::Statemine => {
|
||||
let $partials = new_partial::<statemine_runtime::RuntimeApi, _>(
|
||||
Runtime::AssetHubKusama => {
|
||||
let $partials = new_partial::<asset_hub_kusama_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::aura_build_import_queue::<_, AuraId>,
|
||||
)?;
|
||||
$code
|
||||
},
|
||||
Runtime::Westmint => {
|
||||
let $partials = new_partial::<westmint_runtime::RuntimeApi, _>(
|
||||
Runtime::AssetHubWestend => {
|
||||
let $partials = new_partial::<asset_hub_westend_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::aura_build_import_queue::<_, AuraId>,
|
||||
)?;
|
||||
$code
|
||||
},
|
||||
Runtime::Statemint => {
|
||||
let $partials = new_partial::<statemint_runtime::RuntimeApi, _>(
|
||||
Runtime::AssetHubPolkadot => {
|
||||
let $partials = new_partial::<asset_hub_polkadot_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::aura_build_import_queue::<_, StatemintAuraId>,
|
||||
crate::service::aura_build_import_queue::<_, AssetHubPolkadotAuraId>,
|
||||
)?;
|
||||
$code
|
||||
},
|
||||
@@ -436,9 +451,9 @@ macro_rules! construct_async_run {
|
||||
(|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{
|
||||
let runner = $cli.create_runner($cmd)?;
|
||||
match runner.config().chain_spec.runtime() {
|
||||
Runtime::Westmint => {
|
||||
Runtime::AssetHubWestend => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<westmint_runtime::RuntimeApi, _>(
|
||||
let $components = new_partial::<asset_hub_westend_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::aura_build_import_queue::<_, AuraId>,
|
||||
)?;
|
||||
@@ -446,9 +461,9 @@ macro_rules! construct_async_run {
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
},
|
||||
Runtime::Statemine => {
|
||||
Runtime::AssetHubKusama => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<statemine_runtime::RuntimeApi, _>(
|
||||
let $components = new_partial::<asset_hub_kusama_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::aura_build_import_queue::<_, AuraId>,
|
||||
)?;
|
||||
@@ -456,11 +471,11 @@ macro_rules! construct_async_run {
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
},
|
||||
Runtime::Statemint => {
|
||||
Runtime::AssetHubPolkadot => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<statemint_runtime::RuntimeApi, _>(
|
||||
let $components = new_partial::<asset_hub_polkadot_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::aura_build_import_queue::<_, StatemintAuraId>,
|
||||
crate::service::aura_build_import_queue::<_, AssetHubPolkadotAuraId>,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
@@ -674,11 +689,11 @@ pub fn run() -> Result<()> {
|
||||
if cfg!(feature = "runtime-benchmarks") {
|
||||
runner.sync_run(|config| {
|
||||
match config.chain_spec.runtime() {
|
||||
Runtime::Statemine =>
|
||||
cmd.run::<Block, StatemineRuntimeExecutor>(config),
|
||||
Runtime::Westmint => cmd.run::<Block, WestmintRuntimeExecutor>(config),
|
||||
Runtime::Statemint =>
|
||||
cmd.run::<Block, StatemintRuntimeExecutor>(config),
|
||||
Runtime::AssetHubKusama =>
|
||||
cmd.run::<Block, AssetHubKusamaExecutor>(config),
|
||||
Runtime::AssetHubWestend => cmd.run::<Block, AssetHubWestendExecutor>(config),
|
||||
Runtime::AssetHubPolkadot =>
|
||||
cmd.run::<Block, AssetHubPolkadotRuntimeExecutor>(config),
|
||||
Runtime::CollectivesPolkadot | Runtime::CollectivesWestend =>
|
||||
cmd.run::<Block, CollectivesPolkadotRuntimeExecutor>(config),
|
||||
Runtime::BridgeHub(bridge_hub_runtime_type) => match bridge_hub_runtime_type {
|
||||
@@ -762,25 +777,25 @@ pub fn run() -> Result<()> {
|
||||
let info_provider = timestamp_with_aura_info(6000);
|
||||
|
||||
match runner.config().chain_spec.runtime() {
|
||||
Runtime::Statemine => runner.async_run(|_| {
|
||||
Runtime::AssetHubKusama => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<StatemineRuntimeExecutor>, _>(Some(
|
||||
cmd.run::<Block, HostFunctionsOf<AssetHubKusamaExecutor>, _>(Some(
|
||||
info_provider,
|
||||
)),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
Runtime::Westmint => runner.async_run(|_| {
|
||||
Runtime::AssetHubWestend => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<WestmintRuntimeExecutor>, _>(Some(
|
||||
cmd.run::<Block, HostFunctionsOf<AssetHubWestendExecutor>, _>(Some(
|
||||
info_provider,
|
||||
)),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
Runtime::Statemint => runner.async_run(|_| {
|
||||
Runtime::AssetHubPolkadot => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<StatemintRuntimeExecutor>, _>(Some(
|
||||
cmd.run::<Block, HostFunctionsOf<AssetHubPolkadotRuntimeExecutor>, _>(Some(
|
||||
info_provider,
|
||||
)),
|
||||
task_manager,
|
||||
@@ -858,6 +873,38 @@ pub fn run() -> Result<()> {
|
||||
let collator_options = cli.run.collator_options();
|
||||
|
||||
runner.run_node_until_exit(|config| async move {
|
||||
// If Statemint (Statemine, Westmint, Rockmine) DB exists and we're using the
|
||||
// asset-hub chain spec, then rename the base path to the new chain ID. In the case
|
||||
// that both file paths exist, the node will exit, as the user must decide (by
|
||||
// deleting one path) the information that they want to use as their DB.
|
||||
let old_name = match config.chain_spec.id() {
|
||||
"asset-hub-polkadot" => Some("statemint"),
|
||||
"asset-hub-kusama" => Some("statemine"),
|
||||
"asset-hub-westend" => Some("westmint"),
|
||||
"asset-hub-rococo" => Some("rockmine"),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
if let Some(old_name) = old_name {
|
||||
let new_path = config.base_path.config_dir(config.chain_spec.id());
|
||||
let old_path = config.base_path.config_dir(old_name);
|
||||
|
||||
if old_path.exists() && new_path.exists() {
|
||||
return Err(format!(
|
||||
"Found legacy {} path {} and new asset-hub path {}. Delete one path such that only one exists.",
|
||||
old_name, old_path.display(), new_path.display()
|
||||
).into())
|
||||
}
|
||||
|
||||
if old_path.exists() {
|
||||
std::fs::rename(old_path.clone(), new_path.clone())?;
|
||||
info!(
|
||||
"Statemint renamed to Asset Hub. The filepath with associated data on disk has been renamed from {} to {}.",
|
||||
old_path.display(), new_path.display()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let hwbench = (!cli.no_hardware_benchmarks).then_some(
|
||||
config.database.path().map(|database_path| {
|
||||
let _ = std::fs::create_dir_all(database_path);
|
||||
@@ -900,22 +947,22 @@ pub fn run() -> Result<()> {
|
||||
}
|
||||
|
||||
match config.chain_spec.runtime() {
|
||||
Runtime::Statemint => crate::service::start_generic_aura_node::<
|
||||
statemint_runtime::RuntimeApi,
|
||||
StatemintAuraId,
|
||||
Runtime::AssetHubPolkadot => crate::service::start_generic_aura_node::<
|
||||
asset_hub_polkadot_runtime::RuntimeApi,
|
||||
AssetHubPolkadotAuraId,
|
||||
>(config, polkadot_config, collator_options, id, hwbench)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into),
|
||||
Runtime::Statemine => crate::service::start_generic_aura_node::<
|
||||
statemine_runtime::RuntimeApi,
|
||||
Runtime::AssetHubKusama => crate::service::start_generic_aura_node::<
|
||||
asset_hub_kusama_runtime::RuntimeApi,
|
||||
AuraId,
|
||||
>(config, polkadot_config, collator_options, id, hwbench)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into),
|
||||
Runtime::Westmint => crate::service::start_generic_aura_node::<
|
||||
westmint_runtime::RuntimeApi,
|
||||
Runtime::AssetHubWestend => crate::service::start_generic_aura_node::<
|
||||
asset_hub_westend_runtime::RuntimeApi,
|
||||
AuraId,
|
||||
>(config, polkadot_config, collator_options, id, hwbench)
|
||||
.await
|
||||
@@ -1257,9 +1304,9 @@ mod tests {
|
||||
|
||||
let path = store_configuration(
|
||||
&temp_dir,
|
||||
Box::new(crate::chain_spec::statemint::statemine_local_config()),
|
||||
Box::new(crate::chain_spec::asset_hubs::asset_hub_kusama_local_config()),
|
||||
);
|
||||
assert_eq!(Runtime::Statemine, path.runtime());
|
||||
assert_eq!(Runtime::AssetHubKusama, path.runtime());
|
||||
|
||||
let path = store_configuration(
|
||||
&temp_dir,
|
||||
|
||||
@@ -86,52 +86,52 @@ impl sc_executor::NativeExecutionDispatch for ShellRuntimeExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
// Native Statemint executor instance.
|
||||
pub struct StatemintRuntimeExecutor;
|
||||
/// Native Asset Hub Polkadot (Statemint) executor instance.
|
||||
pub struct AssetHubPolkadotRuntimeExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for StatemintRuntimeExecutor {
|
||||
impl sc_executor::NativeExecutionDispatch for AssetHubPolkadotRuntimeExecutor {
|
||||
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
statemint_runtime::api::dispatch(method, data)
|
||||
asset_hub_polkadot_runtime::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
statemint_runtime::native_version()
|
||||
asset_hub_polkadot_runtime::native_version()
|
||||
}
|
||||
}
|
||||
|
||||
/// Native Statemine executor instance.
|
||||
pub struct StatemineRuntimeExecutor;
|
||||
/// Native Asset Hub Kusama (Statemine) executor instance.
|
||||
pub struct AssetHubKusamaExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for StatemineRuntimeExecutor {
|
||||
impl sc_executor::NativeExecutionDispatch for AssetHubKusamaExecutor {
|
||||
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
statemine_runtime::api::dispatch(method, data)
|
||||
asset_hub_kusama_runtime::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
statemine_runtime::native_version()
|
||||
asset_hub_kusama_runtime::native_version()
|
||||
}
|
||||
}
|
||||
|
||||
/// Native Westmint executor instance.
|
||||
pub struct WestmintRuntimeExecutor;
|
||||
/// Native Asset Hub Westend (Westmint) executor instance.
|
||||
pub struct AssetHubWestendExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for WestmintRuntimeExecutor {
|
||||
impl sc_executor::NativeExecutionDispatch for AssetHubWestendExecutor {
|
||||
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
westmint_runtime::api::dispatch(method, data)
|
||||
asset_hub_westend_runtime::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
westmint_runtime::native_version()
|
||||
asset_hub_westend_runtime::native_version()
|
||||
}
|
||||
}
|
||||
|
||||
// Native Polkadot Collectives executor instance.
|
||||
/// Native Polkadot Collectives executor instance.
|
||||
pub struct CollectivesPolkadotRuntimeExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for CollectivesPolkadotRuntimeExecutor {
|
||||
@@ -146,7 +146,7 @@ impl sc_executor::NativeExecutionDispatch for CollectivesPolkadotRuntimeExecutor
|
||||
}
|
||||
}
|
||||
|
||||
// Native BridgeHubPolkadot executor instance.
|
||||
/// Native BridgeHubPolkadot executor instance.
|
||||
pub struct BridgeHubPolkadotRuntimeExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for BridgeHubPolkadotRuntimeExecutor {
|
||||
@@ -161,7 +161,7 @@ impl sc_executor::NativeExecutionDispatch for BridgeHubPolkadotRuntimeExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
// Native BridgeHubKusama executor instance.
|
||||
/// Native BridgeHubKusama executor instance.
|
||||
pub struct BridgeHubKusamaRuntimeExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for BridgeHubKusamaRuntimeExecutor {
|
||||
@@ -176,7 +176,7 @@ impl sc_executor::NativeExecutionDispatch for BridgeHubKusamaRuntimeExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
// Native BridgeHubRococo executor instance.
|
||||
/// Native BridgeHubRococo executor instance.
|
||||
pub struct BridgeHubRococoRuntimeExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for BridgeHubRococoRuntimeExecutor {
|
||||
@@ -191,7 +191,7 @@ impl sc_executor::NativeExecutionDispatch for BridgeHubRococoRuntimeExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
// Native contracts executor instance.
|
||||
/// Native contracts executor instance.
|
||||
pub struct ContractsRococoRuntimeExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for ContractsRococoRuntimeExecutor {
|
||||
@@ -1068,7 +1068,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Build the import queue for Statemint and other Aura-based runtimes.
|
||||
/// Build the import queue for Aura-based runtimes.
|
||||
pub fn aura_build_import_queue<RuntimeApi, AuraId: AppCrypto>(
|
||||
client: Arc<ParachainClient<RuntimeApi>>,
|
||||
block_import: ParachainBlockImport<RuntimeApi>,
|
||||
@@ -1134,8 +1134,7 @@ where
|
||||
Ok(BasicQueue::new(verifier, Box::new(block_import), None, &spawner, registry))
|
||||
}
|
||||
|
||||
/// Start an aura powered parachain node.
|
||||
/// (collective-polkadot and statemine/t use this)
|
||||
/// Start an aura powered parachain node. Asset Hub and Collectives use this.
|
||||
pub async fn start_generic_aura_node<RuntimeApi, AuraId: AppCrypto>(
|
||||
parachain_config: Configuration,
|
||||
polkadot_config: Configuration,
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::{
|
||||
use tempfile::tempdir;
|
||||
|
||||
/// The runtimes that this command supports.
|
||||
static RUNTIMES: [&str; 3] = ["westmint", "statemine", "statemint"];
|
||||
static RUNTIMES: [&str; 3] = ["asset-hub-westend", "asset-hub-kusama", "asset-hub-polkadot"];
|
||||
|
||||
/// The `benchmark storage` command works for the dev runtimes.
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user