Skip to content

Commit

Permalink
Merge branch 'tomas/fix-wasm-cache-pre-compile' (#3181)
Browse files Browse the repository at this point in the history
* origin/tomas/fix-wasm-cache-pre-compile:
  changelog: add #3181
  namada/wasm/cache: write the file to cache before updating progress
  • Loading branch information
brentstone committed May 8, 2024
2 parents c360811 + 4fb6d12 commit b6325f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fixed a race condition in pre-compiled WASM cache.
([\#3181](https://github.com/anoma/namada/pull/3181))
5 changes: 4 additions & 1 deletion crates/namada/src/vm/wasm/compilation_cache/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@ impl<N: CacheName, A: WasmCacheAccess> Cache<N, A> {
match wasm::run::prepare_wasm_code(code) {
Ok(code) => match compile(code) {
Ok((module, store)) => {
// Write the file
file_write_module(&dir, &module, &hash);

// Update progress
let mut progress =
progress.write().unwrap();
progress
Expand All @@ -430,7 +434,6 @@ impl<N: CacheName, A: WasmCacheAccess> Cache<N, A> {
N::name()
)
}
file_write_module(&dir, &module, &hash);
(module, store)
}
Err(err) => {
Expand Down

0 comments on commit b6325f3

Please sign in to comment.