Skip to content

refactor(protocol/sandbox): migrate to Wasmtime#4860

Merged
ark0f merged 65 commits into
masterfrom
al/wasmtime-migration
May 26, 2026
Merged

refactor(protocol/sandbox): migrate to Wasmtime#4860
ark0f merged 65 commits into
masterfrom
al/wasmtime-migration

Conversation

@ark0f
Copy link
Copy Markdown
Member

@ark0f ark0f commented Sep 22, 2025

Resolves #5432

  • Check node sync

NOTE: Substrate's Wasmtime is also updated

NOTE: our published crates on crates.io still use Wasmtime 8 - #5485

@semanticdiff-com
Copy link
Copy Markdown

semanticdiff-com Bot commented Sep 22, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  utils/gear-replay-cli/src/cmd/mod.rs  99% smaller
  utils/wasm-optimizer/src/cargo_toolchain.rs  63% smaller
  utils/calc-stack-height/src/main.rs  59% smaller
  utils/lazy-pages-fuzzer/src/wasmtime_backend.rs  52% smaller
  sandbox/host/src/store_refcell.rs  52% smaller
  utils/cargo-gbuild/src/command.rs  51% smaller
  lazy-pages/src/sys/windows.rs  44% smaller
  pallets/gear/src/tests.rs  43% smaller
  utils/wasm-optimizer/src/stack_end.rs  41% smaller
  runtime-interface/sandbox/src/detail.rs  39% smaller
  utils/lazy-pages-fuzzer/runner/src/main.rs  38% smaller
  sandbox/sandbox/src/embedded_executor.rs  29% smaller
  lazy-pages/src/lib.rs  22% smaller
  node/authorship/src/tests.rs  17% smaller
  sandbox/host/src/sandbox.rs  12% smaller
  core/backend/src/env.rs  10% smaller
  .config/hakari.toml Unsupported file format
  Cargo.lock Unsupported file format
  Cargo.toml Unsupported file format
  ethexe/processor/src/host/api/mod.rs  0% smaller
  ethexe/processor/src/host/mod.rs  0% smaller
  gstd/Cargo.toml Unsupported file format
  lazy-pages/Cargo.toml Unsupported file format
  lazy-pages/interface/src/lib.rs  0% smaller
  lazy-pages/src/sys/unix.rs  0% smaller
  node/authorship/Cargo.toml Unsupported file format
  node/authorship/build.rs  0% smaller
  node/cli/src/cli.rs  0% smaller
  node/cli/src/command.rs  0% smaller
  pallets/gear-builtin/Cargo.toml Unsupported file format
  pallets/gear/src/benchmarking/mod.rs  0% smaller
  pallets/gear/src/benchmarking/tests/syscalls_integrity.rs  0% smaller
  pallets/gear/src/schedule.rs  0% smaller
  sandbox/host/Cargo.toml Unsupported file format
  sandbox/host/src/sandbox/wasmer_backend.rs  0% smaller
  sandbox/host/src/sandbox/wasmtime_backend.rs  0% smaller
  sandbox/sandbox/Cargo.toml Unsupported file format
  scripts/src/test.sh Unsupported file format
  utils/calc-stack-height/Cargo.toml Unsupported file format
  utils/crates-io/src/lib.rs  0% smaller
  utils/gear-wasmer-cache/Cargo.toml Unsupported file format
  utils/gear-wasmer-cache/src/lib.rs  0% smaller
  utils/gear-workspace-hack/Cargo.toml Unsupported file format
  utils/lazy-pages-fuzzer/Cargo.toml Unsupported file format
  utils/lazy-pages-fuzzer/src/lib.rs  0% smaller
  utils/wasm-optimizer/Cargo.toml Unsupported file format

@breathx
Copy link
Copy Markdown
Member

breathx commented Sep 26, 2025

Unstable right now. Will be considered in future

@breathx breathx closed this Sep 26, 2025
# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	ethexe/processor/src/host/api/mod.rs
#	ethexe/rpc/src/lib.rs
#	ethexe/signer/src/storage.rs
#	examples/ctor/build.rs
#	gcli/src/template.rs
#	pallets/gear/src/tests.rs
#	sandbox/host/Cargo.toml
#	sandbox/host/src/sandbox/wasmer_backend.rs
#	sandbox/sandbox/Cargo.toml
#	sandbox/sandbox/src/embedded_executor.rs
#	utils/calc-stack-height/src/main.rs
#	utils/gear-wasmer-cache/Cargo.toml
#	utils/gear-wasmer-cache/src/lib.rs
#	utils/gring/tests/command.rs
#	utils/lazy-pages-fuzzer/src/wasmtime_backend.rs
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request migrates the WebAssembly sandbox backend from Wasmer to Wasmtime across the entire workspace, including ethexe, protocol, and vara components. The transition involves implementing a new Wasmtime backend, updating gas metering weights to account for Winch compiler optimizations, and removing Wasmer-specific caching logic. Feedback identifies several critical issues, including compilation errors in Linker::get and Val::ty usage, and potential panics from expect calls in host functions and instantiation that violate repository safety rules. Additionally, a typo shadowing the HostError type was found, and an improvement was suggested to restore store data after function invocation to prevent side effects.

Comment thread protocol/sandbox/host/src/sandbox/wasmtime_backend.rs
Comment thread protocol/sandbox/src/embedded_executor.rs
Comment thread protocol/sandbox/src/embedded_executor.rs
Comment thread protocol/sandbox/host/src/sandbox/wasmtime_backend.rs
Comment thread protocol/sandbox/host/src/sandbox/wasmtime_backend.rs
Comment thread protocol/sandbox/src/embedded_executor.rs
@kvs96 kvs96 force-pushed the al/wasmtime-migration branch from 2848b77 to e0d4d1e Compare May 21, 2026 16:18
@ark0f ark0f enabled auto-merge May 26, 2026 12:02
@ark0f ark0f added ci: macos Run macOS CI jobs and removed ci: macos Run macOS CI jobs labels May 26, 2026
@ark0f ark0f added this pull request to the merge queue May 26, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 26, 2026
@ark0f ark0f added this pull request to the merge queue May 26, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 26, 2026
@ark0f ark0f removed the pr: do-not-merge Must not be merged label May 26, 2026
@ark0f ark0f added this pull request to the merge queue May 26, 2026
Merged via the queue into master with commit f350eca May 26, 2026
92 of 94 checks passed
@ark0f ark0f deleted the al/wasmtime-migration branch May 26, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: full Run full CI matrix (all platforms and profiles) scope: gear Gear protocol scope: vara Vara Network (Layer 1) type: refactor Internal improvements without changing behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace Wasmer/wasmi with wasmtime + Winch for Wasm execution

2 participants