Simplify NativeExecutionDispatch and remove the native_executor_instance! macro (#9562)

* Remove the `native_executor_instance!` macro

* Add comment to test runner ex

* Fix comments
This commit is contained in:
Ashley
2021-08-16 17:06:52 +02:00
committed by GitHub
parent d9f02296ab
commit 7caaa9ef8b
9 changed files with 114 additions and 126 deletions
@@ -27,7 +27,6 @@ use sc_client_db::{
use sc_consensus::{
BlockCheckParams, BlockImport, BlockImportParams, ForkChoiceStrategy, ImportResult,
};
use sc_executor::native_executor_instance;
use sc_service::client::{self, new_in_mem, Client, LocalCallExecutor};
use sp_api::ProvideRuntimeApi;
use sp_consensus::{BlockOrigin, BlockStatus, Error as ConsensusError, SelectChain};
@@ -63,11 +62,19 @@ mod light;
const TEST_ENGINE_ID: ConsensusEngineId = *b"TEST";
native_executor_instance!(
Executor,
substrate_test_runtime_client::runtime::api::dispatch,
substrate_test_runtime_client::runtime::native_version,
);
pub struct Executor;
impl sc_executor::NativeExecutionDispatch for Executor {
type ExtendHostFunctions = ();
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
substrate_test_runtime_client::runtime::api::dispatch(method, data)
}
fn native_version() -> sc_executor::NativeVersion {
substrate_test_runtime_client::runtime::native_version()
}
}
fn executor() -> sc_executor::NativeExecutor<Executor> {
sc_executor::NativeExecutor::new(sc_executor::WasmExecutionMethod::Interpreted, None, 8)