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
+1 -1
View File
@@ -19,7 +19,7 @@ futures = "0.3.21"
log = "0.4.17"
tempfile = "3.1.0"
frame-system = { path = "../../../frame/system" }
node-executor = { package = "staging-node-executor", path = "../executor" }
node-cli = { package = "staging-node-cli", path = "../cli" }
node-primitives = { path = "../primitives" }
kitchensink-runtime = { path = "../runtime" }
pallet-asset-conversion = { path = "../../../frame/asset-conversion" }
+6 -8
View File
@@ -43,7 +43,7 @@ use sc_block_builder::BlockBuilderBuilder;
use sc_client_api::{execution_extensions::ExecutionExtensions, UsageProvider};
use sc_client_db::PruningMode;
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy, ImportResult, ImportedAux};
use sc_executor::{NativeElseWasmExecutor, WasmExecutionMethod, WasmtimeInstantiationStrategy};
use sc_executor::{WasmExecutionMethod, WasmtimeInstantiationStrategy};
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
use sp_consensus::BlockOrigin;
@@ -388,13 +388,11 @@ impl BenchDb {
let task_executor = TaskExecutor::new();
let backend = sc_service::new_db_backend(db_config).expect("Should not fail");
let executor = NativeElseWasmExecutor::new_with_wasm_executor(
sc_executor::WasmExecutor::builder()
.with_execution_method(WasmExecutionMethod::Compiled {
instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite,
})
.build(),
);
let executor = sc_executor::WasmExecutor::builder()
.with_execution_method(WasmExecutionMethod::Compiled {
instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite,
})
.build();
let client_config = sc_service::ClientConfig::default();
let genesis_block_builder = sc_service::GenesisBlockBuilder::new(
+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
}
}