You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To pull the Rust Miden SDK through the Wasm CM, we have to provide the WIT interface with Wasm CM style names. E.g. miden::account::add_asset became miden:core-import/[email protected]#add-asset, etc. In the frontend, we need to recover the original MASM module path from the Wasm CM interface and function names.
I suggest parsing the WIT interface name and constructing the MASM module in a generic way. E.g. for miden:core-import/[email protected]#add-asset we need to construct miden::account::add_asset in the frontend.
We have more complicated case where the module name has underscores in it, e.g. miden:core-import/stdlib-crypto-dsa-rpo-falcon which should be converted to stdlib::crypto::dsa::rpo_falcon. We can encode the underscores as -underscore- in the WIT names.
For function names, besides converting - to _ we need to handle the inability to define a function name where the dashed part starts with a digit (e.g. hash-1to1, etc.). In this case, we can encode the hash_1to1 as hash-digit1to1 in the WIT names, digit1 to 1.
The text was updated successfully, but these errors were encountered:
Introduced in #329
Why
To pull the Rust Miden SDK through the Wasm CM, we have to provide the WIT interface with Wasm CM style names. E.g.
miden::account::add_asset
becamemiden:core-import/[email protected]#add-asset
, etc. In the frontend, we need to recover the original MASM module path from the Wasm CM interface and function names.How
The current "quick and dirty" hard-coded way is error-prone.
https://github.com/0xPolygonMiden/compiler/blob/next/frontend-wasm/src/miden_abi/mod.rs
I suggest parsing the WIT interface name and constructing the MASM module in a generic way. E.g. for
miden:core-import/[email protected]#add-asset
we need to constructmiden::account::add_asset
in the frontend.We have more complicated case where the module name has underscores in it, e.g.
miden:core-import/stdlib-crypto-dsa-rpo-falcon
which should be converted tostdlib::crypto::dsa::rpo_falcon
. We can encode the underscores as-underscore-
in the WIT names.For function names, besides converting
-
to_
we need to handle the inability to define a function name where the dashed part starts with a digit (e.g.hash-1to1
, etc.). In this case, we can encode thehash_1to1
ashash-digit1to1
in the WIT names,digit1
to1
.The text was updated successfully, but these errors were encountered: