Skip to content

perf/refac: Groth16 MPC setup improvements #1428

@ivokub

Description

@ivokub

Collecting tasks from #1372:

  • currently in Phase 2 in Initialize method we first obtain coeffTau1, coeffTau2, coeffAlphaTau1 and coeffBetaTau1 and then compute the updated Phase2 key from the circuit description (the big loop which iterates over constraints). This means that we first need to allocate possibly very big slices and then perform computations on the slice elements. Maybe (needs to be benchmarked) it is fine if we only allocate every slice individually and then iterate for every slice the constraints separately. For large circuits this could potentially save tens of GBs of memory we need to allocate.
  • for the serialization we could additionally implement io.UnsafeReaderFrom and io.BinaryDumper interfaces. The idea is that when the sequencer stores the contributions, then it doesn't have to do expensive checks when restoring state from storage.
    • However, when we implement io.UnsafeReaderFrom then we need to consider that the Verify methods of Phase1 and Phase2 do not explicitly do subgroup checks and depend that the subgroups checks are done at deserialization. So keep in mind when implementing
  • allow providing randomness source directly to the contribution. We currently by default use rand.Reader which is secure, but in some cases would wan't to use something else (for example for some ceremonial contributions ).
  • in srsCommons.update method we currently don't parallelize the computations. We could do it quite nicely as every loop depends directly on tau, so it should be sufficient if we only compute the starting points tau, tau^k, tau^2k etc.
  • we should be able to provide the hash function as a parameter when computing challenge. It would allow to do cool things like SNARK proofs of ceremony contribution correctness

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions