Issues in bundling for AztecSnap: Loading wasm in sub-dependency #2019
Unanswered
porco-rosso-j
asked this question in
Q&A
Replies: 1 comment 2 replies
-
We are investigating a Wasm issue that may be the exact issue you are experiencing. I will follow up next week if we manage to solve it. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are trying to build Snap for Aztec Sandbox ( local dev network ).
Here is our repo: https://github.com/porco-rosso-j/aztec-snap
node version: v18.8.0
aztec package and sandbox version: v0.16.1
Currently, despite
mm-snap build
being successful, something in bundling doesn't seem complete as, in runtime, we can't call functions from aztec.js, including wasm-related methods, throwingC.createPXEClient is not a function error
at this line. This might be because an Aztec package used inindex.ts
imports aztec.js that has wasm dependencies ( see details below ).C.createPXEClient is not a function error
is a new error with aztec.js with 0.16.1. Before, with aztec.js of 0.14.2, this didn't occur. Instead, we were stuck at an aztec.js's execution that calls wasm functions inside. *We are not 100% sure if thisnot a function
error is due to wasm but bundling just may work in an incorrect way.*pxe stands for Private Execution Enviroment. pxe service should be fetched in browser app to interact with aztec network. Since pxe works at port 8080, snap is set to serve at 8081. ( *we tried in an opposite way. Didn' make any difference ).
We were suggested to follow this wasm example. However, I'm not sure about the point of having assembly folder that contains wasm build apart from snap folder, as our snap doesn't need to directly call any wasm function like this example or any other existing snap, e.g. AleoSnap, does, but aztec.js only has to do.
We've found two wasm file/module in aztec dependencies.
*@aztec/foundation and @aztec/circuits.js are dependencies of @aztec/aztec.js.
I'm wondering if this would make any difference: porting/building these wasm in assembly folder, setting alias in webpack config in a way that wasm calls inside the aztec packages are redirected to the assembly's wasm files instead of real wasm files in the aztec packages. But I'm not sure if it really would work out.
*Our snap config with extensional webpack config follows this boxes's react example from aztec packages, so that bundling the ESM-compliant aztec dependencies for browser works correctly.
*In case you run sandbox on docker to test our repo, please refer to this doc.
Any feedback/suggestions would be appreciated. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions