zkmopro / mopro

Making client-side proving on mobile simple.
https://zkmopro.org
Apache License 2.0
131 stars 35 forks source link

Refactor out UDL file in favor of proc macros #200

Open chancehudson opened 4 months ago

chancehudson commented 4 months ago

Problem

The current app! macro implements the functions defined in the udl file. This is clunky because we always have to define each function even if we're not compiling support for said functions. The macro itself is also primitive and unhygienic and prevents the user from exposing additional custom functions over the ffi.

Details

To solve this we can switch to use macros like #[uniffi::export] to expose functions directly from the rust code. We can expose our own macros that wrap these functions like export_circom!.

Acceptance criteria

This issue only includes switching the existing code from static udl file to macros. This includes updating the build system so that the ios/android build commands handle generating the swift/kotlin bindings.

The mopro.udl file should be removed along with the committed bindings.

Next steps (optional)

After this issue is complete halo2 integration should be easier/more robust and we can allow the user to define their own functions that are exposed over ffi.

ElusAegis commented 4 months ago

Related to #201 where there was an early work on supporting proc_marco in Mopro.