-
Notifications
You must be signed in to change notification settings - Fork 35
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
Halo2 circuit in mopro (redesigned) #214
Conversation
…e based on settup of `mopro-ffi` flag
…name for matching
…` circom optional and moving `one-cell` as mandatory
…ferent `adapters`
…ferent `adapters`
48fb2eb
to
048e534
Compare
@vimwitch @vivianjeng I have finished the PR. Can you please have a look. Key changes were to I have it now recursively call I have also played with how the I have added tests for iOS, however I have not updated Android as I am still unable to compile it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely moving in the right direction. Just need to pull some logic out of test-e2e
and get rid of a couple macros in favor of written functions.
@vimwitch thank you for the review, I agree with all of it besides how we show the setup to users. Will get to improving the |
04fb870
to
8eea240
Compare
…ding any state variables
…inputs in groups of 2
…uts in groups of 4, and removed dependency on the lazily loaded statics
…nacci into a seperate repository
Halo2 Mopro Samples:
|
Benchmarking:
RSA:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work, this is just about ready to merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Some places I think it can be simplified as I commented
and some comment messages can be written in docs (can be in the following PRs)
# Conflicts: # Cargo.lock # mopro-ffi/Cargo.toml
@vivianjeng thank you for the review, I have implemented the suggestions. However, after I have merged with the main and updated Cargo.lock it no longer runs the I do remember we had some problems with non-determinism, could it be one of them? Or was there something in the recent PR that was merged that could have impacted it? I looked at it and nothing seems to be able to break the process at that point. |
The iOS simulator on github has intermittent failures 😭. Usually if you read the log it will say something like "timed out" or similar. |
Proposition on how we could add Halo2 Circuits to redesigned Mopro.
Overview
I attempted to be as consistent as possible to
Circom
implementation, resulting in defining two typesHalo2ProveFn
andHalo2VerifyFn
which we expect the user to implement locally and then use thekey_halo2_circuit_map
as a way to map between different circuits and their implementations of prove and verify functions._Note that as Halo2 is a library, there is very little shared components, hence
Mopro
only defines these two types as well as useskey_halo2_circuit_map
to invoke correct function at run time. _Halo2 Module in
test-e2e
I have also added a
halo2
module in thetest-e2e
crate. It does not contain a halo2 circuit logic (I have extracted it into another repository as discussed before - https://github.com/ElusAegis/halo2-fibonacci-sample.git, which can be forked into Mopro organisation). What it has is logic to interface with the circuit, implementing logic to parse and prove the values.As each circuit can use its own types, I did not see a way to abstract it away without enforcing strict user limitations. So
halo2
is an example which users would need to reproduce. (Halo2 requires quite a bit of background knowledge).Halo2/Circom Features
Currently, all users must use both Halo2 and Circom (define
key_halo2_circuit_map
andzkey_witness_map
. I have given a thought to how we could be able to disable and enable each of them, however with current design that does not seem to be possible unless we add something likehalo2_placeholder!()
which users need to specify if they do not use Halo2. This does not seem ideal UX.Hence @vimwitch @vivianjeng , perhaps you have some views on how we could be able to do this? We may need to do something different than the current approach of making a user define a particular function.