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:
joe petrowski
2023-06-02 11:58:19 +02:00
committed by GitHub
parent cad48b7136
commit 6007549589
161 changed files with 1123 additions and 1025 deletions
@@ -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;