Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
[runtime] Add async-backing support (#359)
Browse files Browse the repository at this point in the history
* Added async-backing capability
  • Loading branch information
DidacSF authored Oct 20, 2023
1 parent 8851aa4 commit 25d56f5
Show file tree
Hide file tree
Showing 12 changed files with 508 additions and 368 deletions.
85 changes: 57 additions & 28 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ members = [

[workspace.dependencies]
# General
async-trait = { version = "0.1.73", default-features = false}
clap = { version = "4.4.6", default-features = false }
futures = { version = "0.3.28", default-features = false }
hex-literal = { version = "0.4.1", default-features = false }
Expand Down Expand Up @@ -126,6 +127,7 @@ cumulus-client-cli = { git = "https://github.com/paritytech
cumulus-client-collator = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
cumulus-client-consensus-relay-chain = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
cumulus-client-consensus-proposer = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
cumulus-client-network = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
Expand All @@ -135,6 +137,7 @@ cumulus-pallet-parachain-system = { git = "https://github.com/paritytech
cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
cumulus-pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
cumulus-primitives-aura = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
cumulus-primitives-timestamp = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
Expand Down
54 changes: 32 additions & 22 deletions node/cli/src/para/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,16 @@ macro_rules! construct_async_run {
let runner = $cli.create_runner($cmd)?;
runner.async_run(|$config| {
#[cfg(feature = "bajun")]
let $components = service::new_partial::<BajunRuntimeApi, BajunRuntimeExecutor>(&$config)?;
let $components = service::new_partial::<BajunRuntimeApi, BajunRuntimeExecutor, _>(
&$config,
service::aura_build_import_queue::<BajunRuntimeApi, BajunRuntimeExecutor>
)?;

#[cfg(feature = "ajuna")]
let $components = service::new_partial::<AjunaRuntimeApi, AjunaRuntimeExecutor>(&$config)?;
let $components = service::new_partial::<AjunaRuntimeApi, AjunaRuntimeExecutor, _>(
&$config,
service::aura_build_import_queue::<AjunaRuntimeApi, AjunaRuntimeExecutor>
)?;

let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
Expand All @@ -160,10 +166,16 @@ macro_rules! construct_sync_run {
let runner = $cli.create_runner($cmd)?;
runner.sync_run(|$config| {
#[cfg(feature = "bajun")]
let $components = service::new_partial::<BajunRuntimeApi, BajunRuntimeExecutor>(&$config)?;
let $components = service::new_partial::<BajunRuntimeApi, BajunRuntimeExecutor, _>(
&$config,
service::aura_build_import_queue::<BajunRuntimeApi, BajunRuntimeExecutor>
)?;

#[cfg(feature = "ajuna")]
let $components = service::new_partial::<AjunaRuntimeApi, AjunaRuntimeExecutor>(&$config)?;
let $components = service::new_partial::<AjunaRuntimeApi, AjunaRuntimeExecutor, _>(
&$config,
service::aura_build_import_queue::<AjunaRuntimeApi, AjunaRuntimeExecutor>
)?;

{ $( $code )* }
})
Expand Down Expand Up @@ -229,14 +241,18 @@ pub fn run() -> Result<()> {
runner.sync_run(|config| {
#[cfg(feature = "ajuna")]
{
let partials =
service::new_partial::<AjunaRuntimeApi, AjunaRuntimeExecutor>(&config)?;
let partials = service::new_partial::<AjunaRuntimeApi, AjunaRuntimeExecutor, _>(
&config,
service::aura_build_import_queue::<AjunaRuntimeApi, AjunaRuntimeExecutor>,
)?;
return cmd.run::<Block>(&*config.chain_spec, &*partials.client)
}
#[cfg(feature = "bajun")]
{
let partials =
service::new_partial::<BajunRuntimeApi, BajunRuntimeExecutor>(&config)?;
let partials = service::new_partial::<BajunRuntimeApi, BajunRuntimeExecutor, _>(
&config,
service::aura_build_import_queue::<BajunRuntimeApi, BajunRuntimeExecutor>,
)?;
cmd.run::<Block>(&*config.chain_spec, &*partials.client)
}
#[cfg(not(feature = "bajun"))]
Expand Down Expand Up @@ -383,25 +399,19 @@ pub fn run() -> Result<()> {
match &config.chain_spec {
#[cfg(feature = "ajuna")]
spec if spec.id().starts_with("ajuna") =>
service::start_parachain_node::<AjunaRuntimeApi, AjunaRuntimeExecutor>(
config,
polkadot_config,
collator_options,
id,
hwbench,
)
service::start_lookahead_parachain_node::<
AjunaRuntimeApi,
AjunaRuntimeExecutor,
>(config, polkadot_config, collator_options, id, hwbench)
.await
.map(|r| r.0)
.map_err(Into::into),
#[cfg(feature = "bajun")]
spec if spec.id().starts_with("bajun") =>
service::start_parachain_node::<BajunRuntimeApi, BajunRuntimeExecutor>(
config,
polkadot_config,
collator_options,
id,
hwbench,
)
service::start_lookahead_parachain_node::<
BajunRuntimeApi,
BajunRuntimeExecutor,
>(config, polkadot_config, collator_options, id, hwbench)
.await
.map(|r| r.0)
.map_err(Into::into),
Expand Down
Loading

0 comments on commit 25d56f5

Please sign in to comment.