,
pub pool: Arc,
- pub deny_unsafe: DenyUnsafe,
}
pub fn create_full(deps: FullDeps) -> Result>
@@ -57,13 +55,9 @@ where
use substrate_frame_rpc_system::{System, SystemApiServer};
let mut module = RpcExtension::new(());
- let FullDeps {
- client,
- pool,
- deny_unsafe,
- } = deps;
+ let FullDeps { client, pool } = deps;
- module.merge(System::new(Arc::clone(&client), pool, deny_unsafe).into_rpc())?;
+ module.merge(System::new(Arc::clone(&client), pool).into_rpc())?;
module.merge(TransactionPayment::new(client).into_rpc())?;
Ok(module)
}
diff --git a/dip-template/nodes/dip-consumer/src/service.rs b/dip-template/nodes/dip-consumer/src/service.rs
index fe834b0221..8e58152070 100644
--- a/dip-template/nodes/dip-consumer/src/service.rs
+++ b/dip-template/nodes/dip-consumer/src/service.rs
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-// If you feel like getting in touch with us, you can do so at
+// If you feel like getting in touch with us, you can do so at
use std::{sync::Arc, time::Duration};
@@ -37,6 +37,7 @@ use frame_benchmarking::benchmarking::HostFunctions;
use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE;
use sc_client_api::Backend;
use sc_consensus::{DefaultImportQueue, ImportQueue};
+#[allow(deprecated)]
use sc_executor::NativeElseWasmExecutor;
use sc_network::NetworkBlock;
use sc_network_sync::SyncingService;
@@ -67,6 +68,7 @@ impl sc_executor::NativeExecutionDispatch for ParachainNativeExecutor {
}
}
+#[allow(deprecated)]
type ParachainExecutor = NativeElseWasmExecutor;
type ParachainClient = TFullClient;
type ParachainBackend = TFullBackend;
@@ -97,6 +99,7 @@ pub fn new_partial(
})
.transpose()?;
+ #[allow(deprecated)]
let executor = sc_service::new_native_or_wasm_executor(config);
let (client, backend, keystore_container, task_manager) = new_full_parts::(
@@ -175,7 +178,10 @@ async fn start_node_impl(
let prometheus_registry = parachain_config.prometheus_registry().cloned();
let transaction_pool = Arc::clone(¶ms.transaction_pool);
let import_queue_service = params.import_queue.service();
- let net_config = sc_network::config::FullNetworkConfiguration::new(¶chain_config.network);
+ let net_config = sc_network::config::FullNetworkConfiguration::<_, _, sc_network::NetworkWorker>::new(
+ ¶chain_config.network,
+ prometheus_registry.clone(),
+ );
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
build_network(BuildNetworkParams {
@@ -194,22 +200,23 @@ async fn start_node_impl(
if parachain_config.offchain_worker.enabled {
use futures::FutureExt;
+ let offchain_workers = sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions {
+ runtime_api_provider: Arc::clone(&client),
+ keystore: Some(params.keystore_container.keystore()),
+ offchain_db: backend.offchain_storage(),
+ transaction_pool: Some(OffchainTransactionPoolFactory::new(Arc::clone(&transaction_pool))),
+ network_provider: Arc::new(Arc::clone(&network)),
+ is_validator: parachain_config.role.is_authority(),
+ enable_http_requests: false,
+ custom_extensions: move |_| vec![],
+ });
+
task_manager.spawn_handle().spawn(
"offchain-workers-runner",
"offchain-work",
- sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions {
- runtime_api_provider: Arc::clone(&client),
- keystore: Some(params.keystore_container.keystore()),
- offchain_db: backend.offchain_storage(),
- transaction_pool: Some(OffchainTransactionPoolFactory::new(Arc::clone(&transaction_pool))),
- #[allow(clippy::clone_on_ref_ptr)]
- network_provider: network.clone(),
- is_validator: parachain_config.role.is_authority(),
- enable_http_requests: false,
- custom_extensions: move |_| vec![],
- })
- .run(Arc::clone(&client), task_manager.spawn_handle())
- .boxed(),
+ offchain_workers
+ .run(Arc::clone(&client), task_manager.spawn_handle())
+ .boxed(),
);
}
@@ -217,11 +224,10 @@ async fn start_node_impl(
let client = Arc::clone(&client);
let transaction_pool = Arc::clone(&transaction_pool);
- Box::new(move |deny_unsafe, _| {
+ Box::new(move |_| {
let deps = FullDeps {
client: Arc::clone(&client),
pool: Arc::clone(&transaction_pool),
- deny_unsafe,
};
create_full(deps).map_err(Into::into)
@@ -245,7 +251,7 @@ async fn start_node_impl(
if let Some(hwbench) = hwbench {
print_hwbench(&hwbench);
- match SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) {
+ match SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench, false) {
Err(err) if validator => {
log::warn!(
"⚠️ The hardware does not meet the minimal requirements {} for role 'Authority'.",
@@ -357,7 +363,7 @@ fn start_consensus(
task_manager: &TaskManager,
relay_chain_interface: Arc,
transaction_pool: Arc>,
- sync_oracle: Arc>,
+ _sync_oracle: Arc>,
keystore: KeystorePtr,
relay_chain_slot_duration: Duration,
para_id: ParaId,
@@ -367,8 +373,6 @@ fn start_consensus(
) -> Result<(), sc_service::Error> {
use cumulus_client_consensus_aura::collators::lookahead::{self as aura, Params as AuraParams};
- let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
-
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
task_manager.spawn_handle(),
Arc::clone(&client),
@@ -393,12 +397,10 @@ fn start_consensus(
para_backend: backend,
relay_client: relay_chain_interface,
code_hash_provider: move |block_hash| client.code_at(block_hash).ok().map(|c| ValidationCode::from(c).hash()),
- sync_oracle,
keystore,
collator_key,
para_id,
overseer_handle,
- slot_duration,
relay_chain_slot_duration,
proposer,
collator_service,
@@ -406,7 +408,7 @@ fn start_consensus(
reinitialize: false,
};
- let fut = aura::run::(params);
+ let fut = aura::run::(params);
task_manager.spawn_essential_handle().spawn("aura", None, fut);
Ok(())
diff --git a/dip-template/nodes/dip-provider/build.rs b/dip-template/nodes/dip-provider/build.rs
index f672256b2e..3bf56b537e 100644
--- a/dip-template/nodes/dip-provider/build.rs
+++ b/dip-template/nodes/dip-provider/build.rs
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-// If you feel like getting in touch with us, you can do so at
+// If you feel like getting in touch with us, you can do so at
use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
diff --git a/dip-template/nodes/dip-provider/src/chain_spec.rs b/dip-template/nodes/dip-provider/src/chain_spec.rs
index 0488275198..685f146cba 100644
--- a/dip-template/nodes/dip-provider/src/chain_spec.rs
+++ b/dip-template/nodes/dip-provider/src/chain_spec.rs
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-// If you feel like getting in touch with us, you can do so at
+// If you feel like getting in touch with us, you can do so at
// Triggered by the `ChainSpecGroup` derive macro used for the custom chainspec
// extension.
@@ -34,7 +34,7 @@ use sp_runtime::traits::{IdentifyAccount, Verify};
const PARA_ID: u32 = 2_000;
-pub type ChainSpec = GenericChainSpec;
+pub type ChainSpec = GenericChainSpec;
type AccountPublic = ::Signer;
pub(crate) fn get_from_seed(seed: &str) -> ::Public {
@@ -97,6 +97,7 @@ fn testnet_genesis(
.into_iter()
.map(|(acc, aura)| (acc.clone(), acc, template_session_keys(aura)))
.collect(),
+ ..Default::default()
},
..Default::default()
}
diff --git a/dip-template/nodes/dip-provider/src/cli.rs b/dip-template/nodes/dip-provider/src/cli.rs
index 7f8ec35ee1..3459b4bd0c 100644
--- a/dip-template/nodes/dip-provider/src/cli.rs
+++ b/dip-template/nodes/dip-provider/src/cli.rs
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-// If you feel like getting in touch with us, you can do so at
+// If you feel like getting in touch with us, you can do so at
use std::path::PathBuf;
@@ -79,7 +79,10 @@ pub struct RelayChainCli {
}
impl RelayChainCli {
- pub fn new<'a>(para_config: &Configuration, relay_chain_args: impl Iterator- ) -> Self {
+ pub fn new<'a, I>(para_config: &Configuration, relay_chain_args: I) -> Self
+ where
+ I: Iterator
- ,
+ {
let extension = Extensions::try_get(&*para_config.chain_spec);
let chain_id = extension.map(|e| e.relay_chain.clone());
let base_path = Some(para_config.base_path.path().join("polkadot"));
diff --git a/dip-template/nodes/dip-provider/src/command.rs b/dip-template/nodes/dip-provider/src/command.rs
index 4b2990f0bd..9ba442716d 100644
--- a/dip-template/nodes/dip-provider/src/command.rs
+++ b/dip-template/nodes/dip-provider/src/command.rs
@@ -14,21 +14,21 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-// If you feel like getting in touch with us, you can do so at
+// If you feel like getting in touch with us, you can do so at
-use std::{fs::create_dir_all, iter::once, net::SocketAddr};
+use std::{fs::create_dir_all, iter::once};
use cumulus_primitives_core::ParaId;
use dip_provider_runtime_template::Block;
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
use log::info;
use sc_cli::{
- ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, LoggerBuilder,
- NetworkParams, Result, SharedParams, SubstrateCli,
+ ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams, Result,
+ SharedParams, SubstrateCli,
};
use sc_service::{
config::{BasePath, PrometheusConfig},
- Configuration, Role, RpcMethods, TransactionPoolOptions,
+ Role, RpcMethods, TransactionPoolOptions,
};
use sc_sysinfo::gather_hwbench;
use sc_telemetry::TelemetryEndpoints;
@@ -196,7 +196,9 @@ pub fn run() -> Result<()> {
match cmd {
BenchmarkCmd::Pallet(cmd) => {
if cfg!(feature = "runtime-benchmarks") {
- runner.sync_run(|config| cmd.run::(config))
+ runner.sync_run(|config| {
+ cmd.run_with_spec::, ()>(Some(config.chain_spec))
+ })
} else {
Err("Benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
@@ -235,7 +237,7 @@ pub fn run() -> Result<()> {
let hwbench = (!cli.no_hardware_benchmarks)
.then_some(config.database.path().map(|database_path| {
let _ = create_dir_all(database_path);
- gather_hwbench(Some(database_path))
+ gather_hwbench(Some(database_path), &SUBSTRATE_REFERENCE_HARDWARE)
}))
.flatten();
@@ -310,7 +312,7 @@ impl CliConfiguration for RelayChainCli {
.or_else(|| self.base_path.clone().map(Into::into)))
}
- fn rpc_addr(&self, default_listen_port: u16) -> Result