diff --git a/node/src/service.rs b/node/src/service.rs index d9721f2479eca65ed2009ff51388ee2513381efd..3c08c188197c9850dc1c4a70d75d827a86e2b171 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -89,7 +89,9 @@ pub mod gdev_executor { #[allow(dead_code)] #[cfg(feature = "g1")] pub mod g1_executor { + use crate::service::HostFunctions; pub use g1_runtime; + use sc_executor::sp_wasm_interface::{Function, HostFunctionRegistry}; pub struct G1Executor; impl sc_executor::NativeExecutionDispatch for G1Executor { @@ -103,12 +105,26 @@ pub mod g1_executor { g1_runtime::native_version() } } + impl sc_executor::sp_wasm_interface::HostFunctions for G1Executor { + fn host_functions() -> Vec<&'static dyn Function> { + HostFunctions::host_functions() + } + + fn register_static<T>(registry: &mut T) -> Result<(), T::Error> + where + T: HostFunctionRegistry, + { + HostFunctions::register_static(registry) + } + } } #[allow(dead_code)] #[cfg(feature = "gtest")] pub mod gtest_executor { + use crate::service::HostFunctions; pub use gtest_runtime; + use sc_executor::sp_wasm_interface::{Function, HostFunctionRegistry}; pub struct GTestExecutor; impl sc_executor::NativeExecutionDispatch for GTestExecutor { @@ -122,6 +138,18 @@ pub mod gtest_executor { gtest_runtime::native_version() } } + impl sc_executor::sp_wasm_interface::HostFunctions for GTestExecutor { + fn host_functions() -> Vec<&'static dyn Function> { + HostFunctions::host_functions() + } + + fn register_static<T>(registry: &mut T) -> Result<(), T::Error> + where + T: HostFunctionRegistry, + { + HostFunctions::register_static(registry) + } + } } /// /// The minimum period of blocks on which justifications will be