proof-systems icon indicating copy to clipboard operation
proof-systems copied to clipboard

[berkeley] Update curves to arkworks 0.4.2

Open mrmr1993 opened this issue 1 year ago • 1 comments

This is https://github.com/o1-labs/proof-systems/pull/1669 merged into the berkeley branch

mrmr1993 avatar Jan 03 '24 20:01 mrmr1993

Running tests on the Mina branch here, this seems to make proving 2x slower. We should not merge this.

Edit to add data: Timings before this PR:

$ _build/default/src/app/cli/src/mina.exe transaction-snark-profiler --zkapps --k 1 --max-num-updates 4 --min-num-updates 2

Generated zkapp transactions with 5 updates and 4 proof updates in 6.300628 secs
Generated updates permutation 0: SPPPP
Updating authorizations...
Processing zkApp 1 of 17, other_parties length: 2
Verifying zkapp with 3 signatures and 0 proofs took 0.002365 secs
Time for zkApp 1: 20.694s
Processing zkApp 2 of 17, other_parties length: 2
Verifying zkapp with 2 signatures and 1 proofs took 0.604060 secs
Time for zkApp 2: 15.872s
Processing zkApp 3 of 17, other_parties length: 2
Verifying zkapp with 2 signatures and 1 proofs took 0.002470 secs
Time for zkApp 3: 22.776s
Processing zkApp 4 of 17, other_parties length: 2
Verifying zkapp with 1 signatures and 2 proofs took 0.002355 secs
Time for zkApp 4: 24.137s
Processing zkApp 5 of 17, other_parties length: 3
Verifying zkapp with 4 signatures and 0 proofs took 0.002368 secs
Time for zkApp 5: 14.43s
Processing zkApp 6 of 17, other_parties length: 3
Verifying zkapp with 3 signatures and 1 proofs took 0.002401 secs
Time for zkApp 6: 23.847s
Processing zkApp 7 of 17, other_parties length: 3
Verifying zkapp with 2 signatures and 2 proofs took 0.002738 secs
Time for zkApp 7: 25.095s
Processing zkApp 8 of 17, other_parties length: 3
Verifying zkapp with 2 signatures and 2 proofs took 0.002352 secs
Time for zkApp 8: 32.991s
Processing zkApp 9 of 17, other_parties length: 3
Verifying zkapp with 1 signatures and 3 proofs took 0.002609 secs
Time for zkApp 9: 34.68s
Processing zkApp 10 of 17, other_parties length: 4
Verifying zkapp with 5 signatures and 0 proofs took 0.002789 secs
Time for zkApp 10: 23.088s
Processing zkApp 11 of 17, other_parties length: 4
Verifying zkapp with 4 signatures and 1 proofs took 0.002901 secs
Time for zkApp 11: 24.998s
Processing zkApp 12 of 17, other_parties length: 4
Verifying zkapp with 4 signatures and 1 proofs took 0.003747 secs
Time for zkApp 12: 32.638s
Processing zkApp 13 of 17, other_parties length: 4
Verifying zkapp with 3 signatures and 2 proofs took 0.002984 secs
Time for zkApp 13: 41.894s
Processing zkApp 14 of 17, other_parties length: 4
Verifying zkapp with 3 signatures and 2 proofs took 0.002567 secs
Time for zkApp 14: 33.659s
Processing zkApp 15 of 17, other_parties length: 4
Verifying zkapp with 2 signatures and 3 proofs took 0.004652 secs
Time for zkApp 15: 35.761s
Processing zkApp 16 of 17, other_parties length: 4
Verifying zkapp with 2 signatures and 3 proofs took 0.002736 secs
Time for zkApp 16: 43.255s
Processing zkApp 17 of 17, other_parties length: 4
Verifying zkapp with 1 signatures and 4 proofs took 0.002970 secs
Time for zkApp 17: 45.625s
| No.| Proof updates| Non-proof pairs| Non-proof singles| Mempool verification time (sec)| Transaction proving time (sec)|Permutation|
 |--|--|--|--|--|--|--|
| 1| 0| 1| 1| 0.002365| 20.694345| SSS|
| 2| 1| 0| 2| 0.002470| 22.776458| SPS|
| 3| 1| 1| 0| 0.604060| 15.871737| SSP|
| 4| 2| 0| 1| 0.002355| 24.137423| SPP|
| 5| 0| 2| 0| 0.002368| 14.430063| SSSS|
| 6| 1| 1| 1| 0.002401| 23.846874| SPSS|
| 7| 2| 0| 2| 0.002352| 32.990512| SPPS|
| 8| 2| 1| 0| 0.002738| 25.095145| SSPP|
| 9| 3| 0| 1| 0.002609| 34.680144| SPPP|
| 10| 0| 2| 1| 0.002789| 23.088323| SSSSS|
| 11| 1| 1| 2| 0.003747| 32.637736| SPSSS|
| 12| 1| 2| 0| 0.002901| 24.998281| SSPSS|
| 13| 2| 0| 3| 0.002984| 41.893913| SPSPS|
| 14| 2| 1| 1| 0.002567| 33.659293| SPPSS|
| 15| 3| 0| 2| 0.002736| 43.255040| SPPPS|
| 16| 3| 1| 0| 0.004652| 35.761468| SSPPP|
| 17| 4| 0| 1| 0.002970| 45.624724| SPPPP|
[1] Total time was: 8.272m

Timings after this PR:

Generated zkapp transactions with 5 updates and 4 proof updates in 6.383173 secs
Generated updates permutation 0: SPPPP
Updating authorizations...
Processing zkApp 1 of 17, other_parties length: 2
Verifying zkapp with 3 signatures and 0 proofs took 0.002930 secs
Time for zkApp 1: 53.161s
Processing zkApp 2 of 17, other_parties length: 2
Verifying zkapp with 2 signatures and 1 proofs took 0.612038 secs
Time for zkApp 2: 31.853s
Processing zkApp 3 of 17, other_parties length: 2
Verifying zkapp with 2 signatures and 1 proofs took 0.002774 secs
Time for zkApp 3: 48.201s
Processing zkApp 4 of 17, other_parties length: 2
Verifying zkapp with 1 signatures and 2 proofs took 0.002442 secs
Time for zkApp 4: 51.157s
Processing zkApp 5 of 17, other_parties length: 3
Verifying zkapp with 4 signatures and 0 proofs took 0.003283 secs
Time for zkApp 5: 28.792s
Processing zkApp 6 of 17, other_parties length: 3
Verifying zkapp with 3 signatures and 1 proofs took 0.002715 secs
Time for zkApp 6: 49.651s
Processing zkApp 7 of 17, other_parties length: 3
Verifying zkapp with 2 signatures and 2 proofs took 0.004829 secs
Time for zkApp 7: 52.388s
Processing zkApp 8 of 17, other_parties length: 3
Verifying zkapp with 2 signatures and 2 proofs took 0.004929 secs
Time for zkApp 8: 1.164m
Processing zkApp 9 of 17, other_parties length: 3
Verifying zkapp with 1 signatures and 3 proofs took 0.002663 secs
Time for zkApp 9: 1.219m
Processing zkApp 10 of 17, other_parties length: 4
Verifying zkapp with 5 signatures and 0 proofs took 0.003276 secs
Time for zkApp 10: 47.745s
Processing zkApp 11 of 17, other_parties length: 4
Verifying zkapp with 4 signatures and 1 proofs took 0.003769 secs
Time for zkApp 11: 50.607s
Processing zkApp 12 of 17, other_parties length: 4
Verifying zkapp with 4 signatures and 1 proofs took 0.003983 secs
Time for zkApp 12: 1.14m
Processing zkApp 13 of 17, other_parties length: 4
Verifying zkapp with 3 signatures and 2 proofs took 0.003074 secs
Time for zkApp 13: 1.489m
Processing zkApp 14 of 17, other_parties length: 4
Verifying zkapp with 3 signatures and 2 proofs took 0.003038 secs
Time for zkApp 14: 1.187m
Processing zkApp 15 of 17, other_parties length: 4
Verifying zkapp with 2 signatures and 3 proofs took 0.002754 secs
Time for zkApp 15: 1.236m
Processing zkApp 16 of 17, other_parties length: 4
Verifying zkapp with 2 signatures and 3 proofs took 0.003031 secs
Time for zkApp 16: 1.532m
Processing zkApp 17 of 17, other_parties length: 4
Verifying zkapp with 1 signatures and 4 proofs took 0.003037 secs
Time for zkApp 17: 1.582m
| No.| Proof updates| Non-proof pairs| Non-proof singles| Mempool verification time (sec)| Transaction proving time (sec)|Permutation|
 |--|--|--|--|--|--|--|
| 1| 0| 1| 1| 0.002930| 53.160738| SSS|
| 2| 1| 0| 2| 0.002774| 48.200625| SPS|
| 3| 1| 1| 0| 0.612038| 31.852615| SSP|
| 4| 2| 0| 1| 0.002442| 51.156749| SPP|
| 5| 0| 2| 0| 0.003283| 28.791780| SSSS|
| 6| 1| 1| 1| 0.002715| 49.650702| SPSS|
| 7| 2| 0| 2| 0.004929| 69.849299| SPPS|
| 8| 2| 1| 0| 0.004829| 52.387931| SSPP|
| 9| 3| 0| 1| 0.002663| 73.147020| SPPP|
| 10| 0| 2| 1| 0.003276| 47.745237| SSSSS|
| 11| 1| 1| 2| 0.003983| 68.412828| SPSSS|
| 12| 1| 2| 0| 0.003769| 50.607022| SSPSS|
| 13| 2| 0| 3| 0.003074| 89.325761| SPSPS|
| 14| 2| 1| 1| 0.003038| 71.209501| SPPSS|
| 15| 3| 0| 2| 0.003031| 91.921837| SPPPS|
| 16| 3| 1| 0| 0.002754| 74.181963| SSPPP|
| 17| 4| 0| 1| 0.003037| 94.918280| SPPPP|
[1] Total time was: 17.458m

mrmr1993 avatar Jan 04 '24 02:01 mrmr1993

For my notes: cargo test --package kimchi --lib -- tests::serde::tests::test_srs_serialization --exact --nocapture fails for me on this branch.

Serialization format has changed:

ї> cat testelement.srs 
��A�*��#z�qG=3�[e�T�xc��S|�
��t13:35:17 [volhovm@asher] ~/code/proof-systems/srs (volhovm/arkworks042-compatible-debug) 
ї> cat testelement_orig.srs 
��!*��#z�qG=3�[e�T�xc��S|�
��t

(in volhovm/arkworks042-compatible-debug)

For more details see:

  • https://github.com/arkworks-rs/algebra/blob/master/CHANGELOG.md
    • ("New serialization format for Short Weierstrass curves")
  • https://github.com/arkworks-rs/algebra/pull/463

volhovm avatar Aug 19 '24 13:08 volhovm

Upd: serialization solved in https://github.com/o1-labs/proof-systems/pull/2474 + added a test.

volhovm avatar Aug 20 '24 12:08 volhovm