Skip to content

Commit

Permalink
Bump Cairo to 2.9.1. (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
feltroidprime authored Dec 6, 2024
1 parent b44d00d commit 73095cf
Show file tree
Hide file tree
Showing 54 changed files with 16,381 additions and 16,802 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cairo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- uses: actions/checkout@v3
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.8.4"
scarb-version: "2.9.1"
- run: scarb fmt --check
working-directory: src/
- run: cd src/ && scarb test
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Setup Scarb
uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.8.4"
scarb-version: "2.9.1"
- name: Install dependencies
run: make setup

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hydra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Set up Scarb
uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.8.4"
scarb-version: "2.9.1"
- name: Run make rewrite and check for unstaged changes
run: |
source venv/bin/activate
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maturin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ jobs:

- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.8.4"
scarb-version: "2.9.1"
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:

- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.8.4"
scarb-version: "2.9.1"
- name: Set up Python 3.10.14
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ To get started with Garaga, you'll need to have some tools and dependencies inst

Ensure you have the following installed:
- [Python 3.10](https://www.python.org/downloads/) - /!\ Make sure `python3.10` is a valid command in your terminal. The core language used for development. Make sure you have the correct dependencies installed (in particular, GMP) for the `fastecdsa` python package. See [here](https://pypi.org/project/fastecdsa/#installing) for linux and [here](https://github.com/AntonKueltz/fastecdsa/issues/74) for macos.
- [Scarb 2.8.4](https://docs.swmansion.com/scarb/download.html) - The Cairo package manager. Comes with Cairo inside. Requires [Rust](https://www.rust-lang.org/tools/install).
- [Scarb 2.9.1](https://docs.swmansion.com/scarb/download.html) - The Cairo package manager. Comes with Cairo inside. Requires [Rust](https://www.rust-lang.org/tools/install).

##### Optionally :

Expand Down
2 changes: 1 addition & 1 deletion docs/gitbook/installation/developer-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ icon: wrench
To work with Garaga, you need the following dependencies : 

* Python 3.10. The command `python3.10` should be available and working in your terminal. 
* [Scarb](https://docs.swmansion.com/scarb/download.html) v2.8.4. 
* [Scarb](https://docs.swmansion.com/scarb/download.html) v2.9.1. 
* [Rust](https://www.rust-lang.org/tools/install)

Simply clone the [repository](https://github.com/keep-starknet-strange/garaga) :
Expand Down
4 changes: 2 additions & 2 deletions hydra/garaga/modulo_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,9 +1098,9 @@ def compile_circuit_cairo_1(
signature_input = "mut input: Array<u384>"

if self.generic_circuit:
code = f"#[inline(always)]\nfn {function_name}({signature_input}, curve_index:usize)->{signature_output} {{\n"
code = f"#[inline(always)]\npub fn {function_name}({signature_input}, curve_index:usize)->{signature_output} {{\n"
else:
code = f"#[inline(always)]\nfn {function_name}({signature_input})->{signature_output} {{\n"
code = f"#[inline(always)]\npub fn {function_name}({signature_input})->{signature_output} {{\n"

# Define the input for the circuit.
code, offset_to_reference_map, start_index = self.write_cairo1_input_stack(
Expand Down
2 changes: 1 addition & 1 deletion hydra/garaga/precompiled_circuits/all_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ def main(
initialize_compilation(PRECOMPILED_CIRCUITS_DIR, CIRCUITS_TO_COMPILE)
)
output_sizes_exceeding_limit = {filename: set() for filename in filenames_used}
limit = 15
limit = 16
compile_circuits(
CIRCUITS_TO_COMPILE,
compilation_mode,
Expand Down
7 changes: 3 additions & 4 deletions hydra/garaga/starknet/groth16_contract_generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from garaga.starknet.cli.utils import create_directory, get_package_version
from garaga.starknet.groth16_contract_generator.parsing_utils import Groth16VerifyingKey

ECIP_OPS_CLASS_HASH = 0x223A0051C2E31EDE1FD33DB4F01BC979901FD80F3429017710176CCE6AADA3B
ECIP_OPS_CLASS_HASH = 0x2F2A107CEE3E12D1FB6070D2AE30D18C1E412EFDF8EF5C8DD278FC00862F952


def precompute_lines_from_vk(vk: Groth16VerifyingKey) -> StructArray:
Expand Down Expand Up @@ -79,7 +79,6 @@ def gen_groth16_verifier(
use super::{{N_PUBLIC_INPUTS, vk, ic, precomputed_lines}};
const ECIP_OPS_CLASS_HASH: felt252 = {hex(ecip_class_hash)};
use starknet::ContractAddress;
#[storage]
struct Storage {{}}
Expand Down Expand Up @@ -159,7 +158,7 @@ def gen_groth16_verifier(
create_directory(src_dir)

with open(os.path.join(output_folder_path, ".tools-versions"), "w") as f:
f.write("scarb 2.8.4\n")
f.write("scarb 2.9.1\n")

with open(os.path.join(src_dir, "groth16_verifier_constants.cairo"), "w") as f:
f.write(constants_code)
Expand Down Expand Up @@ -199,7 +198,7 @@ def get_scarb_toml_file(package_name: str, cli_mode: bool):
[dependencies]
garaga = {{ {dep} }}
starknet = "2.8.4"
starknet = "2.9.1"
[cairo]
sierra-replace-ids = false
Expand Down
2 changes: 1 addition & 1 deletion src/.tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
scarb 2.8.4
scarb 2.9.1
3 changes: 2 additions & 1 deletion src/Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "garaga"
version = "0.14.0"
edition = "2023_10"
licence = "MIT"
keywords = ["zk", "snarks", "curve", "pairing", "groth16", "plonk", "bls", "elliptic", "signature"]
description = "State-of-the-art Elliptic Curve operations and SNARKS verification for Cairo & Starknet"
Expand All @@ -15,7 +16,7 @@ sierra-replace-ids = false
[dependencies]

[dev-dependencies]
cairo_test = "2.8.4"
cairo_test = "2.9.1"

#snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.30.0" }
#assert_macros = "2.8."
2 changes: 1 addition & 1 deletion src/contracts/drand_quicknet/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2024_07"

[dependencies]
garaga = { path = "../.." }
starknet = "2.8.4"
starknet = "2.9.1"

[cairo]
sierra-replace-ids = false
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/drand_quicknet/src/drand_verifier.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mod DrandQuicknet {
use garaga::definitions::{G1Point, G1G2Pair};
use garaga::pairing_check::{multi_pairing_check_bls12_381_2P_2F, MPCheckHintBLS12_381};
use garaga::utils::drand::{
round_to_curve_bls12_381, DRAND_QUICKNET_PUBLIC_KEY, HashToCurveHint
round_to_curve_bls12_381, DRAND_QUICKNET_PUBLIC_KEY, HashToCurveHint,
};
use super::{precomputed_lines, G2_GEN};
use garaga::utils::hashing::hash_G1Point;
Expand All @@ -37,7 +37,7 @@ mod DrandQuicknet {
) -> Option<felt252> {
let drand_hint: DrandHint = Serde::deserialize(ref full_proof_with_hints).unwrap();
let message = round_to_curve_bls12_381(
drand_hint.round_number, drand_hint.hash_to_curve_hint
drand_hint.round_number, drand_hint.hash_to_curve_hint,
);

let check = multi_pairing_check_bls12_381_2P_2F(
Expand Down
Loading

0 comments on commit 73095cf

Please sign in to comment.