Skip to content

Commit

Permalink
bugfix: wasmtime: instantiating function type incompatibility (#12096)
Browse files Browse the repository at this point in the history
Resolves: #12062 

This PR resolves the issue with the wasmtime function type
incompatibility.
To understand the issue, I highly recommend my investigation comments on
the issue itself: #12062

To be honest, I'm not sure it's a proper fix as I guess the root cause
of the issue is somewhere outside of the file that leads to running
under different engines/settings, leading to instantiating failures.
It's a bit weird that the WasmtimeVM instance and Module instance could
be different somehow as wasmtime::Engine is an arc wrapper. And module
seems to clone it inside which should be still the same instance.

I could reproduce the issue only by tweaking the code manually by
recreating an engine before the linking. It means that something more
complex happens and we need a test on that

But this fix resolves an issue reported by #12062:
https://github.com/near/near-workspaces-rs/actions/runs/10835958697/job/30200440749


CC @race-of-sloths
  • Loading branch information
akorchyn authored Sep 16, 2024
1 parent 0e7df47 commit 773aae7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/near-vm-runner/src/wasmtime_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ impl crate::runner::VM for WasmtimeVM {
}
}

let mut store = Store::new(&self.engine, ());
let mut store = Store::new(module.engine(), ());
let memory = WasmtimeMemory::new(
&mut store,
self.config.limit_config.initial_memory_pages,
Expand Down

0 comments on commit 773aae7

Please sign in to comment.