Open vivianjeng opened 2 weeks ago
@vivianjeng what does it mean for to be difficult to extend? Could give an example of what is being extended?
I think we discussed this a bit before, but we should consider if we should recommend teams move to their own FFI implementation. Sorta like ejecting from an expo app, but ejecting from mopro.
For most simple cases they would use mopro, but if they want to customize the UDL (by adding new functions/types) it would be better for project to eject from mopro so they can edit things without abstraction.
@alxkzmn I imagine that
developers can use both functions in mopro-ffi
e.g. generateCircomProof
and also functions defined in like test-e2e
e.g. YourStruct
or like GPU example: https://github.com/zkmopro/gpu-acceleration/blob/main/guide-for-extending-ffi.md#extend-the-udl-file-for-custom-functions
you can define your function after mopro.udl
// mopro-ffi/src/mopro.udl
namespace mopro {
// ... other definitions
[Throws=MoproError]
boolean your_function(u32 a, u32 b);
};
dictionary YourStruct {
u32 a;
u32 b;
};
@chancehudson I think we can make all implementations possible
mopro-ffi
and not customize UDLmopro-ffi
and customize UDL (now it is not possible)mopro-ffi
and customize UDLjust to overwrite or copy the output new bindings without fixing the file path https://github.com/zkmopro/mopro/blob/61f6b364bf9052a8d83251a7a4104b9ff541dede/mopro-ffi/src/app_config/ios.rs#L7-L9
it would be better for project to eject from mopro so they can edit things without abstraction.
How does it work? I think they will still need to clone the mopro repo and write UDL?
I think we can pass the custom udl as an option when building:
cargo run --bin ios -- --custom-udl path/to/custom.udl
- if run like this, will use the specified custom UDL. if no arg provided, will use the bundled UDL;
Problem
Currently we fix the uniffi files and functions in
bin/ios.rs
andbin/android.rs
And if we create a new app liketest-e2e
We cannot update the functions throughmopro.udl
because it will be overwritten bybin/ios
/bin/android
It will be difficult for applications that need to extend the rust package e.g. GPU research or if we will build other SDKsDetails
mopro-ffi
bin/ios
,bin/android
): e.g. build_bindings.shMoproiOSBindings
)test-e2e
src/mopro.udl
file and output customized bindings withcargo run --bin ios
andcargo run --bin android
Acceptance criteria
test-e2e/src/lib.rs
generateCircomProof
) and new bindings can be called in both iOS and AndroidNext steps (optional)