Update Polkadot & Substrate (#300)

This commit is contained in:
Cecile Tonglet
2021-01-20 17:35:05 +01:00
committed by GitHub
parent d6a7bc4e30
commit 8c6febdd3b
9 changed files with 249 additions and 289 deletions
Generated
+211 -259
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -37,6 +37,7 @@ sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
+14 -13
View File
@@ -24,7 +24,7 @@ use log::info;
use parachain_runtime::Block;
use polkadot_parachain::primitives::AccountIdConversion;
use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, InitLoggerParams,
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams,
KeystoreParams, NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli,
};
use sc_service::{
@@ -217,10 +217,9 @@ pub fn run() -> Result<()> {
})
}
Some(Subcommand::ExportGenesisState(params)) => {
sc_cli::init_logger(InitLoggerParams {
tracing_receiver: sc_tracing::TracingReceiver::Log,
..Default::default()
})?;
let mut builder = sc_cli::GlobalLoggerBuilder::new("");
builder.with_profiling(sc_tracing::TracingReceiver::Log, "");
let _ = builder.init();
let block: Block = generate_genesis_block(&load_spec(
&params.chain.clone().unwrap_or_default(),
@@ -242,10 +241,9 @@ pub fn run() -> Result<()> {
Ok(())
}
Some(Subcommand::ExportGenesisWasm(params)) => {
sc_cli::init_logger(InitLoggerParams {
tracing_receiver: sc_tracing::TracingReceiver::Log,
..Default::default()
})?;
let mut builder = sc_cli::GlobalLoggerBuilder::new("");
builder.with_profiling(sc_tracing::TracingReceiver::Log, "");
let _ = builder.init();
let raw_wasm_blob =
extract_genesis_wasm(&cli.load_spec(&params.chain.clone().unwrap_or_default())?)?;
@@ -292,9 +290,12 @@ pub fn run() -> Result<()> {
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
let task_executor = config.task_executor.clone();
let polkadot_config =
SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, task_executor)
.map_err(|err| format!("Relay chain argument error: {}", err))?;
let polkadot_config = SubstrateCli::create_configuration(
&polkadot_cli,
&polkadot_cli,
task_executor,
None,
).map_err(|err| format!("Relay chain argument error: {}", err))?;
let collator = cli.run.base.validator || cli.collator;
info!("Parachain id: {:?}", id);
@@ -369,7 +370,7 @@ impl CliConfiguration<Self> for RelayChainCli {
self.base.base.prometheus_config(default_listen_port)
}
fn init<C: SubstrateCli>(&self) -> Result<()> {
fn init<C: SubstrateCli>(&self) -> Result<sc_telemetry::TelemetryWorker> {
unreachable!("PolkadotCli is never initialized; qed");
}
+7 -6
View File
@@ -49,13 +49,13 @@ pub fn new_partial(
(),
sp_consensus::import_queue::BasicQueue<Block, PrefixedMemoryDB<BlakeTwo256>>,
sc_transaction_pool::FullPool<Block, TFullClient<Block, RuntimeApi, Executor>>,
(),
Option<sc_telemetry::TelemetrySpan>,
>,
sc_service::Error,
> {
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
let (client, backend, keystore_container, task_manager) =
let (client, backend, keystore_container, task_manager, telemetry_span) =
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(&config)?;
let client = Arc::new(client);
@@ -85,7 +85,7 @@ pub fn new_partial(
transaction_pool,
inherent_data_providers,
select_chain: (),
other: (),
other: telemetry_span,
};
Ok(params)
@@ -94,7 +94,7 @@ pub fn new_partial(
/// Start a node with the given parachain `Configuration` and relay chain `Configuration`.
///
/// This is the actual implementation that is abstract over the executor and the runtime api.
#[sc_cli::prefix_logs_with("Parachain")]
#[sc_tracing::logging::prefix_logs_with("Parachain")]
async fn start_node_impl<RB>(
parachain_config: Configuration,
collator_key: CollatorPair,
@@ -125,6 +125,7 @@ where
)?;
let params = new_partial(&parachain_config)?;
let telemetry_span = params.other;
params
.inherent_data_providers
.register_provider(sp_timestamp::InherentDataProvider)
@@ -164,18 +165,18 @@ where
client: client.clone(),
transaction_pool: transaction_pool.clone(),
task_manager: &mut task_manager,
telemetry_connection_sinks: Default::default(),
config: parachain_config,
keystore: params.keystore_container.sync_keystore(),
backend: backend.clone(),
network: network.clone(),
network_status_sinks,
system_rpc_tx,
telemetry_span,
})?;
let announce_block = {
let network = network.clone();
Arc::new(move |hash, data| network.announce_block(hash, data))
Arc::new(move |hash, data| network.announce_block(hash, Some(data)))
};
if validator {
+1 -1
View File
@@ -13,7 +13,7 @@ cumulus-primitives = { path = "../primitives" }
# Substrate dependencies
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
+1 -1
View File
@@ -324,7 +324,7 @@ pub fn prepare_node_config(mut parachain_config: Configuration) -> Configuration
}
/// Build the Polkadot full node using the given `config`.
#[sc_cli::prefix_logs_with("Relaychain")]
#[sc_tracing::logging::prefix_logs_with("Relaychain")]
pub fn build_polkadot_full_node(
config: Configuration,
collator_id: CollatorId,
+2 -1
View File
@@ -14,11 +14,12 @@ sc-basic-authorship = { git = "https://github.com/paritytech/substrate", version
sc-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
+9 -7
View File
@@ -73,13 +73,13 @@ pub fn new_partial(
(),
sp_consensus::import_queue::BasicQueue<Block, PrefixedMemoryDB<BlakeTwo256>>,
sc_transaction_pool::FullPool<Block, TFullClient<Block, RuntimeApi, RuntimeExecutor>>,
(),
Option<sc_telemetry::TelemetrySpan>,
>,
sc_service::Error,
> {
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
let (client, backend, keystore_container, task_manager) =
let (client, backend, keystore_container, task_manager, telemetry_span) =
sc_service::new_full_parts::<Block, RuntimeApi, RuntimeExecutor>(&config)?;
let client = Arc::new(client);
@@ -109,7 +109,7 @@ pub fn new_partial(
transaction_pool,
inherent_data_providers,
select_chain: (),
other: (),
other: telemetry_span,
};
Ok(params)
@@ -118,7 +118,7 @@ pub fn new_partial(
/// Start a node with the given parachain `Configuration` and relay chain `Configuration`.
///
/// This is the actual implementation that is abstract over the executor and the runtime api.
#[sc_cli::prefix_logs_with(parachain_config.network.node_name.as_str())]
#[sc_tracing::logging::prefix_logs_with(parachain_config.network.node_name.as_str())]
async fn start_node_impl<RB>(
parachain_config: Configuration,
collator_key: CollatorPair,
@@ -146,6 +146,7 @@ where
let mut parachain_config = prepare_node_config(parachain_config);
let params = new_partial(&mut parachain_config)?;
let telemetry_span = params.other;
params
.inherent_data_providers
.register_provider(sp_timestamp::InherentDataProvider)
@@ -193,25 +194,25 @@ where
Box::new(move |_, _| rpc_ext_builder(client.clone()))
};
let rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
let (rpc_handlers, _) = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
on_demand: None,
remote_blockchain: None,
rpc_extensions_builder,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
task_manager: &mut task_manager,
telemetry_connection_sinks: Default::default(),
config: parachain_config,
keystore: params.keystore_container.sync_keystore(),
backend,
network: network.clone(),
network_status_sinks,
system_rpc_tx,
telemetry_span,
})?;
let announce_block = {
let network = network.clone();
Arc::new(move |hash, data| network.announce_block(hash, data))
Arc::new(move |hash, data| network.announce_block(hash, Some(data)))
};
let polkadot_full_node = polkadot_full_node.with_client(polkadot_test_service::TestClient);
@@ -415,6 +416,7 @@ pub fn node_config(
rpc_cors: None,
rpc_methods: Default::default(),
prometheus_config: None,
telemetry_handle: None,
telemetry_endpoints: None,
telemetry_external_transport: None,
default_heap_pages: None,
+3 -1
View File
@@ -22,7 +22,9 @@ use substrate_test_runtime_client::AccountKeyring::*;
#[substrate_test_utils::test]
async fn test_collating_and_non_collator_mode_catching_up(task_executor: TaskExecutor) {
sc_cli::init_logger(Default::default()).expect("Sets up logger");
let mut builder = sc_cli::GlobalLoggerBuilder::new("");
builder.with_colors(false);
let _ = builder.init();
let para_id = ParaId::from(100);