#![warn(missing_docs)]
#[macro_use]
mod executor;
#[cfg(test)]
mod integration_tests;
mod wasm_runtime;
pub use codec::Codec;
#[allow(deprecated)]
pub use executor::NativeElseWasmExecutor;
pub use executor::{with_externalities_safe, NativeExecutionDispatch, WasmExecutor};
#[doc(hidden)]
pub use pezsp_core::traits::Externalities;
pub use pezsp_version::{NativeVersion, RuntimeVersion};
#[doc(hidden)]
pub use pezsp_wasm_interface;
pub use pezsp_wasm_interface::HostFunctions;
pub use wasm_runtime::{read_embedded_version, WasmExecutionMethod};
pub use pezsc_executor_common::{
error,
wasm_runtime::{HeapAllocStrategy, DEFAULT_HEAP_ALLOC_PAGES, DEFAULT_HEAP_ALLOC_STRATEGY},
};
pub use pezsc_executor_wasmtime::InstantiationStrategy as WasmtimeInstantiationStrategy;
pub trait RuntimeVersionOf {
fn runtime_version(
&self,
ext: &mut dyn Externalities,
runtime_code: &pezsp_core::traits::RuntimeCode,
) -> error::Result<RuntimeVersion>;
}
#[cfg(test)]
mod tests {
use super::*;
use pezsc_executor_common::runtime_blob::RuntimeBlob;
use pezsc_runtime_test::wasm_binary_unwrap;
use pezsp_io::TestExternalities;
#[test]
fn call_in_interpreted_wasm_works() {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
let executor = WasmExecutor::<pezsp_io::BizinikiwiHostFunctions>::builder().build();
let res = executor
.uncached_call(
RuntimeBlob::uncompress_if_needed(wasm_binary_unwrap()).unwrap(),
&mut ext,
true,
"test_empty_return",
&[],
)
.unwrap();
assert_eq!(res, vec![0u8; 0]);
}
}