Wasm executor should provide stubs for unknown externs (wasmi) (#4550)

Related to #4456
This commit is contained in:
Cecile Tonglet
2020-01-09 11:18:14 +01:00
committed by GitHub
parent 189bd2349c
commit cc573bc106
6 changed files with 193 additions and 25 deletions
+3
View File
@@ -67,12 +67,14 @@ pub fn call_in_wasm<E: Externalities, HF: sp_wasm_interface::HostFunctions>(
ext: &mut E,
code: &[u8],
heap_pages: u64,
allow_missing_imports: bool,
) -> error::Result<Vec<u8>> {
let mut instance = wasm_runtime::create_wasm_runtime_with_code(
execution_method,
heap_pages,
code,
HF::host_functions(),
allow_missing_imports,
)?;
instance.call(ext, function, call_data)
}
@@ -103,6 +105,7 @@ mod tests {
&mut ext,
&WASM_BINARY,
8,
true,
).unwrap();
assert_eq!(res, vec![0u8; 0]);
}