polkadot-collator: Switch to wasm only (#1054)

* 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>
This commit is contained in:
Bastian Köcher
2022-03-02 12:44:53 +01:00
committed by GitHub
parent e42a7c3fff
commit 92313f6502
2 changed files with 137 additions and 180 deletions
+34 -31
View File
@@ -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,
},
};
@@ -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,
)?;
@@ -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,
)?;
@@ -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,
)?;
@@ -330,7 +329,6 @@ macro_rules! construct_async_run {
runner.async_run(|$config| {
let $components = new_partial::<
rococo_parachain_runtime::RuntimeApi,
RococoParachainRuntimeExecutor,
_
>(
&$config,
@@ -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)