Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layout/starknet with keccak #116

Merged
merged 37 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
239b001
starknet with keccak layout
Okm165 Mar 18, 2024
95921c1
fix
Okm165 Mar 18, 2024
c412e35
fix
Okm165 Mar 18, 2024
75dbf02
runner update vec252 refactor
Okm165 Mar 19, 2024
56244d1
starknet foundry rpc v0_7
Okm165 Mar 20, 2024
121cf7e
newest snfoundry tool version
Okm165 Mar 20, 2024
2751e4f
nightly scarb version
Okm165 Mar 20, 2024
8e9b5f8
Merge branch 'feat/fact_registry' into feat/layout/starknet_with_keccak
Okm165 Mar 20, 2024
69f3844
Merge branch 'feat/layout_changer' into feat/layout/starknet_with_keccak
Okm165 Mar 20, 2024
d79f4a1
starknet with keccak example proof
Okm165 Mar 20, 2024
c2ae1be
merge
Okm165 Mar 21, 2024
8b29aa1
add starknet_with_keccak to ci
Okm165 Mar 21, 2024
ccedef0
recursive layout as default
Okm165 Mar 21, 2024
ff8a865
Revert "add starknet_with_keccak to ci"
Okm165 Mar 21, 2024
5360ecf
Merge branch 'feat/layout_changer' into feat/layout/starknet_with_keccak
Okm165 Mar 21, 2024
8019ae9
starknet_with_keccak pop_front optimization
Okm165 Mar 21, 2024
52a2def
ci turn on proof verification tests
Okm165 Mar 22, 2024
ec60430
starknet_with_keccak loop optimizaton
Okm165 Mar 22, 2024
4d76ad2
starknet pop_front optimization
Okm165 Mar 22, 2024
2043afc
small pop_front optimization
Okm165 Mar 22, 2024
ca9c415
recursive_with_poseidon pop_front optimization
Okm165 Mar 22, 2024
8649efc
recursive pop_front optimization
Okm165 Mar 22, 2024
934596b
dex pop_front optimization
Okm165 Mar 22, 2024
612c1f2
deployed contract update
Okm165 Mar 22, 2024
bdbe904
proof_verification_tests only on main
Okm165 Mar 22, 2024
fef117a
turn off starknet_with_keccak in ci
Okm165 Mar 22, 2024
98b4a3a
Revert "proof_verification_tests only on main"
Okm165 Mar 22, 2024
2550e99
Merge branch 'main' into feat/layout/starknet_with_keccak
Okm165 Mar 25, 2024
0fe3de2
Merge branch 'main' into layouts_optimization
Okm165 Mar 25, 2024
d1bcde7
keccak periodic columns renamed
Okm165 Mar 25, 2024
96fc234
Merge branch 'feat/layout/starknet_with_keccak' into layouts_optimiza…
Okm165 Mar 25, 2024
acbaaae
Revert "turn off starknet_with_keccak in ci"
Okm165 Mar 25, 2024
044341b
Reapply "proof_verification_tests only on main"
Okm165 Mar 25, 2024
8d35531
README layout types fix
Okm165 Mar 25, 2024
77dab5f
Merge pull request #119 from HerodotusDev/layouts_optimization
fmkra Mar 26, 2024
f5da118
README badges
Okm165 Mar 26, 2024
0f82641
version bump & rpc fixed
Okm165 Mar 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/proof_verification_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
layout: ["dex", "recursive", "recursive_with_poseidon", "small", "starknet"]
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 .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
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

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

[![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)

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

## Building the Verifier

To build the Cairo Verifier, follow these steps:
Expand Down Expand Up @@ -44,7 +48,7 @@ cargo run --release --bin snfoundry_proof_serializer < examples/proofs/recursive

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

[List of deployed Verifier Contracts](deployed_contracts.md)
Expand All @@ -57,7 +61,7 @@ By default, the verifier is configured for recursive layout and keccak hash for
python configure.py -l recursive -s keccak
```

layout types: [dex, recursive, recursive_with_poseidon, small, starknet]
layout types: [dex, recursive, recursive_with_poseidon, small, starknet, starknet_with_keccak]
hash types: [keccak, blake2s]

## Creating a Proof
Expand Down
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pathlib import Path
from utils import process_file

LAYOUT_TYPES = ("dex", "recursive", "recursive_with_poseidon", "small", "starknet")
LAYOUT_TYPES = ("dex", "recursive", "recursive_with_poseidon", "small", "starknet", "starknet_with_keccak")
HASH_TYPES = ("keccak", "blake2s")


Expand Down
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** |
|[0x069df5a99fa42c37c946c58da0953d721b928078e740fef14da44e0f8c01f0f6](https://sepolia.starkscan.co/contract/0x069df5a99fa42c37c946c58da0953d721b928078e740fef14da44e0f8c01f0f6) | **Sepolia Testnet** | **recursive** |
|[0x487810706cc0dfdba0c82403d98e9d32dc36793ed2b731231e5ea19f00c5861](https://sepolia.starkscan.co/contract/0x487810706cc0dfdba0c82403d98e9d32dc36793ed2b731231e5ea19f00c5861) | **Sepolia Testnet** | **recursive** |
| | **Sepolia Testnet** | **recursive_with_poseidon** |
| | **Sepolia Testnet** | **small** |
| | **Sepolia Testnet** | **starknet** |
Expand Down
1,995 changes: 1,995 additions & 0 deletions examples/proofs/starknet_with_keccak/example_proof.json

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions examples/starknet/.tool-versions

This file was deleted.

10 changes: 2 additions & 8 deletions examples/starknet/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ edition = "2023_10"

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

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

[tool.sncast.testnet]
account = "testnet-sepolia"
accounts-file = "~/.starknet_accounts/starknet_open_zeppelin_accounts.json"
url = "https://free-rpc.nethermind.io/sepolia-juno/v0_6"
casm = true
2 changes: 1 addition & 1 deletion examples/starknet/snfoundry.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[sncast.testnet]
account = "testnet-sepolia"
accounts-file = "~/.starknet_accounts/starknet_open_zeppelin_accounts.json"
url = "https://free-rpc.nethermind.io/sepolia-juno/v0_6"
url = "https://free-rpc.nethermind.io/sepolia-juno/v0_7"
8 changes: 4 additions & 4 deletions examples/starknet/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ fn main() -> anyhow::Result<()> {
let witness: VecFelt252 = serde_json::from_str(&parsed.witness.to_string()).unwrap();

let proof = chain!(
config.to_vec(),
public_input.to_vec(),
unsent_commitment.to_vec(),
witness.to_vec()
config.into_iter(),
public_input.into_iter(),
unsent_commitment.into_iter(),
witness.into_iter()
)
.collect_vec();

Expand Down
2 changes: 0 additions & 2 deletions fact_registry/.tool-versions

This file was deleted.

10 changes: 2 additions & 8 deletions fact_registry/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ edition = "2023_10"

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

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

[tool.sncast.testnet]
account = "testnet-sepolia"
accounts-file = "~/.starknet_accounts/starknet_open_zeppelin_accounts.json"
url = "https://free-rpc.nethermind.io/sepolia-juno/v0_6"
casm = true
2 changes: 1 addition & 1 deletion fact_registry/snfoundry.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[sncast.testnet]
account = "testnet-sepolia"
accounts-file = "~/.starknet_accounts/starknet_open_zeppelin_accounts.json"
url = "https://free-rpc.nethermind.io/sepolia-juno/v0_6"
url = "https://free-rpc.nethermind.io/sepolia-juno/v0_7"
8 changes: 4 additions & 4 deletions runner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ fn main() -> anyhow::Result<()> {
let witness: VecFelt252 = serde_json::from_str(&parsed.witness.to_string()).unwrap();

let proof = chain!(
config.to_vec(),
public_input.to_vec(),
unsent_commitment.to_vec(),
witness.to_vec()
config.into_iter(),
public_input.into_iter(),
unsent_commitment.into_iter(),
witness.into_iter()
)
.collect_vec();

Expand Down
9 changes: 9 additions & 0 deletions runner/src/vec252.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ impl VecFelt252 {
}
}

impl IntoIterator for VecFelt252 {
type Item = Felt252;
type IntoIter = std::vec::IntoIter<Self::Item>;

fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}

impl Deref for VecFelt252 {
type Target = Vec<Felt252>;
fn deref(&self) -> &Self::Target {
Expand Down
3 changes: 3 additions & 0 deletions src/air/layouts.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ mod recursive;
// === STARKNET BEGIN ===
// mod starknet;
// === STARKNET END ===
// === STARKNET_WITH_KECCAK BEGIN ===
// mod starknet_with_keccak;
// === STARKNET_WITH_KECCAK END ===


Loading
Loading