Skip to content

Commit

Permalink
Re-use sp_genesis_builder::DEV_RUNTIME_PRESET
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur committed Sep 2, 2024
1 parent a6d37ba commit e96f540
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ fn asset_hub_rococo_genesis(

/// Encapsulates names of predefined presets.
mod preset_names {
pub const PRESET_DEVELOPMENT: &str = "development";
pub const PRESET_LOCAL: &str = "local";
pub const PRESET_GENESIS: &str = "genesis";
}
Expand Down Expand Up @@ -141,7 +140,7 @@ pub fn get_preset(id: &PresetId) -> Option<Vec<u8>> {
ROC * 1_000_000,
1000.into(),
),
Ok(PRESET_DEVELOPMENT) => asset_hub_rococo_genesis(
Ok(sp_genesis_builder::DEV_RUNTIME_PRESET) => asset_hub_rococo_genesis(
// initial collators.
vec![(
get_account_id_from_seed::<sr25519::Public>("Alice"),
Expand Down Expand Up @@ -171,7 +170,7 @@ pub fn preset_names() -> Vec<PresetId> {
use preset_names::*;
vec![
PresetId::from(PRESET_GENESIS),
PresetId::from(PRESET_DEVELOPMENT),
PresetId::from(sp_genesis_builder::DEV_RUNTIME_PRESET),
PresetId::from(PRESET_LOCAL),
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ fn asset_hub_westend_genesis(

/// Encapsulates names of predefined presets.
mod preset_names {
pub const PRESET_DEVELOPMENT: &str = "development";
pub const PRESET_LOCAL: &str = "local";
pub const PRESET_GENESIS: &str = "genesis";
}
Expand Down Expand Up @@ -139,7 +138,7 @@ pub fn get_preset(id: &PresetId) -> Option<Vec<u8>> {
WND * 1_000_000,
1000.into(),
),
Ok(PRESET_DEVELOPMENT) => asset_hub_westend_genesis(
Ok(sp_genesis_builder::DEV_RUNTIME_PRESET) => asset_hub_westend_genesis(
// initial collators.
vec![(
get_account_id_from_seed::<sr25519::Public>("Alice"),
Expand Down Expand Up @@ -169,7 +168,7 @@ pub fn preset_names() -> Vec<PresetId> {
use preset_names::*;
vec![
PresetId::from(PRESET_GENESIS),
PresetId::from(PRESET_DEVELOPMENT),
PresetId::from(sp_genesis_builder::DEV_RUNTIME_PRESET),
PresetId::from(PRESET_LOCAL),
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ fn bridge_hub_rococo_genesis(

/// Encapsulates names of predefined presets.
mod preset_names {
pub const PRESET_DEVELOPMENT: &str = "development";
pub const PRESET_LOCAL: &str = "local";
}

Expand Down Expand Up @@ -118,7 +117,7 @@ pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option<sp_std::vec::Vec<
Some(get_account_id_from_seed::<sr25519::Public>("Bob")),
rococo_runtime_constants::system_parachain::ASSET_HUB_ID.into(),
),
Ok(PRESET_DEVELOPMENT) => bridge_hub_rococo_genesis(
Ok(sp_genesis_builder::DEV_RUNTIME_PRESET) => bridge_hub_rococo_genesis(
// initial collators.
vec![
(
Expand Down Expand Up @@ -160,5 +159,5 @@ pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option<sp_std::vec::Vec<
/// List of supported presets.
pub fn preset_names() -> Vec<PresetId> {
use preset_names::*;
vec![PresetId::from(PRESET_DEVELOPMENT), PresetId::from(PRESET_LOCAL)]
vec![PresetId::from(sp_genesis_builder::DEV_RUNTIME_PRESET), PresetId::from(PRESET_LOCAL)]
}
1 change: 1 addition & 0 deletions cumulus/polkadot-parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ testnet-parachains-constants = { features = [
# Substrate
sp-runtime = { workspace = true }
sp-core = { workspace = true, default-features = true }
sp-genesis-builder = { workspace = true, default-features = true }
sc-cli = { workspace = true, default-features = true }
sc-service = { workspace = true, default-features = true }
sc-chain-spec = { workspace = true, default-features = true }
Expand Down
4 changes: 2 additions & 2 deletions cumulus/polkadot-parachain/src/chain_spec/asset_hubs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn asset_hub_westend_development_config() -> GenericChainSpec {
.with_name("Westend Asset Hub Development")
.with_id("asset-hub-westend-dev")
.with_chain_type(ChainType::Local)
.with_genesis_config_preset_name("development")
.with_genesis_config_preset_name(sp_genesis_builder::DEV_RUNTIME_PRESET)
.with_properties(properties)
.build()
}
Expand Down Expand Up @@ -97,7 +97,7 @@ fn asset_hub_rococo_like_development_config(
.with_name(name)
.with_id(chain_id)
.with_chain_type(ChainType::Local)
.with_genesis_config_preset_name("development")
.with_genesis_config_preset_name(sp_genesis_builder::DEV_RUNTIME_PRESET)
.with_properties(properties)
.build()
}
Expand Down
2 changes: 1 addition & 1 deletion cumulus/polkadot-parachain/src/chain_spec/bridge_hubs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub mod rococo {
.with_id(super::ensure_id(id).expect("invalid id"))
.with_chain_type(chain_type.clone())
.with_genesis_config_preset_name(match chain_type {
ChainType::Development => "development",
ChainType::Development => sp_genesis_builder::DEV_RUNTIME_PRESET,
ChainType::Local => "local",
_ => panic!("chain_type: {chain_type:?} not supported here!"),
})
Expand Down

0 comments on commit e96f540

Please sign in to comment.