Skip to content

Commit

Permalink
Merge pull request HerodotusDev#135 from HerodotusDev/cairo1_example_…
Browse files Browse the repository at this point in the history
…proofs

cairo1 proofs
  • Loading branch information
Okm165 authored Jun 18, 2024
2 parents 57d1d72 + a79ca71 commit f09095c
Show file tree
Hide file tree
Showing 15 changed files with 7,478 additions and 1,454 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/proof_verification_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
strategy:
matrix:
cairo_version: ["cairo1"]
layout: ["recursive"]
layout: ["dex", "recursive", "recursive_with_poseidon", "small", "starknet", "starknet_with_keccak"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo/", rev = "44
cairo-proof-parser = { git = "https://github.com/Okm165/cairo-proof-parser", rev = "97a04bbee07330311b38d6f4cecfed3acb237626"}
cairo-vm = "0.9.2"
clap = { version = "4.5.2", features = ["derive"] }
itertools = "0.12.0"
itertools = "0.13.0"
num-bigint = "0.4.4"
runner = { path = "runner" }
serde = { version = "1", features = ["derive"] }
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ scarb test

For local proof verification, follow these steps:

1. Run the verifier locally using the following command on example proof, followed by the Cairo version of the circuit (0 or 1) used to generate the proof:
1. Run the verifier locally using the following command on example proof, followed by the Cairo version (cairo0 or cairo1) used to generate the proof:

```bash
cargo run --release --bin runner -- target/dev/cairo_verifier.sierra.json 0 < examples/proofs/recursive/example_proof.json
cargo run --release --bin runner -- --program target/dev/cairo_verifier.sierra.json -c cairo0 < examples/proofs/recursive/cairo0_example_proof.json
cargo run --release --bin runner -- --program target/dev/cairo_verifier.sierra.json -c cairo1 < examples/proofs/recursive/cairo1_example_proof.json
```

### Starknet Proof Verification
Expand All @@ -41,14 +42,14 @@ To verify proofs on Starknet, proceed with the following steps:
1. Prepare calldata of example proof for sncast:

```bash
cargo run --release --bin snfoundry_proof_serializer < examples/proofs/recursive/example_proof.json > examples/starknet/calldata
cargo run --release --bin snfoundry_proof_serializer -- -c cairo0 < examples/proofs/recursive/cairo0_example_proof.json > examples/starknet/calldata
```

2. Call the function with calldata on the Starknet contract:

```bash
cd examples/starknet
./1-verify-proof.sh 0x487810706cc0dfdba0c82403d98e9d32dc36793ed2b731231e5ea19f00c5861 calldata
./1-verify-proof.sh 0x274d8165a19590bdeaa94d1dd427e2034462d7611754ab3e15714a908c60df7 calldata
```

[List of deployed Verifier Contracts](deployed_contracts.md)
Expand Down Expand Up @@ -76,8 +77,8 @@ cargo run --release --bin benches -- target/dev/cairo_verifier.sierra.json

### Stone Prover Instructions

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).
For detailed instructions and examples, refer to the Stone Prover [documentation](https://github.com/starkware-libs/stone-prover?tab=readme-ov-file#overview).

### Stone Prover SDK Tool
How to prove [Cairo0](https://github.com/starkware-libs/stone-prover?tab=readme-ov-file#creating-and-verifying-a-proof-of-a-cairozero-program) program with Stone Prover.

For information on how to use the Stone Prover SDK tool, please refer to the [documentation](https://github.com/Moonsong-Labs/stone-prover-sdk).
How to prove [Cairo1](https://github.com/starkware-libs/stone-prover?tab=readme-ov-file#creating-and-verifying-a-proof-of-a-cairo-program) program with Stone Prover.
2 changes: 1 addition & 1 deletion deployed_contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
| | **Mainnet** | **starknet** |
| | **Mainnet** | **starknet_with_keccak** |
| | **Sepolia Testnet** | **dex** |
|[0x0110fc9f06e4864b5e7f51432149bc4c5ef7a2786e9125ba2177fbfe0a682751](https://sepolia.starkscan.co/contract/0x0110fc9f06e4864b5e7f51432149bc4c5ef7a2786e9125ba2177fbfe0a682751) | **Sepolia Testnet** | **recursive** |
|[0x274d8165a19590bdeaa94d1dd427e2034462d7611754ab3e15714a908c60df7](https://sepolia.starkscan.co/contract/0x274d8165a19590bdeaa94d1dd427e2034462d7611754ab3e15714a908c60df7) | **Sepolia Testnet** | **recursive** |
| | **Sepolia Testnet** | **recursive_with_poseidon** |
| | **Sepolia Testnet** | **small** |
| | **Sepolia Testnet** | **starknet** |
Expand Down
1,107 changes: 1,107 additions & 0 deletions examples/proofs/dex/cairo1_example_proof.json

Large diffs are not rendered by default.

1,423 changes: 0 additions & 1,423 deletions examples/proofs/recursive_cairo1/cairo0_example_proof.json

This file was deleted.

Loading

0 comments on commit f09095c

Please sign in to comment.