diff --git a/node/src/cli.rs b/node/src/cli.rs index 3fd366c..1bf64fa 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -20,10 +20,6 @@ use std::path::PathBuf; #[allow(clippy::large_enum_variant)] #[derive(Debug, clap::Subcommand)] pub enum Subcommand { - /// Key management CLI utilities - #[command(subcommand)] - Key(sc_cli::KeySubcommand), - /// Build a chain specification. BuildSpec(sc_cli::BuildSpecCmd), diff --git a/node/src/command.rs b/node/src/command.rs index cddb608..1cf9a2b 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -27,11 +27,10 @@ use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; use log::info; use sc_cli::{ ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, - NetworkParams, Result, SharedParams, SubstrateCli, + NetworkParams, Result, RpcEndpoint, SharedParams, SubstrateCli, }; use sc_service::config::{BasePath, PrometheusConfig}; use sp_runtime::traits::AccountIdConversion; -use std::net::SocketAddr; const POLKADOT_PARA_ID: u32 = 2051; const PASEO_PARA_ID: u32 = 2051; @@ -75,8 +74,8 @@ impl SubstrateCli for Cli { format!( "Ajuna parachain\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]", + to the relay chain node.\n\n\ + {} -- ", Self::executable_name() ) } @@ -100,7 +99,7 @@ impl SubstrateCli for Cli { impl SubstrateCli for RelayChainCli { fn impl_name() -> String { - "Polkadot parachain".into() + "Ajuna parachain".into() } fn impl_version() -> String { @@ -112,7 +111,7 @@ impl SubstrateCli for RelayChainCli { "Ajuna Parachain\n\nThe command-line arguments provided first will be \ passed to the parachain node, while the arguments provided after -- will be passed \ to the relay chain node.\n\n\ - {} [parachain-args] -- [relay_chain-args]", + {} -- ", Self::executable_name() ) } @@ -250,7 +249,6 @@ pub fn run() -> Result<()> { _ => Err("Benchmarking sub-command unsupported".into()), } }, - Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?), None => { let runner = cli.create_runner(&cli.run.normalize())?; let collator_options = cli.run.collator_options(); @@ -259,7 +257,10 @@ pub fn run() -> Result<()> { let hwbench = (!cli.no_hardware_benchmarks) .then_some(config.database.path().map(|database_path| { let _ = std::fs::create_dir_all(database_path); - sc_sysinfo::gather_hwbench(Some(database_path)) + sc_sysinfo::gather_hwbench( + Some(database_path), + &SUBSTRATE_REFERENCE_HARDWARE, + ) })) .flatten(); @@ -341,7 +342,7 @@ impl CliConfiguration for RelayChainCli { .or_else(|| self.base_path.clone().map(Into::into))) } - fn rpc_addr(&self, default_listen_port: u16) -> Result> { + fn rpc_addr(&self, default_listen_port: u16) -> Result>> { self.base.base.rpc_addr(default_listen_port) } @@ -353,15 +354,9 @@ impl CliConfiguration for RelayChainCli { self.base.base.prometheus_config(default_listen_port, chain_spec) } - fn init( - &self, - _support_url: &String, - _impl_version: &String, - _logger_hook: F, - _config: &sc_service::Configuration, - ) -> Result<()> + fn init(&self, _support_url: &String, _impl_version: &String, _logger_hook: F) -> Result<()> where - F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration), + F: FnOnce(&mut sc_cli::LoggerBuilder), { unreachable!("PolkadotCli is never initialized; qed"); } diff --git a/node/src/rpc.rs b/node/src/rpc.rs index 25f70eb..8d9f4ad 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -21,7 +21,6 @@ use std::sync::Arc; use parachains_common::{AccountId, Balance, Block, Nonce}; -pub use sc_rpc::DenyUnsafe; use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; @@ -36,8 +35,6 @@ pub struct FullDeps { pub client: Arc, /// Transaction pool instance. pub pool: Arc

, - /// Whether to deny unsafe calls - pub deny_unsafe: DenyUnsafe, } /// Instantiate all RPC extensions. @@ -60,9 +57,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(client.clone(), pool, deny_unsafe).into_rpc())?; + module.merge(System::new(client.clone(), pool).into_rpc())?; module.merge(TransactionPayment::new(client).into_rpc())?; Ok(module) } diff --git a/node/src/service.rs b/node/src/service.rs index e5528b5..ad6a76f 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -28,6 +28,7 @@ use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface}; // Substrate Imports use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE; +use substrate_prometheus_endpoint::Registry; use sc_client_api::Backend; use sc_consensus::ImportQueue; use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY}; @@ -36,7 +37,6 @@ use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, Ta use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; use sc_transaction_pool_api::OffchainTransactionPoolFactory; use sp_keystore::KeystorePtr; -use substrate_prometheus_endpoint::Registry; type ParachainExecutor = WasmExecutor; @@ -73,15 +73,16 @@ pub fn new_partial(config: &Configuration) -> Result .transpose()?; let heap_pages = config + .executor .default_heap_pages .map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static { extra_pages: h as _ }); let executor = ParachainExecutor::builder() - .with_execution_method(config.wasm_method) + .with_execution_method(config.executor.wasm_method) .with_onchain_heap_alloc_strategy(heap_pages) .with_offchain_heap_alloc_strategy(heap_pages) - .with_max_runtime_instances(config.max_runtime_instances) - .with_runtime_cache_size(config.runtime_cache_size) + .with_max_runtime_instances(config.executor.max_runtime_instances) + .with_runtime_cache_size(config.executor.runtime_cache_size) .build(); let (client, backend, keystore_container, task_manager) = @@ -231,11 +232,13 @@ pub async fn start_parachain_node( let params = new_partial(¶chain_config)?; let (block_import, mut telemetry, telemetry_worker_handle) = params.other; + + let prometheus_registry = parachain_config.prometheus_registry().cloned(); let net_config = sc_network::config::FullNetworkConfiguration::< _, _, sc_network::NetworkWorker, - >::new(¶chain_config.network); + >::new(¶chain_config.network, prometheus_registry.clone()); let client = params.client.clone(); let backend = params.backend.clone(); @@ -253,7 +256,6 @@ pub async fn start_parachain_node( .map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?; let validator = parachain_config.role.is_authority(); - let prometheus_registry = parachain_config.prometheus_registry().cloned(); let transaction_pool = params.transaction_pool.clone(); let import_queue_service = params.import_queue.service(); @@ -300,12 +302,9 @@ pub async fn start_parachain_node( let client = client.clone(); let transaction_pool = transaction_pool.clone(); - Box::new(move |deny_unsafe, _| { - let deps = crate::rpc::FullDeps { - client: client.clone(), - pool: transaction_pool.clone(), - deny_unsafe, - }; + Box::new(move |_| { + let deps = + crate::rpc::FullDeps { client: client.clone(), pool: transaction_pool.clone() }; crate::rpc::create_full(deps).map_err(Into::into) }) @@ -331,7 +330,7 @@ pub async fn start_parachain_node( // Here you can check whether the hardware meets your chains' requirements. Putting a link // in there and swapping out the requirements for your own are probably a good idea. The // requirements for a para-chain are dictated by its relay-chain. - 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'.",