mopro icon indicating copy to clipboard operation
mopro copied to clipboard

feat: load zkey from a file path, add file downloader in swift

Open vivianjeng opened this issue 1 year ago • 2 comments

Research for #65

TODO

  • [ ] use #[cfg(feature = "use_external_zkey")] to control features
  • [x] download and load arkzkey in initializeMopro (See 3.)
  • [ ] download file in android and use it in proof
  • [ ] benchmark different size of arkzkeys
  • [ ] try on real device

load from a fixed path e.g. "mopro-core/examples/circom/keccak256/target/keccak256_256_test_final.arkzkey" proving time in swift

Time to deserialize proving key: 9.177727583s
Time to deserialize matrices: 70.397416ms
Initializing arkzkey took: 9.25s

Generating proof 2
Witness generation took: 423.89ms
Loading arkzkey took: 26.66ms

proof generation took: 1.36s

there is no much difference between using ARKZKEY and .arkzkey Using ARKZKEY is even slightly slower than loading from a .arkzkey file

download from a server e.g. "https://mopro.vivianjeng.xyz/keccak256_256_test_final.arkzkey"

Download ark key took: 0.021011948585510254

Time to deserialize proving key: 8.894824041s
Time to deserialize matrices: 26.038125ms
Initializing arkzkey took: 8.92s

Generating proof 2
Witness generation took: 410.84ms

// TODO: should be done in initialization
Time to deserialize proving key: 8.895085333s
Time to deserialize matrices: 24.071833ms
Loading arkzkey took: 8.94s
proof generation took: 979.47ms

Init with arkzkey initialization

Time to deserialize proving key: 8.930367541s
Time to deserialize matrices: 24.104291ms

Generating proof 2
Witness generation took: 429.28ms
Loading arkzkey took: 208.00ns
proof generation took: 963.43ms

Verification time 2: 3.227791ms

vivianjeng avatar Feb 02 '24 07:02 vivianjeng