refactor(sc-executor): use wasm executor builder instead of old apis (#13740)

* 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

* fix and improve

* refactor builder

* fix

* fix bench

* fix tests

* fix warnings

* fix warnings

* fix

* fix

* update by suggestions

* update name
This commit is contained in:
yjh
2023-04-10 07:48:40 +08:00
committed by GitHub
parent f4d079a723
commit d5e460b3bf
29 changed files with 212 additions and 209 deletions
@@ -27,7 +27,7 @@ use sc_cli::{
execution_method_from_cli, CliConfiguration, ExecutionStrategy, Result, SharedParams,
};
use sc_client_db::BenchmarkingState;
use sc_executor::NativeElseWasmExecutor;
use sc_executor::{NativeElseWasmExecutor, WasmExecutor};
use sc_service::{Configuration, NativeExecutionDispatch};
use serde::Serialize;
use sp_core::{
@@ -209,11 +209,16 @@ impl PalletCmd {
// Do not enable storage tracking
false,
)?;
let executor = NativeElseWasmExecutor::<ExecDispatch>::new(
execution_method_from_cli(self.wasm_method, self.wasmtime_instantiation_strategy),
self.heap_pages,
2, // The runtime instances cache size.
2, // The runtime cache size
let method =
execution_method_from_cli(self.wasm_method, self.wasmtime_instantiation_strategy);
let executor = NativeElseWasmExecutor::<ExecDispatch>::new_with_wasm_executor(
WasmExecutor::builder()
.with_execution_method(method)
.with_max_runtime_instances(2)
.with_runtime_cache_size(2)
.build(),
);
let extensions = || -> Extensions {