From eb7a72d34cb6cb3c9566a52351fc3f55a8f0d6b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 26 Jul 2024 14:55:39 +0200 Subject: [PATCH 1/2] Stop using the native executor The native executor is deprecated and also doesn't work together with the new metadata hash (mentioned in the guide https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/guides/enable_metadata_hash/index.html). --- node/src/command.rs | 6 +++--- node/src/service.rs | 32 ++++++++++---------------------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/node/src/command.rs b/node/src/command.rs index 6fe0b6431..c92ff3beb 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -17,7 +17,7 @@ use crate::chain_spec; use crate::cli::{Cli, RelayChainCli, Subcommand}; -use crate::service::{new_partial, HydraDXNativeExecutor}; +use crate::service::new_partial; use codec::Encode; use cumulus_primitives_core::ParaId; @@ -28,7 +28,7 @@ use sc_cli::{ ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli, }; -use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch}; +use sc_executor::sp_wasm_interface::ExtendedHostFunctions; use sc_service::config::{BasePath, PrometheusConfig}; use sp_core::hexdisplay::HexDisplay; use sp_runtime::{ @@ -197,7 +197,7 @@ pub fn run() -> sc_cli::Result<()> { runner.sync_run(|config| { cmd.run::::ExtendHostFunctions, + frame_benchmarking::benchmarking::HostFunctions, >>(config) }) } else { diff --git a/node/src/service.rs b/node/src/service.rs index e45de298b..aaf30824e 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -40,7 +40,7 @@ use fc_db::kv::Backend as FrontierBackend; use fc_rpc_core::types::{FeeHistoryCache, FilterPool}; use sc_client_api::Backend; use sc_consensus::ImportQueue; -use sc_executor::{HeapAllocStrategy, NativeElseWasmExecutor, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY}; +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}; @@ -53,24 +53,14 @@ use substrate_prometheus_endpoint::Registry; pub(crate) mod evm; use crate::{chain_spec, rpc}; -/// Native executor type. -pub struct HydraDXNativeExecutor; - -impl sc_executor::NativeExecutionDispatch for HydraDXNativeExecutor { - type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; - - fn dispatch(method: &str, data: &[u8]) -> Option> { - hydradx_runtime::api::dispatch(method, data) - } - - fn native_version() -> sc_executor::NativeVersion { - hydradx_runtime::native_version() - } -} - -type ParachainExecutor = NativeElseWasmExecutor; - -type ParachainClient = TFullClient; +type ParachainClient = TFullClient< + Block, + RuntimeApi, + WasmExecutor<( + sp_io::SubstrateHostFunctions, + frame_benchmarking::benchmarking::HostFunctions, + )>, +>; type ParachainBackend = TFullBackend; @@ -117,7 +107,7 @@ pub fn new_partial( extra_pages: h as _, }); - let wasm = WasmExecutor::builder() + let executor = WasmExecutor::builder() .with_execution_method(config.wasm_method) .with_onchain_heap_alloc_strategy(heap_pages) .with_offchain_heap_alloc_strategy(heap_pages) @@ -125,8 +115,6 @@ pub fn new_partial( .with_runtime_cache_size(config.runtime_cache_size) .build(); - let executor = ParachainExecutor::new_with_wasm_executor(wasm); - let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::( config, telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), From ac1909df233dcb71ec21c7aadaac10cca73f4e08 Mon Sep 17 00:00:00 2001 From: Roznovjak Date: Fri, 26 Jul 2024 18:16:16 +0200 Subject: [PATCH 2/2] bump node version --- Cargo.lock | 2 +- node/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a667f8fe8..27aa36163 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4795,7 +4795,7 @@ dependencies = [ [[package]] name = "hydradx" -version = "13.1.1" +version = "13.1.2" dependencies = [ "async-trait", "clap 4.5.4", diff --git a/node/Cargo.toml b/node/Cargo.toml index c4c7720dd..42a5c68e3 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx" -version = "13.1.1" +version = "13.1.2" description = "Hydration node" authors = ["GalacticCouncil"] edition = "2021"