mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 07:37:57 +00:00
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:
@@ -18,14 +18,20 @@
|
||||
//! A `CodeExecutor` specialization which uses natively compiled runtime when the wasm to be
|
||||
//! executed is equivalent to the natively compiled code.
|
||||
|
||||
use sc_executor::native_executor_instance;
|
||||
pub use sc_executor::NativeExecutor;
|
||||
|
||||
// Declare an instance of the native executor named `Executor`. Include the wasm binary as the
|
||||
// equivalent wasm code.
|
||||
native_executor_instance!(
|
||||
pub Executor,
|
||||
node_runtime::api::dispatch,
|
||||
node_runtime::native_version,
|
||||
frame_benchmarking::benchmarking::HostFunctions,
|
||||
);
|
||||
pub struct Executor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for Executor {
|
||||
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
node_runtime::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
node_runtime::native_version()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,8 +67,7 @@ impl AppCrypto<MultiSigner, MultiSignature> for TestAuthorityId {
|
||||
///
|
||||
/// `compact` since it is after post-processing with wasm-gc which performs tree-shaking thus
|
||||
/// making the binary slimmer. There is a convention to use compact version of the runtime
|
||||
/// as canonical. This is why `native_executor_instance` also uses the compact version of the
|
||||
/// runtime.
|
||||
/// as canonical.
|
||||
pub fn compact_code_unwrap() -> &'static [u8] {
|
||||
node_runtime::WASM_BINARY.expect(
|
||||
"Development wasm binary is not available. Testing is only supported with the flag \
|
||||
|
||||
Reference in New Issue
Block a user