Remove RuntimeApi dependency on system parachain runtime code (#2455)

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>
This commit is contained in:
Dónal Murray
2023-11-24 16:48:56 +00:00
committed by GitHub
parent 8af61d03b6
commit d07186b8e3
9 changed files with 497 additions and 261 deletions
+9 -15
View File
@@ -40,7 +40,7 @@ use sp_core::Pair;
use jsonrpsee::RpcModule;
use crate::rpc;
use crate::{fake_runtime_api::aura::RuntimeApi, rpc};
pub use parachains_common::{AccountId, Balance, Block, BlockNumber, Hash, Header, Nonce};
use cumulus_client_consensus_relay_chain::Verifier as RelayChainVerifier;
@@ -917,8 +917,8 @@ where
/// Build the import queue for the rococo parachain runtime.
pub fn rococo_parachain_build_import_queue(
client: Arc<ParachainClient<rococo_parachain_runtime::RuntimeApi>>,
block_import: ParachainBlockImport<rococo_parachain_runtime::RuntimeApi>,
client: Arc<ParachainClient<RuntimeApi>>,
block_import: ParachainBlockImport<RuntimeApi>,
config: &Configuration,
telemetry: Option<TelemetryHandle>,
task_manager: &TaskManager,
@@ -960,11 +960,8 @@ pub async fn start_rococo_parachain_node(
collator_options: CollatorOptions,
para_id: ParaId,
hwbench: Option<sc_sysinfo::HwBench>,
) -> sc_service::error::Result<(
TaskManager,
Arc<ParachainClient<rococo_parachain_runtime::RuntimeApi>>,
)> {
start_node_impl::<rococo_parachain_runtime::RuntimeApi, _, _, _>(
) -> sc_service::error::Result<(TaskManager, Arc<ParachainClient<RuntimeApi>>)> {
start_node_impl::<RuntimeApi, _, _, _>(
parachain_config,
polkadot_config,
collator_options,
@@ -1866,8 +1863,8 @@ where
#[allow(clippy::type_complexity)]
pub fn contracts_rococo_build_import_queue(
client: Arc<ParachainClient<contracts_rococo_runtime::RuntimeApi>>,
block_import: ParachainBlockImport<contracts_rococo_runtime::RuntimeApi>,
client: Arc<ParachainClient<RuntimeApi>>,
block_import: ParachainBlockImport<RuntimeApi>,
config: &Configuration,
telemetry: Option<TelemetryHandle>,
task_manager: &TaskManager,
@@ -1909,11 +1906,8 @@ pub async fn start_contracts_rococo_node(
collator_options: CollatorOptions,
para_id: ParaId,
hwbench: Option<sc_sysinfo::HwBench>,
) -> sc_service::error::Result<(
TaskManager,
Arc<ParachainClient<contracts_rococo_runtime::RuntimeApi>>,
)> {
start_contracts_rococo_node_impl::<contracts_rococo_runtime::RuntimeApi, _, _, _>(
) -> sc_service::error::Result<(TaskManager, Arc<ParachainClient<RuntimeApi>>)> {
start_contracts_rococo_node_impl::<RuntimeApi, _, _, _>(
parachain_config,
polkadot_config,
collator_options,