feat: load zkey from a file path, add file downloader in swift
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
ARKZKEYand.arkzkeyUsingARKZKEYis even slightly slower than loading from a.arkzkeyfile
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
What's needed for this PR to be ready for review/merge? Can we gate this feature behind a feature flag maybe? So existing flow works but this can be toggled. Also basic docs in README or so would be great
@vivianjeng can this PR be closed with #75 merged?