Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update back to wasmi v0.32 #1667

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ opt-level = 2
panic = "abort"
[profile.dev.package."*"]
opt-level = 3
debug-assertions = false # The debug assertions in wasmi in particular take a lot of time

# The `test` profile mimics the `dev` profile to avoid recompilations.
[profile.test]
Expand Down
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.31.0", default-features = false }
wasmi = { version = "0.32.0-beta.5", 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: 4 additions & 10 deletions lib/src/executor/vm/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ use super::{
use alloc::{borrow::ToOwned as _, string::ToString as _, sync::Arc, vec::Vec};
use core::fmt;

// 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,
}
pub use wasmi::CompilationMode;

/// See [`super::VirtualMachinePrototype`].
pub struct InterpreterPrototype {
Expand Down Expand Up @@ -59,7 +54,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 @@ -74,7 +69,7 @@ impl InterpreterPrototype {
config.wasm_mutable_global(false);
config.wasm_saturating_float_to_int(false);
config.wasm_tail_call(false);
// TODO: when updating to wasmi 0.32: config.compilation_mode(compilation_mode);
config.compilation_mode(compilation_mode);

wasmi::Engine::new(&config)
};
Expand Down Expand Up @@ -138,8 +133,7 @@ impl InterpreterPrototype {
&mut store,
func_type.clone(),
move |_caller, parameters, _ret| {
// TODO: in wasmi v0.32, this is `wasmi::Error::host``
Err(wasmi::core::Trap::from(InterruptedTrap {
Err(wasmi::Error::host(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 @@ -4,6 +4,7 @@

### Changed

- Update back to wasmi v0.32. The wasmi version was downgraded to v0.31 in smoldot v2.0.20 due to performance issues. These performance issues turned out to be simply caused by `debug-assertions = true`. ([#1667](https://github.com/smol-dot/smoldot/pull/1667))
- Clarify the value of `isSyncing` returned by `system_health`. The value will be equal to `false` if no peer that smoldot is connected to is more than 10 blocks ahead, and that the highest block would runtime code has been downloaded is no more than 12 blocks ahead of the highest block of the local chain. ([#1658](https://github.com/smol-dot/smoldot/pull/1658))

### Fixed
Expand Down
Loading