Skip to content

Commit

Permalink
Merge branch 'main' into with-scarb-features
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 authored Apr 4, 2024
2 parents 30b0fb4 + a10777d commit e05d976
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 59 deletions.
Binary file added .github/readme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
scarb nightly-2024-03-16
starknet-foundry 0.20.0
starknet-foundry 0.20.1
65 changes: 9 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cairo Verifier

![Cairo Verifier](https://github.com/HerodotusDev/cairo-verifier/assets/46165861/8692dfc1-f267-4c7e-9af0-4ceaeec84207)
![Integrity](.github/readme.png)

[![Continuous Integration - tests](https://github.com/HerodotusDev/cairo-verifier/actions/workflows/tests.yml/badge.svg)](https://github.com/HerodotusDev/cairo-verifier/actions/workflows/tests.yml)

Expand Down Expand Up @@ -68,67 +68,20 @@ cd examples/starknet

[List of deployed Verifier Contracts](deployed_contracts.md)

## Creating a Proof

To create a proof, perform the following steps:

1. Install stone-prover (restart your shell after installation):

```bash
git clone https://github.com/starkware-libs/stone-prover.git
cd stone-prover
docker build --tag prover .
container_id=$(docker create prover)
docker cp -L ${container_id}:/bin/cpu_air_prover ../examples/prover
docker cp -L ${container_id}:/bin/cpu_air_verifier ../examples/prover
```

2. Install cairo-lang:

```bash
pip install cairo-lang==0.12.0
```

3. Compile a Cairo program, for example, the Fibonacci program:

```bash
cd examples/prover
cairo-compile fibonacci.cairo --output fibonacci_compiled.json --proof_mode
```
## Benchmarking

4. Run the Cairo program:
In order to launch benchmarking, just run this (it requires recursive layout configuration):

```bash
cairo-run \
--program=fibonacci_compiled.json \
--layout=recursive \
--program_input=fibonacci_input.json \
--air_public_input=fibonacci_public_input.json \
--air_private_input=fibonacci_private_input.json \
--trace_file=fibonacci_trace.bin \
--memory_file=fibonacci_memory.bin \
--print_output \
--proof_mode
cargo run --release --bin benches -- target/dev/cairo_verifier.sierra.json
```

5. Prove the Cairo program:

```bash
./cpu_air_prover \
--out_file=../proofs/recursive/fibonacci_proof.json \
--private_input_file=fibonacci_private_input.json \
--public_input_file=fibonacci_public_input.json \
--prover_config_file=cpu_air_prover_config.json \
--parameter_file=cpu_air_params.json \
--generate_annotations
```
## Creating a Proof

You can verify this proof locally or on the Starknet Cairo verifier contract by specifying the path examples/proofs/recursive/fibonacci_proof.json to the newly generated proof.
### Stone Prover Instructions

## Benchmarking
For detailed instructions and examples, refer to the Stone Prover [documentation](https://github.com/starkware-libs/stone-prover?tab=readme-ov-file#creating-and-verifying-a-proof-of-a-cairozero-program).

In order to launch benchmarking, just run this (it requires recursive layout configuration):
### Stone Prover SDK Tool

```bash
cargo run --release --bin benches -- target/dev/cairo_verifier.sierra.json
```
For information on how to use the Stone Prover SDK tool, please refer to the [documentation](https://github.com/Moonsong-Labs/stone-prover-sdk).
2 changes: 1 addition & 1 deletion examples/starknet/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2023_10"

[dependencies]
cairo_verifier = { path = ".." }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.20.0" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.20.1" }

[[target.starknet-contract]]
casm = true
2 changes: 1 addition & 1 deletion fact_registry/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2023_10"

[dependencies]
cairo_verifier = { path = ".." }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.20.0" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.20.1" }

[[target.starknet-contract]]
casm = true

0 comments on commit e05d976

Please sign in to comment.