mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 04:07: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:
@@ -51,8 +51,8 @@ pub mod prelude {
|
||||
};
|
||||
// Client structs
|
||||
pub use super::{
|
||||
Backend, Executor, LightBackend, LightExecutor, LocalExecutor, NativeExecutor, TestClient,
|
||||
TestClientBuilder, WasmExecutionMethod,
|
||||
Backend, ExecutorDispatch, LightBackend, LightExecutor, LocalExecutorDispatch,
|
||||
NativeElseWasmExecutor, TestClient, TestClientBuilder, WasmExecutionMethod,
|
||||
};
|
||||
// Keyring
|
||||
pub use super::{AccountKeyring, Sr25519Keyring};
|
||||
@@ -60,9 +60,9 @@ pub mod prelude {
|
||||
|
||||
/// A unit struct which implements `NativeExecutionDispatch` feeding in the
|
||||
/// hard-coded runtime.
|
||||
pub struct LocalExecutor;
|
||||
pub struct LocalExecutorDispatch;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for LocalExecutor {
|
||||
impl sc_executor::NativeExecutionDispatch for LocalExecutorDispatch {
|
||||
type ExtendHostFunctions = ();
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
@@ -78,10 +78,10 @@ impl sc_executor::NativeExecutionDispatch for LocalExecutor {
|
||||
pub type Backend = substrate_test_client::Backend<substrate_test_runtime::Block>;
|
||||
|
||||
/// Test client executor.
|
||||
pub type Executor = client::LocalCallExecutor<
|
||||
pub type ExecutorDispatch = client::LocalCallExecutor<
|
||||
substrate_test_runtime::Block,
|
||||
Backend,
|
||||
NativeExecutor<LocalExecutor>,
|
||||
NativeElseWasmExecutor<LocalExecutorDispatch>,
|
||||
>;
|
||||
|
||||
/// Test client light database backend.
|
||||
@@ -96,7 +96,7 @@ pub type LightExecutor = sc_light::GenesisCallExecutor<
|
||||
sc_client_db::light::LightStorage<substrate_test_runtime::Block>,
|
||||
HashFor<substrate_test_runtime::Block>,
|
||||
>,
|
||||
NativeExecutor<LocalExecutor>,
|
||||
NativeElseWasmExecutor<LocalExecutorDispatch>,
|
||||
>,
|
||||
>;
|
||||
|
||||
@@ -174,13 +174,13 @@ pub type TestClientBuilder<E, B> = substrate_test_client::TestClientBuilder<
|
||||
GenesisParameters,
|
||||
>;
|
||||
|
||||
/// Test client type with `LocalExecutor` and generic Backend.
|
||||
/// Test client type with `LocalExecutorDispatch` and generic Backend.
|
||||
pub type Client<B> = client::Client<
|
||||
B,
|
||||
client::LocalCallExecutor<
|
||||
substrate_test_runtime::Block,
|
||||
B,
|
||||
sc_executor::NativeExecutor<LocalExecutor>,
|
||||
sc_executor::NativeElseWasmExecutor<LocalExecutorDispatch>,
|
||||
>,
|
||||
substrate_test_runtime::Block,
|
||||
substrate_test_runtime::RuntimeApi,
|
||||
@@ -195,7 +195,7 @@ pub trait DefaultTestClientBuilderExt: Sized {
|
||||
fn new() -> Self;
|
||||
}
|
||||
|
||||
impl DefaultTestClientBuilderExt for TestClientBuilder<Executor, Backend> {
|
||||
impl DefaultTestClientBuilderExt for TestClientBuilder<ExecutorDispatch, Backend> {
|
||||
fn new() -> Self {
|
||||
Self::with_default_backend()
|
||||
}
|
||||
@@ -277,7 +277,7 @@ impl<B> TestClientBuilderExt<B>
|
||||
client::LocalCallExecutor<
|
||||
substrate_test_runtime::Block,
|
||||
B,
|
||||
sc_executor::NativeExecutor<LocalExecutor>,
|
||||
sc_executor::NativeElseWasmExecutor<LocalExecutorDispatch>,
|
||||
>,
|
||||
B,
|
||||
> where
|
||||
@@ -436,6 +436,6 @@ pub fn new_light_fetcher() -> LightFetcher {
|
||||
}
|
||||
|
||||
/// Create a new native executor.
|
||||
pub fn new_native_executor() -> sc_executor::NativeExecutor<LocalExecutor> {
|
||||
sc_executor::NativeExecutor::new(sc_executor::WasmExecutionMethod::Interpreted, None, 8)
|
||||
pub fn new_native_executor() -> sc_executor::NativeElseWasmExecutor<LocalExecutorDispatch> {
|
||||
sc_executor::NativeElseWasmExecutor::new(sc_executor::WasmExecutionMethod::Interpreted, None, 8)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user