Skip to content

Prevent cleanDir(localPaths.zkeys) if zkeys and pot are present (to avoid double computing) #350

@NicoSerranoP

Description

@NicoSerranoP

Prerequisites

Please answer the following question for yourself before submitting a feature request.

  • I checked to make sure that this request has not already been filed

Motivation

When setting up a ceremony we compute the first zkey for each circuit. This computation function takes the .r1cs, .wasm and .ptau files and outputs the .zkeys files.

  1. The zkey generation computation could be expensive depending on the circuit's size
  2. The .ptau download could take time depending on the file's size

Details

Before starting the setup process, we clean the working directory (specifically the /output directory):
https://github.com/privacy-scaling-explorations/p0tion/blob/085b7949650e46d8d23b09366e2fc5afc2d08dbe/packages/phase2cli/src/commands/setup.ts#L499

In this directory there could be files from previous failed setup processes that could we useful as a starting point. My first idea was to get rid of this 4 cleanDir commands but I think it would be better to tell the user that he could put in there the .zkeys and .ptau files he already has and ask the user if he wants to delete the directory if he needs a clean start.

Remember that not this feature is not related to that code section only but also in:

  1. the .ptau download step should be skipped if the file is already there (remember to check inside the /output directory:
    https://github.com/privacy-scaling-explorations/p0tion/blob/085b7949650e46d8d23b09366e2fc5afc2d08dbe/packages/phase2cli/src/commands/setup.ts#L284

  2. the zkey computation process, there should be a checking step to see if there is already a file there:
    https://github.com/privacy-scaling-explorations/p0tion/blob/085b7949650e46d8d23b09366e2fc5afc2d08dbe/packages/phase2cli/src/commands/setup.ts#L547

Make sure that you have reviewed p0tion's Contributor Guidelines

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions