Skip to content

Wrap getMidenClient in withWasmClientLock in MidenProvider#143

Open
nikolaysamoil0ff wants to merge 1 commit into0xMiden:mainfrom
nikolaysamoil0ff:main
Open

Wrap getMidenClient in withWasmClientLock in MidenProvider#143
nikolaysamoil0ff wants to merge 1 commit into0xMiden:mainfrom
nikolaysamoil0ff:main

Conversation

@nikolaysamoil0ff
Copy link
Copy Markdown

Wraped the eager getMidenClient() initialization in MidenProvider with withWasmClientLock and added the corresponding import from ../sdk/miden-client.

According to CLAUDE.md, the Miden WASM client cannot handle concurrent access, and all interactions with it must be wrapped in withWasmClientLock. Direct calls to getMidenClient() without the lock can lead to concurrency issues, including the documented Rust error:

recursive use of an object detected which would lead to unsafe aliasing in rust

Since MidenProvider performs eager initialization on app startup, this could overlap with other WASM operations (e.g. workers, AutoSync, frontend hooks) and cause race conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant