Remove wasmi backend from sc-executor (#13800)

* refactor: use builder api for all executors

* improve a lot

* remove unused args

* cleanup deps

* fix inconsistency about heap alloc

* add `heap_pages` back to try-runtime

* fix

* chore: reduce duplicated code for sc-service-test

* cleanup code

* fmt

* improve test executor

* improve

* use #[deprecated]

* set runtime_cache_size: 4

* wip

* fix and improve

* remove sc-executor-wasmi deps

* clean up bench and tests

* delete "client/executor/wasmi"

* cleanup

* refactor builder

* fix

* fix bench

* fix tests

* fix warnings

* fix warnings

* fix

* fix

* remove wasmi and fix tests

* unused imports

* improve by suggestions

* Update client/cli/src/arg_enums.rs

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: parity-processbot <>
This commit is contained in:
yjh
2023-05-23 23:31:45 +08:00
committed by GitHub
parent ea21a495f8
commit b6a2948461
18 changed files with 36 additions and 795 deletions
+4 -19
View File
@@ -43,8 +43,6 @@ use sp_wasm_interface::HostFunctions;
/// Specification of different methods of executing the runtime Wasm code.
#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone)]
pub enum WasmExecutionMethod {
/// Uses the Wasmi interpreter.
Interpreted,
/// Uses the Wasmtime compiled runtime.
Compiled {
/// The instantiation strategy to use.
@@ -53,8 +51,10 @@ pub enum WasmExecutionMethod {
}
impl Default for WasmExecutionMethod {
fn default() -> WasmExecutionMethod {
WasmExecutionMethod::Interpreted
fn default() -> Self {
Self::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::PoolingCopyOnWrite,
}
}
}
@@ -299,21 +299,6 @@ where
H: HostFunctions,
{
match wasm_method {
WasmExecutionMethod::Interpreted => {
// Wasmi doesn't have any need in a cache directory.
//
// We drop the cache_path here to silence warnings that cache_path is not used if
// compiling without the `wasmtime` flag.
let _ = cache_path;
sc_executor_wasmi::create_runtime(
blob,
heap_alloc_strategy,
H::host_functions(),
allow_missing_func_imports,
)
.map(|runtime| -> Box<dyn WasmModule> { Box::new(runtime) })
},
WasmExecutionMethod::Compiled { instantiation_strategy } =>
sc_executor_wasmtime::create_runtime::<H>(
blob,