Upgrade Polkadot & Substrate (#139)

* Upgrade Polkadot & Substrate

* Update test/parachain/src/command.rs

Co-authored-by: Cecile Tonglet <cecile@parity.io>

Co-authored-by: Cecile Tonglet <cecile@parity.io>
This commit is contained in:
Bastian Köcher
2020-07-09 14:33:00 +02:00
committed by GitHub
parent 27c8654c57
commit fa0a3c1f42
3 changed files with 219 additions and 197 deletions
+182 -161
View File
File diff suppressed because it is too large Load Diff
+30 -33
View File
@@ -34,35 +34,35 @@ use sp_runtime::{
use std::{net::SocketAddr, sync::Arc};
impl SubstrateCli for Cli {
fn impl_name() -> &'static str {
"Cumulus Test Parachain Collator"
fn impl_name() -> String {
"Cumulus Test Parachain Collator".into()
}
fn impl_version() -> &'static str {
env!("SUBSTRATE_CLI_IMPL_VERSION")
fn impl_version() -> String {
env!("SUBSTRATE_CLI_IMPL_VERSION").into()
}
fn description() -> &'static str {
"Cumulus test parachain collator\n\nThe command-line arguments provided first will be \
fn description() -> String {
format!("Cumulus test parachain collator\n\nThe command-line arguments provided first will be \
passed to the parachain node, while the arguments provided after -- will be passed \
to the relaychain node.\n\n\
cumulus-test-parachain-collator [parachain-args] -- [relaychain-args]"
{} [parachain-args] -- [relaychain-args]", Self::executable_name())
}
fn author() -> &'static str {
env!("CARGO_PKG_AUTHORS")
fn author() -> String {
env!("CARGO_PKG_AUTHORS").into()
}
fn support_url() -> &'static str {
"https://github.com/paritytech/cumulus/issues/new"
fn support_url() -> String {
"https://github.com/paritytech/cumulus/issues/new".into()
}
fn copyright_start_year() -> i32 {
2017
}
fn executable_name() -> &'static str {
"cumulus-test-parachain-collator"
fn executable_name() -> String {
"cumulus-test-parachain-collator".into()
}
fn load_spec(&self, _id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
@@ -78,46 +78,41 @@ impl SubstrateCli for Cli {
}
impl SubstrateCli for PolkadotCli {
fn impl_name() -> &'static str {
"Cumulus Test Parachain Collator"
fn impl_name() -> String {
"Cumulus Test Parachain Collator".into()
}
fn impl_version() -> &'static str {
env!("SUBSTRATE_CLI_IMPL_VERSION")
fn impl_version() -> String {
env!("SUBSTRATE_CLI_IMPL_VERSION").into()
}
fn description() -> &'static str {
fn description() -> String {
"Cumulus test parachain collator\n\nThe command-line arguments provided first will be \
passed to the parachain node, while the arguments provided after -- will be passed \
to the relaychain node.\n\n\
cumulus-test-parachain-collator [parachain-args] -- [relaychain-args]"
.into()
}
fn author() -> &'static str {
env!("CARGO_PKG_AUTHORS")
fn author() -> String {
env!("CARGO_PKG_AUTHORS").into()
}
fn support_url() -> &'static str {
"https://github.com/paritytech/cumulus/issues/new"
fn support_url() -> String {
"https://github.com/paritytech/cumulus/issues/new".into()
}
fn copyright_start_year() -> i32 {
2017
}
fn executable_name() -> &'static str {
"cumulus-test-parachain-collator"
fn executable_name() -> String {
"cumulus-test-parachain-collator".into()
}
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
Ok(match id {
"" | "local" | "dev" => Box::new(polkadot_service::PolkadotChainSpec::from_json_bytes(
&include_bytes!("../res/polkadot_chainspec.json")[..],
)?),
path => Box::new(chain_spec::ChainSpec::from_json_file(
std::path::PathBuf::from(path),
)?),
})
polkadot_cli::Cli::from_iter([PolkadotCli::executable_name().to_string()].iter())
.load_spec(id)
}
fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
@@ -161,7 +156,9 @@ pub fn run() -> Result<()> {
Some(Subcommand::Base(subcommand)) => {
let runner = cli.create_runner(subcommand)?;
runner.run_subcommand(subcommand, |config| Ok(new_full_start!(config).0))
runner.run_subcommand(subcommand, |config| {
Ok(new_full_start!(config).0.to_chain_ops_parts())
})
}
Some(Subcommand::ExportGenesisState(params)) => {
sc_cli::init_logger("");
+7 -3
View File
@@ -17,7 +17,7 @@
use ansi_term::Color;
use cumulus_collator::{prepare_collator_config, CollatorBuilder};
use cumulus_network::DelayedBlockAnnounceValidator;
use futures::FutureExt;
use futures::{FutureExt, future::ready};
use polkadot_primitives::parachain::CollatorPair;
use sc_executor::native_executor_instance;
pub use sc_executor::NativeExecutor;
@@ -135,8 +135,12 @@ pub fn run_collator(
prefix: format!("[{}] ", Color::Blue.bold().paint("Relaychain")),
};
let polkadot_future =
polkadot_collator::start_collator(builder, id, key, polkadot_config).map(|_| ());
let (polkadot_future, task_manager) =
polkadot_collator::start_collator(builder, id, key, polkadot_config)?;
// Make sure the polkadot task manager survives as long as the service.
let polkadot_future = polkadot_future.then(move |_| { let _ = task_manager; ready(())});
service.task_manager.spawn_essential_handle().spawn("polkadot", polkadot_future);
Ok(service.task_manager)