Skip to content

Commit

Permalink
workaround wasmer store segfault by keeping it in cache
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Jul 24, 2024
1 parent fcdcf0c commit 9938763
Show file tree
Hide file tree
Showing 10 changed files with 311 additions and 237 deletions.
52 changes: 28 additions & 24 deletions Cargo.lock

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

10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,12 @@ tracing-log = "0.2.0"
tracing-subscriber = {version = "0.3.7", default-features = false, features = ["env-filter", "fmt"]}
wasmparser = "0.107.0"
wasm-instrument = {version = "0.4.0", features = ["sign_ext"]}
wasmer = "4.3.1"
wasmer-cache = "4.3.1"
wasmer-compiler-singlepass = "4.3.1"
wasmer-vm = "4.3.1"
wasmer = "4.3.5"
wasmer-cache = "4.3.5"
wasmer-compiler = "4.3.5"
wasmer-compiler-singlepass = "4.3.5"
wasmer-types = "4.3.5"
wasmer-vm = "4.3.5"
winapi = "0.3.9"
yansi = "0.5.1"
zeroize = { version = "1.5.5", features = ["zeroize_derive"] }
Expand Down
2 changes: 2 additions & 0 deletions crates/namada/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,5 @@ tempfile.workspace = true
test-log.workspace = true
tokio = { workspace = true, features = ["rt", "macros"] }
tracing-subscriber.workspace = true
wasmer-compiler = { workspace = true }
wasmer-types = { workspace = true }
12 changes: 7 additions & 5 deletions crates/namada/src/vm/host_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2422,21 +2422,23 @@ pub mod testing {
tx_index: &TxIndex,
result_buffer: &mut Option<Vec<u8>>,
yielded_value: &mut Option<Vec<u8>>,
store: Rc<RefCell<wasmer::Store>>,
#[cfg(feature = "wasm-runtime")] vp_wasm_cache: &mut VpCache<CA>,
#[cfg(feature = "wasm-runtime")] tx_wasm_cache: &mut TxCache<CA>,
) -> TxVmEnv<WasmMemory, <S as StateRead>::D, <S as StateRead>::H, CA>
where
S: State,
CA: WasmCacheAccess,
{
let mut store = crate::vm::wasm::compilation_cache::common::store();

let wasm_memory =
crate::vm::wasm::memory::prepare_tx_memory(&mut store).unwrap();
let wasm_memory = {
let mut borrowed_store = store.borrow_mut();
crate::vm::wasm::memory::prepare_tx_memory(&mut *borrowed_store)
.unwrap()
};

let (write_log, in_mem, db) = state.split_borrow();
let mut env = TxVmEnv::new(
WasmMemory::new(Rc::new(RefCell::new(store))),
WasmMemory::new(Rc::downgrade(&store)),
write_log,
in_mem,
db,
Expand Down
Loading

0 comments on commit 9938763

Please sign in to comment.