mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
Make choosing an executor (native/wasm) an explicit part of service construction (#9525)
* Split native executor stuff from wasm executor stuff * Remove `native_runtime_version` in places * Fix warning * Fix test warning * Remove redundant NativeRuntimeInfo trait * Add a warning for use_native * Run cargo fmt * Revert "Add a warning for use_native" This reverts commit 9494f765a06037e991dd60524f2ed1b14649bfd6. * Make choosing an executor (native/wasm) an explicit part of service construction * Add Cargo.lock * Rename Executor to ExecutorDispatch * Update bin/node/executor/src/lib.rs Co-authored-by: Squirrel <gilescope@gmail.com> * Fix tests * Fix minor node-executor error * Fix node cli command thing Co-authored-by: Squirrel <gilescope@gmail.com>
This commit is contained in:
@@ -21,23 +21,26 @@
|
||||
//! Service implementation. Specialized wrapper over substrate service.
|
||||
|
||||
use futures::prelude::*;
|
||||
use node_executor::Executor;
|
||||
use node_executor::ExecutorDispatch;
|
||||
use node_primitives::Block;
|
||||
use node_runtime::RuntimeApi;
|
||||
use sc_client_api::{ExecutorProvider, RemoteBackend};
|
||||
use sc_consensus_babe::{self, SlotProportion};
|
||||
use sc_executor::NativeElseWasmExecutor;
|
||||
use sc_network::{Event, NetworkService};
|
||||
use sc_service::{config::Configuration, error::Error as ServiceError, RpcHandlers, TaskManager};
|
||||
use sc_telemetry::{Telemetry, TelemetryWorker};
|
||||
use sp_runtime::traits::Block as BlockT;
|
||||
use std::sync::Arc;
|
||||
|
||||
type FullClient = sc_service::TFullClient<Block, RuntimeApi, Executor>;
|
||||
type FullClient =
|
||||
sc_service::TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<ExecutorDispatch>>;
|
||||
type FullBackend = sc_service::TFullBackend<Block>;
|
||||
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;
|
||||
type FullGrandpaBlockImport =
|
||||
grandpa::GrandpaBlockImport<FullBackend, Block, FullClient, FullSelectChain>;
|
||||
type LightClient = sc_service::TLightClient<Block, RuntimeApi, Executor>;
|
||||
type LightClient =
|
||||
sc_service::TLightClient<Block, RuntimeApi, NativeElseWasmExecutor<ExecutorDispatch>>;
|
||||
|
||||
pub fn new_partial(
|
||||
config: &Configuration,
|
||||
@@ -75,10 +78,17 @@ pub fn new_partial(
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
let executor = NativeElseWasmExecutor::<ExecutorDispatch>::new(
|
||||
config.wasm_method,
|
||||
config.default_heap_pages,
|
||||
config.max_runtime_instances,
|
||||
);
|
||||
|
||||
let (client, backend, keystore_container, task_manager) =
|
||||
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(
|
||||
sc_service::new_full_parts::<Block, RuntimeApi, _>(
|
||||
&config,
|
||||
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
|
||||
executor,
|
||||
)?;
|
||||
let client = Arc::new(client);
|
||||
|
||||
@@ -447,10 +457,17 @@ pub fn new_light_base(
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
let executor = NativeElseWasmExecutor::<ExecutorDispatch>::new(
|
||||
config.wasm_method,
|
||||
config.default_heap_pages,
|
||||
config.max_runtime_instances,
|
||||
);
|
||||
|
||||
let (client, backend, keystore_container, mut task_manager, on_demand) =
|
||||
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(
|
||||
sc_service::new_light_parts::<Block, RuntimeApi, _>(
|
||||
&config,
|
||||
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
|
||||
executor,
|
||||
)?;
|
||||
|
||||
let mut telemetry = telemetry.map(|(worker, telemetry)| {
|
||||
|
||||
Reference in New Issue
Block a user