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
@@ -18,8 +18,6 @@
//! Rust executor possible errors.
use wasmi;
/// Result type alias.
pub type Result<T> = std::result::Result<T, Error>;
@@ -27,9 +25,6 @@ pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
pub enum Error {
#[error(transparent)]
Wasmi(#[from] wasmi::Error),
#[error("Error calling api function: {0}")]
ApiError(Box<dyn std::error::Error + Send + Sync>),
@@ -48,9 +43,6 @@ pub enum Error {
#[error("Invalid type returned (should be u64)")]
InvalidReturn,
#[error("Runtime error")]
Runtime,
#[error("Runtime panicked: {0}")]
RuntimePanicked(String),
@@ -109,8 +101,6 @@ pub enum Error {
OutputExceedsBounds,
}
impl wasmi::HostError for Error {}
impl From<&'static str> for Error {
fn from(err: &'static str) -> Error {
Error::Other(err.into())
@@ -26,9 +26,6 @@
//!
//! To give you some examples:
//!
//! - wasmi allows reaching to non-exported mutable globals so that we could reset them. Wasmtime
//! doesnt support that.
//!
//! We need to reset the globals because when we
//! execute the Substrate Runtime, we do not drop and create the instance anew, instead
//! we restore some selected parts of the state.