forked from matter-labs/zksync-era
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(prover): merging key generation into a single binary (matter-lab…
…s#1101) ## What ❔ * Merging 3 different key generation steps into a single binary * Added 'clap' support with arguments to select what keys should be created. * Also started printing out the md5sum of the generated setup keys, for easier debugging. ## Why ❔ * Having it in one binary is cleaner, and will allow new things (like checking the validity of all the keys) in the next steps. * There will be a separate PR to update our nighly/manual workflows.
- Loading branch information
Showing
10 changed files
with
367 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -896,3 +896,4 @@ downcasting | |
parameterized | ||
reimplementation | ||
composability | ||
md5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,52 @@ | ||
# Setup data and VK generator and server | ||
# Circuit key generator | ||
|
||
Tool for generating different type of circuit related keys: | ||
|
||
- verification keys | ||
- setup keys (for CPU and GPU) | ||
- commitments | ||
|
||
## Verification keys | ||
|
||
The current set of verification keys is committed under 'data/' directory. If you want to refresh it (for example after | ||
circuit changes), first please make sure that you have a CRS file (used for SNARK key), and then you can run: | ||
|
||
```shell | ||
CRS_FILE=yyy ZKSYNC_HOME=xxx cargo run --release --bin key_generator generate-vk | ||
``` | ||
|
||
### CRS FILE | ||
|
||
The SNARK VK generation requires the `CRS_FILE` environment variable to be present and point to the correct file. The | ||
file can be downloaded from the following | ||
[link](https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2^26.key) its also present in dir after | ||
zk init keys/setup/setup_2^26.key | ||
file can be downloaded (around 1GB) from the following | ||
[link](https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2^24.key) its also present in dir after | ||
zk init keys/setup/setup_2^24.key | ||
|
||
## Commitments | ||
|
||
Commitments is basically a 'hash' of the verification keys, that is used in our configuration, and also in Verifier.sol. | ||
|
||
## generating setup-data for specific circuit type | ||
You can run it with `dry-run`, to see the results, or set `dry-run` to false to update the config in | ||
`etc/env/base/contracts.toml`. | ||
|
||
`zk f cargo +nightly-2023-08-21 run --release --bin zksync_setup_data_generator_fri -- --numeric-circuit 1 --is_base_layer` | ||
```shell | ||
ZKSYNC_HOME=xxx cargo run --release --bin key_generator update-commitments --dry-run=true | ||
``` | ||
|
||
## generating GPU setup-data for specific circuit type | ||
## Setup keys | ||
|
||
`zk f cargo +nightly-2023-08-21 run --features "gpu" --release --bin zksync_setup_data_generator_fri -- --numeric-circuit 1 --is_base_layer` | ||
Setup keys are used when you run the actual prover. They are around 15GB for each circuit type, and we have different | ||
setup keys for GPU vs CPU prover. | ||
|
||
## Generating VK's | ||
For example, the command below will generate the setup keys for the basic circuit of type 3. | ||
|
||
`cargo +nightly-2023-08-21 run --release --bin zksync_vk_generator_fri` | ||
```shell | ||
ZKSYNC_HOME=xxx cargo run --release --bin key_generator generate-sk basic 3 | ||
``` | ||
|
||
## generating VK commitment for existing VK's | ||
And command below will generate all the GPU keys (notice that we have to build with 'gpu' feature enabled, as this adds | ||
additional dependencies). | ||
|
||
`cargo +nightly-2023-08-21 run --release --bin zksync_commitment_generator_fri` | ||
```shell | ||
ZKSYNC_HOME=xxx cargo run --feature=gpu --release --bin key_generator generate-sk-gpu all | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.