Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Stop using the native executor #881

Merged
merged 2 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hydradx"
version = "13.1.1"
version = "13.1.2"
description = "Hydration node"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down
6 changes: 3 additions & 3 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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::{
Expand Down Expand Up @@ -197,7 +197,7 @@ pub fn run() -> sc_cli::Result<()> {
runner.sync_run(|config| {
cmd.run::<Block, ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
<HydraDXNativeExecutor as NativeExecutionDispatch>::ExtendHostFunctions,
frame_benchmarking::benchmarking::HostFunctions,
>>(config)
})
} else {
Expand Down
32 changes: 10 additions & 22 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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<Vec<u8>> {
hydradx_runtime::api::dispatch(method, data)
}

fn native_version() -> sc_executor::NativeVersion {
hydradx_runtime::native_version()
}
}

type ParachainExecutor = NativeElseWasmExecutor<HydraDXNativeExecutor>;

type ParachainClient = TFullClient<Block, RuntimeApi, ParachainExecutor>;
type ParachainClient = TFullClient<
Block,
RuntimeApi,
WasmExecutor<(
sp_io::SubstrateHostFunctions,
frame_benchmarking::benchmarking::HostFunctions,
)>,
>;

type ParachainBackend = TFullBackend<Block>;

Expand Down Expand Up @@ -117,16 +107,14 @@ 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)
.with_max_runtime_instances(config.max_runtime_instances)
.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::<Block, RuntimeApi, _>(
config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
Expand Down
Loading