-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from celo-org/victor/update-readme
update the readme to be a bit more clear
- Loading branch information
Showing
1 changed file
with
36 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,42 @@ | ||
# celo-zprize | ||
# ZPrize MSM on Mobile Reference Test Harness | ||
|
||
Example testing harness for the "[Accelerating Mobile Proving](https://www.zprize.io/prizes/accelerating-mobile-proving)" challenge in ZPrize 2022. | ||
Example and reference testing harness for the "[Accelerating MSM on Mobile](https://www.zprize.io/prizes/accelerating-mobile-proving)" challenge in ZPrize 2022. | ||
|
||
To build, download [Android Studio](https://developer.android.com/studio) and open `android/Zprize/app`. Then use Android Studio's device manager to select either an | ||
emulator or physical device, and install the app on that device using the "Run app" button. | ||
## Build | ||
|
||
To rebuild the Rust API, download the [cross](https://github.com/cross-rs/cross) crate. Then run `cross build --target armv7-linux-androideabi --release`, | ||
then copy `target/armv7-linux-androideabi/release/libcelo_zprize.so` to `android/ZPrize/app/src/main/jniLibs/armeabi-v7a/libmsm.so`. Then reinstall the app as normal. | ||
### Android app | ||
|
||
To modify the fixed test vectors, add the new test vector files to `android/ZPrize/app/src/main/assets/`. | ||
Building the Android app can be accomplished with Android Studio: | ||
1. Download [Android Studio](https://developer.android.com/studio) and install the Android API 32 platform, NDK, and Android SDK Platform tools through the SDK Manager. | ||
2. Open `android/Zprize` in Android Studio. | ||
3. Use Android Studio's device manager to select either an emulator or physical device. | ||
4. Install the app on that device using the Run > Run 'app' menu action. | ||
|
||
To run `src/main.rs`, run `cargo run --release`. | ||
### Rust library | ||
|
||
On a Galaxy A13, output files were stored to `data/data/com.example.zprize/files/`. The output group elements of the MSM, one per iteration, are stored in `result.txt`. The time per iteration is recorded in `resulttimes.txt`. When running test vectors, the files will contain the results for each vector of inputs in sequence. | ||
Prebuilt libraries are available in this repository as `android/ZPrize/app/src/main/jniLibs/armeabi-v7a`. | ||
When you modify the Rust libraries, build the modified library for inclusion in the Android app: | ||
1. Download the [cross](https://github.com/cross-rs/cross) crate. | ||
2. Run `cross build --target armv7-linux-androideabi --release` | ||
3. Copy `target/armv7-linux-androideabi/release/libcelo_zprize.so` to `android/ZPrize/app/src/main/jniLibs/armeabi-v7a/libmsm.so`. | ||
4. Rebuild and install the app as described above. | ||
|
||
## Test vectors | ||
|
||
A number of static test vectors to check the basic correctness of the MSM implementation are | ||
included, as described in the prize specification. | ||
|
||
<!-- TODO How is someone supposed to generate new test vector file. It seems to be a non-obvious binary format --> | ||
To modify the fixed test vectors, add the new test vector files to `android/ZPrize/app/src/main/assets/` | ||
|
||
## Benchmarking on host | ||
|
||
You can run a benchmark locally (on your computer) with run `cargo run --release`. The local | ||
benchmark is defined in `src/main.rs`. | ||
|
||
## Benchmarking on device | ||
|
||
On the Android device, output files were stored to `data/data/com.example.zprize/files/`. | ||
The output group elements of the MSM, one per iteration, are stored in `result.txt`. | ||
The time per iteration is recorded in `resulttimes.txt`. | ||
When running test vectors, the files will contain the results for each vector of inputs in sequence. |