Skip to content

Commit

Permalink
Revert wasmi to v0.31 again (#1624)
Browse files Browse the repository at this point in the history
* Revert wasmi to v0.31 again

* PR link
  • Loading branch information
tomaka authored Jan 29, 2024
1 parent 0e4ae12 commit d9a7c02
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 29 deletions.
28 changes: 4 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ siphasher = { version = "1.0.0", default-features = false }
slab = { version = "0.4.8", default-features = false }
smallvec = { version = "1.13.1", default-features = false }
twox-hash = { version = "1.6.3", default-features = false }
wasmi = { version = "0.32.0-beta.5", default-features = false }
wasmi = { version = "0.31.0", default-features = false }
x25519-dalek = { version = "2.0.0-rc.3", default-features = false, features = ["alloc", "precomputed-tables", "static_secrets", "zeroize"] }
zeroize = { version = "1.6.0", default-features = false, features = ["alloc"] }

Expand Down
14 changes: 10 additions & 4 deletions lib/src/executor/vm/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ use super::{
use alloc::{borrow::ToOwned as _, string::ToString as _, sync::Arc, vec::Vec};
use core::fmt;

pub use wasmi::CompilationMode;
// TODO: this enum is a small hack. It mimics the `CompilationMode` enum of wasmi 0.32 so that we don't have to change the API of this module when upgrading to 0.32
// TODO: when upgrading: `pub use wasmi::CompilationMode;`
pub enum CompilationMode {
Eager,
Lazy,
}

/// See [`super::VirtualMachinePrototype`].
pub struct InterpreterPrototype {
Expand Down Expand Up @@ -54,7 +59,7 @@ impl InterpreterPrototype {
/// See [`super::VirtualMachinePrototype::new`].
pub fn new(
module_bytes: &[u8],
compilation_mode: CompilationMode,
_compilation_mode: CompilationMode,
symbols: &mut dyn FnMut(&str, &str, &Signature) -> Result<usize, ()>,
) -> Result<Self, NewErr> {
let engine = {
Expand All @@ -69,7 +74,7 @@ impl InterpreterPrototype {
config.wasm_mutable_global(false);
config.wasm_saturating_float_to_int(false);
config.wasm_tail_call(false);
config.compilation_mode(compilation_mode);
// TODO: when updating to wasmi 0.32: config.compilation_mode(compilation_mode);

wasmi::Engine::new(&config)
};
Expand Down Expand Up @@ -133,7 +138,8 @@ impl InterpreterPrototype {
&mut store,
func_type.clone(),
move |_caller, parameters, _ret| {
Err(wasmi::Error::host(InterruptedTrap {
// TODO: in wasmi v0.32, this is `wasmi::Error::host``
Err(wasmi::core::Trap::from(InterruptedTrap {
function_index,
parameters: parameters
.iter()
Expand Down
1 change: 1 addition & 0 deletions wasm-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixed

- Fix "Justification targets block not in the chain" errors, leading to peers being erroneously banned. ([#1618](https://github.com/smol-dot/smoldot/pull/1618))
- Revert wasmi version to v0.31 due to performance issues with the experimental v0.32. The WebAssembly runtime is no longer compiled lazily as was the same since smoldot v2.0.17. ([#1642](https://github.com/smol-dot/smoldot/pull/1624))

## 2.0.19 - 2024-01-26

Expand Down

0 comments on commit d9a7c02

Please sign in to comment.