mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 19:11:02 +00:00
polkadot-parachain: one chain-spec for all (#2457)
This PR removes some `ChainSpec` types which are not necessary (left-overs from #1256). Currently `ChainSpec` does not have to be generic over the specific `RuntimeGenesisConfig`, it is enough to use single type for all: https://github.com/paritytech/polkadot-sdk/blob/9f787018857660440182142adc806954d7d07709/cumulus/polkadot-parachain/src/chain_spec/mod.rs#L53-L54 related to: https://github.com/paritytech/polkadot-sdk/issues/25 --------- Co-authored-by: command-bot <>
This commit is contained in:
committed by
GitHub
parent
ffc64fd255
commit
d5d15a1802
@@ -16,6 +16,7 @@
|
||||
|
||||
use crate::{
|
||||
chain_spec,
|
||||
chain_spec::GenericChainSpec,
|
||||
cli::{Cli, RelayChainCli, Subcommand},
|
||||
fake_runtime_api::{
|
||||
asset_hub_polkadot_aura::RuntimeApi as AssetHubPolkadotRuntimeApi, aura::RuntimeApi,
|
||||
@@ -128,18 +129,15 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
// - Defaul-like
|
||||
"staging" =>
|
||||
Box::new(chain_spec::rococo_parachain::staging_rococo_parachain_local_config()),
|
||||
"tick" =>
|
||||
Box::new(chain_spec::rococo_parachain::RococoParachainChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/tick.json")[..],
|
||||
)?),
|
||||
"trick" =>
|
||||
Box::new(chain_spec::rococo_parachain::RococoParachainChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/trick.json")[..],
|
||||
)?),
|
||||
"track" =>
|
||||
Box::new(chain_spec::rococo_parachain::RococoParachainChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/track.json")[..],
|
||||
)?),
|
||||
"tick" => Box::new(GenericChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/tick.json")[..],
|
||||
)?),
|
||||
"trick" => Box::new(GenericChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/trick.json")[..],
|
||||
)?),
|
||||
"track" => Box::new(GenericChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/track.json")[..],
|
||||
)?),
|
||||
|
||||
// -- Starters
|
||||
"shell" => Box::new(chain_spec::shell::get_shell_chain_spec()),
|
||||
@@ -154,10 +152,9 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
"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
|
||||
"asset-hub-polkadot" | "statemint" =>
|
||||
Box::new(chain_spec::asset_hubs::AssetHubPolkadotChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/asset-hub-polkadot.json")[..],
|
||||
)?),
|
||||
"asset-hub-polkadot" | "statemint" => Box::new(GenericChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/asset-hub-polkadot.json")[..],
|
||||
)?),
|
||||
|
||||
// -- Asset Hub Kusama
|
||||
"asset-hub-kusama-dev" | "statemine-dev" =>
|
||||
@@ -168,10 +165,9 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
"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
|
||||
"asset-hub-kusama" | "statemine" =>
|
||||
Box::new(chain_spec::asset_hubs::AssetHubKusamaChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/asset-hub-kusama.json")[..],
|
||||
)?),
|
||||
"asset-hub-kusama" | "statemine" => Box::new(GenericChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/asset-hub-kusama.json")[..],
|
||||
)?),
|
||||
|
||||
// -- Asset Hub Rococo
|
||||
"asset-hub-rococo-dev" =>
|
||||
@@ -181,10 +177,9 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
// the chain spec as used for generating the upgrade genesis values
|
||||
"asset-hub-rococo-genesis" =>
|
||||
Box::new(chain_spec::asset_hubs::asset_hub_rococo_genesis_config()),
|
||||
"asset-hub-rococo" =>
|
||||
Box::new(chain_spec::asset_hubs::AssetHubRococoChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/asset-hub-rococo.json")[..],
|
||||
)?),
|
||||
"asset-hub-rococo" => Box::new(GenericChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/asset-hub-rococo.json")[..],
|
||||
)?),
|
||||
|
||||
// -- Asset Hub Westend
|
||||
"asset-hub-westend-dev" | "westmint-dev" =>
|
||||
@@ -195,28 +190,25 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
"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
|
||||
"asset-hub-westend" | "westmint" =>
|
||||
Box::new(chain_spec::asset_hubs::AssetHubWestendChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/asset-hub-westend.json")[..],
|
||||
)?),
|
||||
"asset-hub-westend" | "westmint" => Box::new(GenericChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/asset-hub-westend.json")[..],
|
||||
)?),
|
||||
|
||||
// -- Polkadot Collectives
|
||||
"collectives-polkadot-dev" =>
|
||||
Box::new(chain_spec::collectives::collectives_polkadot_development_config()),
|
||||
"collectives-polkadot-local" =>
|
||||
Box::new(chain_spec::collectives::collectives_polkadot_local_config()),
|
||||
"collectives-polkadot" =>
|
||||
Box::new(chain_spec::collectives::CollectivesPolkadotChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/collectives-polkadot.json")[..],
|
||||
)?),
|
||||
"collectives-polkadot" => Box::new(GenericChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/collectives-polkadot.json")[..],
|
||||
)?),
|
||||
"collectives-westend-dev" =>
|
||||
Box::new(chain_spec::collectives::collectives_westend_development_config()),
|
||||
"collectives-westend-local" =>
|
||||
Box::new(chain_spec::collectives::collectives_westend_local_config()),
|
||||
"collectives-westend" =>
|
||||
Box::new(chain_spec::collectives::CollectivesWestendChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/collectives-westend.json")[..],
|
||||
)?),
|
||||
"collectives-westend" => Box::new(GenericChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/collectives-westend.json")[..],
|
||||
)?),
|
||||
|
||||
// -- Contracts on Rococo
|
||||
"contracts-rococo-dev" =>
|
||||
@@ -224,10 +216,9 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
"contracts-rococo-local" =>
|
||||
Box::new(chain_spec::contracts::contracts_rococo_local_config()),
|
||||
"contracts-rococo-genesis" => Box::new(chain_spec::contracts::contracts_rococo_config()),
|
||||
"contracts-rococo" =>
|
||||
Box::new(chain_spec::contracts::ContractsRococoChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/contracts-rococo.json")[..],
|
||||
)?),
|
||||
"contracts-rococo" => Box::new(GenericChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/contracts-rococo.json")[..],
|
||||
)?),
|
||||
|
||||
// -- BridgeHub
|
||||
bridge_like_id
|
||||
@@ -279,44 +270,7 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
},
|
||||
|
||||
// -- Loading a specific spec from disk
|
||||
path => {
|
||||
let path: PathBuf = path.into();
|
||||
match path.runtime() {
|
||||
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::AssetHubRococo =>
|
||||
Box::new(chain_spec::asset_hubs::AssetHubRococoChainSpec::from_json_file(path)?),
|
||||
Runtime::AssetHubWestend => Box::new(
|
||||
chain_spec::asset_hubs::AssetHubWestendChainSpec::from_json_file(path)?,
|
||||
),
|
||||
Runtime::CollectivesPolkadot => Box::new(
|
||||
chain_spec::collectives::CollectivesPolkadotChainSpec::from_json_file(path)?,
|
||||
),
|
||||
Runtime::CollectivesWestend => Box::new(
|
||||
chain_spec::collectives::CollectivesWestendChainSpec::from_json_file(path)?,
|
||||
),
|
||||
Runtime::Shell =>
|
||||
Box::new(chain_spec::shell::ShellChainSpec::from_json_file(path)?),
|
||||
Runtime::Seedling =>
|
||||
Box::new(chain_spec::seedling::SeedlingChainSpec::from_json_file(path)?),
|
||||
Runtime::ContractsRococo =>
|
||||
Box::new(chain_spec::contracts::ContractsRococoChainSpec::from_json_file(path)?),
|
||||
Runtime::BridgeHub(bridge_hub_runtime_type) =>
|
||||
bridge_hub_runtime_type.chain_spec_from_json_file(path)?,
|
||||
Runtime::Penpal(_para_id) =>
|
||||
Box::new(chain_spec::penpal::PenpalChainSpec::from_json_file(path)?),
|
||||
Runtime::GluttonWestend =>
|
||||
Box::new(chain_spec::glutton::GluttonChainSpec::from_json_file(path)?),
|
||||
Runtime::Glutton =>
|
||||
Box::new(chain_spec::glutton::GluttonChainSpec::from_json_file(path)?),
|
||||
Runtime::Default => Box::new(
|
||||
chain_spec::rococo_parachain::RococoParachainChainSpec::from_json_file(path)?,
|
||||
),
|
||||
}
|
||||
},
|
||||
path => Box::new(GenericChainSpec::from_json_file(path.into())?),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user