Skip to content

Commit

Permalink
formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
byteZorvin committed Sep 9, 2024
1 parent c14a612 commit f5886b8
Show file tree
Hide file tree
Showing 13 changed files with 1,997 additions and 2,066 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/target
/dependencies/*
dependencies
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore artifacts:
build
coverage
dependencies
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
# Proof Generator

A proof generator for cairo programs. This repository uses [stone-prover](https://github.com/starkware-libs/stone-prover) under the hood to generate proofs and uses [cairo-vm](https://github.com/lambdaclass/cairo-vm) to run, compile and bootload the programs.

## Overview

You can genrate proofs for cairo programs here. The commands available are documented here.
There are 2 ways to genrate proofs:
There are 2 ways to genrate proofs:

1. First bootloading the program and then proving the execution of the bootloader. This is the recommended way and generates smaller proofs. Check out a simple bootloader [here](https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/cairo/bootloaders/simple_bootloader/simple_bootloader.cairo_)
2. Proving the execution of the program directly.


## Installation

Run the following command to install the dependencies:

```shell
./install.sh
cargo build
```

## Files

`compiled.json`: The compiled Cairo program.
`input.json`: Input data for the Cairo program.
`public_input.json`: Public inputs for the proof generation.
Expand All @@ -28,30 +33,35 @@ cargo build
`cpu_air_params.json`: Parameters file for the CPU AIR prover(stone-prover).

## Preparing a program

To checkout an example, check out the `examples` directory.
1. Create a new cairo program to proove, e.g. `dummy_snos.cairo`.

1. Create a new cairo program to proove, e.g. `dummy_snos.cairo`.
2. Create a corresponding input file, e.g. `dummy_snos_input.json`.
3. Modify the `examples/cpu_air_params.json` and `examples/cpu_air_config.json` to fit your needs. Check out the [stone-prover](https://github.com/starkware-libs/stone-prover) documentation to see how to generate these files.


## Generating a proof

- If you want to generate a proof after bootloading it, run:

```shell
make prove_with_bootloader CAIRO_PROGRAM=<path_to_cairo_file>
```

- If you want to generate a proof for a program directly, run:

```shell
make prove_with_program CAIRO_PROGRAM=<path_to_cairo_file>
```


- If you want to generate a PIE(Position Independent Executable) program, run:

```shell
make generate_pie CAIRO_PROGRAM=<path_to_cairo_file>
```

- If you want to run the PIE program, run:

```shell
make run_pie CAIRO_PROGRAM=<path_to_cairo_file>
```
```
7 changes: 1 addition & 6 deletions examples/dummy_snos/dummy_snos_cpu_air_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
"pow_hash": "keccak256",
"stark": {
"fri": {
"fri_step_list": [
0,
4,
4,
1
],
"fri_step_list": [0, 4, 4, 1],
"last_layer_degree_bound": 128,
"n_queries": 10,
"proof_of_work_bits": 30
Expand Down
Loading

0 comments on commit f5886b8

Please sign in to comment.