Skip to content

Commit

Permalink
Add CairoVersion to other layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
delaaxe committed Jun 7, 2024
1 parent b0c5047 commit c7b8e5e
Show file tree
Hide file tree
Showing 7 changed files with 1,468 additions and 11 deletions.
36 changes: 35 additions & 1 deletion .github/workflows/proof_verification_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,38 @@ jobs:
run: scarb test

- name: Run verification
run: cargo run --release --bin runner -- target/dev/cairo_verifier.sierra.json < examples/proofs/${{ matrix.layout }}/example_proof.json
run: cargo run --release --bin runner -- target/dev/cairo_verifier.sierra.json 0 < examples/proofs/${{ matrix.layout }}/example_proof.json

verify-proof-cairo1:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Scarb
uses: software-mansion/setup-scarb@v1

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Configure layout
run: python configure.py -l recursive -s keccak

- name: Build project
run: scarb build

- name: Test project
run: scarb test

- name: Run verification
run: cargo run --release --bin runner -- target/dev/cairo_verifier.sierra.json 1 < examples/proofs/recursive_cairo1/example_proof.json
1,423 changes: 1,423 additions & 0 deletions examples/proofs/recursive_cairo1/example_proof.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/air/layouts/dex/public_input.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use cairo_verifier::{
segments, get_builtins, CPU_COMPONENT_HEIGHT, CPU_COMPONENT_STEP, LAYOUT_CODE,
PEDERSEN_BUILTIN_ROW_RATIO, RANGE_CHECK_BUILTIN_ROW_RATIO, ECDSA_BUILTIN_ROW_RATIO
},
public_input::{PublicInput, PublicInputTrait}
public_input::{CairoVersion, PublicInput, PublicInputTrait}
},
domains::StarkDomains
};
Expand All @@ -19,7 +19,7 @@ use core::{pedersen::PedersenTrait, hash::{HashStateTrait, HashStateExTrait, Has
use poseidon::poseidon_hash_span;

impl DexPublicInputImpl of PublicInputTrait {
fn verify(self: @PublicInput) -> (felt252, felt252) {
fn verify(self: @PublicInput, cairo_version: CairoVersion) -> (felt252, felt252) {
let public_segments = self.segments;

let initial_pc = *public_segments.at(segments::PROGRAM).begin_addr;
Expand Down
4 changes: 2 additions & 2 deletions src/air/layouts/recursive_with_poseidon/public_input.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use cairo_verifier::{
PEDERSEN_BUILTIN_ROW_RATIO, RANGE_CHECK_BUILTIN_ROW_RATIO, BITWISE_ROW_RATIO,
POSEIDON_ROW_RATIO
},
public_input::{PublicInput, PublicInputTrait}
public_input::{CairoVersion, PublicInput, PublicInputTrait}
},
domains::StarkDomains
};
Expand All @@ -20,7 +20,7 @@ use core::{pedersen::PedersenTrait, hash::{HashStateTrait, HashStateExTrait, Has
use poseidon::poseidon_hash_span;

impl RecursiveWithPoseidonPublicInputImpl of PublicInputTrait {
fn verify(self: @PublicInput) -> (felt252, felt252) {
fn verify(self: @PublicInput, cairo_version: CairoVersion) -> (felt252, felt252) {
let public_segments = self.segments;

let initial_pc = *public_segments.at(segments::PROGRAM).begin_addr;
Expand Down
4 changes: 2 additions & 2 deletions src/air/layouts/small/public_input.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use cairo_verifier::{
segments, get_builtins, CPU_COMPONENT_HEIGHT, CPU_COMPONENT_STEP, LAYOUT_CODE,
PEDERSEN_BUILTIN_ROW_RATIO, RANGE_CHECK_BUILTIN_ROW_RATIO, ECDSA_BUILTIN_ROW_RATIO
},
public_input::{PublicInput, PublicInputTrait}
public_input::{CairoVersion, PublicInput, PublicInputTrait}
},
domains::StarkDomains
};
Expand All @@ -19,7 +19,7 @@ use core::{pedersen::PedersenTrait, hash::{HashStateTrait, HashStateExTrait, Has
use poseidon::poseidon_hash_span;

impl SmallPublicInputImpl of PublicInputTrait {
fn verify(self: @PublicInput) -> (felt252, felt252) {
fn verify(self: @PublicInput, cairo_version: CairoVersion) -> (felt252, felt252) {
let public_segments = self.segments;

let initial_pc = *public_segments.at(segments::PROGRAM).begin_addr;
Expand Down
4 changes: 2 additions & 2 deletions src/air/layouts/starknet/public_input.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use cairo_verifier::{
PEDERSEN_BUILTIN_ROW_RATIO, RANGE_CHECK_BUILTIN_ROW_RATIO, BITWISE_ROW_RATIO,
ECDSA_BUILTIN_ROW_RATIO, EC_OP_BUILTIN_ROW_RATIO, POSEIDON_ROW_RATIO
},
public_input::{PublicInput, PublicInputTrait}
public_input::{CairoVersion, PublicInput, PublicInputTrait}
},
domains::StarkDomains
};
Expand All @@ -20,7 +20,7 @@ use core::{pedersen::PedersenTrait, hash::{HashStateTrait, HashStateExTrait, Has
use poseidon::poseidon_hash_span;

impl StarknetPublicInputImpl of PublicInputTrait {
fn verify(self: @PublicInput) -> (felt252, felt252) {
fn verify(self: @PublicInput, cairo_version: CairoVersion) -> (felt252, felt252) {
let public_segments = self.segments;

let initial_pc = *public_segments.at(segments::PROGRAM).begin_addr;
Expand Down
4 changes: 2 additions & 2 deletions src/air/layouts/starknet_with_keccak/public_input.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use cairo_verifier::{
PEDERSEN_BUILTIN_ROW_RATIO, RANGE_CHECK_BUILTIN_ROW_RATIO, BITWISE_ROW_RATIO,
ECDSA_BUILTIN_ROW_RATIO, EC_OP_BUILTIN_ROW_RATIO, POSEIDON_ROW_RATIO, KECCAK_ROW_RATIO
},
public_input::{PublicInput, PublicInputTrait}
public_input::{CairoVersion, PublicInput, PublicInputTrait}
},
domains::StarkDomains
};
Expand All @@ -20,7 +20,7 @@ use core::{pedersen::PedersenTrait, hash::{HashStateTrait, HashStateExTrait, Has
use poseidon::poseidon_hash_span;

impl StarknetWithKeccakPublicInputImpl of PublicInputTrait {
fn verify(self: @PublicInput) -> (felt252, felt252) {
fn verify(self: @PublicInput, cairo_version: CairoVersion) -> (felt252, felt252) {
let public_segments = self.segments;

let initial_pc = *public_segments.at(segments::PROGRAM).begin_addr;
Expand Down

0 comments on commit c7b8e5e

Please sign in to comment.