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 20, 2024
1 parent 4868174 commit 2d878e4
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ A monorepo for Summa, zk proof of solvency protocol

### Subdirectories

- `prover`: Halo2 based zk prover and KZG polynomial interpolation for Summa
- `backend` : Rust API to interact with Summa
- `prover`: HyperPlonk based ZK prover and Multilinear KZG for Summa
- `backend` : Rust API to interact with Summa prover and verifier

## License

Expand Down
41 changes: 30 additions & 11 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,40 @@ Key Features:

## Prerequisites

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.
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 Summa circuits. Specifically, the `hyperplonk-srs-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 `hyperplonk-srs-17`, use the following command:

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

<details>
<summary>Additional hermez files are available here</summary>

| Curve | Source | K | File in raw format |
| ------- | ------- | ---- | -------------------------------------------------------------------------------------------------------------------- |
| `bn254` | `hermez`| `17` | [hyperplonk-srs-17](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hyperplonk-srs-17) |
| `bn254` | `hermez`| `18` | [hyperplonk-srs-18](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hyperplonk-srs-18) |
| `bn254` | `hermez`| `19` | [hyperplonk-srs-19](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hyperplonk-srs-19) |
| `bn254` | `hermez`| `20` | [hyperplonk-srs-20](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hyperplonk-srs-20) |
| `bn254` | `hermez`| `21` | [hyperplonk-srs-21](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hyperplonk-srs-21) |
| `bn254` | `hermez`| `22` | [hyperplonk-srs-22](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hyperplonk-srs-22) |
| `bn254` | `hermez`| `23` | [hyperplonk-srs-23](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hyperplonk-srs-23) |
| `bn254` | `hermez`| `24` | [hyperplonk-srs-24](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hyperplonk-srs-24) |
| `bn254` | `hermez`| `25` | [hyperplonk-srs-25](https://summa-solvency.s3.eu-central-1.amazonaws.com/trusted-setup-hyperplonk2kzg/hyperplonk-srs-25) |

Note that these files are generated for testing purposes only. They are created temporarily and are not produced through a formal ceremony process.

</details><br>

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

## Running Test

To build the binary executable and test it, use the following commands:

```
```bash
cargo build
cargo test --release -- --nocapture
```
Expand All @@ -43,7 +62,7 @@ This example illustrates how Summa can generate commitment proofs and verifier p

To execute this example, use the command:

```
```bash
cargo run --release --example summa_solvency_flow
```

Expand All @@ -56,14 +75,14 @@ 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 SRS (`hyperplonk-srs-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/hyperplonk-srs-17`: contains parameters for constructing the zk circuits.

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

```
```bash
1. Commitment and Verifier Parameters successfully Exported!
```

Expand All @@ -75,7 +94,7 @@ After generating the inclusion proof, it is transformed into a JSON format for e

Upon successful execution, you'll find a file named `user_0_proof.json` and see the following message:

```
```bash
2. Exported proof to user #0, as `user_0_proof.json`, with verifier params `verifier_params.json`
```

Expand All @@ -94,6 +113,6 @@ In this step, the user has to:

The result will be displayed as:

```
```bash
3. Verified the proof with veirifer parameters for User #0: true
```
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/hyperplonk-srs-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/hyperplonk-srs-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/hyperplonk-srs-17").unwrap();

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

0 comments on commit 2d878e4

Please sign in to comment.