mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 08:47:57 +00:00
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:
committed by
GitHub
parent
1d5d4a4840
commit
39d6c95c0d
@@ -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(
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user