Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: iOS Bindings #846

Merged
merged 49 commits into from
Oct 23, 2024
Merged

Conversation

ElusAegis
Copy link
Contributor

PR: Integrating iOS Bindings for the EZKL Library

This PR introduces iOS bindings for the EZKL library, developed using the uniffi package. This package facilitates the generation of bindings for multiple platforms, including iOS (Swift), as well as Android (Kotlin, Java), Python, and Ruby.

Key Updates:

  1. Created a new bindings module to consolidate all bindings, moving the previously existing python and wasm bindings under it.
  2. Introduced a bindings/universal module containing uniffi-compatible bindings. These bindings implement most functions by reusing code from the existing wasm bindings.
  3. Refactored the wasm bindings to leverage the shared code from the universal bindings.
  4. Added a new script bin/ios_gen_bindings to generate iOS bindings and package them for integration into iOS projects.
  5. Included a new GitHub Actions workflow .github/workflows/update-ios-package.yml to test the bindings and automatically update the iOS package with the latest bindings when a new release of EZKL comes out.

Next Steps:

We should consider migrating the iOS EZKL package under the zkonduit organization to better streamline the development process.

Future Considerations:

A larger refactor could further simplify the code by avoiding the need to use cfg(not(any(target_os = "ios", target_arch = "wasm32"))) for functions that should be excluded from the bindings. Moving such functions into a separate module would reduce the number of changes introduced by this PR and improve code clarity.

@ElusAegis ElusAegis force-pushed the fork/ios-bindings-lean branch from ef59418 to d09b089 Compare October 1, 2024 13:16
@alexander-camuto
Copy link
Collaborator

@ElusAegis wasm tests are currently cooked because of relative imports :)

@ElusAegis ElusAegis force-pushed the fork/ios-bindings-lean branch from d09b089 to b31ad4f Compare October 16, 2024 08:11
@ElusAegis
Copy link
Contributor Author

@alexander-camuto I think this is ready for another review

Key Updates since last review:

  1. Added ios-integration-tests to be run locally, that required to patch uniffi_testing crate, which has an issue submitted to resolve this. This also required to add the build.rs file to set up correct ENV variable for the ios bindings test. Optionally, we could remove build.rs and instead force users to set this variable before running the tests.
  2. Moved from using target_os = "ios" to a specific feature for ios bindings - ios-bindings. Additionally added ios-bindings-test feature for the tests. This is useful to enable some test dependencies only when testing, thus making the bindings leaner.
  3. Restructured the Cargo.toml file to optimise out dependencies that are not needed for ios and wasm bindings, such as clap. Additionally, cleaned up the code, so that it would compile with --no-default-features flag, by conditinally compiling some modules only when feature ezkl is enabled (which was previously gated by target_arch = "wasm32". This is useful when we want to have as lean version of EZKL as possible, for for example ios bindings.
  4. Fixed crate dependency issue for wasm tests.
  5. Added ios-integration-tests and swift-package-tests to rust.yml to test the ios bindings and ios bindings package.

Next Steps:

  1. To finish integration, we need to move the iOS EZKL Swift Package under the zkonduit control and correctly setup repository secrets to enable the update-ios-package.yml to function and push releases.

    Possibly, update-ios-package.yml can be integrated into release workflow.

@alexander-camuto
Copy link
Collaborator

@ElusAegis a few conflicts to resolve given the reusable verifier merge and then will merge in

@alexander-camuto alexander-camuto changed the title feat: Integrating iOS Bindings for the EZKL Library feat: iOS Bindings Oct 22, 2024
…e more logic between wasm and universal bindings
Removed import that was never compiled but was invalid
Fixed how we patch the `halo2_proofs` dependency to stop the resolution error.
@ElusAegis ElusAegis force-pushed the fork/ios-bindings-lean branch from 1b3654a to 9f370ee Compare October 22, 2024 15:20
@alexander-camuto alexander-camuto merged commit 1cb1b6e into zkonduit:main Oct 23, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants