Skip to content

Commit

Permalink
fix: update README for fixed SRS files for hyperplonk backend
Browse files Browse the repository at this point in the history
  • Loading branch information
sifnoc committed Jul 12, 2024
1 parent 4868174 commit 0a1deb2
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 7 deletions.
44 changes: 40 additions & 4 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,48 @@ Key Features:

Before testing or running the Summa backend, you must download the ptau file, which contains the Powers of Tau trusted setup parameters essential for building the ZK circuits. Specifically, the `hermez-raw-hyperplonk-17` file is required for the [Summa flow](./examples/summa_solvency_flow.rs) example and its associated test case.

You can find this and other necessary files at https://github.com/sifnoc/halo2-kzg-srs. To download `hermez-raw-hyperplonk-17`, use the following command:
You can generate this through `hyperplonk-srs-generator` in [summa-dev/plonkish](https://github.com/summa-dev/plonkish). Also, It can be downloaded `hermez-raw-hyperplonk-17`, use the following command:

```
wget https://trusted-setup-halo2kzg.s3.eu-central-1.amazonaws.com/hermez-raw-plonkish-17
wget https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-17
```

<details>
<summary>Additional Hermez Files Available Here</summary>

| Curve | Source | K | File in raw format |
| ------- | ------- | ---- | -------------------------------------------------------------------------------------------------------------------- |
| `bn254` | `hermez`| `1` | [hermez-raw-hyperplonk-1](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-1) |
| `bn254` | `hermez`| `2` | [hermez-raw-hyperplonk-2](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-2) |
| `bn254` | `hermez`| `3` | [hermez-raw-hyperplonk-3](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-3) |
| `bn254` | `hermez`| `4` | [hermez-raw-hyperplonk-4](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-4) |
| `bn254` | `hermez`| `5` | [hermez-raw-hyperplonk-5](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-5) |
| `bn254` | `hermez`| `6` | [hermez-raw-hyperplonk-6](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-6) |
| `bn254` | `hermez`| `7` | [hermez-raw-hyperplonk-7](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-7) |
| `bn254` | `hermez`| `8` | [hermez-raw-hyperplonk-8](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-8) |
| `bn254` | `hermez`| `9` | [hermez-raw-hyperplonk-9](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-9) |
| `bn254` | `hermez`| `10` | [hermez-raw-hyperplonk-10](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-10) |
| `bn254` | `hermez`| `11` | [hermez-raw-hyperplonk-11](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-11) |
| `bn254` | `hermez`| `12` | [hermez-raw-hyperplonk-12](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-12) |
| `bn254` | `hermez`| `13` | [hermez-raw-hyperplonk-13](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-13) |
| `bn254` | `hermez`| `14` | [hermez-raw-hyperplonk-14](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-14) |
| `bn254` | `hermez`| `15` | [hermez-raw-hyperplonk-15](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-15) |
| `bn254` | `hermez`| `16` | [hermez-raw-hyperplonk-16](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-16) |
| `bn254` | `hermez`| `17` | [hermez-raw-hyperplonk-17](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-17) |
| `bn254` | `hermez`| `18` | [hermez-raw-hyperplonk-18](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-18) |
| `bn254` | `hermez`| `19` | [hermez-raw-hyperplonk-19](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-19) |
| `bn254` | `hermez`| `20` | [hermez-raw-hyperplonk-20](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-20) |
| `bn254` | `hermez`| `21` | [hermez-raw-hyperplonk-21](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-21) |
| `bn254` | `hermez`| `22` | [hermez-raw-hyperplonk-22](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-22) |
| `bn254` | `hermez`| `23` | [hermez-raw-hyperplonk-23](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-23) |
| `bn254` | `hermez`| `24` | [hermez-raw-hyperplonk-24](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-24) |
| `bn254` | `hermez`| `25` | [hermez-raw-hyperplonk-25](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hermez-raw-hyperplonk-25) |
| `bn254` | `hermez`| `26` | |
| `bn254` | `hermez`| `27` | |

We have not generated files for K values greater than 25. Please contact us if these are necessary.
</details><br>

Ensure this file is downloaded before proceeding with the example or test case.

## Running Test
Expand Down Expand Up @@ -56,10 +92,10 @@ Without the CEX publishing the commitment, users cannot verify their inclusion p
In this step, we'll guide you through the process of generating a commitment using the `Round` component.
The `Round` serves as the core of the backend in Summa, and we have briefly described it in the Components section.

To initialize the `Round` instance, you'll need the paths to the liabilities CSV file (`entry_16.csv`) and the `ptau/hermez-raw-plonkish-17` file. These files serve the following purposes:
To initialize the `Round` instance, you'll need the paths to the liabilities CSV file (`entry_16.csv`) and the `ptau/hermez-raw-hyperplonk-17` file. These files serve the following purposes:

- `entry_16.csv`: contains the username and liabilities entries for each CEX user (necessary to build the commitment). Liabilities column names have the following format: `balance_<CRYPTOCURRENCY>_<CHAIN>`, where <CRYPTOCURRENCY> and <CHAIN> are the names of the cryptocurrencies and their corresponding blockchains.
- `ptau/hermez-raw-plonkish-17`: contains parameters for constructing the zk circuits.
- `ptau/hermez-raw-hyperplonk-17`: contains parameters for constructing the zk circuits.

If this step runs successfully, you will see the following message:

Expand Down
2 changes: 1 addition & 1 deletion backend/examples/summa_solvency_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn main() {
let (circuit_info, circuit) = circuit_fn(num_vars as usize);
let instances = circuit.instances();

let param = ProvingBackend::setup_custom("../backend/ptau/hermez-raw-plonkish-17").unwrap();
let param = ProvingBackend::setup_custom("../backend/ptau/hermez-raw-hyperplonk-17").unwrap();
let (pp, vp) = ProvingBackend::preprocess(&param, &circuit_info).unwrap();

let (advice_polys, proof_transcript) = {
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion backend/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod test {
const K: u32 = 17;
const N_CURRENCIES: usize = 2;
const N_USERS: usize = 16;
const PARAMS_PATH: &str = "../backend/ptau/hermez-raw-plonkish-17";
const PARAMS_PATH: &str = "../backend/ptau/hermez-raw-hyperplonk-17";

#[test]
fn test_round_features() {
Expand Down
2 changes: 1 addition & 1 deletion prover/src/circuits/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn test_summa_hyperplonk() {
let (circuit_info, circuit) = circuit_fn(num_vars as usize);
let instances = circuit.instances();

let param = ProvingBackend::setup_custom("../backend/ptau/hermez-raw-plonkish-17").unwrap();
let param = ProvingBackend::setup_custom("../backend/ptau/hermez-raw-hyperplonk-17").unwrap();

let (prover_parameters, verifier_parameters) =
ProvingBackend::preprocess(&param, &circuit_info).unwrap();
Expand Down

0 comments on commit 0a1deb2

Please sign in to comment.