From 0813bc7e6646524a53a3ef7c0db2a9a9247c9b5a Mon Sep 17 00:00:00 2001 From: Roznovjak Date: Wed, 18 Dec 2024 09:54:10 +0100 Subject: [PATCH] fix node build --- node/src/chain_spec/mod.rs | 5 ++--- node/src/command.rs | 10 ++++++---- node/src/rpc.rs | 8 ++------ node/src/service.rs | 19 +++++++++---------- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index 6db1dedbab..859cc20ace 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -29,7 +29,7 @@ const TOKEN_DECIMALS: u8 = 12; const TOKEN_SYMBOL: &str = "BSX"; const PROTOCOL_ID: &str = "bsx"; -use basilisk_runtime::{AccountId, AuraId, Balance, RuntimeGenesisConfig, Signature, WASM_BINARY}; +use basilisk_runtime::{AccountId, AuraId, Balance, Signature, WASM_BINARY}; use cumulus_primitives_core::ParaId; use hex_literal::hex; use primitives::{ @@ -45,7 +45,6 @@ use sp_core::{crypto::UncheckedInto, sr25519, Pair, Public}; use sp_runtime::traits::{IdentifyAccount, Verify}; /// The extensions for the [`ChainSpec`]. #[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)] -#[serde(deny_unknown_fields)] pub struct Extensions { /// The relay chain of the Parachain. pub relay_chain: String, @@ -61,7 +60,7 @@ impl Extensions { } /// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. -pub type ChainSpec = sc_service::GenericChainSpec; +pub type ChainSpec = sc_service::GenericChainSpec; /// Generate a crypto pair from seed. pub fn get_from_seed(seed: &str) -> ::Public { diff --git a/node/src/command.rs b/node/src/command.rs index 30a15f788e..13d110c76c 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -278,7 +278,10 @@ pub fn run() -> sc_cli::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(); @@ -296,7 +299,7 @@ pub fn run() -> sc_cli::Result<()> { let id = ParaId::from(para_id); let parachain_account = - AccountIdConversion::::into_account_truncating(&id); + AccountIdConversion::::into_account_truncating(&id); let state_version = Cli::runtime_version().state_version(); @@ -378,10 +381,9 @@ impl CliConfiguration for RelayChainCli { _support_url: &String, _impl_version: &String, _logger_hook: F, - _config: &sc_service::Configuration, ) -> 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 ba274b1901..6735d412a5 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -8,7 +8,6 @@ use std::sync::Arc; use basilisk_runtime::{opaque::Block, AccountId, Balance, Index}; -pub use sc_rpc_api::DenyUnsafe; use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; @@ -20,8 +19,6 @@ pub struct FullDeps { pub client: Arc, /// Transaction pool instance. pub pool: Arc

, - /// Whether to deny unsafe calls - pub deny_unsafe: DenyUnsafe, /// Backend used by the node. pub backend: Arc, } @@ -50,13 +47,12 @@ where let FullDeps { client, pool, - deny_unsafe, backend, } = 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.clone()).into_rpc())?; - module.merge(StateMigration::new(client, backend, deny_unsafe).into_rpc())?; + module.merge(StateMigration::new(client, backend).into_rpc())?; // Extend this RPC with a custom API by using the following syntax. // `YourRpcStruct` should have a reference to a client, which is needed diff --git a/node/src/service.rs b/node/src/service.rs index 38581e4b01..29111fe470 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -48,7 +48,6 @@ use sc_client_api::Backend; use sc_consensus::ImportQueue; use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY}; use sc_network::NetworkBlock; -use sc_network_sync::SyncingService; use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager}; use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; use sc_transaction_pool_api::OffchainTransactionPoolFactory; @@ -97,17 +96,18 @@ pub fn new_partial( .transpose()?; let heap_pages = config + .executor .default_heap_pages .map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static { extra_pages: h as _, }); let executor = WasmExecutor::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) = @@ -171,8 +171,11 @@ async fn start_node_impl( 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, + prometheus_registry.clone(), ); let client = params.client.clone(); @@ -235,11 +238,10 @@ async fn start_node_impl( let transaction_pool = transaction_pool.clone(); let backend = backend.clone(); - Box::new(move |deny_unsafe, _| { + Box::new(move |_| { let deps = crate::rpc::FullDeps { client: client.clone(), pool: transaction_pool.clone(), - deny_unsafe, backend: backend.clone(), }; @@ -326,7 +328,6 @@ async fn start_node_impl( &task_manager, relay_chain_interface.clone(), transaction_pool, - sync_service.clone(), params.keystore_container.keystore(), relay_chain_slot_duration, para_id, @@ -379,7 +380,6 @@ fn start_consensus( task_manager: &TaskManager, relay_chain_interface: Arc, transaction_pool: Arc>, - sync_oracle: Arc>, keystore: KeystorePtr, relay_chain_slot_duration: Duration, para_id: ParaId, @@ -416,7 +416,6 @@ fn start_consensus( para_backend: backend.clone(), 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, @@ -428,7 +427,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(())