Update Substrate & Polkadot (#141)

This commit is contained in:
Bastian Köcher
2020-07-09 15:28:45 +02:00
committed by GitHub
parent fa0a3c1f42
commit e40bef8641
10 changed files with 520 additions and 418 deletions
@@ -192,6 +192,7 @@ impl frame_system::Trait for Runtime {
type BlockExecutionWeight = ();
type MaximumExtrinsicWeight = MaximumExtrinsicWeight;
type BaseCallFilter = ();
type SystemWeightInfo = ();
}
parameter_types! {
@@ -203,6 +204,7 @@ impl pallet_timestamp::Trait for Runtime {
type Moment = u64;
type OnTimestampSet = ();
type MinimumPeriod = MinimumPeriod;
type WeightInfo = ();
}
parameter_types! {
@@ -220,6 +222,7 @@ impl pallet_balances::Trait for Runtime {
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
}
impl pallet_transaction_payment::Trait for Runtime {
+7 -12
View File
@@ -43,10 +43,13 @@ impl SubstrateCli for Cli {
}
fn description() -> String {
format!("Cumulus test parachain collator\n\nThe command-line arguments provided first will be \
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\
{} [parachain-args] -- [relaychain-args]", Self::executable_name())
{} [parachain-args] -- [relaychain-args]",
Self::executable_name()
)
}
fn author() -> String {
@@ -61,10 +64,6 @@ impl SubstrateCli for Cli {
2017
}
fn executable_name() -> String {
"cumulus-test-parachain-collator".into()
}
fn load_spec(&self, _id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
// Such a hack :(
Ok(Box::new(chain_spec::get_chain_spec(
@@ -106,10 +105,6 @@ impl SubstrateCli for PolkadotCli {
2017
}
fn executable_name() -> String {
"cumulus-test-parachain-collator".into()
}
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
polkadot_cli::Cli::from_iter([PolkadotCli::executable_name().to_string()].iter())
.load_spec(id)
@@ -161,7 +156,7 @@ pub fn run() -> Result<()> {
})
}
Some(Subcommand::ExportGenesisState(params)) => {
sc_cli::init_logger("");
sc_cli::init_logger("", &<sc_cli::LogRotationOpt as structopt::StructOpt>::from_args())?;
let block = generate_genesis_state(params.parachain_id.into())?;
let header_hex = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
@@ -200,7 +195,7 @@ pub fn run() -> Result<()> {
})
}
Some(Subcommand::PolkadotValidationWorker(cmd)) => {
sc_cli::init_logger("");
sc_cli::init_logger("", &<sc_cli::LogRotationOpt as structopt::StructOpt>::from_args())?;
polkadot_service::run_validation_worker(&cmd.mem_id)?;
Ok(())
+14 -5
View File
@@ -17,7 +17,7 @@
use ansi_term::Color;
use cumulus_collator::{prepare_collator_config, CollatorBuilder};
use cumulus_network::DelayedBlockAnnounceValidator;
use futures::{FutureExt, future::ready};
use futures::{future::ready, FutureExt};
use polkadot_primitives::parachain::CollatorPair;
use sc_executor::native_executor_instance;
pub use sc_executor::NativeExecutor;
@@ -51,7 +51,10 @@ macro_rules! new_full_start {
.with_select_chain(|_config, backend| Ok(sc_consensus::LongestChain::new(backend.clone())))?
.with_transaction_pool(|builder| {
let client = builder.client();
let pool_api = Arc::new(sc_transaction_pool::FullChainApi::new(client.clone()));
let pool_api = Arc::new(sc_transaction_pool::FullChainApi::new(
client.clone(),
builder.prometheus_registry(),
));
let pool = sc_transaction_pool::BasicPool::new(
builder.config().transaction_pool.clone(),
pool_api,
@@ -72,7 +75,7 @@ macro_rules! new_full_start {
})?;
(builder, inherent_data_providers)
}};
}};
}
/// Run a collator node with the given parachain `Configuration` and relaychain `Configuration`
@@ -139,9 +142,15 @@ pub fn run_collator(
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(())});
let polkadot_future = polkadot_future.then(move |_| {
let _ = task_manager;
ready(())
});
service.task_manager.spawn_essential_handle().spawn("polkadot", polkadot_future);
service
.task_manager
.spawn_essential_handle()
.spawn("polkadot", polkadot_future);
Ok(service.task_manager)
}