Skip to content

Commit

Permalink
Add native runtimes back into polkadot-parachain
Browse files Browse the repository at this point in the history
  • Loading branch information
seadanda committed Oct 3, 2023
1 parent d4377db commit f208bb3
Show file tree
Hide file tree
Showing 6 changed files with 465 additions and 15 deletions.
18 changes: 18 additions & 0 deletions cumulus/polkadot-parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@ serde_json = "1.0.107"
# Local
rococo-parachain-runtime = { path = "../parachains/runtimes/testing/rococo-parachain" }
shell-runtime = { path = "../parachains/runtimes/starters/shell" }
glutton-runtime = { path = "../parachains/runtimes/glutton/glutton-kusama" }
glutton-westend-runtime = { path = "../parachains/runtimes/glutton/glutton-westend" }
seedling-runtime = { path = "../parachains/runtimes/starters/seedling" }
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" }
collectives-westend-runtime = { path = "../parachains/runtimes/collectives/collectives-westend" }
contracts-rococo-runtime = { path = "../parachains/runtimes/contracts/contracts-rococo" }
bridge-hub-rococo-runtime = { path = "../parachains/runtimes/bridge-hubs/bridge-hub-rococo" }
bridge-hub-kusama-runtime = { path = "../parachains/runtimes/bridge-hubs/bridge-hub-kusama" }
bridge-hub-polkadot-runtime = { path = "../parachains/runtimes/bridge-hubs/bridge-hub-polkadot" }
penpal-runtime = { path = "../parachains/runtimes/testing/penpal" }
jsonrpsee = { version = "0.16.2", features = ["server"] }
parachains-common = { path = "../parachains/common" }
Expand Down Expand Up @@ -101,12 +107,18 @@ wait-timeout = "0.2"
[features]
default = []
runtime-benchmarks = [
"asset-hub-kusama-runtime/runtime-benchmarks",
"asset-hub-polkadot-runtime/runtime-benchmarks",
"asset-hub-westend-runtime/runtime-benchmarks",
"bridge-hub-kusama-runtime/runtime-benchmarks",
"bridge-hub-polkadot-runtime/runtime-benchmarks",
"bridge-hub-rococo-runtime/runtime-benchmarks",
"collectives-polkadot-runtime/runtime-benchmarks",
"collectives-westend-runtime/runtime-benchmarks",
"contracts-rococo-runtime/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"glutton-runtime/runtime-benchmarks",
"glutton-westend-runtime/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
"penpal-runtime/runtime-benchmarks",
Expand All @@ -118,10 +130,16 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
]
try-runtime = [
"asset-hub-kusama-runtime/try-runtime",
"asset-hub-polkadot-runtime/try-runtime",
"asset-hub-westend-runtime/try-runtime",
"bridge-hub-kusama-runtime/try-runtime",
"bridge-hub-polkadot-runtime/try-runtime",
"bridge-hub-rococo-runtime/try-runtime",
"collectives-polkadot-runtime/try-runtime",
"collectives-westend-runtime/try-runtime",
"contracts-rococo-runtime/try-runtime",
"glutton-runtime/try-runtime",
"glutton-westend-runtime/try-runtime",
"penpal-runtime/try-runtime",
"polkadot-cli/try-runtime",
Expand Down
81 changes: 76 additions & 5 deletions cumulus/polkadot-parachain/src/chain_spec/glutton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn glutton_development_config(para_id: ParaId) -> GluttonChainSpec {
None,
None,
None,
Extensions { relay_chain: "westend-dev".into(), para_id: para_id.into() },
Extensions { relay_chain: "kusama-dev".into(), para_id: para_id.into() },
)
}

Expand All @@ -64,7 +64,7 @@ pub fn glutton_local_config(para_id: ParaId) -> GluttonChainSpec {
None,
None,
None,
Extensions { relay_chain: "westend-local".into(), para_id: para_id.into() },
Extensions { relay_chain: "kusama-local".into(), para_id: para_id.into() },
)
}

Expand All @@ -76,7 +76,7 @@ pub fn glutton_config(para_id: ParaId) -> GluttonChainSpec {
// Name
format!("Glutton {}", para_id).as_str(),
// ID
format!("glutton-westend-{}", para_id).as_str(),
format!("glutton-kusama-{}", para_id).as_str(),
ChainType::Live,
move || {
glutton_genesis(
Expand All @@ -90,10 +90,10 @@ pub fn glutton_config(para_id: ParaId) -> GluttonChainSpec {
Vec::new(),
None,
// Protocol ID
Some(format!("glutton-westend-{}", para_id).as_str()),
Some(format!("glutton-kusama-{}", para_id).as_str()),
None,
Some(properties),
Extensions { relay_chain: "westend".into(), para_id: para_id.into() },
Extensions { relay_chain: "kusama".into(), para_id: para_id.into() },
)
}

Expand Down Expand Up @@ -123,3 +123,74 @@ fn glutton_genesis(
},
}
}

pub fn glutton_westend_development_config(para_id: ParaId) -> GluttonChainSpec {
GluttonChainSpec::from_genesis(
// Name
"Glutton Development",
// ID
"glutton_dev",
ChainType::Local,
move || glutton_genesis(para_id, vec![get_collator_keys_from_seed::<AuraId>("Alice")]),
Vec::new(),
None,
None,
None,
None,
Extensions { relay_chain: "westend-dev".into(), para_id: para_id.into() },
)
}

pub fn glutton_westend_local_config(para_id: ParaId) -> GluttonChainSpec {
GluttonChainSpec::from_genesis(
// Name
"Glutton Local",
// ID
"glutton_local",
ChainType::Local,
move || {
glutton_genesis(
para_id,
vec![
get_collator_keys_from_seed::<AuraId>("Alice"),
get_collator_keys_from_seed::<AuraId>("Bob"),
],
)
},
Vec::new(),
None,
None,
None,
None,
Extensions { relay_chain: "westend-local".into(), para_id: para_id.into() },
)
}

pub fn glutton_westend_config(para_id: ParaId) -> GluttonChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("ss58Format".into(), 2.into());

GluttonChainSpec::from_genesis(
// Name
format!("Glutton {}", para_id).as_str(),
// ID
format!("glutton-westend-{}", para_id).as_str(),
ChainType::Live,
move || {
glutton_genesis(
para_id,
vec![
get_collator_keys_from_seed::<AuraId>("Alice"),
get_collator_keys_from_seed::<AuraId>("Bob"),
],
)
},
Vec::new(),
None,
// Protocol ID
Some(format!("glutton-westend-{}", para_id).as_str()),
None,
Some(properties),
Extensions { relay_chain: "westend".into(), para_id: para_id.into() },
)
}
4 changes: 2 additions & 2 deletions cumulus/polkadot-parachain/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ pub enum Subcommand {
const AFTER_HELP_EXAMPLE: &str = color_print::cstr!(
r#"<bold><underline>Examples:</></>
<bold>polkadot-parachain --chain asset-hub-westend --sync warp -- --chain polkadot --sync warp</>
Launch a warp-syncing full node of the <italic>Asset Hub</> parachain on the <italic>Polkadot</> Relay Chain.
Launch a warp-syncing full node of the <italic>Asset Hub</> parachain on the <italic>Westend</> Relay Chain.
<bold>polkadot-parachain --chain asset-hub-westend --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.
Launch a warp-syncing full node of the <italic>Asset Hub</> parachain on the <italic>Westend</> Relay Chain.
Uses <italic>ws://rpc.example.com</> as remote relay chain node.
"#
);
Expand Down
Loading

0 comments on commit f208bb3

Please sign in to comment.