Skip to content

Protocol 3 Testing

Brecht Devos edited this page May 9, 2019 · 13 revisions

Large blocks

Getting started

  • Make a build with multi-threading enabled, otherwise the proof generation will be very slow. This currently only works on Linux:

    • You will need to build from the protocol_v3 project. Follow the build instructions here.
    • in protocols/packages/loopring_v3/Makefile change CMAKE_TYPE := cmake-release to CMAKE_TYPE := cmake-openmp-release
    • Run make again.
    • That's it.
    • [Optional steps below, NOT NEEDED IF EVERYTHING IS WORKING AS EXPECTED]
    • To check if everything is working correctly you can do the following steps:
    • In lightcone2/circuit/main.cpp, before #ifdef MULTICORE at the top of the file, add #define MULTICORE 1. This will print the number of cores used.
    • You can manually set the number of threads that will be created by adding omp_set_num_threads([N]); before const int max_threads = omp_get_max_threads();. [N] is the number of threads you want.
  • One time step: For testing you can just create new keys, for production these keys are generated in the trusted setup. The proving key is very large!

dex_circuit -createkeys [inBlock.json]

Make sure you have a keys folder in your working directory.

  • Proving a block

dex_circuit -prove [inBlock.json] [outProof.json]

If the necessary keys aren't generated yet this will also generate the keys.

System requirements

Requirements increase linearly with the number of constraints.

For the maximum 256M constraints (~512 ring settlements):

  • Memory: Up to ~512GB. Yes, this is memory (not storage). 512GB RAM is probably very expensive (if even possible), having a large swap file on an SSD is probably more realistic to make sure we don't go out of memory. Still, the more RAM the better. When testing with a swap file I noticed long periods of time the CPU wasn't doing much, I suspect it was swapping data in and out of RAM.

  • Storage: The proving key is ~120GB. This data is read at the start so this probably doesn't need to be on a quick drive. If we need to use a swap file we also need enough quick storage to store that. The blocks and the proofs are very small.

Performance

32M constraints 64M constraints 128M constraints 256M constraints
i7 (4 cores), 16GB RAM, SSD ~19 minutes ~55 minutes ~114 minutes

Generating the keys takes a bit longer than creating a proof, but that doesn't matter because it only needs to be done once for a circuit.

nothing here

Clone this wiki locally