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
// skip functions that are provided by the Miden SDK and/or intrinsics// only function names (no CM path)
package.metadata.section.bindings.skip = vec![// Our function names can clash with user's function names leading to// skipping the bindings generation of the user's function names// see https://github.com/0xPolygonMiden/compiler/issues/341"remove-asset",
"create-note",
"heap-base",
"hash-one-to-one",
"hash-two-to-one",
"add-asset",
"add",
]
can accidentally skip bindings generation for user's functions if they have the same name as the intrinsics or Miden SDK functions (add, add-asset, create-note, etc.).
How to fix
We could add interface name support in the skip field in wit-bindgen. So that the whole Rust module (interface counterpart) is not generated. We would need to be careful and not break any wit-bindgen user's code, e.g. the function name skipping should continue to work as it is now. Ideally, we would want to specify the full path to the interface in the skip field, but if we're limited to using only the interface name we need to prioritize the function name skipping if both the interface and the function names are the same.
In this case, we have to make our interface names that we use in the skip field unique enough to not clash with the user's interface names.
The text was updated successfully, but these errors were encountered:
greenhat
changed the title
Skipping for Miden SDK Rust bindings generation based on function names can accidentally skip user's functionsf
Skipping for Miden SDK Rust bindings generation based on function names can accidentally skip user's functions
Oct 11, 2024
Introduced in #329
Motivation
Using the function names to skip the Rust bindings generation for the Miden SDK and intrinsics functions at
https://github.com/0xPolygonMiden/compiler/blob/next/tools/cargo-miden/src/lib.rs
can accidentally skip bindings generation for user's functions if they have the same name as the intrinsics or Miden SDK functions (
add
,add-asset
,create-note
, etc.).How to fix
We could add interface name support in the
skip
field in wit-bindgen. So that the whole Rust module (interface counterpart) is not generated. We would need to be careful and not break any wit-bindgen user's code, e.g. the function name skipping should continue to work as it is now. Ideally, we would want to specify the full path to the interface in theskip
field, but if we're limited to using only the interface name we need to prioritize the function name skipping if both the interface and the function names are the same.In this case, we have to make our interface names that we use in the
skip
field unique enough to not clash with the user's interface names.The text was updated successfully, but these errors were encountered: