substrate-node: NativeElseWasmExecutor is no longer used (#2521)

This PR removes `NativeElseWasmExecutor` usage from substrate node.
Instead [`WasmExecutor<(sp_io::SubstrateHostFunctions,
sp_statement_store::runtime_api::HostFunctions)>`](https://github.com/paritytech/polkadot-sdk/blob/49a41ab3bb3f630c20e5b24cec8d92382404631c/substrate/bin/node/executor/src/lib.rs#L26)
is used.

Related to #2358.

---------

Co-authored-by: Davide Galassi <davxy@datawok.net>
This commit is contained in:
Michal Kucharczyk
2023-11-29 10:30:09 +01:00
committed by GitHub
parent 1d5d4a4840
commit 39d6c95c0d
19 changed files with 159 additions and 254 deletions
+14 -5
View File
@@ -23,7 +23,7 @@ use sp_runtime::BuildStorage;
pub use substrate_test_client::*;
/// Call executor for `kitchensink-runtime` `TestClient`.
pub type ExecutorDispatch = sc_executor::NativeElseWasmExecutor<node_executor::ExecutorDispatch>;
use node_cli::service::RuntimeExecutor;
/// Default backend type.
pub type Backend = sc_client_db::Backend<node_primitives::Block>;
@@ -31,7 +31,7 @@ pub type Backend = sc_client_db::Backend<node_primitives::Block>;
/// Test client type.
pub type Client = client::Client<
Backend,
client::LocalCallExecutor<node_primitives::Block, Backend, ExecutorDispatch>,
client::LocalCallExecutor<node_primitives::Block, Backend, RuntimeExecutor>,
node_primitives::Block,
kitchensink_runtime::RuntimeApi,
>;
@@ -63,7 +63,7 @@ pub trait TestClientBuilderExt: Sized {
impl TestClientBuilderExt
for substrate_test_client::TestClientBuilder<
node_primitives::Block,
client::LocalCallExecutor<node_primitives::Block, Backend, ExecutorDispatch>,
client::LocalCallExecutor<node_primitives::Block, Backend, RuntimeExecutor>,
Backend,
GenesisParameters,
>
@@ -71,8 +71,17 @@ impl TestClientBuilderExt
fn new() -> Self {
Self::default()
}
fn build(self) -> Client {
self.build_with_native_executor(None).0
let executor = RuntimeExecutor::builder().build();
use sc_service::client::LocalCallExecutor;
use std::sync::Arc;
let executor = LocalCallExecutor::new(
self.backend().clone(),
executor.clone(),
Default::default(),
ExecutionExtensions::new(None, Arc::new(executor)),
)
.expect("Creates LocalCallExecutor");
self.build_with_executor(executor).0
}
}