Skip to content

Commit

Permalink
Remove RuntimeApi dependency on system parachain runtime code (#2455)
Browse files Browse the repository at this point in the history
The last issue blocking the removal of the Polkadot and Kusama system
parachains from the repo in #1737 is the dependency on the runtime code
through the RuntimeApi in `polkadot-parachain`.

This PR introduces two fake runtimes to satisfy the build requirements
and changes the `new_partial` function to make it not be generic over
the runtimes.
The reason for the second runtime is the different Aura keys used in
Polkadot Asset Hub, as the impl for AuraApi depends on this type.
If this changes the `RuntimeApi` generic could be removed completely
from all functions in `services.rs` and and generic type parameters in
`services.rs` and specified as a concrete type to TFullClient`.

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
  • Loading branch information
seadanda and bkchr authored Nov 24, 2023
1 parent 8af61d0 commit d07186b
Show file tree
Hide file tree
Showing 9 changed files with 497 additions and 261 deletions.
9 changes: 9 additions & 0 deletions Cargo.lock

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

13 changes: 13 additions & 0 deletions cumulus/polkadot-parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ sp-runtime = { path = "../../substrate/primitives/runtime", default-features = f
sp-io = { path = "../../substrate/primitives/io" }
sp-core = { path = "../../substrate/primitives/core" }
sp-session = { path = "../../substrate/primitives/session" }
frame-try-runtime = { path = "../../substrate/frame/try-runtime", optional = true }
sc-consensus = { path = "../../substrate/client/consensus/common" }
sp-tracing = { path = "../../substrate/primitives/tracing" }
frame-support = { path = "../../substrate/frame/support" }
sc-cli = { path = "../../substrate/client/cli" }
sc-client-api = { path = "../../substrate/client/api" }
sc-executor = { path = "../../substrate/client/executor" }
Expand All @@ -63,12 +65,19 @@ sc-network-sync = { path = "../../substrate/client/network/sync" }
sc-basic-authorship = { path = "../../substrate/client/basic-authorship" }
sp-timestamp = { path = "../../substrate/primitives/timestamp" }
sp-blockchain = { path = "../../substrate/primitives/blockchain" }
sp-genesis-builder = { path = "../../substrate/primitives/genesis-builder", default-features = false }
sp-block-builder = { path = "../../substrate/primitives/block-builder" }
sp-keystore = { path = "../../substrate/primitives/keystore" }
sc-chain-spec = { path = "../../substrate/client/chain-spec" }
sc-rpc = { path = "../../substrate/client/rpc" }
sp-version = { path = "../../substrate/primitives/version" }
sc-tracing = { path = "../../substrate/client/tracing" }
sp-offchain = { path = "../../substrate/primitives/offchain" }
frame-system-rpc-runtime-api = { path = "../../substrate/frame/system/rpc/runtime-api" }
pallet-transaction-payment = { path = "../../substrate/frame/transaction-payment" }
pallet-transaction-payment-rpc-runtime-api = { path = "../../substrate/frame/transaction-payment/rpc/runtime-api" }
sp-std = { path = "../../substrate/primitives/std" }
sp-inherents = { path = "../../substrate/primitives/inherents" }
sp-api = { path = "../../substrate/primitives/api" }
sp-consensus-aura = { path = "../../substrate/primitives/consensus/aura" }
sc-sysinfo = { path = "../../substrate/client/sysinfo" }
Expand Down Expand Up @@ -126,6 +135,7 @@ runtime-benchmarks = [
"cumulus-primitives-core/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"glutton-runtime/runtime-benchmarks",
"glutton-westend-runtime/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
Expand All @@ -149,8 +159,11 @@ try-runtime = [
"collectives-polkadot-runtime/try-runtime",
"collectives-westend-runtime/try-runtime",
"contracts-rococo-runtime/try-runtime",
"frame-support/try-runtime",
"frame-try-runtime/try-runtime",
"glutton-runtime/try-runtime",
"glutton-westend-runtime/try-runtime",
"pallet-transaction-payment/try-runtime",
"penpal-runtime/try-runtime",
"polkadot-cli/try-runtime",
"polkadot-service/try-runtime",
Expand Down
5 changes: 0 additions & 5 deletions cumulus/polkadot-parachain/src/chain_spec/bridge_hubs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,6 @@ pub mod rococo {
/// Specialized `ChainSpec` for the normal parachain runtime.
pub type BridgeHubChainSpec = sc_service::GenericChainSpec<(), Extensions>;

pub type RuntimeApi = bridge_hub_rococo_runtime::RuntimeApi;

pub fn local_config<ModifyProperties: Fn(&mut sc_chain_spec::Properties)>(
id: &str,
chain_name: &str,
Expand Down Expand Up @@ -319,7 +317,6 @@ pub mod kusama {

/// Specialized `ChainSpec` for the normal parachain runtime.
pub type BridgeHubChainSpec = sc_service::GenericChainSpec<(), Extensions>;
pub type RuntimeApi = bridge_hub_kusama_runtime::RuntimeApi;

pub fn local_config(
id: &str,
Expand Down Expand Up @@ -429,7 +426,6 @@ pub mod westend {
/// Specialized `ChainSpec` for the normal parachain runtime.
pub type BridgeHubChainSpec =
sc_service::GenericChainSpec<bridge_hub_westend_runtime::RuntimeGenesisConfig, Extensions>;
pub type RuntimeApi = bridge_hub_westend_runtime::RuntimeApi;

pub fn local_config(
id: &str,
Expand Down Expand Up @@ -545,7 +541,6 @@ pub mod polkadot {

/// Specialized `ChainSpec` for the normal parachain runtime.
pub type BridgeHubChainSpec = sc_service::GenericChainSpec<(), Extensions>;
pub type RuntimeApi = bridge_hub_polkadot_runtime::RuntimeApi;

pub fn local_config(
id: &str,
Expand Down
Loading

0 comments on commit d07186b

Please sign in to comment.