mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 16:57:58 +00:00
Cursed implementation of allowing missing imports on wasmtime (#4730)
* Quick and dirty impl. * Clean up * Check the signatures. * Fix tests. * Apply suggestions from code review Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Ignore non function members. Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
committed by
Bastian Köcher
parent
e4f3e85585
commit
2421576f91
@@ -68,7 +68,7 @@ pub fn call_in_wasm<HF: sp_wasm_interface::HostFunctions>(
|
||||
ext: &mut dyn Externalities,
|
||||
code: &[u8],
|
||||
heap_pages: u64,
|
||||
allow_missing_imports: bool,
|
||||
allow_missing_func_imports: bool,
|
||||
) -> error::Result<Vec<u8>> {
|
||||
call_in_wasm_with_host_functions(
|
||||
function,
|
||||
@@ -78,7 +78,7 @@ pub fn call_in_wasm<HF: sp_wasm_interface::HostFunctions>(
|
||||
code,
|
||||
heap_pages,
|
||||
HF::host_functions(),
|
||||
allow_missing_imports,
|
||||
allow_missing_func_imports,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -92,14 +92,14 @@ pub fn call_in_wasm_with_host_functions(
|
||||
code: &[u8],
|
||||
heap_pages: u64,
|
||||
host_functions: Vec<&'static dyn sp_wasm_interface::Function>,
|
||||
allow_missing_imports: bool,
|
||||
allow_missing_func_imports: bool,
|
||||
) -> error::Result<Vec<u8>> {
|
||||
let instance = wasm_runtime::create_wasm_runtime_with_code(
|
||||
execution_method,
|
||||
heap_pages,
|
||||
code,
|
||||
host_functions,
|
||||
allow_missing_imports,
|
||||
allow_missing_func_imports,
|
||||
)?;
|
||||
|
||||
// It is safe, as we delete the instance afterwards.
|
||||
|
||||
Reference in New Issue
Block a user