Upgrade wasm crate dependencies (#12173)

* Upgrade wasm crate dependencies

* New wasmi version changed error output a bit

* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts

* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts

Co-authored-by: command-bot <>
This commit is contained in:
Alexander Theißen
2022-09-08 13:48:19 +01:00
committed by GitHub
parent 6c5d4668d0
commit 5afe00d89c
19 changed files with 708 additions and 685 deletions
+2 -2
View File
@@ -17,9 +17,9 @@ targets = ["x86_64-unknown-linux-gnu"]
codec = { package = "parity-scale-codec", version = "3.0.0" }
environmental = "1.1.3"
thiserror = "1.0.30"
wasm-instrument = "0.1"
wasm-instrument = "0.2"
wasmer = { version = "2.2", features = ["singlepass"], optional = true }
wasmi = "0.9.1"
wasmi = "0.13"
sc-allocator = { version = "4.1.0-dev", path = "../../allocator" }
sp-maybe-compressed-blob = { version = "4.1.0-dev", path = "../../../primitives/maybe-compressed-blob" }
sp-sandbox = { version = "0.10.0-dev", path = "../../../primitives/sandbox" }
@@ -18,14 +18,14 @@
//! Wasmi specific impls for sandbox
use std::rc::Rc;
use std::{fmt, rc::Rc};
use codec::{Decode, Encode};
use sp_sandbox::HostError;
use sp_wasm_interface::{FunctionContext, Pointer, ReturnValue, Value, WordSize};
use wasmi::{
memory_units::Pages, ImportResolver, MemoryInstance, Module, ModuleInstance, RuntimeArgs,
RuntimeValue, Trap, TrapKind,
RuntimeValue, Trap,
};
use crate::{
@@ -39,9 +39,20 @@ use crate::{
environmental::environmental!(SandboxContextStore: trait SandboxContext);
#[derive(Debug)]
struct CustomHostError(String);
impl fmt::Display for CustomHostError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "HostError: {}", self.0)
}
}
impl wasmi::HostError for CustomHostError {}
/// Construct trap error from specified message
fn trap(msg: &'static str) -> Trap {
TrapKind::Host(Box::new(Error::Other(msg.into()))).into()
Trap::host(CustomHostError(msg.into()))
}
impl ImportResolver for Imports {