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

Commit

Permalink
polkadot-collator: Switch to wasm only (#1054)
Browse files Browse the repository at this point in the history
* polkadot-collator: Switch to wasm only

This switches the polkadot-collator to run everything in wasm only mode. While we should not that
yet with the relay chain, because it can happen that we run out of memory (very unlikely). On the
relay chain that would be bad, because we only have at max 2 sessions to bring everything back, for
Parachains that isn't such a problem as they would only stall and we could roll out a release that
fixes it. Besides that, Parachain validation on the relay chain happens in Wasm already all the time
and there is the memory usage even higher then on block import.

* cargo fmt

* remove unused var

Co-authored-by: Squirrel <gilescope@gmail.com>
  • Loading branch information
bkchr and gilescope authored Mar 2, 2022
1 parent e42a7c3 commit 92313f6
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 180 deletions.
65 changes: 34 additions & 31 deletions polkadot-parachains/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ use crate::{
chain_spec,
cli::{Cli, RelayChainCli, Subcommand},
service::{
new_partial, Block, CanvasKusamaRuntimeExecutor, RococoParachainRuntimeExecutor,
SeedlingRuntimeExecutor, ShellRuntimeExecutor, StatemineRuntimeExecutor,
new_partial, Block, ShellRuntimeExecutor, StatemineRuntimeExecutor,
StatemintRuntimeExecutor, WestmintRuntimeExecutor,
},
};
Expand Down Expand Up @@ -274,34 +273,34 @@ macro_rules! construct_async_run {
let runner = $cli.create_runner($cmd)?;
if runner.config().chain_spec.is_westmint() {
runner.async_run(|$config| {
let $components = new_partial::<westmint_runtime::RuntimeApi, WestmintRuntimeExecutor, _>(
let $components = new_partial::<westmint_runtime::RuntimeApi, _>(
&$config,
crate::service::statemint_build_import_queue::<_, _, AuraId>,
crate::service::statemint_build_import_queue::<_, AuraId>,
)?;
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
})
} else if runner.config().chain_spec.is_statemine() {
runner.async_run(|$config| {
let $components = new_partial::<statemine_runtime::RuntimeApi, StatemineRuntimeExecutor, _>(
let $components = new_partial::<statemine_runtime::RuntimeApi, _>(
&$config,
crate::service::statemint_build_import_queue::<_, _, AuraId>,
crate::service::statemint_build_import_queue::<_, AuraId>,
)?;
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
})
} else if runner.config().chain_spec.is_statemint() {
runner.async_run(|$config| {
let $components = new_partial::<statemint_runtime::RuntimeApi, StatemintRuntimeExecutor, _>(
let $components = new_partial::<statemint_runtime::RuntimeApi, _>(
&$config,
crate::service::statemint_build_import_queue::<_, _, StatemintAuraId>,
crate::service::statemint_build_import_queue::<_, StatemintAuraId>,
)?;
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
})
} else if runner.config().chain_spec.is_shell() {
runner.async_run(|$config| {
let $components = new_partial::<shell_runtime::RuntimeApi, ShellRuntimeExecutor, _>(
let $components = new_partial::<shell_runtime::RuntimeApi, _>(
&$config,
crate::service::shell_build_import_queue,
)?;
Expand All @@ -310,7 +309,7 @@ macro_rules! construct_async_run {
})
} else if runner.config().chain_spec.is_seedling() {
runner.async_run(|$config| {
let $components = new_partial::<seedling_runtime::RuntimeApi, SeedlingRuntimeExecutor, _>(
let $components = new_partial::<seedling_runtime::RuntimeApi, _>(
&$config,
crate::service::shell_build_import_queue,
)?;
Expand All @@ -319,7 +318,7 @@ macro_rules! construct_async_run {
})
} else if runner.config().chain_spec.is_canvas_kusama() {
runner.async_run(|$config| {
let $components = new_partial::<canvas_kusama_runtime::RuntimeApi, CanvasKusamaRuntimeExecutor, _>(
let $components = new_partial::<canvas_kusama_runtime::RuntimeApi, _>(
&$config,
crate::service::canvas_kusama_build_import_queue,
)?;
Expand All @@ -330,7 +329,6 @@ macro_rules! construct_async_run {
runner.async_run(|$config| {
let $components = new_partial::<
rococo_parachain_runtime::RuntimeApi,
RococoParachainRuntimeExecutor,
_
>(
&$config,
Expand Down Expand Up @@ -533,43 +531,48 @@ pub fn run() -> Result<()> {
if config.chain_spec.is_statemint() {
crate::service::start_statemint_node::<
statemint_runtime::RuntimeApi,
StatemintRuntimeExecutor,
StatemintAuraId,
>(config, polkadot_config, collator_options, id)
.await
.map(|r| r.0)
.map_err(Into::into)
} else if config.chain_spec.is_statemine() {
crate::service::start_statemint_node::<
statemine_runtime::RuntimeApi,
StatemineRuntimeExecutor,
AuraId,
>(config, polkadot_config, collator_options, id)
crate::service::start_statemint_node::<statemine_runtime::RuntimeApi, AuraId>(
config,
polkadot_config,
collator_options,
id,
)
.await
.map(|r| r.0)
.map_err(Into::into)
} else if config.chain_spec.is_westmint() {
crate::service::start_statemint_node::<
westmint_runtime::RuntimeApi,
WestmintRuntimeExecutor,
AuraId,
>(config, polkadot_config, collator_options, id)
crate::service::start_statemint_node::<westmint_runtime::RuntimeApi, AuraId>(
config,
polkadot_config,
collator_options,
id,
)
.await
.map(|r| r.0)
.map_err(Into::into)
} else if config.chain_spec.is_shell() {
crate::service::start_shell_node::<
shell_runtime::RuntimeApi,
ShellRuntimeExecutor,
>(config, polkadot_config, collator_options, id)
crate::service::start_shell_node::<shell_runtime::RuntimeApi>(
config,
polkadot_config,
collator_options,
id,
)
.await
.map(|r| r.0)
.map_err(Into::into)
} else if config.chain_spec.is_seedling() {
crate::service::start_shell_node::<
seedling_runtime::RuntimeApi,
SeedlingRuntimeExecutor,
>(config, polkadot_config, collator_options, id)
crate::service::start_shell_node::<seedling_runtime::RuntimeApi>(
config,
polkadot_config,
collator_options,
id,
)
.await
.map(|r| r.0)
.map_err(Into::into)
Expand Down
Loading

0 comments on commit 92313f6

Please sign in to comment.