Copy disabled (too large)
Download .txt
Showing preview only (13,507K chars total). Download the full file to get everything.
Repository: keep-starknet-strange/garaga
Branch: main
Commit: 307c00af4a7f
Files: 465
Total size: 12.8 MB
Directory structure:
gitextract_6da2_nl2/
├── .cargo/
│ └── config.toml
├── .claude/
│ ├── commands/
│ │ ├── bump-version.md
│ │ └── upgrade-cairo.md
│ └── skills/
│ ├── benchmarking-cairo/
│ │ ├── SKILL.md
│ │ ├── installation.md
│ │ └── profile.py
│ └── cairo-coding/
│ ├── SKILL.md
│ └── bounded_int_calc.py
├── .github/
│ ├── .all-contributorsrc
│ ├── CODEOWNERS
│ ├── ISSUE_TEMPLATE/
│ │ ├── 01_BUG_REPORT.md
│ │ ├── 02_FEATURE_REQUEST.md
│ │ ├── 03_CODEBASE_IMPROVEMENT.md
│ │ └── config.yml
│ ├── PULL_REQUEST_TEMPLATE.md
│ ├── labels.yml
│ ├── scripts/
│ │ ├── declare_maintained_contracts.py
│ │ └── verify_contracts.py
│ └── workflows/
│ ├── cairo.yml
│ ├── docs-sync.yml
│ ├── e2e.yml
│ ├── hydra.yml
│ ├── labels.yml
│ ├── maturin.yml
│ ├── node.yml
│ ├── setup.yml
│ └── wasm.yml
├── .gitignore
├── .pre-commit-config.yaml
├── .secrets.template
├── .tool-versions
├── CLAUDE.md
├── Cargo.toml
├── LICENSE
├── Makefile
├── README.md
├── Scarb.toml
├── docs/
│ ├── CODE_OF_CONDUCT.md
│ ├── CONTRIBUTING.md
│ ├── PYPI_README.md
│ ├── SECURITY.md
│ ├── benchmarks/
│ │ └── test_summary.json
│ └── gitbook/
│ ├── README.md
│ ├── SUMMARY.md
│ ├── building-powerful-applications.md
│ ├── developer-setup-and-guides/
│ │ ├── README.md
│ │ ├── garaga-rs-crate/
│ │ │ ├── README.md
│ │ │ ├── rust-greater-than-python-bindings.md
│ │ │ └── rust-greater-than-wasm-bindings.md
│ │ └── working-with-auto-generated-cairo-code.md
│ ├── installation/
│ │ ├── README.md
│ │ ├── cairo-library.md
│ │ ├── developer-setup.md
│ │ ├── npm-package.md
│ │ ├── python-package.md
│ │ └── rust-crate.md
│ ├── maintained-smart-contracts/
│ │ ├── README.md
│ │ ├── drand.md
│ │ ├── risczero.md
│ │ └── sp1.md
│ ├── security.md
│ ├── smart-contract-generators/
│ │ ├── README.md
│ │ ├── groth16/
│ │ │ ├── README.md
│ │ │ ├── generate-and-deploy-your-verifier-contract.md
│ │ │ └── generating-calldata-from-a-proof-and-using-your-deployed-contract/
│ │ │ ├── README.md
│ │ │ ├── using-python-garaga-cli.md
│ │ │ ├── using-rust.md
│ │ │ └── using-typescript.md
│ │ └── noir.md
│ ├── support.md
│ ├── updating-these-docs.md
│ └── using-garaga-libraries-in-your-cairo-project/
│ ├── README.md
│ ├── ec-multi-scalar-multiplication.md
│ ├── ec-signatures.md
│ ├── hashing-functions.md
│ └── rsa-signatures.md
├── hydra/
│ └── garaga/
│ ├── algebra.py
│ ├── curves.py
│ ├── drand/
│ │ ├── client.py
│ │ └── tlock.py
│ ├── extension_field_modulo_circuit.py
│ ├── hints/
│ │ ├── bls.py
│ │ ├── ecip.py
│ │ ├── eisenstein.py
│ │ ├── extf_mul.py
│ │ ├── fake_glv.py
│ │ ├── frobenius.py
│ │ ├── io.py
│ │ ├── keccak256.py
│ │ ├── multi_miller_witness.py
│ │ ├── neg_3.py
│ │ └── tower_backup.py
│ ├── modulo_circuit.py
│ ├── modulo_circuit_structs.py
│ ├── points.py
│ ├── poseidon_transcript.py
│ ├── precompiled_circuits/
│ │ ├── all_circuits.py
│ │ ├── cofactor_clearing.py
│ │ ├── compilable_circuits/
│ │ │ ├── apply_isogeny.py
│ │ │ ├── base.py
│ │ │ ├── cairo1_mpcheck_circuits.py
│ │ │ ├── cairo1_tower_pairing.py
│ │ │ ├── common_cairo_fustat_circuits.py
│ │ │ ├── rsa.py
│ │ │ └── ultra_honk.py
│ │ ├── ec.py
│ │ ├── final_exp.py
│ │ ├── fp2.py
│ │ ├── isogeny.py
│ │ ├── map_to_curve.py
│ │ ├── miller_tower.py
│ │ ├── multi_miller_loop.py
│ │ ├── multi_pairing_check.py
│ │ ├── poseidon_bn254.py
│ │ └── zk_honk.py
│ ├── rsa_rns.py
│ ├── signature.py
│ └── starknet/
│ ├── cli/
│ │ ├── declare.py
│ │ ├── deploy.py
│ │ ├── gen.py
│ │ ├── smart_contract_project.py
│ │ ├── starknet_cli.py
│ │ ├── utils.py
│ │ └── verify.py
│ ├── constants.py
│ ├── groth16_contract_generator/
│ │ ├── calldata.py
│ │ ├── examples/
│ │ │ ├── gnark_proof_bn254.json
│ │ │ ├── gnark_public_bn254.json
│ │ │ ├── gnark_vk_bn254.json
│ │ │ ├── proof_bls.json
│ │ │ ├── proof_bn254.json
│ │ │ ├── proof_risc0.json
│ │ │ ├── proof_sp1.json
│ │ │ ├── snarkjs_proof_bls12381.json
│ │ │ ├── snarkjs_proof_bn254.json
│ │ │ ├── snarkjs_public_bls12381.json
│ │ │ ├── snarkjs_public_bn254.json
│ │ │ ├── snarkjs_vk_bls12381.json
│ │ │ ├── snarkjs_vk_bn254.json
│ │ │ ├── vk_bls.json
│ │ │ ├── vk_bn254.json
│ │ │ ├── vk_risc0.json
│ │ │ └── vk_sp1.json
│ │ ├── generator.py
│ │ ├── generator_risc0.py
│ │ ├── generator_sp1.py
│ │ └── parsing_utils.py
│ ├── honk_contract_generator/
│ │ ├── calldata.py
│ │ └── generator_honk.py
│ └── tests_and_calldata_generators/
│ ├── drand_calldata.py
│ ├── map_to_curve.py
│ ├── mpcheck.py
│ ├── msm.py
│ ├── signatures.py
│ └── test_writer.py
├── pyproject.toml
├── src/
│ ├── .tool-versions
│ ├── Scarb.toml
│ ├── contracts/
│ │ ├── autogenerated/
│ │ │ ├── groth16_example_bls12_381/
│ │ │ │ ├── .tool-versions
│ │ │ │ ├── Scarb.toml
│ │ │ │ ├── src/
│ │ │ │ │ ├── groth16_verifier.cairo
│ │ │ │ │ ├── groth16_verifier_constants.cairo
│ │ │ │ │ └── lib.cairo
│ │ │ │ └── tests/
│ │ │ │ ├── proof_calldata.txt
│ │ │ │ └── test_contract.cairo
│ │ │ ├── groth16_example_bn254/
│ │ │ │ ├── .tool-versions
│ │ │ │ ├── Scarb.toml
│ │ │ │ ├── src/
│ │ │ │ │ ├── groth16_verifier.cairo
│ │ │ │ │ ├── groth16_verifier_constants.cairo
│ │ │ │ │ └── lib.cairo
│ │ │ │ └── tests/
│ │ │ │ ├── proof_calldata.txt
│ │ │ │ └── test_contract.cairo
│ │ │ ├── noir_ultra_keccak_zk_honk_example/
│ │ │ │ ├── .tool-versions
│ │ │ │ ├── Scarb.toml
│ │ │ │ ├── src/
│ │ │ │ │ ├── honk_verifier.cairo
│ │ │ │ │ ├── honk_verifier_circuits.cairo
│ │ │ │ │ ├── honk_verifier_constants.cairo
│ │ │ │ │ └── lib.cairo
│ │ │ │ └── tests/
│ │ │ │ ├── proof_calldata.txt
│ │ │ │ └── test_contract.cairo
│ │ │ ├── risc0_verifier_bn254/
│ │ │ │ ├── .tool-versions
│ │ │ │ ├── Scarb.toml
│ │ │ │ ├── src/
│ │ │ │ │ ├── groth16_verifier.cairo
│ │ │ │ │ ├── groth16_verifier_constants.cairo
│ │ │ │ │ └── lib.cairo
│ │ │ │ └── tests/
│ │ │ │ ├── proof_calldata.txt
│ │ │ │ └── test_contract.cairo
│ │ │ └── sp1_verifier_bn254/
│ │ │ ├── .tool-versions
│ │ │ ├── Scarb.toml
│ │ │ ├── src/
│ │ │ │ ├── groth16_verifier.cairo
│ │ │ │ └── lib.cairo
│ │ │ └── tests/
│ │ │ ├── proof_calldata.txt
│ │ │ └── test_contract.cairo
│ │ ├── drand_decrypt_quicknet/
│ │ │ ├── Scarb.toml
│ │ │ └── src/
│ │ │ ├── drand_decrypt.cairo
│ │ │ ├── drand_decrypt_constants.cairo
│ │ │ └── lib.cairo
│ │ ├── drand_quicknet/
│ │ │ ├── .tool-versions
│ │ │ ├── Scarb.toml
│ │ │ └── src/
│ │ │ ├── drand_verifier.cairo
│ │ │ ├── drand_verifier_constants.cairo
│ │ │ └── lib.cairo
│ │ ├── mutator_set/
│ │ │ ├── .tool-versions
│ │ │ ├── Makefile
│ │ │ ├── Scarb.toml
│ │ │ ├── scripts/
│ │ │ │ ├── prover.py
│ │ │ │ └── regenerate_verifier.py
│ │ │ ├── snfoundry.toml
│ │ │ ├── src/
│ │ │ │ ├── lib.cairo
│ │ │ │ ├── mutator_set_contract.cairo
│ │ │ │ └── zk_verifier/
│ │ │ │ ├── honk_verifier_circuits.cairo
│ │ │ │ ├── honk_verifier_constants.cairo
│ │ │ │ └── honk_verifier_contract.cairo
│ │ │ ├── tests/
│ │ │ │ └── test_contract.cairo
│ │ │ └── zk_program/
│ │ │ ├── Nargo.toml
│ │ │ ├── Prover.toml
│ │ │ └── src/
│ │ │ ├── main.nr
│ │ │ ├── mmr.nr
│ │ │ └── mmr_tests.nr
│ │ ├── risc0_sample_app/
│ │ │ ├── README.md
│ │ │ ├── fibonacci_prover/
│ │ │ │ ├── .gitignore
│ │ │ │ ├── Cargo.toml
│ │ │ │ ├── README.md
│ │ │ │ ├── host/
│ │ │ │ │ ├── Cargo.toml
│ │ │ │ │ └── src/
│ │ │ │ │ └── main.rs
│ │ │ │ ├── methods/
│ │ │ │ │ ├── Cargo.toml
│ │ │ │ │ ├── build.rs
│ │ │ │ │ ├── guest/
│ │ │ │ │ │ ├── Cargo.toml
│ │ │ │ │ │ └── src/
│ │ │ │ │ │ └── main.rs
│ │ │ │ │ └── src/
│ │ │ │ │ └── lib.rs
│ │ │ │ └── rust-toolchain.toml
│ │ │ └── fibonacci_sequencer/
│ │ │ ├── .gitignore
│ │ │ ├── Scarb.toml
│ │ │ ├── snfoundry.toml
│ │ │ ├── src/
│ │ │ │ └── lib.cairo
│ │ │ └── tests/
│ │ │ └── test_contract.cairo
│ │ └── universal_ecip/
│ │ ├── Scarb.toml
│ │ └── src/
│ │ └── lib.cairo
│ ├── corelib_imports/
│ │ ├── README.md
│ │ ├── Scarb.toml
│ │ └── src/
│ │ └── lib.cairo
│ └── src/
│ ├── apps/
│ │ ├── drand.cairo
│ │ ├── noir/
│ │ │ └── zk_honk_transcript.cairo
│ │ ├── noir.cairo
│ │ ├── risc0.cairo
│ │ ├── sp1.cairo
│ │ └── sp1_constants.cairo
│ ├── basic_field_ops.cairo
│ ├── circuits/
│ │ ├── README.md
│ │ ├── dummy.cairo
│ │ ├── ec.cairo
│ │ ├── extf_mul.cairo
│ │ ├── isogeny.cairo
│ │ ├── multi_pairing_check.cairo
│ │ ├── rsa.cairo
│ │ └── tower_circuits.cairo
│ ├── core/
│ │ └── circuit.cairo
│ ├── crypto/
│ │ └── mmr.cairo
│ ├── definitions/
│ │ ├── curves.cairo
│ │ └── structs/
│ │ ├── fields.cairo
│ │ └── points.cairo
│ ├── definitions.cairo
│ ├── ec/
│ │ ├── ec_ops.cairo
│ │ ├── ec_ops_g2.cairo
│ │ ├── generate_selector_code.py
│ │ ├── pairing/
│ │ │ ├── groth16.cairo
│ │ │ ├── pairing_check.cairo
│ │ │ └── single_pairing_tower.cairo
│ │ └── selectors.cairo
│ ├── hashes/
│ │ ├── poseidon_bn254.cairo
│ │ └── sha_512.cairo
│ ├── lib.cairo
│ ├── signatures/
│ │ ├── ecdsa.cairo
│ │ ├── eddsa_25519.cairo
│ │ ├── rsa.cairo
│ │ └── schnorr.cairo
│ ├── tests/
│ │ ├── autogenerated/
│ │ │ ├── ecdsa_tests.cairo
│ │ │ ├── eddsa_tests.cairo
│ │ │ ├── msm_tests.cairo
│ │ │ ├── pairing_tests.cairo
│ │ │ ├── rsa_tests.cairo
│ │ │ ├── schnorr_tests.cairo
│ │ │ └── tower_pairing_tests.cairo
│ │ ├── calldata_tests.cairo
│ │ ├── proof_calldata.txt
│ │ ├── sha512_tests.cairo
│ │ └── sp1_groth_16_tests.cairo
│ └── utils/
│ ├── calldata.cairo
│ ├── hashing.cairo
│ └── neg_3.cairo
├── tests/
│ ├── benchmarks_compiled.py
│ ├── benchmarks_manual.py
│ ├── conftest.py
│ ├── contracts_e2e/
│ │ ├── __init__.py
│ │ ├── e2e_test.py
│ │ ├── fixtures/
│ │ │ ├── __init__.py
│ │ │ ├── accounts.py
│ │ │ ├── clients.py
│ │ │ ├── constants.py
│ │ │ └── devnet.py
│ │ ├── install_devnet.sh
│ │ ├── test-variables.env.template
│ │ └── utils.py
│ ├── ed25519_test_vectors.json
│ └── hydra/
│ ├── algebra/
│ │ ├── test_polynomial.py
│ │ ├── test_pyfelt.py
│ │ └── test_tower_final_exp.py
│ ├── circuits/
│ │ ├── test_ec.py
│ │ ├── test_honk.py
│ │ └── test_multi_miller_loop.py
│ ├── hints/
│ │ ├── test_ecip.py
│ │ ├── test_eisenstein.py
│ │ ├── test_fake_glv.py
│ │ ├── test_final_exp_witness.py
│ │ ├── test_frobenius.py
│ │ └── test_neg3.py
│ ├── starknet/
│ │ ├── test_calldata.py
│ │ ├── test_groth16_vk_proof_parsing.py
│ │ ├── test_honk_vk_proof_parsing.py
│ │ └── test_signatures_calldata.py
│ ├── test_bls18_381_map_to_curve.py
│ ├── test_cofactor_clearing.py
│ ├── test_drand.py
│ ├── test_extension_field_modulo_circuit.py
│ ├── test_g1_point.py
│ ├── test_g2_point.py
│ ├── test_isogeny.py
│ ├── test_poseidon_hash.py
│ └── test_rsa_rns.py
└── tools/
├── addchain/
│ ├── bls12_381_e.acc
│ ├── bls12_381_h3_s.acc
│ ├── bn254_exp.acc
│ ├── bn254_exp0.acc
│ ├── bn254_r_m_d_inv.acc
│ └── gen_rust_addchain.py
├── garaga_rs/
│ ├── Cargo.toml
│ └── src/
│ ├── algebra/
│ │ ├── extf_mul.rs
│ │ ├── g1g2pair.rs
│ │ ├── g1point.rs
│ │ ├── g2point.rs
│ │ ├── polynomial.rs
│ │ └── rational_function.rs
│ ├── calldata/
│ │ ├── drand_calldata.rs
│ │ ├── drand_tlock_calldata.rs
│ │ ├── full_proof_with_hints/
│ │ │ ├── groth16.rs
│ │ │ └── zk_honk.rs
│ │ ├── mod.rs
│ │ ├── mpc_calldata.rs
│ │ ├── msm_calldata.rs
│ │ └── signatures.rs
│ ├── constants.rs
│ ├── crypto/
│ │ ├── digest.rs
│ │ ├── merkle_tree.rs
│ │ ├── mmr/
│ │ │ ├── mmr_accumulator.rs
│ │ │ ├── mmr_membership_proof.rs
│ │ │ ├── mmr_successor_proof.rs
│ │ │ ├── mmr_trait.rs
│ │ │ ├── shared_advanced.rs
│ │ │ └── shared_basic.rs
│ │ └── poseidon_bn254.rs
│ ├── definitions.rs
│ ├── ecip/
│ │ ├── core.rs
│ │ └── ff.rs
│ ├── frobenius.rs
│ ├── hints/
│ │ ├── eisenstein.rs
│ │ └── fake_glv.rs
│ ├── io.rs
│ ├── lib.rs
│ ├── pairing/
│ │ ├── final_exp_witness/
│ │ │ ├── addchain_pow_generated.rs
│ │ │ ├── bls12_381_final_exp_witness.rs
│ │ │ ├── bn254_final_exp_witness.rs
│ │ │ └── mod.rs
│ │ ├── multi_miller_loop.rs
│ │ └── multi_pairing_check.rs
│ ├── poseidon_transcript.rs
│ ├── python_bindings/
│ │ ├── drand_calldata.rs
│ │ ├── ecip.rs
│ │ ├── extf_mul.rs
│ │ ├── final_exp_witness.rs
│ │ ├── g2.rs
│ │ ├── groth16_calldata.rs
│ │ ├── hades_permutation.rs
│ │ ├── mod.rs
│ │ ├── mpc_calldata.rs
│ │ ├── msm.rs
│ │ ├── pairing.rs
│ │ ├── signatures.rs
│ │ └── zk_honk_calldata.rs
│ └── wasm_bindings.rs
├── make/
│ ├── bytecode_check.sh
│ ├── bytecode_check_max_log_n.sh
│ ├── check_sierra_size.py
│ ├── ci_cairo.sh
│ ├── ci_e2e.sh
│ ├── ci_hydra.sh
│ ├── ci_wasm.sh
│ ├── common.sh
│ ├── constants.json
│ ├── generate_constants.py
│ ├── rewrite.sh
│ ├── setup.sh
│ ├── steps.sh
│ ├── test_contracts.sh
│ ├── update_bench_in_readme.py
│ ├── update_risc0_class_hash.sh
│ ├── wasm-test-gen.sh
│ └── wasm.sh
├── noir/
│ ├── Makefile
│ ├── hello/
│ │ ├── Nargo.toml
│ │ ├── Prover.toml
│ │ └── src/
│ │ └── main.nr
│ ├── run.sh
│ └── transcript.py
├── npm/
│ ├── garaga_ts/
│ │ ├── .gitignore
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── babel.config.cjs
│ │ ├── docker-compose.yml
│ │ ├── fix-chown.sh
│ │ ├── jest.config.ts
│ │ ├── patch.wasm.cjs
│ │ ├── rollup.config.js
│ │ ├── src/
│ │ │ ├── constants.ts
│ │ │ ├── node/
│ │ │ │ ├── api.ts
│ │ │ │ ├── definitions.ts
│ │ │ │ ├── hints/
│ │ │ │ │ └── io.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── starknet/
│ │ │ │ ├── groth16ContractGenerator/
│ │ │ │ │ └── parsingUtils.ts
│ │ │ │ └── honkContractGenerator/
│ │ │ │ └── parsingUtils.ts
│ │ │ └── wasm/
│ │ │ └── pkg/
│ │ │ ├── garaga_rs.d.ts
│ │ │ ├── garaga_rs.js
│ │ │ ├── garaga_rs_bg.wasm.d.ts
│ │ │ └── garaga_rs_bg.wasm.js
│ │ └── tests/
│ │ └── starknet/
│ │ ├── drandCalldata.test.ts
│ │ ├── drandTlockCalldata.test.ts
│ │ ├── groth16Calldata.test.ts
│ │ ├── groth16VkProofParsing.test.ts
│ │ ├── poseidonHash.test.ts
│ │ ├── signaturesCalldata.test.ts
│ │ └── zkHonkCalldata.test.ts
│ └── integration-test-suite/
│ ├── .gitignore
│ └── packages/
│ ├── nodejs-ts-cjs-tsc/
│ │ ├── .gitignore
│ │ ├── output.txt
│ │ └── src/
│ │ ├── examples.ts
│ │ └── index.ts
│ ├── nodejs-ts-esm-tsc/
│ │ ├── .gitignore
│ │ ├── output.txt
│ │ └── src/
│ │ ├── examples.ts
│ │ └── index.ts
│ ├── web-js-esm-react/
│ │ ├── .gitignore
│ │ ├── next.config.mjs
│ │ ├── output.txt
│ │ ├── scrape.cjs
│ │ └── src/
│ │ └── app/
│ │ ├── examples.js
│ │ ├── layout.js
│ │ └── page.js
│ └── web-js-esm-webpack/
│ ├── .gitignore
│ ├── output.txt
│ ├── scrape.cjs
│ ├── src/
│ │ ├── bootstrap.js
│ │ ├── examples.js
│ │ └── index.js
│ └── webpack.config.js
├── process_manager.py
└── profile_tests.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .cargo/config.toml
================================================
[build]
target-dir = ".cargo/garaga_rs/target"
================================================
FILE: .claude/commands/bump-version.md
================================================
# Bump Garaga Version
Bump the garaga version across the entire codebase (Python, Rust, Cairo, TypeScript, docs).
## Arguments
The user provides:
- **NEW_VERSION**: The new garaga version (e.g. `1.0.2`)
## Procedure
### Step 0: Detect current version
Read `tools/make/constants.json` and extract `release_info.garaga_version`. This is the OLD version that will be replaced everywhere.
Present the current version to the user and confirm the target version before proceeding. If the user already provided an explicit version number as an argument, skip the proposal and use it directly.
### Step 1: Update `tools/make/constants.json`
Update `release_info.garaga_version` to the new version.
### Step 2: Run `generate_constants.py`
Run `make constants` from the project root.
This auto-regenerates the constants files AND updates version references in:
- `hydra/garaga/starknet/constants.py`
- `tools/garaga_rs/src/constants.rs`
- `tools/npm/garaga_ts/src/constants.ts`
- `pyproject.toml` (package version)
- `tools/garaga_rs/Cargo.toml` (package version)
- `tools/npm/garaga_ts/package.json` (package version)
- `docs/PYPI_README.md` (pip install version)
- `tools/npm/garaga_ts/README.md` (API doc link)
- `docs/gitbook/smart-contract-generators/noir.md` (Garaga CLI version line only)
If the script fails, fall back to manually editing each of these files.
### Step 3: Update `src/Scarb.toml`
Update the `version = "OLD"` field (line near the top, under `[package]`) to the new version.
### Step 4: Update `Cargo.lock`
Run `cargo update -p garaga_rs` from the project root to sync the lock file with the new Cargo.toml version.
### Step 5: Run `make rewrite`
Run `make rewrite` from the project root. This regenerates all autogenerated contracts under `src/contracts/autogenerated/` which embed the garaga version in comments and Scarb.toml files.
This takes a few minutes. The makefile activates the venv automatically. If it fails, report the error.
### Step 6: Update documentation
Replace ALL occurrences of the old garaga version with the new one in these documentation files:
- `docs/gitbook/README.md`
- `docs/gitbook/installation/README.md`
- `docs/gitbook/installation/cairo-library.md`
- `docs/gitbook/installation/npm-package.md`
- `docs/gitbook/installation/python-package.md`
- `docs/gitbook/installation/rust-crate.md`
- `docs/gitbook/maintained-smart-contracts/README.md`
- `docs/gitbook/maintained-smart-contracts/risczero.md`
- `docs/gitbook/security.md`
- `docs/gitbook/smart-contract-generators/groth16/generate-and-deploy-your-verifier-contract.md`
- `docs/gitbook/using-garaga-libraries-in-your-cairo-project/README.md`
- `docs/gitbook/using-garaga-libraries-in-your-cairo-project/ec-multi-scalar-multiplication.md`
Version appears in several forms that must ALL be updated:
- Bare version: `1.0.1` (in Scarb.toml examples, pip install, npm install, class hash headers)
- Prefixed with `v`: `v1.0.1` (in git tags, release links, Cargo.toml git tag references)
- Prefixed with `==`: `==1.0.1` (pip install commands)
- Prefixed with `@`: `@1.0.1` (npm/scarb add commands)
Be thorough: read each file, find all old version occurrences, and replace them. Do NOT change version numbers that belong to other tools (Cairo, Scarb, Noir, Barretenberg, RiscZero, SP1, Starknet Foundry).
### Step 7: Verify
Run a grep for the old version across the repo:
```
grep -r "OLD_VERSION" --include="*.toml" --include="*.yml" --include="*.json" --include="*.py" --include="*.rs" --include="*.ts" --include="*.md" --include="*.sh" .
```
Report any remaining references. Some may be intentional (e.g. changelogs, historical references). Flag anything that looks like it should have been updated.
## Notes
- The `generate_constants.py` script handles: constants files (Python/Rust/TS), `pyproject.toml`, `Cargo.toml`, `package.json`, `PYPI_README.md`, `npm README.md`, and Noir docs version line. Everything else must be updated manually.
- `make rewrite` regenerates everything under `src/contracts/autogenerated/`. Never manually edit those files.
- The `src/Scarb.toml` version must be updated manually (Step 3) as `generate_constants.py` does not touch it.
- Documentation (Step 6) is the most labor-intensive part. Be careful to only replace the garaga version, not versions of other tools.
================================================
FILE: .claude/commands/upgrade-cairo.md
================================================
# Upgrade Cairo Version
Upgrade the Cairo/Scarb version (and optionally the Starknet Foundry version) across the entire codebase.
## Arguments
The user provides:
- **NEW_CAIRO_VERSION**: The new Cairo/Scarb version (e.g. `2.16.0`)
- **NEW_FOUNDRY_VERSION** (optional): The new Starknet Foundry version (e.g. `0.58.0`). If not provided, keep the current Foundry version unchanged.
## Procedure
### Step 0: Detect current versions and propose latest available
Read `tools/make/constants.json` to extract the current `cairo_version` and `starknet_foundry_version`. These are the OLD versions that will be replaced everywhere.
Then query asdf for the latest available versions:
- Run `asdf list all scarb` and pick the latest stable version (no `-rc`, `-alpha`, `-beta`, `-nightly` suffixes).
- Run `asdf list all starknet-foundry` and pick the latest stable version.
Present the current and latest available versions to the user, e.g.:
```
Current: scarb 2.14.0, starknet-foundry 0.53.0
Latest: scarb 2.16.1, starknet-foundry 0.58.0
```
Ask the user to confirm the target versions before proceeding. If the user already provided explicit version numbers as arguments, skip the proposal and use those directly.
### Step 1: Update `tools/make/constants.json`
Update `release_info.cairo_version` to the new Cairo version.
If a new Foundry version was provided, also update `release_info.starknet_foundry_version`.
### Step 2: Run `generate_constants.py`
Run `make constants` from the project root (the makefile activates the venv automatically).
This auto-regenerates:
- `hydra/garaga/starknet/constants.py` (CAIRO_VERSION, STARKNET_FOUNDRY_VERSION)
- `tools/garaga_rs/src/constants.rs`
- `tools/npm/garaga_ts/src/constants.ts`
If the script fails (e.g. missing dependencies), fall back to manually editing `hydra/garaga/starknet/constants.py` to update `CAIRO_VERSION` and `STARKNET_FOUNDRY_VERSION`.
### Step 3: Update root `Scarb.toml`
Update `[workspace.dependencies]`:
- `cairo_test = "OLD"` → `"NEW_CAIRO_VERSION"`
- `starknet = "OLD"` → `"NEW_CAIRO_VERSION"`
### Step 4: Update `src/Scarb.toml`
Update:
- `starknet = "..."` → `"NEW_CAIRO_VERSION"` (in `[dependencies]`)
- `assert_macros = "..."` → `"NEW_CAIRO_VERSION"` (in `[dev-dependencies]`)
- `cairo_execute = "..."` → `"NEW_CAIRO_VERSION"` (in `[dev-dependencies]`)
- If new Foundry version provided: `snforge_std = "..."` → `"NEW_FOUNDRY_VERSION"` (in `[dev-dependencies]`)
### Step 5: Update `src/corelib_imports/Scarb.toml`
Update `cairo_test = "..."` → `"NEW_CAIRO_VERSION"` (in `[dev-dependencies]`).
### Step 6: Update `.tool-versions` files
Update the root `.tool-versions`:
- `scarb OLD` → `scarb NEW_CAIRO_VERSION`
- If new Foundry version: `starknet-foundry OLD` → `starknet-foundry NEW_FOUNDRY_VERSION`
Update `src/.tool-versions`:
- `scarb OLD` → `scarb NEW_CAIRO_VERSION`
- If new Foundry version: `starknet-foundry OLD` → `starknet-foundry NEW_FOUNDRY_VERSION`
After updating both `.tool-versions` files, run `asdf install` from the project root to install the new tool versions. Report the output to the user. If asdf is not available or fails, tell the user to manually install the required scarb and starknet-foundry versions.
### Step 7: Update manual (non-autogenerated) contract `Scarb.toml` files
The following contract directories are NOT auto-generated by `make rewrite` and must be updated manually:
- `src/contracts/drand_quicknet/Scarb.toml`
- `src/contracts/drand_decrypt_quicknet/Scarb.toml`
- `src/contracts/mutator_set/Scarb.toml`
- `src/contracts/universal_ecip/Scarb.toml`
- `src/contracts/risc0_sample_app/fibonacci_sequencer/Scarb.toml`
In each, update:
- `starknet = "OLD_CAIRO"` → `"NEW_CAIRO_VERSION"`
- `assert_macros = "OLD_CAIRO"` → `"NEW_CAIRO_VERSION"` (if present)
- If new Foundry version: `snforge_std = "OLD_FOUNDRY"` → `"NEW_FOUNDRY_VERSION"` (if present)
Also update any `.tool-versions` files in these directories (currently only `src/contracts/drand_quicknet/.tool-versions` and `src/contracts/mutator_set/.tool-versions` exist).
**DO NOT** manually edit files under `src/contracts/autogenerated/` — those are regenerated by `make rewrite` in the next step.
### Step 8: Run `make rewrite`
Run `make rewrite` from the project root. This regenerates:
- All `src/contracts/autogenerated/*/Scarb.toml` (using CAIRO_VERSION from constants.py)
- All `src/contracts/autogenerated/*/.tool-versions` (using CAIRO_VERSION and STARKNET_FOUNDRY_VERSION from constants.py)
- All Cairo circuit files under `src/src/circuits/`
- All autogenerated contract source code and tests
This takes a few minutes. The makefile activates the venv automatically. If it fails, report the error — the user may need to run `make setup` first.
### Step 9: Update CI workflows
Update `scarb-version: "OLD"` → `"NEW_CAIRO_VERSION"` in:
- `.github/workflows/e2e.yml`
- `.github/workflows/hydra.yml`
- `.github/workflows/maturin.yml`
- `.github/workflows/wasm.yml`
Only update lines that contain `scarb-version:`.
### Step 10: Update `tools/make/setup.sh`
Replace all occurrences of the old Cairo version with the new one in the Scarb version check block near the end of the file (the `grep -q` line and the two echo lines that mention the version).
### Step 11: Update documentation
Update the old Cairo/Scarb version string to the new one in:
- `README.md`
- `docs/gitbook/installation/developer-setup.md`
- `docs/gitbook/maintained-smart-contracts/risczero.md`
- `docs/CONTRIBUTING.md`
Only change lines that reference Scarb version numbers. If new Foundry version provided, also update any Foundry version references in these docs.
### Step 12: Update hardcoded class hashes
The Cairo compiler version affects compiled Sierra output, so all hardcoded class hashes must be recomputed.
**ECIP class hash** — used by all Groth16 verifier contracts:
1. `cd src/contracts/universal_ecip && scarb build`
2. `sncast utils class-hash --contract-name UniversalECIP` → copy the hash (strip leading zeros after `0x`)
3. Update `ECIP_OPS_CLASS_HASH` in `hydra/garaga/starknet/groth16_contract_generator/generator.py`
4. Re-run `make rewrite` to regenerate autogenerated contracts with the new hash
**RISC0 verifier class hash** — used by the fibonacci_sequencer sample app:
Run `make update-risc0-class-hash` (this builds, computes, and patches automatically).
### Step 13: Verify
Run `grep -r "OLD_CAIRO_VERSION" --include="*.toml" --include="*.yml" --include="*.json" --include="*.py" --include="*.sh" --include="*.md" .` to check for any remaining references to the old version. Report any stragglers found (some may be intentional, e.g. changelogs).
### Step 14: Test compilation
Run `cd src && scarb build` to verify the new version compiles. If it fails with type errors on `const` declarations (e.g. `E2126: Constant type must not depend on its value`), the Cairo version may require explicit generic type parameters. Update the Python generators in `hydra/garaga/starknet/groth16_contract_generator/` and `hydra/garaga/starknet/honk_contract_generator/` to emit the required generics (e.g. `Groth16VerifyingKey<u288>`, `G2Line<u288>`), then fix the generated `.cairo` files and re-run `make rewrite`.
### Step 15: Run black formatting check
Run `source venv/bin/activate && black --target-version py310 --check hydra/` to verify Python formatting passes. The pre-commit hook and CI both use `--target-version py310` to avoid formatting differences across Python versions. If files need reformatting, run `black --target-version py310 hydra/` and include the changes.
## Notes
- This procedure does NOT modify Cairo source code. If the new Cairo version introduces breaking language changes, those must be handled separately.
- The `generate_constants.py` script propagates constants from `constants.json` into Python/Rust/TS constants files — it does NOT touch Scarb.toml or .tool-versions files.
- `make rewrite` auto-generates everything under `src/contracts/autogenerated/` and `src/src/circuits/`. Never manually edit those — they will be overwritten.
- Manual contracts (`drand_quicknet`, `drand_decrypt_quicknet`, `mutator_set`, `universal_ecip`, `fibonacci_sequencer`) must be updated by hand since they are not regenerated.
- The pre-commit hook uses black from `.pre-commit-config.yaml` (must match the version in `tools/make/requirements.txt`). If they diverge, formatting will pass locally but fail in CI.
================================================
FILE: .claude/skills/benchmarking-cairo/SKILL.md
================================================
---
name: benchmarking-cairo
description: Use when profiling Cairo functions, measuring step counts, analyzing resource usage, generating call-graph PNGs, or launching pprof to visualize Cairo execution traces
---
# Benchmarking Cairo
## Overview
Profile Cairo function execution to identify hotspots by steps, calls, range checks, and other builtins. Works with both `scarb execute` (standalone programs) and `snforge test` (Starknet Foundry tests).
If tools are missing, see `installation.md` in this skill directory. The CLI script is `profile.py` in this skill directory.
## REQUIRED: Use the CLI
**Always use `python3 profile.py profile` (from this skill directory) for profiling.** Do NOT run snforge/cairo-profiler/pprof manually — the CLI handles the full pipeline deterministically (trace generation, profile building, PNG export, naming).
### snforge mode (test functions)
```bash
python3 profile.py profile \
--mode snforge \
--package falcon \
--test test_ntt_zknox_vs_felt252 \
--name ntt-zknox-reduced \
--metric steps
```
### scarb mode (standalone executables)
```bash
python3 profile.py profile \
--mode scarb \
--package falcon \
--executable bench_ntt \
--args-file tests/data/ntt_input_512.json \
--name ntt-felt252 \
--metric steps
```
### CLI arguments
| Argument | Required | Description |
|----------|----------|-------------|
| `--mode` | yes | `snforge` or `scarb` |
| `--package` | yes | Scarb package name (e.g. `falcon`) |
| `--name` | yes | Human-friendly profile label (e.g. `ntt-zknox-reduced`) |
| `--test` | snforge | Test filter passed to `snforge test` |
| `--executable` | scarb | Executable name for `scarb execute` |
| `--args-file` | no | Arguments file for `scarb execute` |
| `--metric` | no | `steps` (default), `rc`, `sierra-gas`, `l2-gas` |
| `--output` | no | Output directory (default: `profiles/`) |
| `--nodefraction` | no | Hide PNG nodes below this fraction of total (default: `0.005`). Use `0` to show all nodes. |
| `--edgefraction` | no | Hide PNG edges below this fraction of total (default: `0.001`). Use `0` to show all edges. |
### CLI exit codes — act on errors
| Code | Meaning | What to do |
|------|---------|------------|
| 0 | Success | Read the PNG path from output |
| 1 | Argument error | Fix the CLI invocation |
| 2 | snforge/scarb failed | Check compilation errors, test failures |
| 3 | Trace file not found | Test must PASS to produce a trace. Check test name matches exactly. |
| 4 | cairo-profiler failed | Check trace JSON is valid |
| 5 | pprof PNG export failed | Check graphviz is installed (`apt install graphviz`) |
| 6 | Missing tool | Install the missing tool (see `installation.md`) |
### Output
The CLI produces two files in `profiles/`:
```
profiles/YY-MM-DD-HH:MM_<package>_<name>_<metric>_<commit>.pb.gz
profiles/YY-MM-DD-HH:MM_<package>_<name>_<metric>_<commit>.png
```
After running the CLI, **always read the PNG** to verify the profile shows the expected functions.
## Pitfalls
### Stale trace files
`snfoundry_trace/` keeps old traces. If you change code and re-profile, you MUST re-run `snforge test --save-trace-data` (the CLI does this automatically). **Never build a profile from a trace that predates your code change.**
### Missing functions in the PNG
If a function doesn't appear in the PNG, it may be below the `--nodefraction` threshold. Use `--nodefraction 0` to show all nodes. You can also check the text output (printed by the CLI) — functions with 0 flat steps but high cumulative steps are wrappers that delegate all work to callees.
### Timestamp mismatch between pb.gz and png
When running steps manually, the pb.gz and png may get different timestamps if they cross a minute boundary. The CLI computes the timestamp once so both files always match.
## Manual profiling (advanced)
For interactive exploration beyond what the CLI provides:
```bash
# Launch web UI for interactive flame graphs
pprof -http=:8080 profiles/<name>.pb.gz
# View specific sample in terminal
cairo-profiler view profiles/<name>.pb.gz --sample steps --limit 20
# List available samples
cairo-profiler view profiles/<name>.pb.gz --list-samples
```
## Metric reference
| `--metric` | tracked-resource | Samples in profile |
|------------|------------------|--------------------|
| `steps` | `cairo-steps` | steps, calls, range check builtin, memory holes, casm size |
| `rc` | `cairo-steps` | (same as steps, PNG shows range check builtin) |
| `sierra-gas` | `sierra-gas` | sierra gas, calls, casm size |
| `l2-gas` | `sierra-gas` | l2 gas (requires `enable-gas = true` + dispatcher pattern) |
## L2 Gas profiling (snforge)
L2 gas requires **all three**:
1. `[cairo] enable-gas = true` in Scarb.toml
2. `--metric l2-gas` (uses sierra-gas tracking)
3. **Dispatcher pattern** — profiled code must run inside a deployed contract
```cairo
#[starknet::interface]
trait IBench<TContractState> {
fn my_function(self: @TContractState) -> felt252;
}
#[starknet::contract]
mod bench { /* ... */ }
// Test using dispatcher
#[test]
fn bench_my_function() {
let contract = declare("bench").unwrap().contract_class();
let (addr, _) = contract.deploy(@array![]).unwrap();
let dispatcher = IBenchDispatcher { contract_address: addr };
dispatcher.my_function();
}
```
**Known limitation:** Syscall execution costs (secp256r1, keccak, etc.) are not attributed in the l2 gas profile. Use snforge test output for total gas; use profiler for relative hotspot analysis within Cairo code.
================================================
FILE: .claude/skills/benchmarking-cairo/installation.md
================================================
# Tool Installation for Cairo Benchmarking
## Scarb (Cairo build tool & package manager)
```bash
# Via asdf (recommended)
asdf plugin add scarb
asdf install scarb latest
asdf global scarb latest
# Or via installer
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh
```
Verify: `scarb --version`
## Starknet Foundry (snforge)
```bash
# Via snfoundryup installer
curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh
snfoundryup
# Or via asdf
asdf plugin add starknet-foundry
asdf install starknet-foundry latest
asdf global starknet-foundry latest
```
Verify: `snforge --version`
## cairo-profiler
```bash
# Via curl (Linux/macOS)
curl -L https://raw.githubusercontent.com/software-mansion/cairo-profiler/main/scripts/install.sh | sh
# Or via asdf
asdf plugin add cairo-profiler
asdf install cairo-profiler latest
asdf global cairo-profiler latest
```
Verify: `cairo-profiler --version`
GitHub: https://github.com/software-mansion/cairo-profiler
## pprof (Google profiling visualization)
Requires Go toolchain:
```bash
# Install Go (if not present)
# See https://go.dev/doc/install
# Install pprof
go install github.com/google/pprof@latest
```
Ensure `$(go env GOPATH)/bin` is in your `PATH`.
Verify: `pprof -h`
## Graphviz (required by pprof for PNG/SVG/PDF output)
```bash
# Debian/Ubuntu
sudo apt-get install graphviz
# macOS
brew install graphviz
# Fedora
sudo dnf install graphviz
```
Verify: `dot -V`
================================================
FILE: .claude/skills/benchmarking-cairo/profile.py
================================================
#!/usr/bin/env python3
"""
Cairo profiling CLI — deterministic pipeline for generating profiles.
Usage:
# snforge mode (run test, build profile, export PNG)
python3 profile.py profile \
--mode snforge \
--package falcon \
--test test_ntt_zknox_vs_felt252 \
--name ntt-zknox-reduced \
--metric steps
# scarb execute mode
python3 profile.py profile \
--mode scarb \
--package falcon \
--executable bench_ntt \
--args-file tests/data/ntt_input_512.json \
--name ntt-felt252 \
--metric steps
Exit codes:
0 Success
1 Argument error
2 snforge/scarb execution failed
3 Trace file not found after execution
4 cairo-profiler build failed
5 pprof PNG export failed
6 Missing external tool (snforge, scarb, cairo-profiler, pprof)
"""
import argparse
import glob
import os
import subprocess
import sys
from datetime import datetime
from pathlib import Path
# ---------------------------------------------------------------------------
# Helpers
# ---------------------------------------------------------------------------
def _check_tool(name: str) -> str:
"""Return path to tool or exit with code 6."""
import shutil
path = shutil.which(name)
if path is None:
_fail(6, f"Required tool '{name}' not found on PATH. See installation.md.")
return path
def _fail(code: int, msg: str) -> None:
"""Print error and exit."""
print(f"ERROR [{code}]: {msg}", file=sys.stderr)
sys.exit(code)
def _run(
cmd: list[str], cwd: str | None = None, timeout: int = 600
) -> subprocess.CompletedProcess:
"""Run a command, printing it first. Returns CompletedProcess."""
print(f" $ {' '.join(cmd)}")
return subprocess.run(cmd, cwd=cwd, timeout=timeout, capture_output=False)
def _git_short_hash(repo_root: str) -> str:
"""Return short git hash or 'unknown'."""
try:
result = subprocess.run(
["git", "rev-parse", "--short", "HEAD"],
cwd=repo_root,
capture_output=True,
text=True,
timeout=5,
)
return result.stdout.strip() if result.returncode == 0 else "unknown"
except Exception:
return "unknown"
def _profile_filename(
output_dir: str, package: str, name: str, metric: str, commit: str, ext: str
) -> str:
"""Generate deterministic profile filename."""
ts = datetime.now().strftime("%y-%m-%d-%H:%M")
return os.path.join(output_dir, f"{ts}_{package}_{name}_{metric}_{commit}.{ext}")
# ---------------------------------------------------------------------------
# Metric → sample mapping
# ---------------------------------------------------------------------------
METRIC_CONFIG = {
"steps": {
"tracked_resource": "cairo-steps",
"sample_name": "steps",
"pprof_sample_index": "steps",
},
"rc": {
"tracked_resource": "cairo-steps",
"sample_name": "range check builtin",
"pprof_sample_index": "range_check_builtin",
},
"sierra-gas": {
"tracked_resource": "sierra-gas",
"sample_name": "sierra gas",
"pprof_sample_index": "sierra_gas",
},
"l2-gas": {
"tracked_resource": "sierra-gas",
"sample_name": "l2 gas",
"pprof_sample_index": "l2_gas",
},
}
# ---------------------------------------------------------------------------
# Pipeline steps
# ---------------------------------------------------------------------------
def _find_package_dir(repo_root: str, package: str) -> str:
"""Resolve package directory from workspace."""
pkg_dir = os.path.join(repo_root, "packages", package)
if os.path.isdir(pkg_dir) and os.path.isfile(os.path.join(pkg_dir, "Scarb.toml")):
return pkg_dir
# Maybe it's a top-level package
if os.path.isfile(os.path.join(repo_root, "Scarb.toml")):
return repo_root
_fail(
1,
f"Cannot find package '{package}'. Looked in packages/{package}/ and repo root.",
)
return "" # unreachable
def _step_snforge(pkg_dir: str, test_filter: str, tracked_resource: str) -> None:
"""Run snforge test with trace generation."""
_check_tool("snforge")
print(
f"\n[1/4] Running snforge test (filter: {test_filter}, resource: {tracked_resource})"
)
result = _run(
[
"snforge",
"test",
test_filter,
"--save-trace-data",
"--tracked-resource",
tracked_resource,
],
cwd=pkg_dir,
timeout=600,
)
if result.returncode != 0:
_fail(2, f"snforge test failed with exit code {result.returncode}")
def _step_scarb(pkg_dir: str, executable: str, args_file: str) -> None:
"""Run scarb execute with trace generation."""
_check_tool("scarb")
print(f"\n[1/4] Running scarb execute (executable: {executable})")
cmd = [
"scarb",
"execute",
"--executable-name",
executable,
"--print-resource-usage",
"--save-profiler-trace-data",
]
if args_file:
cmd.extend(["--arguments-file", args_file])
result = _run(cmd, cwd=pkg_dir, timeout=600)
if result.returncode != 0:
_fail(2, f"scarb execute failed with exit code {result.returncode}")
def _find_trace_snforge(pkg_dir: str, test_filter: str) -> str:
"""Find the trace JSON generated by snforge."""
trace_dir = os.path.join(pkg_dir, "snfoundry_trace")
if not os.path.isdir(trace_dir):
# In workspace setups, snforge may create trace in a member subdir.
# Search for snfoundry_trace under pkg_dir.
for root, dirs, _files in os.walk(pkg_dir):
if "snfoundry_trace" in dirs:
trace_dir = os.path.join(root, "snfoundry_trace")
break
else:
_fail(
3,
f"Trace directory not found: {os.path.join(pkg_dir, 'snfoundry_trace')}\n"
f" Also searched subdirectories of {pkg_dir}\n"
f" Did snforge run successfully? Check that the test passed.",
)
# snforge names traces like: <package>_<test_module>_<test_name>.json
# It replaces "::" with "_" in filenames, so normalize the filter.
filter_normalized = test_filter.replace("::", "_")
pattern = os.path.join(trace_dir, f"*{filter_normalized}*.json")
matches = sorted(glob.glob(pattern), key=os.path.getmtime, reverse=True)
if not matches:
# Also try the original filter in case naming convention differs
pattern = os.path.join(trace_dir, f"*{test_filter}*.json")
matches = sorted(glob.glob(pattern), key=os.path.getmtime, reverse=True)
if not matches:
# List what IS there for debugging
all_traces = glob.glob(os.path.join(trace_dir, "*.json"))
available = (
"\n ".join(os.path.basename(f) for f in all_traces)
if all_traces
else "(none)"
)
_fail(
3,
f"No trace file matching '*{test_filter}*' in {trace_dir}/\n"
f" Available traces:\n {available}\n"
f" Hint: The test must PASS to generate a trace. Failing/filtered tests produce no trace.",
)
if len(matches) > 1:
print(f" Warning: Multiple traces match '{test_filter}', using most recent:")
for m in matches:
print(f" {os.path.basename(m)}")
trace = matches[0]
print(f" Trace: {os.path.basename(trace)}")
return trace
def _find_trace_scarb(pkg_dir: str, package: str) -> str:
"""Find the trace JSON generated by scarb execute."""
# Standard location: target/execute/<package>/execution1/cairo_profiler_trace.json
trace = os.path.join(
pkg_dir, "target", "execute", package, "execution1", "cairo_profiler_trace.json"
)
if not os.path.isfile(trace):
_fail(
3,
f"Trace file not found: {trace}\n"
f" Expected at: target/execute/{package}/execution1/cairo_profiler_trace.json\n"
f" Did scarb execute succeed? Check --save-profiler-trace-data was used.",
)
print(f" Trace: {trace}")
return trace
def _step_build_profile(trace_path: str, output_path: str) -> None:
"""Build pprof profile from trace JSON."""
_check_tool("cairo-profiler")
print(f"\n[3/4] Building profile: {os.path.basename(output_path)}")
result = _run(
[
"cairo-profiler",
"build-profile",
trace_path,
"--show-libfuncs",
"--output-path",
output_path,
]
)
if result.returncode != 0:
_fail(
4,
f"cairo-profiler build-profile failed with exit code {result.returncode}\n"
f" Trace: {trace_path}",
)
if not os.path.isfile(output_path):
_fail(4, f"cairo-profiler completed but output file not found: {output_path}")
def _step_view_profile(profile_path: str, sample_name: str) -> None:
"""Print top-20 functions by the chosen sample."""
print(f"\n Top functions by {sample_name}:")
_run(
[
"cairo-profiler",
"view",
profile_path,
"--sample",
sample_name,
"--limit",
"20",
]
)
def _step_export_png(
profile_path: str,
png_path: str,
pprof_sample_index: str,
nodefraction: float = 0.005,
edgefraction: float = 0.001,
) -> None:
"""Export PNG call graph via pprof."""
_check_tool("pprof")
print(f"\n[4/4] Exporting PNG: {os.path.basename(png_path)}")
result = _run(
[
"pprof",
"-png",
f"-sample_index={pprof_sample_index}",
f"-nodefraction={nodefraction}",
f"-edgefraction={edgefraction}",
"-output",
png_path,
profile_path,
]
)
if result.returncode != 0:
_fail(
5,
f"pprof PNG export failed with exit code {result.returncode}\n"
f" Profile: {profile_path}\n"
f" Hint: Is graphviz (dot) installed? Run: apt install graphviz",
)
if not os.path.isfile(png_path):
_fail(5, f"pprof completed but PNG not found: {png_path}")
# ---------------------------------------------------------------------------
# Main
# ---------------------------------------------------------------------------
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
prog="profile.py",
description="Cairo profiling CLI — run tests, build profiles, export PNGs.",
)
sub = parser.add_subparsers(dest="command")
p = sub.add_parser("profile", help="Full profiling pipeline")
p.add_argument(
"--mode",
required=True,
choices=["snforge", "scarb"],
help="Execution mode: snforge (test) or scarb (executable)",
)
p.add_argument("--package", required=True, help="Scarb package name (e.g. falcon)")
p.add_argument(
"--name",
required=True,
help="Human-friendly profile name (e.g. ntt-zknox-reduced)",
)
p.add_argument(
"--metric",
default="steps",
choices=list(METRIC_CONFIG.keys()),
help="Metric to profile (default: steps)",
)
p.add_argument(
"--output", default="profiles", help="Output directory (default: profiles/)"
)
# snforge-specific
p.add_argument(
"--test",
default=None,
help="[snforge] Test filter (e.g. test_ntt_zknox_vs_felt252)",
)
# scarb-specific
p.add_argument("--executable", default=None, help="[scarb] Executable name")
p.add_argument("--args-file", default=None, help="[scarb] Arguments file path")
# pprof display options
p.add_argument(
"--nodefraction",
type=float,
default=0.005,
help="Hide nodes below this fraction of total (default: 0.005). Use 0 to show all.",
)
p.add_argument(
"--edgefraction",
type=float,
default=0.001,
help="Hide edges below this fraction of total (default: 0.001). Use 0 to show all.",
)
return parser
def main() -> int:
parser = build_parser()
args = parser.parse_args()
if args.command != "profile":
parser.print_help()
return 1
# Validate mode-specific args
if args.mode == "snforge" and not args.test:
_fail(
1,
"--test is required for snforge mode.\n"
" Example: --test test_ntt_zknox_vs_felt252",
)
if args.mode == "scarb" and not args.executable:
_fail(
1,
"--executable is required for scarb mode.\n"
" Example: --executable bench_ntt",
)
# Resolve paths
repo_root = _find_repo_root()
pkg_dir = _find_package_dir(repo_root, args.package)
output_dir = os.path.join(repo_root, args.output)
os.makedirs(output_dir, exist_ok=True)
commit = _git_short_hash(repo_root)
metric_cfg = METRIC_CONFIG[args.metric]
# Generate output filenames
pb_path = _profile_filename(
output_dir, args.package, args.name, args.metric, commit, "pb.gz"
)
png_path = _profile_filename(
output_dir, args.package, args.name, args.metric, commit, "png"
)
print(f"Cairo Profiling Pipeline")
print(f" Mode: {args.mode}")
print(f" Package: {args.package} ({pkg_dir})")
print(f" Name: {args.name}")
print(f" Metric: {args.metric} (sample: {metric_cfg['sample_name']})")
print(f" Commit: {commit}")
print(f" Output: {os.path.basename(pb_path)}")
sys.stdout.flush()
# Step 1: Run test/executable
if args.mode == "snforge":
_step_snforge(pkg_dir, args.test, metric_cfg["tracked_resource"])
else:
_step_scarb(pkg_dir, args.executable, args.args_file)
# Step 2: Find trace
print(f"\n[2/4] Locating trace file")
if args.mode == "snforge":
trace_path = _find_trace_snforge(pkg_dir, args.test)
else:
trace_path = _find_trace_scarb(pkg_dir, args.package)
# Step 3: Build profile
_step_build_profile(trace_path, pb_path)
_step_view_profile(pb_path, metric_cfg["sample_name"])
# Step 4: Export PNG
_step_export_png(
pb_path,
png_path,
metric_cfg["pprof_sample_index"],
nodefraction=args.nodefraction,
edgefraction=args.edgefraction,
)
# Summary
print(f"\n{'='*60}")
print(f"Profile: {pb_path}")
print(f"PNG: {png_path}")
print(f"{'='*60}")
return 0
def _find_repo_root() -> str:
"""Walk up from cwd to find the git repo root."""
path = Path.cwd()
while path != path.parent:
if (path / ".git").exists():
return str(path)
path = path.parent
# Fallback to cwd
return str(Path.cwd())
if __name__ == "__main__":
sys.exit(main())
================================================
FILE: .claude/skills/cairo-coding/SKILL.md
================================================
---
name: cairo-coding
description: Use when writing or optimizing Cairo functions — fixing slow loops, expensive arithmetic, integer splitting or limb assembly, modular reduction, storage slot packing, or BoundedInt type bounds
---
# Coding Cairo
Rules and patterns for writing efficient Cairo code. Sourced from audit findings and production profiling.
## When to Use
- Implementing arithmetic (modular, parity checks, quotient/remainder)
- Optimizing loops (slow iteration, repeated `.len()` calls, index-based access)
- Splitting or assembling integer limbs (u256 → u128, u32s → u128, felt252 → u96)
- Packing struct fields into storage slots
- Using `BoundedInt` for zero-overhead arithmetic with compile-time bounds
- Choosing integer types (u128 vs u256, BoundedInt vs native types)
**Not for:** Profiling/benchmarking (use benchmarking-cairo)
## Quick Reference — All Rules
| # | Rule | Instead of | Use |
|---|------|-----------|-----|
| 1 | Combined quotient+remainder | `x / m` + `x % m` | `DivRem::div_rem(x, m)` |
| 2 | Cheap loop conditions | `while i < n` | `while i != n` |
| 3 | Constant powers of 2 | `2_u32.pow(k)` | `match`-based lookup table |
| 4 | Pointer-based iteration | `*data.at(i)` in index loop | `pop_front` / `for` / `multi_pop_front` |
| 5 | Cache array length | `.len()` in loop condition | `let n = data.len();` before loop |
| 6 | Pointer-based slicing | Manual loop extraction | `span.slice(start, length)` |
| 7 | Cheap parity/halving | `index & 1`, `index / 2` | `DivRem::div_rem(index, 2)` |
| 8 | Smallest integer type | `u256` when range < 2^128 | `u128` (type encodes constraint) |
| 9 | Storage slot packing | One slot per field | `StorePacking` trait |
| 10 | BoundedInt for limbs | Bitwise ops / raw u128 math | `bounded_int::{div_rem, mul, add}` |
| 11 | Fast 2-input Poseidon | `poseidon_hash_span([x,y])` | `hades_permutation(x, y, 2)` |
| 12 | Bulk felt252→BoundedInt | `downcast` / `try_into` (4 steps) | `u128s_from_felt252` + `upcast` (2 steps) |
## Always / Never Rules
### 1. Always use `DivRem::div_rem` — never separate `%` and `/`
Cairo computes quotient and remainder in a single operation. Using both `%` and `/` on the same value doubles the cost.
```cairo
// BAD
let q = x / m;
let r = x % m;
// GOOD
let (q, r) = DivRem::div_rem(x, m);
```
### 2. Never use `<` or `>` in while loop conditions — use `!=`
Equality checks are cheaper than comparisons in Cairo.
```cairo
// BAD
while i < n { ... i += 1; }
// GOOD
while i != n { ... i += 1; }
```
### 3. Never compute `2^k` with `pow()` — use a lookup table
`u32::pow()` is expensive. Use a `match` lookup for known ranges.
```cairo
// BAD
let p = 2_u32.pow(depth.into());
// GOOD — match-based lookup
fn pow2(n: u32) -> u32 {
match n {
0 => 1, 1 => 2, 2 => 4, 3 => 8, 4 => 16, 5 => 32,
6 => 64, 7 => 128, 8 => 256, 9 => 512, 10 => 1024,
// extend as needed
_ => core::panic_with_felt252('pow2 out of range'),
}
}
```
### 4. Always iterate arrays with `pop_front` / `for` / `multi_pop_front` — never index-loop
Index-based access (`array.at(i)`) is more expensive than pointer-based iteration.
```cairo
// BAD
let mut i = 0;
while i != data.len() {
let val = *data.at(i);
i += 1;
}
// GOOD — pop_front
while let Option::Some(val) = data.pop_front() { ... }
// GOOD — for loop (equivalent)
for val in data { ... }
// GOOD — batch iteration
while let Option::Some(chunk) = data.multi_pop_front::<4>() { ... }
```
### 5. Never call `.len()` inside a loop condition — cache it
`.len()` recomputes every iteration. Store it once.
```cairo
// BAD
while i != data.len() { ... i += 1; }
// GOOD
let n = data.len();
while i != n { ... i += 1; }
```
### 6. Always use `span.slice()` instead of manual loop extraction
`slice()` manipulates pointers directly — no element-by-element copying.
```cairo
// BAD
let mut result: Array<felt252> = array![];
let mut i = 0;
while i != length {
result.append(*data.at(start + i));
i += 1;
}
// GOOD
let result = data.slice(start, length);
```
### 7. Always use `DivRem` for parity checks — never use bitwise ops
Bitwise AND is more expensive than `div_rem` in Cairo. Use `DivRem::div_rem(x, 2)` to get both the halved value and parity in one operation.
```cairo
// BAD
let is_odd = (index & 1) == 1;
index = index / 2;
// GOOD
let (q, r) = DivRem::div_rem(index, 2);
if r == 1 { /* odd branch */ }
index = q;
```
### 8. Always use the smallest integer type that fits the value range
`u128` instead of `u256` when the range is known. Adds clarity, prevents intermediate overflow.
```cairo
// BAD — u256 for a value known to be < 2^128
fn deposit(value: u256) { assert(value < MAX_U128, '...'); ... }
// GOOD — type encodes the constraint
fn deposit(value: u128) { ... }
```
### 9. Always use `StorePacking` to pack small fields into one storage slot
Multiple small fields (basis points, flags, bounded amounts) can share a single `felt252` slot.
```cairo
use starknet::storage_access::StorePacking;
const POW_2_128: felt252 = 0x100000000000000000000000000000000;
impl MyStorePacking of StorePacking<MyStruct, felt252> {
fn pack(value: MyStruct) -> felt252 {
value.amount.into() + value.fee_bps.into() * POW_2_128
}
fn unpack(value: felt252) -> MyStruct {
let u256 { low, high } = value.into();
MyStruct { amount: low, fee_bps: high.try_into().unwrap() }
}
}
```
### 10. Always use BoundedInt for byte cutting, limb assembly, and type conversions
Never use bitwise ops (`&`, `|`, shifts) or raw `u128`/`u256` arithmetic for splitting or combining integer limbs. Use `bounded_int::div_rem` to extract parts and `bounded_int::mul` + `bounded_int::add` to assemble them. BoundedInt tracks bounds at compile time, eliminating overflow checks.
**Assembling limbs** (e.g., 4 x u32 → u128):
```cairo
// BAD — direct u128 arithmetic (28,340 gas)
fn u32s_to_u128(d0: u32, d1: u32, d2: u32, d3: u32) -> u128 {
d0.into() + d1.into() * POW_2_32 + d2.into() * POW_2_64 + d3.into() * POW_2_96
}
// GOOD — BoundedInt (13,840 gas, 2x faster)
fn u32s_to_u128(d0: u32, d1: u32, d2: u32, d3: u32) -> u128 {
let d0_bi: u32_bi = upcast(d0);
let d1_bi: u32_bi = upcast(d1);
let d2_bi: u32_bi = upcast(d2);
let d3_bi: u32_bi = upcast(d3);
let r: u128_bi = add(add(add(d0_bi, mul(d1_bi, POW_32_UI)), mul(d2_bi, POW_64_UI)), mul(d3_bi, POW_96_UI));
upcast(r)
}
```
**Splitting values** (e.g., felt252 → two u96 limbs):
```cairo
// GOOD — div_rem to split, mul+add to reassemble
fn felt252_to_two_u96(value: felt252) -> (u96, u96) {
match u128s_from_felt252(value) {
U128sFromFelt252Result::Narrow(low) => {
let (hi32, lo96) = bounded_int::div_rem(low, NZ_POW96_TYPED);
(lo96, upcast(hi32))
},
U128sFromFelt252Result::Wide((high, low)) => {
let (lo_hi32, lo96) = bounded_int::div_rem(low, NZ_POW96_TYPED);
let hi64: BoundedInt<0, { POW64 - 1 }> = downcast(high).unwrap();
(lo96, bounded_int::add(bounded_int::mul(hi64, POW32_TYPED), lo_hi32))
},
}
}
```
**Extracting bits** (e.g., building a 4-bit selector):
```cairo
// GOOD — div_rem by 2 extracts LSB, quotient is right-shifted value
let (qu1, bit0) = bounded_int::div_rem(u1, TWO_NZ); // bit0 in {0,1}
let (qu2, bit1) = bounded_int::div_rem(u2, TWO_NZ);
let selector = add(bit0, mul(bit1, TWO_UI)); // selector in {0..3}
```
See [garaga/selectors.cairo](https://github.com/keep-starknet-strange/garaga/blob/main/src/src/ec/selectors.cairo) and [cairo-perfs-snippets](https://github.com/feltroidprime/cairo-perfs-snippets) for production examples.
## Code Quality
- **DRY:** Extract repeated validation into helper functions. If two functions validate-then-write the same struct, extract a shared `_set_config()`.
- **`scarb fmt`:** Run before every commit.
- **`.tool-versions`:** Pin Scarb and Starknet Foundry versions with ASDF for reproducible builds.
- **Keep dependencies updated:** Newer Scarb/Foundry versions include gas optimizations and compiler improvements.
---
## BoundedInt Optimization
`BoundedInt<MIN, MAX>` encodes value constraints in the type system, eliminating runtime overflow checks. Use the CLI tool to compute bounds — do NOT calculate manually.
### Critical Architecture Decision: Avoid Downcast
**The #1 optimization pitfall:** Converting between `u16`/`u32`/`u64` and `BoundedInt` at function boundaries.
#### The Problem
If your functions take `u16` and return `u16`, you must:
1. `downcast` input to `BoundedInt` (expensive — requires range check)
2. Do bounded arithmetic (cheap)
3. `upcast` result back to `u16` (cheap but wasteful)
The `downcast` operation adds a range check that **dominates the savings** from bounded arithmetic. In profiling:
- `downcast`: 161,280 steps (18.86%)
- `bounded_int_div_rem`: 204,288 steps (23.89%)
- Total bounded approach: worse than original!
#### The Solution: BoundedInt Throughout
**Use `BoundedInt` types as function inputs AND outputs.** This eliminates downcast entirely.
```cairo
// BAD: Converts at every call (downcast overhead kills performance)
pub fn add_mod(a: u16, b: u16) -> u16 {
let a: Zq = downcast(a).expect('overflow'); // EXPENSIVE
let b: Zq = downcast(b).expect('overflow'); // EXPENSIVE
let sum: ZqSum = add(a, b);
let (_q, rem) = bounded_int_div_rem(sum, nz_q);
upcast(rem)
}
// GOOD: BoundedInt in, BoundedInt out (no downcast)
pub fn add_mod(a: Zq, b: Zq) -> Zq {
let sum: ZqSum = add(a, b);
let (_q, rem) = bounded_int_div_rem(sum, nz_q);
rem
}
```
#### Refactoring Strategy
When optimizing existing code:
1. **Identify the hot path** — profile to find which functions use modular arithmetic heavily
2. **Change signatures** — update function inputs/outputs to use `BoundedInt` types
3. **Propagate types outward** — callers must also use `BoundedInt`
4. **Downcast only at boundaries** — convert from u16/u32 only at system entry points (e.g., deserialization)
#### Type Conversion Rules
| From | To | Operation | Cost |
|------|-----|-----------|------|
| `u16` | `BoundedInt<0, 65535>` | `upcast` | Free (superset) |
| `u16` | `BoundedInt<0, 12288>` | `downcast` | **Expensive** (range check) |
| `BoundedInt<0, 12288>` | `u16` | `upcast` | Free (subset) |
| `BoundedInt<A, B>` | `BoundedInt<C, D>` where [A,B] ⊆ [C,D] | `upcast` | Free |
| `BoundedInt<A, B>` | `BoundedInt<C, D>` where [A,B] ⊄ [C,D] | `downcast` | **Expensive** |
**Key insight:** `upcast` only works when target range is a **superset** of source range. You cannot upcast `u32` to `BoundedInt<0, 150994944>` because `u32` max (4294967295) > 150994944.
### Prerequisites
```toml
# Scarb.toml
[dependencies]
corelib_imports = "0.1.3"
```
```cairo
// CORRECT imports — copy exactly
use corelib_imports::bounded_int::{
BoundedInt, upcast, downcast, bounded_int_div_rem,
AddHelper, MulHelper, DivRemHelper, UnitInt,
};
use corelib_imports::bounded_int::bounded_int::{SubHelper, add, sub, mul};
```
### Copy-Paste Template
Working example for modular arithmetic mod 100:
```cairo
use corelib_imports::bounded_int::{
BoundedInt, upcast, downcast, bounded_int_div_rem,
AddHelper, MulHelper, DivRemHelper, UnitInt,
};
use corelib_imports::bounded_int::bounded_int::{SubHelper, add, sub, mul};
type Val = BoundedInt<0, 99>; // [0, 99]
type ValSum = BoundedInt<0, 198>; // [0, 198]
type ValConst = UnitInt<100>; // singleton {100}
impl AddValImpl of AddHelper<Val, Val> {
type Result = ValSum;
}
impl DivRemValImpl of DivRemHelper<ValSum, ValConst> {
type DivT = BoundedInt<0, 1>;
type RemT = Val;
}
fn add_mod_100(a: Val, b: Val) -> Val {
let sum: ValSum = add(a, b);
let nz_100: NonZero<ValConst> = 100;
let (_q, rem) = bounded_int_div_rem(sum, nz_100);
rem
}
```
### CLI Tool
Use `bounded_int_calc.py` in this skill directory. **Always use CLI — never calculate manually.**
```bash
# Addition: [a_lo, a_hi] + [b_lo, b_hi]
python3 bounded_int_calc.py add 0 12288 0 12288
# -> BoundedInt<0, 24576>
# Subtraction: [a_lo, a_hi] - [b_lo, b_hi]
python3 bounded_int_calc.py sub 0 12288 0 12288
# -> BoundedInt<-12288, 12288>
# Multiplication
python3 bounded_int_calc.py mul 0 12288 0 12288
# -> BoundedInt<0, 150994944>
# Division: quotient and remainder bounds
python3 bounded_int_calc.py div 0 24576 12289 12289
# -> DivT: BoundedInt<0, 1>, RemT: BoundedInt<0, 12288>
# Custom impl name
python3 bounded_int_calc.py mul 0 12288 0 12288 --name MulZqImpl
```
### BoundedInt Bounds Quick Reference
| Operation | Formula |
|-----------|---------|
| Add | `[a_lo + b_lo, a_hi + b_hi]` |
| Sub | `[a_lo - b_hi, a_hi - b_lo]` |
| Mul (unsigned) | `[a_lo * b_lo, a_hi * b_hi]` |
| Div quotient | `[a_lo / b_hi, a_hi / b_lo]` |
| Div remainder | `[0, b_hi - 1]` |
### Negative Dividends: SHIFT Pattern
`bounded_int_div_rem` doesn't support negative lower bounds. When a subtraction produces a negative-bounded result that needs reduction, add a multiple of the modulus first:
```cairo
// sub_mod: (a - b) mod Q via SHIFT
pub fn sub_mod(a: Zq, b: Zq) -> Zq {
let a_plus_q: BoundedInt<12289, 24577> = add(a, Q_CONST); // shift by +Q
let diff: BoundedInt<1, 24577> = sub(a_plus_q, b); // now non-negative
let (_q, rem) = bounded_int_div_rem(diff, nz_q());
rem
}
// fused_sub_mul_mod: a - (b*c) mod Q via large SHIFT
// OFFSET = 12288 * Q = 151007232 (smallest multiple of Q >= max product)
pub fn fused_sub_mul_mod(a: Zq, b: Zq, c: Zq) -> Zq {
let prod: ZqProd = mul(b, c);
let a_offset: BoundedInt<151007232, 151019520> = add(a, OFFSET_CONST);
let diff: BoundedInt<12288, 151019520> = sub(a_offset, prod);
let (_q, rem) = bounded_int_div_rem(diff, nz_q());
rem
}
```
Rule: SHIFT = `ceil(|min_possible_value| / modulus) * modulus`. Adding SHIFT preserves the result mod Q (since SHIFT ≡ 0 mod Q) while making all values non-negative.
### felt252 → BoundedInt: Prefer u128 Decomposition Over Downcast
`u128s_from_felt252` is a native VM operation (2 steps/call). `downcast` (used by `try_into()`) performs a range check (4 steps/call). When converting many felt252 values to BoundedInt, decompose to u128 first, then upcast to `BoundedInt<0, u128_max>`. You lose tight compile-time bounds but save 2 steps per conversion — significant at scale.
Benchmarked per-call costs (isolated loop, 512 iterations, varying input):
| Libfunc | Steps/call | Source |
|---------|-----------|--------|
| `u128s_from_felt252` | 2 | 1,024 flat / 512 calls |
| `downcast` (try_into) | 4 | 2,048 flat / 512 calls |
| `bounded_int_div_rem` | 7 | 3,584 flat / 512 calls (same both) |
| Approach | Per-conversion cost | Sierra bloat | Notes |
|----------|-------------------|--------------|-------|
| `try_into().unwrap()` | 4 steps (downcast) | **O(N^2)** — panic drops all live vars | Never in unrolled code |
| `match try_into() { Some/None }` | 4 steps (downcast) | OK | No panic but pays downcast cost |
| `u128s_from_felt252` + `upcast` | 2 steps | OK | **Preferred** — native decomposition |
End-to-end impact (512-point NTT verify): u128 approach saves 1,024 steps / ~1.6M L2 gas (4.4%) vs match-based downcast.
```cairo
use corelib_imports::integer::{U128sFromFelt252Result, u128s_from_felt252};
type U128AsBounded = BoundedInt<0, 340282366920938463463374607431768211455>;
#[inline(always)]
fn felt252_as_u128(x: felt252) -> u128 {
match u128s_from_felt252(x) {
U128sFromFelt252Result::Narrow(low) => low,
U128sFromFelt252Result::Wide((_, low)) => low,
}
}
// Convert felt252 to BoundedInt via u128 (no range-check overhead)
let r: U128AsBounded = upcast(felt252_as_u128(value + SHIFT));
let (_, r) = bounded_int_div_rem(r, NZ_Q); // DivRemHelper<U128AsBounded, QConst>
```
**Trade-off:** `U128AsBounded` has max=2^128-1 instead of the tight shifted bound. The `DivRemHelper` quotient type is wider, but `bounded_int_div_rem` cost is the same. Fine for most cases — only matters if downstream code needs tight bounds on the quotient.
**When to use which:**
- **Bulk conversions (generated/unrolled code):** Always `u128s_from_felt252` + `upcast`
- **One-off boundary conversions (deserialization):** `downcast` is fine — per-call overhead negligible
- **Never in hot paths:** `try_into().unwrap()` — panic path causes quadratic Sierra bloat
### Common BoundedInt Mistakes
- **Downcast at every function call** — the biggest performance killer. Use `BoundedInt` types throughout, not just inside arithmetic functions.
- **Trying to upcast to a narrower type** — `upcast(val: u32)` to `BoundedInt<0, 150994944>` fails because u32 max > 150994944.
- **Wrong imports** — use exact imports from Prerequisites section above.
- **Wrong subtraction bounds** — it's `[a_lo - b_hi, a_hi - b_lo]`, NOT `[a_lo - b_lo, a_hi - b_hi]`.
- **Negative dividend in `bounded_int_div_rem`** — div_rem doesn't support negative lower bounds. Add a SHIFT (multiple of modulus) before reducing. See SHIFT pattern above.
- **Missing intermediate types** — always annotate: `let sum: ZqSum = add(a, b);`
- **Division quotient off-by-one** — integer division floors: `24576 / 12289 = 1`, not 2.
- **Using `UnitInt` vs `BoundedInt` for constants** — use `UnitInt<N>` for singleton constants like divisors.
- **Using `div_rem` vs `bounded_int_div_rem`** — the function is `bounded_int_div_rem`, not `div_rem`.
- **Bounds exceed u128::max** — BoundedInt bounds are hard-capped at 2^128. Larger values crash the Sierra specializer: 'Provided generic argument is unsupported.'
- **Using `downcast`/`try_into` for bulk felt252 → BoundedInt** — use `u128s_from_felt252` + `upcast` instead (2 vs 4 steps/call). See "felt252 → BoundedInt" section above.
================================================
FILE: .claude/skills/cairo-coding/bounded_int_calc.py
================================================
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Bounded Integer Implementation Calculator
Computes exact type bounds for Cairo BoundedInt helper trait implementations.
Outputs ready-to-paste Cairo code.
Usage:
python3 bounded_int_calc.py add <a_lo> <a_hi> <b_lo> <b_hi> [--name NAME]
python3 bounded_int_calc.py sub <a_lo> <a_hi> <b_lo> <b_hi> [--name NAME]
python3 bounded_int_calc.py mul <a_lo> <a_hi> <b_lo> <b_hi> [--name NAME]
python3 bounded_int_calc.py div <a_lo> <a_hi> <b_lo> <b_hi> [--name NAME]
"""
import argparse
import sys
# felt252 prime (for validation)
FELT252_PRIME = 0x800000000000011000000000000000000000000000000000000000000000001
def validate_felt252(value: int, name: str) -> None:
"""Warn if value exceeds felt252 range."""
if value < 0:
# Negative values are represented as P - |value| in felt252
if abs(value) >= FELT252_PRIME:
print(f"WARNING: {name} = {value} exceeds felt252 range!", file=sys.stderr)
elif value >= FELT252_PRIME:
print(f"WARNING: {name} = {value} exceeds felt252 range!", file=sys.stderr)
def format_bound(value: int) -> str:
"""Format a bound value, handling negatives."""
if value < 0:
return str(value)
return str(value)
def calc_add(a_lo: int, a_hi: int, b_lo: int, b_hi: int) -> tuple[int, int]:
"""Calculate addition bounds: [a_lo + b_lo, a_hi + b_hi]"""
result_lo = a_lo + b_lo
result_hi = a_hi + b_hi
return result_lo, result_hi
def calc_sub(a_lo: int, a_hi: int, b_lo: int, b_hi: int) -> tuple[int, int]:
"""Calculate subtraction bounds: [a_lo - b_hi, a_hi - b_lo]"""
result_lo = a_lo - b_hi
result_hi = a_hi - b_lo
return result_lo, result_hi
def calc_mul(a_lo: int, a_hi: int, b_lo: int, b_hi: int) -> tuple[int, int]:
"""
Calculate multiplication bounds.
For unsigned: [a_lo * b_lo, a_hi * b_hi]
For signed/mixed: evaluate all corners.
"""
corners = [
a_lo * b_lo,
a_lo * b_hi,
a_hi * b_lo,
a_hi * b_hi,
]
return min(corners), max(corners)
def calc_div(
a_lo: int, a_hi: int, b_lo: int, b_hi: int
) -> tuple[tuple[int, int], tuple[int, int]]:
"""
Calculate division bounds.
Quotient: [a_lo // b_hi, a_hi // b_lo]
Remainder: [0, b_hi - 1]
Note: Cairo's bounded_int_div_rem requires non-negative dividends.
"""
if b_lo <= 0:
print("ERROR: Divisor lower bound must be positive!", file=sys.stderr)
sys.exit(1)
if a_lo < 0:
print(
"ERROR: Dividend lower bound must be non-negative! Cairo's bounded_int_div_rem does not support negative dividends.",
file=sys.stderr,
)
sys.exit(1)
quot_lo = a_lo // b_hi
quot_hi = a_hi // b_lo
rem_lo = 0
rem_hi = b_hi - 1
return (quot_lo, quot_hi), (rem_lo, rem_hi)
def generate_add_impl(a_lo: int, a_hi: int, b_lo: int, b_hi: int, name: str) -> str:
result_lo, result_hi = calc_add(a_lo, a_hi, b_lo, b_hi)
validate_felt252(result_lo, "Result min")
validate_felt252(result_hi, "Result max")
return f"""impl {name} of AddHelper<BoundedInt<{format_bound(a_lo)}, {format_bound(a_hi)}>, BoundedInt<{format_bound(b_lo)}, {format_bound(b_hi)}>> {{
type Result = BoundedInt<{format_bound(result_lo)}, {format_bound(result_hi)}>;
}}"""
def generate_sub_impl(a_lo: int, a_hi: int, b_lo: int, b_hi: int, name: str) -> str:
result_lo, result_hi = calc_sub(a_lo, a_hi, b_lo, b_hi)
validate_felt252(result_lo, "Result min")
validate_felt252(result_hi, "Result max")
return f"""impl {name} of SubHelper<BoundedInt<{format_bound(a_lo)}, {format_bound(a_hi)}>, BoundedInt<{format_bound(b_lo)}, {format_bound(b_hi)}>> {{
type Result = BoundedInt<{format_bound(result_lo)}, {format_bound(result_hi)}>;
}}"""
def generate_mul_impl(a_lo: int, a_hi: int, b_lo: int, b_hi: int, name: str) -> str:
result_lo, result_hi = calc_mul(a_lo, a_hi, b_lo, b_hi)
validate_felt252(result_lo, "Result min")
validate_felt252(result_hi, "Result max")
return f"""impl {name} of MulHelper<BoundedInt<{format_bound(a_lo)}, {format_bound(a_hi)}>, BoundedInt<{format_bound(b_lo)}, {format_bound(b_hi)}>> {{
type Result = BoundedInt<{format_bound(result_lo)}, {format_bound(result_hi)}>;
}}"""
def generate_div_impl(a_lo: int, a_hi: int, b_lo: int, b_hi: int, name: str) -> str:
(quot_lo, quot_hi), (rem_lo, rem_hi) = calc_div(a_lo, a_hi, b_lo, b_hi)
validate_felt252(quot_lo, "Quotient min")
validate_felt252(quot_hi, "Quotient max")
validate_felt252(rem_lo, "Remainder min")
validate_felt252(rem_hi, "Remainder max")
return f"""impl {name} of DivRemHelper<BoundedInt<{format_bound(a_lo)}, {format_bound(a_hi)}>, BoundedInt<{format_bound(b_lo)}, {format_bound(b_hi)}>> {{
type DivT = BoundedInt<{format_bound(quot_lo)}, {format_bound(quot_hi)}>;
type RemT = BoundedInt<{format_bound(rem_lo)}, {format_bound(rem_hi)}>;
}}"""
def main():
parser = argparse.ArgumentParser(
description="Calculate BoundedInt helper trait implementations",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
# Addition: [0, 12288] + [0, 12288]
python3 bounded_int_calc.py add 0 12288 0 12288
# Subtraction: [0, 12288] - [0, 12288]
python3 bounded_int_calc.py sub 0 12288 0 12288
# Multiplication: [0, 12288] * [0, 12288]
python3 bounded_int_calc.py mul 0 12288 0 12288
# Division: [128, 255] / [3, 8]
python3 bounded_int_calc.py div 128 255 3 8
# Custom impl name
python3 bounded_int_calc.py mul 0 12288 0 12288 --name Zq12289MulHelper
""",
)
subparsers = parser.add_subparsers(dest="operation", required=True)
# Add command
add_parser = subparsers.add_parser(
"add", help="Addition: [a_lo, a_hi] + [b_lo, b_hi]"
)
add_parser.add_argument("a_lo", type=int, help="Lower bound of first operand")
add_parser.add_argument("a_hi", type=int, help="Upper bound of first operand")
add_parser.add_argument("b_lo", type=int, help="Lower bound of second operand")
add_parser.add_argument("b_hi", type=int, help="Upper bound of second operand")
add_parser.add_argument("--name", default="AddImpl", help="Name for the impl")
# Sub command
sub_parser = subparsers.add_parser(
"sub", help="Subtraction: [a_lo, a_hi] - [b_lo, b_hi]"
)
sub_parser.add_argument("a_lo", type=int, help="Lower bound of first operand")
sub_parser.add_argument("a_hi", type=int, help="Upper bound of first operand")
sub_parser.add_argument("b_lo", type=int, help="Lower bound of second operand")
sub_parser.add_argument("b_hi", type=int, help="Upper bound of second operand")
sub_parser.add_argument("--name", default="SubImpl", help="Name for the impl")
# Mul command
mul_parser = subparsers.add_parser(
"mul", help="Multiplication: [a_lo, a_hi] * [b_lo, b_hi]"
)
mul_parser.add_argument("a_lo", type=int, help="Lower bound of first operand")
mul_parser.add_argument("a_hi", type=int, help="Upper bound of first operand")
mul_parser.add_argument("b_lo", type=int, help="Lower bound of second operand")
mul_parser.add_argument("b_hi", type=int, help="Upper bound of second operand")
mul_parser.add_argument("--name", default="MulImpl", help="Name for the impl")
# Div command
div_parser = subparsers.add_parser(
"div", help="Division: [a_lo, a_hi] / [b_lo, b_hi]"
)
div_parser.add_argument("a_lo", type=int, help="Lower bound of dividend")
div_parser.add_argument("a_hi", type=int, help="Upper bound of dividend")
div_parser.add_argument(
"b_lo", type=int, help="Lower bound of divisor (must be > 0)"
)
div_parser.add_argument("b_hi", type=int, help="Upper bound of divisor")
div_parser.add_argument("--name", default="DivRemImpl", help="Name for the impl")
args = parser.parse_args()
if args.operation == "add":
print(generate_add_impl(args.a_lo, args.a_hi, args.b_lo, args.b_hi, args.name))
elif args.operation == "sub":
print(generate_sub_impl(args.a_lo, args.a_hi, args.b_lo, args.b_hi, args.name))
elif args.operation == "mul":
print(generate_mul_impl(args.a_lo, args.a_hi, args.b_lo, args.b_hi, args.name))
elif args.operation == "div":
print(generate_div_impl(args.a_lo, args.a_hi, args.b_lo, args.b_hi, args.name))
if __name__ == "__main__":
main()
================================================
FILE: .github/.all-contributorsrc
================================================
{
"projectName": "garaga",
"projectOwner": "keep-starknet-strange",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"imageSize": 100,
"commit": true,
"commitConvention": "gitmoji",
"contributors": [
{
"login": "feltroidprime",
"name": "Feltroid Prime",
"avatar_url": "https://avatars.githubusercontent.com/u/96737978?v=4",
"profile": "https://github.com/feltroidprime",
"contributions": [
"code"
]
},
{
"login": "abdelhamidbakhta",
"name": "Abdel @ StarkWare ",
"avatar_url": "https://avatars.githubusercontent.com/u/45264458?v=4",
"profile": "https://github.com/abdelhamidbakhta",
"contributions": [
"code"
]
},
{
"login": "tekkac",
"name": "Tarik K.",
"avatar_url": "https://avatars.githubusercontent.com/u/98529704?v=4",
"profile": "https://github.com/tekkac",
"contributions": [
"code"
]
},
{
"login": "bacharif",
"name": "Bachir Arif",
"avatar_url": "https://avatars.githubusercontent.com/u/22233193?v=4",
"profile": "https://github.com/bacharif",
"contributions": [
"code"
]
},
{
"login": "rdubois-crypto",
"name": "Renaud Dubois",
"avatar_url": "https://avatars.githubusercontent.com/u/103030189?v=4",
"profile": "https://github.com/rdubois-crypto",
"contributions": [
"code"
]
},
{
"login": "raugfer",
"name": "Rodrigo Ferreira",
"avatar_url": "https://avatars.githubusercontent.com/u/725060?v=4",
"profile": "https://raugfer.com/",
"contributions": [
"code"
]
},
{
"login": "luiz-lvj",
"name": "Luiz Vasconcelos Júnior",
"avatar_url": "https://avatars.githubusercontent.com/u/64055364?v=4",
"profile": "https://github.com/luiz-lvj",
"contributions": [
"code"
]
},
{
"login": "shramee",
"name": "Shramee Srivastav",
"avatar_url": "https://avatars.githubusercontent.com/u/11048263?v=4",
"profile": "http://shramee.me/",
"contributions": [
"code"
]
},
{
"login": "akinovak",
"name": "Andrija Novakovic",
"avatar_url": "https://avatars.githubusercontent.com/u/28649205?v=4",
"profile": "https://github.com/akinovak",
"contributions": [
"code"
]
},
{
"login": "Liam-Eagen",
"name": "Liam Eagen",
"avatar_url": "https://avatars.githubusercontent.com/u/5618692?v=4",
"profile": "https://github.com/Liam-Eagen",
"contributions": [
"code"
]
},
{
"login": "petscheit",
"name": "Paul Etscheit",
"avatar_url": "https://avatars.githubusercontent.com/u/10947187?v=4",
"profile": "https://github.com/petscheit",
"contributions": [
"code"
]
},
{
"login": "stefanMadzharov",
"name": "stefanMadzharov",
"avatar_url": "https://avatars.githubusercontent.com/u/83451593?v=4",
"profile": "https://github.com/stefanMadzharov",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
"linkToUsage": true
}
================================================
FILE: .github/CODEOWNERS
================================================
* @abdelhamidbakhta @feltroidprime
================================================
FILE: .github/ISSUE_TEMPLATE/01_BUG_REPORT.md
================================================
---
name: Bug Report
about: Create a report to help Garaga to improve
title: "bug: "
labels: "bug"
assignees: ""
---
# Bug Report
**Garaga version:**
<!-- Please specify commit or tag version. -->
**Current behavior:**
<!-- Describe how the bug manifests. -->
**Expected behavior:**
<!-- Describe what you expect the behavior to be without the bug. -->
**Steps to reproduce:**
<!-- Explain the steps required to duplicate the issue, especially if you are able to provide a sample application. -->
**Related code:**
<!-- If you are able to illustrate the bug or feature request with an example, please provide it here. -->
```
insert short code snippets here
```
**Other information:**
<!-- List any other information that is relevant to your issue. Related issues, suggestions on how to fix, Stack Overflow links, forum links, etc. -->
================================================
FILE: .github/ISSUE_TEMPLATE/02_FEATURE_REQUEST.md
================================================
---
name: Feature Request
about: Suggest an idea for this project
title: "feat: "
labels: "enhancement"
assignees: ""
---
# Feature Request
**Describe the Feature Request**
<!-- A clear and concise description of what the feature request is. Please include if your feature request is related to a problem. -->
**Describe Preferred Solution**
<!-- A clear and concise description of what you want to happen. -->
**Describe Alternatives**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
**Related Code**
<!-- If you are able to illustrate the bug or feature request with an example, please provide it here. -->
**Additional Context**
<!-- List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to add, use case, Stack Overflow links, forum links, screenshots, OS if applicable, etc. -->
**If the feature request is approved, would you be willing to submit a PR?**
_(Help can be provided if you need assistance submitting a PR)_
- [ ] Yes
- [ ] No
================================================
FILE: .github/ISSUE_TEMPLATE/03_CODEBASE_IMPROVEMENT.md
================================================
---
name: Codebase improvement
about: Provide your feedback for the existing codebase. Suggest a better solution for algorithms, development tools, etc.
title: "dev: "
labels: "enhancement"
assignees: ""
---
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
---
blank_issues_enabled: false
contact_links:
- name: Garaga Community Support
url: https://github.com/keep-starknet-strange/garaga/discussions
about: Please ask and answer questions here.
================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
<!--- Please provide a general summary of your changes in the title above -->
# Pull Request type
<!-- Please try to limit your pull request to one type; submit multiple pull requests if needed. -->
Please check the type of change your PR introduces:
- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no API changes)
- [ ] Build-related changes
- [ ] Documentation content changes
- [ ] Testing
- [ ] Other (please describe):
# What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
Issue Number: N/A
# What is the new behavior?
<!-- Please describe the behavior or changes that are being added by this PR. -->
-
-
-
# Does this introduce a breaking change?
- [ ] Yes
- [ ] No
<!-- If this does introduce a breaking change, please describe the impact and migration path for existing applications below. -->
# Other information
<!-- Any other information that is important to this PR, such as screenshots of how the component looks before and after the change. -->
================================================
FILE: .github/labels.yml
================================================
---
- name: "breaking-change"
color: ee0701
description: "A change that changes the API or breaks backward compatibility for users."
- name: "bugfix"
color: ee0701
description: "Inconsistencies or issues which will cause a problem for users or implementors."
- name: "documentation"
color: 0052cc
description: "Solely about the documentation of the project."
- name: "enhancement"
color: 1d76db
description: "Enhancement of the code, not introducing new features."
- name: "refactor"
color: 1d76db
description: "Updating the code with simpler, easier to understand or more efficient syntax or methods, but not introducing new features."
- name: "performance"
color: 1d76db
description: "Improving performance of the project, not introducing new features."
- name: "new-feature"
color: 0e8a16
description: "New features or options."
- name: "maintenance"
color: 2af79e
description: "Generic maintenance tasks."
- name: "ci"
color: 1d76db
description: "Work that improves the continuous integration."
- name: "dependencies"
color: 1d76db
description: "Change in project dependencies."
- name: "in-progress"
color: fbca04
description: "Issue is currently being worked on by a developer."
- name: "stale"
color: fef2c0
description: "No activity for quite some time."
- name: "no-stale"
color: fef2c0
description: "This is exempt from the stale bot."
- name: "security"
color: ee0701
description: "Addressing a vulnerability or security risk in this project."
- name: "incomplete"
color: fef2c0
description: "Missing information."
- name: "invalid"
color: fef2c0
description: "This is off-topic, spam, or otherwise doesn't apply to this project."
- name: "beginner-friendly"
color: 0e8a16
description: "Good first issue for people wanting to contribute to this project."
- name: "help-wanted"
color: 0e8a16
description: "We need some extra helping hands or expertise in order to resolve this!"
- name: "priority-critical"
color: ee0701
description: "Must be addressed as soon as possible."
- name: "priority-high"
color: b60205
description: "After critical issues are fixed, these should be dealt with before any further issues."
- name: "priority-medium"
color: 0e8a16
description: "This issue may be useful, and needs some attention."
- name: "priority-low"
color: e4ea8a
description: "Nice addition, maybe... someday..."
- name: "major"
color: b60205
description: "This PR causes a major bump in the version number."
- name: "minor"
color: 0e8a16
description: "This PR causes a minor bump in the version number."
================================================
FILE: .github/scripts/declare_maintained_contracts.py
================================================
import asyncio
import os
from enum import Enum
from pathlib import Path
import dotenv
from starknet_py.net.account.account import Account
from starknet_py.net.full_node_client import FullNodeClient
from starknet_py.net.models import StarknetChainId
from starknet_py.net.signer.stark_curve_signer import KeyPair
from garaga.hints.io import to_int
from garaga.starknet.cli.smart_contract_project import SmartContractProject
from garaga.starknet.tests_and_calldata_generators.drand_calldata import (
generate_drand_decrypt_constants,
)
dotenv.load_dotenv(".secrets")
CONTRACTS_PATH = Path("src/contracts")
class Network(Enum):
SEPOLIA = "sepolia"
MAINNET = "mainnet"
def to_starknet_chain_id(self):
if self == Network.SEPOLIA:
return StarknetChainId.SEPOLIA
elif self == Network.MAINNET:
return StarknetChainId.MAINNET
else:
raise ValueError(f"Unknown network: {self}")
def get_account(network: Network):
rpc_url = os.getenv(f"{network.value.upper()}_RPC_URL")
account_address = os.getenv(f"{network.value.upper()}_ACCOUNT_ADDRESS")
account_private_key = os.getenv(f"{network.value.upper()}_ACCOUNT_PRIVATE_KEY")
client = FullNodeClient(node_url=rpc_url)
account = Account(
address=account_address,
client=client,
key_pair=KeyPair.from_private_key(to_int(account_private_key)),
chain=network.to_starknet_chain_id(),
)
return account
async def declare_contract_from_path(path: Path, network: Network):
contract = SmartContractProject(smart_contract_folder=path)
account = get_account(network)
await contract.declare_class_hash(account=account)
async def declare_contract_from_path_both_networks(path: Path):
await declare_contract_from_path(path, Network.SEPOLIA)
await asyncio.sleep(0.3)
await declare_contract_from_path(path, Network.MAINNET)
async def main():
await declare_contract_from_path_both_networks(CONTRACTS_PATH / "universal_ecip")
await asyncio.sleep(0.3)
await declare_contract_from_path_both_networks(CONTRACTS_PATH / "drand_quicknet")
await asyncio.sleep(0.3)
# Generate verifier class hash into decrypt constants, then declare
verifier = SmartContractProject(
smart_contract_folder=CONTRACTS_PATH / "drand_quicknet"
)
generate_drand_decrypt_constants(
verifier.get_sierra_class_hash(),
CONTRACTS_PATH / "drand_decrypt_quicknet",
)
await declare_contract_from_path_both_networks(
CONTRACTS_PATH / "drand_decrypt_quicknet"
)
await asyncio.sleep(0.3)
await declare_contract_from_path_both_networks(
CONTRACTS_PATH / "autogenerated" / "risc0_verifier_bn254"
)
await asyncio.sleep(0.3)
await declare_contract_from_path_both_networks(
CONTRACTS_PATH / "autogenerated" / "sp1_verifier_bn254"
)
if __name__ == "__main__":
asyncio.run(main())
================================================
FILE: .github/scripts/verify_contracts.py
================================================
import ast
import asyncio
import os
import sys
from enum import Enum
from pathlib import Path
import dotenv
from starknet_py.net.full_node_client import FullNodeClient
import garaga.hints.io as io
from garaga.starknet.cli.smart_contract_project import SmartContractProject
dotenv.load_dotenv(".secrets")
class Network(Enum):
SEPOLIA = "sepolia"
MAINNET = "mainnet"
def get_rpc_url(self):
return os.getenv(f"{self.value.upper()}_RPC_URL")
def get_class_hash_from_generator():
try:
with open(
"hydra/garaga/starknet/groth16_contract_generator/generator.py", "r"
) as f:
tree = ast.parse(f.read())
for node in ast.walk(tree):
if isinstance(node, ast.Assign) and len(node.targets) == 1:
if getattr(node.targets[0], "id", None) == "ECIP_OPS_CLASS_HASH":
return hex(node.value.value)
raise ValueError("ECIP_OPS_CLASS_HASH not found in generator.py")
except Exception as e:
print(f"Error parsing generator.py: {str(e)}", file=sys.stderr)
sys.exit(1)
async def verify_network(network: Network, class_hash: str):
class_hash = io.to_hex_str(class_hash)
print(f"\nVerifying class hash {class_hash} on {network.value}...")
rpc_url = network.get_rpc_url()
print(f"Using RPC URL: {rpc_url}")
client = FullNodeClient(rpc_url)
try:
result = await client.get_class_by_hash(class_hash)
if not result:
print(f"Error: Contract not declared on {network.value}", file=sys.stderr)
sys.exit(1)
print(f"✓ Contract verified on {network.value}")
except Exception as e:
print(f"Error checking {network.value}: {str(e)}", file=sys.stderr)
sys.exit(1)
async def verify_ecip_contract():
class_hash = get_class_hash_from_generator()
print(f"Verifying ECIP contract using class hash: {class_hash}")
await verify_network(Network.SEPOLIA, class_hash)
await verify_network(Network.MAINNET, class_hash)
print("\n✓ Contract verified on both networks")
async def verify_contract_from_path(path: Path):
contract = SmartContractProject(smart_contract_folder=path)
class_hash = contract.get_sierra_class_hash()
print(f"Verifying contract {path} with class hash {io.to_hex_str(class_hash)}")
await verify_network(Network.SEPOLIA, class_hash)
await verify_network(Network.MAINNET, class_hash)
if __name__ == "__main__":
asyncio.run(verify_ecip_contract())
asyncio.run(verify_contract_from_path(Path("src/contracts/drand_quicknet")))
asyncio.run(verify_contract_from_path(Path("src/contracts/drand_decrypt_quicknet")))
asyncio.run(
verify_contract_from_path(
Path("src/contracts/autogenerated/risc0_verifier_bn254")
)
)
asyncio.run(
verify_contract_from_path(
Path("src/contracts/autogenerated/sp1_verifier_bn254")
)
)
================================================
FILE: .github/workflows/cairo.yml
================================================
name: Cairo Workflow / publish
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
jobs:
pre_job:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'never'
paths: '["src/**", ".github/workflows/cairo.yml"]'
test-cairo:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
- name: Setup Starknet Foundry
uses: foundry-rs/setup-snfoundry@v4
- name: Setup Scarb
uses: software-mansion/setup-scarb@v1
with:
scarb-lock: ./src/Scarb.lock
- name: Run scarb fmt check in src
working-directory: src/
run: scarb fmt --check
- name: Run scarb test in src
working-directory: src/
run: scarb test
- name: Run scarb fmt check in mutator_set
working-directory: src/contracts/mutator_set
run: scarb fmt --check
- name: Run snforge test in mutator_set
working-directory: src/contracts/mutator_set
run: snforge test
- name: Run scarb test for all autogenerated contracts
run: ./tools/make/test_contracts.sh
- name: Run scarb fmt check in risc0_sample_app
working-directory: src/contracts/risc0_sample_app/fibonacci_sequencer
run: scarb fmt --check
# Conflicting with the e2e test : we don't want to dedeploy the verifier at each commit.
# - name: Run snforge test in risc0_sample_app
# working-directory: src/contracts/risc0_sample_app/fibonacci_sequencer
# run: snforge test
- name: Publish to Scarb Registry
if: startsWith(github.ref, 'refs/tags/')
working-directory: src/
env:
SCARB_REGISTRY_AUTH_TOKEN: ${{ secrets.SCARB_REGISTRY_AUTH_TOKEN }}
run: scarb publish
================================================
FILE: .github/workflows/docs-sync.yml
================================================
# .github/workflows/docs-sync.yml
#
# Keep GitBook docs (docs/gitbook) and source code in sync.
# ├─ create-docs-pr : docs ➜ main (PR auto-merges if docs-only)
# └─ sync-main-to-docs : main ➜ docs (keeps non-docs files identical to main)
name: Documentation Sync
permissions:
contents: write # allow pushing branches / squash-merge
pull-requests: write # allow opening / merging PRs
issues: write # create & apply labels
on:
push:
branches: [ main, docs ] # run on every push to either branch
defaults:
run:
shell: bash # strict mode added in scripts
concurrency:
group: docs-sync-${{ github.ref }}
cancel-in-progress: true
jobs:
#───────────────────────────────────────────────────────────────────────────────
# A. docs ➜ main – single rolling PR on branch: docs-sync
#───────────────────────────────────────────────────────────────────────────────
create-docs-pr:
if: >-
github.event.ref == 'refs/heads/docs' &&
( github.actor == 'gitbook-com[bot]' ||
github.actor == 'gitbook-io[bot]' ||
contains(github.event.head_commit.message, '[gitbook]') )
runs-on: ubuntu-latest
steps:
# 1️⃣ Check out the latest MAIN in a clean worktree
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
persist-credentials: false
- run: |
git config user.name "GitBook Docs Bot"
git config user.email "docs-bot@garaga.dev"
# 2️⃣ Overlay docs/gitbook from the docs branch
- name: Sync docs/gitbook from docs branch
run: |
set -euo pipefail
git fetch --quiet origin docs
git checkout origin/docs -- docs/gitbook
# Exit early if nothing changed (check staged changes since git checkout stages them)
if git diff --cached --quiet; then
echo "No documentation changes — skipping PR."
echo "SKIP_PR=true" >>"$GITHUB_ENV"
fi
# 3️⃣ Commit the changes (only if any)
- name: Commit docs update
if: env.SKIP_PR != 'true'
run: |
set -euo pipefail
# Changes are already staged by git checkout, just commit them
git commit -m "📚 Sync docs/gitbook @ ${{ github.sha }}"
# 4️⃣ Create / update the rolling PR on branch docs-sync
- uses: peter-evans/create-pull-request@v7
if: env.SKIP_PR != 'true'
id: cpr
with:
token: ${{ secrets.DOCS_SYNC_PAT }}
branch: docs-sync # ← single, reusable branch
base: main
title: "📚 Update documentation from GitBook"
commit-message: "📚 docs(branch=docs) → main @ ${{ github.sha }}"
labels: documentation,auto-generated
delete-branch: true # auto-delete after you squash-merge
# 5️⃣ Add an extra label & comment if non-docs files slipped in
- name: Flag mixed-content PRs
if: env.SKIP_PR != 'true'
env:
GH_TOKEN: ${{ secrets.DOCS_SYNC_PAT }}
run: |
set -euo pipefail
# If *any* file outside docs/gitbook changed, add label + comment
if git diff --name-only origin/main | grep -vqE '^docs/gitbook/'; then
gh pr edit "${{ steps.cpr.outputs.pull-request-number }}" \
--add-label "needs-review"
gh pr comment "${{ steps.cpr.outputs.pull-request-number }}" \
--body "⚠️ *Mixed content* – this PR touches files outside \`docs/gitbook\`. Please review."
fi
#───────────────────────────────────────────────────────────────────────────────
# B. main ➜ docs – keep non-docs files identical to main
#───────────────────────────────────────────────────────────────────────────────
sync-main-to-docs:
if: >-
github.event.ref == 'refs/heads/main' &&
!contains(github.event.head_commit.message, '[gitbook]') &&
github.actor != 'gitbook-com[bot]' &&
github.actor != 'gitbook-io[bot]'
runs-on: ubuntu-latest
steps:
# 1) Check out docs branch (create it if it doesn't exist)
- uses: actions/checkout@v4
with:
ref: docs
fetch-depth: 0
token: ${{ secrets.DOCS_SYNC_PAT }}
- name: Configure Git
run: |
git config user.name "GitHub Docs Sync"
git config user.email "docs-sync@garaga.dev"
git fetch origin main --tags --prune
# 2) Bring EVERYTHING (including docs/gitbook) up to date with main
- name: Sync repo from main
run: |
set -euo pipefail
git fetch origin main --tags --prune
# Overwrite the working tree with the state of main
git checkout origin/main -- .
# Stage everything and commit only if something changed
git add -A
if git diff --cached --quiet; then
echo "No updates required – docs branch already matches main."
exit 0
fi
git commit -m "🔄 Sync all files from main @ ${{ github.sha }}"
# ─── 3) Open (or update) a PR towards docs ─────────────────────────────
- uses: peter-evans/create-pull-request@v7
id: cpr
with:
token: ${{ secrets.DOCS_SYNC_PAT }}
# the current HEAD contains the commit we just made
branch: main-sync-${{ github.sha }}-${{ github.run_id }}
base: docs
commit-message: "🔄 Sync non-docs files from main @ ${{ github.sha }}"
title: "🔄 Sync main → docs (non-docs files)"
body: |
This PR keeps the **docs** branch in sync with **main**.
Source commit: ${{ github.sha }}
> 🤖 _docs-sync workflow_
labels: documentation,auto-generated,auto-merge
delete-branch: true
draft: false # open as a normal PR
# ─── 4) Enable auto-merge; will complete when checks are green ─────────
- name: Enable auto-merge
if: steps.cpr.outputs.pull-request-number
env:
GH_TOKEN: ${{ secrets.DOCS_SYNC_PAT }}
run: |
gh pr merge ${{ steps.cpr.outputs.pull-request-number }} \
--auto --squash --delete-branch --repo "$GITHUB_REPOSITORY" || \
echo "Auto-merge pending required checks."
================================================
FILE: .github/workflows/e2e.yml
================================================
name: E2E-devnet
on:
push:
branches: [main]
pull_request:
jobs:
pre_job:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'never'
paths_ignore: '["**/README.md", "**/docs/**"]'
devnet-test-matrix:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.14']
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.87.0
override: true
profile: minimal
- name: Setup Scarb
uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.16.1"
- name: Install dependencies
run: make setup
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- name: Install devnet
run: ./tests/contracts_e2e/install_devnet.sh
- name: Run tests
run: source venv/bin/activate && pytest -n auto -s -x tests/contracts_e2e/e2e_test.py
# Summary job for branch protection (matrix jobs have version suffix in name)
devnet-test:
needs: [pre_job, devnet-test-matrix]
if: always()
runs-on: ubuntu-latest
steps:
- name: Check matrix job status
run: |
if [ "${{ needs.pre_job.outputs.should_skip }}" == "true" ]; then
echo "Tests skipped"
exit 0
fi
if [ "${{ needs.devnet-test-matrix.result }}" != "success" ]; then
echo "Matrix tests failed"
exit 1
fi
echo "All tests passed"
================================================
FILE: .github/workflows/hydra.yml
================================================
name: Hydra backend test
on:
push:
branches: [main]
pull_request:
jobs:
pre_job:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'never'
paths_ignore: '["**/README.md", "**/docs/**"]'
test-hydra-matrix:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.12', '3.14']
fail-fast: false
steps:
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: make setup
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- name: Check Black formatting
run: source venv/bin/activate && black --check .
- name: Test garaga_rs
run: |
source venv/bin/activate
(cd tools/garaga_rs && cargo fmt --check && cargo test)
- name: Run pytest
run: |
source venv/bin/activate
pytest -n auto
- name: Set up Scarb
uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.16.1"
- name: Run make rewrite and check for unstaged changes
if: matrix.python-version == '3.14'
run: |
source venv/bin/activate
if ! make rewrite; then
echo "Error: 'make rewrite' command failed"
exit 1
fi
if [[ -n $(git status --porcelain) ]]; then
echo "Error: Unstaged changes detected after running 'make rewrite'"
git status
exit 1
fi
- name: Check bytecode size limits
if: matrix.python-version == '3.14'
run: |
source venv/bin/activate
make check-max-log-n
continue-on-error: false
# Summary job for branch protection (matrix jobs have version suffix in name)
test-hydra:
needs: [pre_job, test-hydra-matrix]
if: always()
runs-on: ubuntu-latest
steps:
- name: Check matrix job status
run: |
if [ "${{ needs.pre_job.outputs.should_skip }}" == "true" ]; then
echo "Tests skipped"
exit 0
fi
if [ "${{ needs.test-hydra-matrix.result }}" != "success" ]; then
echo "Matrix tests failed"
exit 1
fi
echo "All tests passed"
================================================
FILE: .github/workflows/labels.yml
================================================
---
name: Sync labels
on:
push:
branches:
- main
paths:
- .github/labels.yml
jobs:
labels:
name: ♻️ Sync labels
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v2
- name: 🚀 Run Label Syncer
uses: micnncim/action-label-syncer@v1.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
================================================
FILE: .github/workflows/maturin.yml
================================================
name: Maturin
on:
push:
tags:
- '*'
workflow_dispatch:
permissions:
contents: read
jobs:
pre_job:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'never'
paths_ignore: '["**/README.md", "**/docs/**"]'
linux:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
- runner: ubuntu-latest
target: s390x
- runner: ubuntu-latest
target: ppc64le
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: |
3.10
3.11
3.12
3.13
3.14
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --features python
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist
musllinux:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: |
3.10
3.11
3.12
3.13
3.14
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --features python
sccache: 'true'
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: dist
windows:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --features python
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}-py${{ matrix.python-version }}
path: dist
macos:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-14
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: |
3.10
3.11
3.12
3.13
3.14
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --features python
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist
sdist:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist
release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')" # Only run on tag pushes
needs: [linux, musllinux, windows, macos, sdist]
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.16.1"
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10.x"
- name: Install dependencies
run: make setup
- name: Verify Contract Declaration
env:
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
run: source venv/bin/activate && python .github/scripts/verify_contracts.py
- uses: actions/download-artifact@v4
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*
================================================
FILE: .github/workflows/node.yml
================================================
name: NODE tests
on:
push:
branches:
- main
- master
tags:
- '*'
pull_request:
workflow_dispatch:
jobs:
pre_job:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'never'
paths: '["tools/**"]'
npm-test:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
name: NPM Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Run npm test in garaga_ts
working-directory: tools/npm/garaga_ts
run: |
npm ci
npm test
================================================
FILE: .github/workflows/setup.yml
================================================
name: Test make setup (cross-platform)
on:
push:
branches: [main]
paths:
- 'tools/make/setup.sh'
- '.github/workflows/setup.yml'
pull_request:
paths:
- 'tools/make/setup.sh'
- '.github/workflows/setup.yml'
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'never'
shellcheck:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run ShellCheck
# SC2016: single-quoted strings intentionally prevent expansion (activate script)
# SC1091: sourced files (venv/bin/activate) don't exist at lint time
run: shellcheck -s bash -e SC2016,SC1091 tools/make/setup.sh
test-setup:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
name: Linux x86_64
- os: macos-14
name: macOS arm64
fail-fast: false
name: setup (${{ matrix.name }})
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Run make setup
run: make setup
- name: Verify venv
run: |
source venv/bin/activate
python --version
test-setup-fedora:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
container: fedora:latest
name: setup (Fedora dnf)
steps:
- name: Install base tools
run: dnf install -y git curl gcc g++ make perl-FindBin
- uses: actions/checkout@v4
- name: Mark workspace as safe for git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Run make setup
run: |
source "$HOME/.cargo/env"
make setup
- name: Verify venv
run: |
source "$HOME/.cargo/env"
source venv/bin/activate
python --version
================================================
FILE: .github/workflows/wasm.yml
================================================
name: WASM npm publish
on:
push:
branches:
- main
- master
tags:
- '*'
pull_request:
workflow_dispatch:
jobs:
pre_job:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'never'
paths: '["tools/**"]'
test-wasm:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
name: test-wasm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- uses: dtolnay/rust-toolchain@stable
- run: cargo install wasm-pack
- name: Run wasm specific tests
working-directory: tools/garaga_rs
run: RUSTFLAGS='--cfg getrandom_backend="wasm_js"' wasm-pack test --node --release --no-default-features --features wasm
build-wasm:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
name: build-wasm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and check for changes in generated code
working-directory: tools/npm/garaga_ts
run: |
docker compose up --build --exit-code-from app
git status --porcelain
[[ -z $(git status --porcelain ) ]]
- name: Upload package file as artifact
uses: actions/upload-artifact@v4
with:
name: npm-package
path: tools/npm/garaga_ts/*.tgz
if-no-files-found: error
test-integration:
needs: [pre_job, build-wasm]
if: needs.pre_job.outputs.should_skip != 'true'
name: test-integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install Puppeteer dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libnss3 libxss1 libasound2t64 libatk-bridge2.0-0 libatk1.0-0 \
libcups2 libxcomposite1 libxdamage1 libxrandr2 libgbm1 \
libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libgtk-3-0
- name: Download package file as artifact
uses: actions/download-artifact@v4
with:
name: npm-package
path: tools/npm/garaga_ts
- name: Build and tests integration test packages
working-directory: tools/npm/integration-test-suite
run: |
cp ../garaga_ts/garaga-*.tgz garaga.tgz
npm i
npm run build
npx puppeteer browsers install
npm run test
release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')" # Only run on tag pushes
needs: [build-wasm, test-wasm, test-integration]
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.16.1"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: make setup
- name: Verify Contract Declaration
env:
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
run: source venv/bin/activate && python .github/scripts/verify_contracts.py
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
- name: Download package file as artifact
uses: actions/download-artifact@v4
with:
name: npm-package
- name: Publish to npm
run: |
npm publish --access=public *.tgz
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_TOKEN }}
================================================
FILE: .gitignore
================================================
*.json
!*_input.json
!*Proof.json
!frobenius_*.json
!*test_vectors.json
__pycache__
venv
*.env
*profiling*
*.o
*.c
*.so
*.html
*.sage.py
*.idea
*.secrets
*.pb.gz
.cargo/hypothesis/
*.go
tools/garaga_rs/target/
tools/make/requirements.txt
.prev_tests_failed
src/cairo/target/
*target*
Scarb.lock
tests/contracts_e2e/devnet/*
# Foundry artifacts for Solidity testing
tools/noir/hello/lib/
tools/noir/hello/out/
tools/noir/hello/cache/
tools/noir/hello/test/
tools/noir/hello/foundry.toml
!hydra/garaga/starknet/groth16_contract_generator/examples/*.json
!docs/benchmarks/test_summary.json
*snfoundry_cache
!tools/npm/garaga_rs/*.json
!tools/make/constants.json
# Benchmarks and profiling data
.cargo/benchmarks/*/
src/profile/
/profiles/
**/.snfoundry_trace/**
# Worktrees
.worktrees/
.stignore
.claude/worktrees/
================================================
FILE: .pre-commit-config.yaml
================================================
repos:
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
args: ["--in-place", "--remove-all-unused-imports"]
files: \.py$
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]
files: \.py$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
exclude: ^tools/npm/garaga_ts/src/wasm/pkg/
- id: end-of-file-fixer
exclude: (\.cairo$|^tools/npm/garaga_ts/src/wasm/pkg/)
- id: check-yaml
- id: check-toml
- repo: https://github.com/psf/black
rev: 26.1.0
hooks:
- id: black
args: ["--target-version", "py310"]
files: \.py$
- repo: local
hooks:
- id: scarb-fmt
name: scarb fmt
entry: bash -c 'cd src && scarb fmt'
language: system
files: \.cairo$
pass_filenames: false
- id: cargo-fmt
name: cargo fmt
entry: bash -c 'cd tools/garaga_rs && cargo fmt'
language: system
files: ^tools/garaga_rs/.*\.rs$
pass_filenames: false
================================================
FILE: .secrets.template
================================================
SEPOLIA_RPC_URL="https://rpc.starknet-testnet.lava.build:443"
SEPOLIA_ACCOUNT_PRIVATE_KEY=0x1
SEPOLIA_ACCOUNT_ADDRESS=0x2
MAINNET_RPC_URL="https://"
MAINNET_ACCOUNT_PRIVATE_KEY=0x3
MAINNET_ACCOUNT_ADDRESS=0x4
================================================
FILE: .tool-versions
================================================
scarb 2.16.1
starknet-foundry 0.57.0
starknet-devnet 0.5.1
cairo-profiler 0.14.0
================================================
FILE: CLAUDE.md
================================================
# Garaga
## Project layout
- `src/` — Cairo contracts and library (Scarb workspace, `snforge test`)
- `tools/garaga_rs/` — Rust core (`cargo test -p garaga_rs`, `cargo clippy`)
- `tools/garaga_rs/src/python_bindings/` — PyO3 bindings (`make maturin`)
- `tools/garaga_rs/src/wasm_bindings.rs` — WASM bindings (`make wasm`, Docker-based)
- `tools/npm/garaga_ts/` — TypeScript wrappers + WASM pkg
- `hydra/` — Python calldata builders and helpers
- `tests/` — E2E and integration tests
## Build commands
| What | Command |
|------|---------|
| Rust tests | `cargo test -p garaga_rs` |
| Rust lint | `cargo clippy --workspace` |
| Python bindings | `make maturin` |
| WASM + TS + npm | `make wasm` (Docker) |
| Cairo tests | `snforge test -p garaga` |
| Format | `make fmt` (scarb fmt + cargo fmt) |
## Critical invariants
**Rust/Python parity**: Every calldata builder has both a Python and Rust path via `use_rust` flag. Parity is enforced by pytest asserting `calldata_py == calldata_rs` byte-for-byte. Use `fixed_sigma` or equivalent for determinism.
**WASM regeneration**: After any change to Rust source in `tools/garaga_rs/src/` (except `python_bindings/`) or `Cargo.toml`, run `make wasm` and commit regenerated files in `tools/npm/garaga_ts/src/wasm/pkg/`. CI will fail if out of sync.
**TypeScript coverage**: Every WASM binding needs a typed wrapper in `tools/npm/garaga_ts/src/node/api.ts`, a Jest test, and coverage across all 4 integration suites (Node CJS, Node ESM, Webpack, React).
**E2E tests**: Deploy on starknet-devnet via `SmartContractProject.declare_class_hash()`, generate calldata via Python, invoke contract, assert via `wait_for_acceptance()`.
**Cairo circuits**: Never include unused values in circuit output tuples (`extend_struct_output`) — each output enlarges the circuit's generic tuple and can trigger CASM `Offset overflow` when the tuple exceeds stdlib `CircuitDefinition` bounds. Prefer `#[inline(always)]` on circuit functions and loops over repeated calls to keep AP offsets scoped per iteration.
================================================
FILE: Cargo.toml
================================================
[workspace]
resolver = "2"
members = [
"tools/garaga_rs"
]
[profile.release]
lto = true
debug = false
opt-level = 3
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2023 Keep StarkNet Strange
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: Makefile
================================================
SHELL := /bin/bash
ACTIVATE := source venv/bin/activate &&
.PHONY: build test coverage run run-profile generate-constants profile-test benchmarks update-risc0-class-hash
constants:
$(ACTIVATE) python tools/make/generate_constants.py
setup:
./tools/make/setup.sh
bytecode-check:
./tools/make/bytecode_check.sh
check-max-log-n:
./tools/make/bytecode_check_max_log_n.sh
rewrite:
$(ACTIVATE) ./tools/make/rewrite.sh
rewrite-no-tests:
$(ACTIVATE) ./tools/make/rewrite.sh no-tests
regen:
cd src/contracts/mutator_set && make regen
update-risc0-class-hash:
./tools/make/update_risc0_class_hash.sh
steps:
./tools/make/steps.sh
fmt:
scarb fmt && cargo fmt
# Profile a specific test and generate performance visualizations
# Usage: make profile-test [TEST=<test_name_filter>] [JOBS=<parallel_jobs>]
# Each job takes ~3GB of ram
DEFAULT_JOBS := 8
profile-test:
@JOBS_VAL=$${JOBS:-$(DEFAULT_JOBS)}; \
if [ -z "$(TEST)" ]; then \
echo "Running all tests with profiling ($$JOBS_VAL jobs)..."; \
$(ACTIVATE) python tools/profile_tests.py --all --parallel-jobs $$JOBS_VAL --generate-benchmarks; \
else \
echo "Running tests with filter: $(TEST) ($$JOBS_VAL jobs)"; \
$(ACTIVATE) python tools/profile_tests.py $(TEST) --parallel-jobs $$JOBS_VAL --generate-benchmarks; \
fi
benchmarks:
@echo "Generating Cairo benchmarks from existing test data..."
$(ACTIVATE) python tools/profile_tests.py --benchmarks-only
ci-e2e:
./tools/make/ci_e2e.sh
ci-hydra:
./tools/make/ci_hydra.sh
ci-cairo:
./tools/make/ci_cairo.sh
ci-wasm:
./tools/make/ci_wasm.sh
wasm:
./tools/make/wasm.sh
wasm-test-gen:
./tools/make/wasm-test-gen.sh
maturin:
$(ACTIVATE) maturin develop --release --features python
clean:
sudo rm -rf build/
mkdir -p build/
================================================
FILE: README.md
================================================
<div align="center">
<h1>Garaga</h1>
<img src="docs/images/logo.png" height="200">
<br />
<a href="https://github.com/keep-starknet-strange/garaga/issues/new?assignees=&labels=bug&template=01_BUG_REPORT.md&title=bug%3A+">Report a Bug</a>
-
<a href="https://github.com/keep-starknet-strange/garaga/issues/new?assignees=&labels=enhancement&template=02_FEATURE_REQUEST.md&title=feat%3A+">Request a Feature</a>
-
<a href="https://github.com/keep-starknet-strange/garaga/discussions">Ask a Question</a>
</div>
<div align="center">
<br />
[](https://github.com/keep-starknet-strange/garaga/actions)
[](LICENSE)
[](https://github.com/keep-starknet-strange/garaga/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
[](https://github.com/keep-starknet-strange)
</div>
</details>
## About
> State-of-the-art Elliptic Curve tooling and SNARKS verification for Cairo & Starknet 🐺.
Garaga enables efficient elliptic curve operations on Starknet.
It achieves state of the art performance by
- using a dedicated builtin made by Starkware for emulated modular arithmetic
- using a suite of non-deterministic techniques for extension field multiplication, pairings, and multi scalar multiplication to reduce the number of steps to verify results.
Garaga currently supports:
- Scalar & Multi-scalar multiplication for any Weirstrass curve, including BN254, BLS12_381, SECP256/R1, and ED25519. You can add the one you need by specifying the curve parameters.
- Pairing operations for BN254 and BLS12_381.
- Groth16 smart contract verifiers generators for BN254 and BLS12_381.
- Noir smart contract verifiers generators for ultra keccak honk flavour.
## Architecture overview

Garaga consists of a Pythonic backend with Rust bindings and CairoZero / Cairo libraries.
- The Pythonic backend is here to define emulated modular arithmetic circuits that can be compiled to Cairo or Cairo1 code.
It also handles witnesses generation for the non-deterministic computations, smart contract contract generation for a given proof system and elliptic curve, and calldata generation from a given proof.
- The CairoZero / Starknet interfaces are responsible for composing and calling the circuits, as well as adding all the extra logic needed to make the algorithms work (Fiat-Shamir heuristic, SNARKS verifiers algorithms, etc).
## Quickstart : deploying a SNARK verifier on Starknet
Currently, only Groth16 on BN254 and BLS12_381 is supported with automatic support for json files coming from SnarkJS and Gnark.
1. Create a new directory for you project, and bring the jsons files for verification key, proof file and public inputs inside it.
2. Install the garaga pip package with `pip install garaga`. Python 3.10+ is required and a virtual environment is recommended. Enter `garaga` in your terminal to get started.
3. Run the `garaga gen` command in your terminal to generate the code for the SNARK verifier given your verification key.
4. Edit the generated smart contract to fit the needs of your dapp.
5. Create an environment file `.secrets` following the `.secrets.template` file in the root of this repository, containing the Starkner RPC url, your account address, and the private key.
6. Run the `garaga declare` command in your terminal to declare the smart contract on Starknet and obtain its class hash. Note that this is an expensive operation.
7. Run the `garaga deploy` command in your terminal using the class hash obtained in the previous step to get the contract address.
8. Run the `garaga verify-onchain` command in your terminal using the contract address, the verification key, the proof and the public inputs to verify the proof against the SNARK verifier contract.
For more details, please refer to the [documentation](https://garaga.gitbook.io/garaga/).
## Developer setup
To get started with Garaga, you'll need to have some tools and dependencies installed. Here's everything you need:
### Prerequisites
Ensure you have the following installed:
- [Rust](https://www.rust-lang.org/tools/install) - Required for building the `garaga_rs` extension.
- [Scarb 2.16.1](https://docs.swmansion.com/scarb/download.html) - The Cairo package manager. Comes with Cairo inside.
Python 3.10-3.14 is used for development but does **not** need to be installed manually — `make setup` will auto-install it via [uv](https://docs.astral.sh/uv/) if it's not already available. Make sure you have GMP installed 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.
##### Optionally :
- [pprof](https://github.com/google/pprof) - A tool for visualization and analysis of profiling data. Requires [Go](https://go.dev/).
- [graphviz](https://graphviz.org/download/) - Necessary for generating graphical representations of profiling data.
### Setup
Clone the repository and run the setup command from the root:
```bash
make setup
```
This will automatically:
- Install [uv](https://docs.astral.sh/uv/) if not present
- Install Python 3.14 via uv if no compatible version (3.10-3.14) is found
- Create a virtual environment and install all dependencies
- Build the Rust extension
The setup is idempotent — running it again will update dependencies without recreating the virtual environment.
Before proceeding, activate the virtual environment by running `source venv/bin/activate`.
## Cairo Benchmarks
📊 **Click on any section below to expand and view detailed benchmark tables with test performance metrics.**
**Note:** Click on the test name to view the profiling image. Resources shown in the table for contracts include extra costs due to the foundry logic.
Check the profile file for more details.
<details>
<summary><strong>contracts</strong></summary>
<details>
<summary><strong>└── groth16_example_bls12_381_integrationtest::test_contract</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Poseidon | Add Mod | Mul Mod | Sierra Gas |
|------------------------------------------------------------------------------------------------|---------|---------------|------------------|------------|-----------|-----------|--------------|
| [test_verify_groth16_proof_bls12_381](docs/benchmarks/test_verify_groth16_proof_bls12_381.png) | 353,527 | 10,972 | 90,280 | 586 | 7,506 | 10,868 | 49,754,798 |
</details>
<details>
<summary><strong>└── groth16_example_bn254_integrationtest::test_contract</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Poseidon | Add Mod | Mul Mod | Sierra Gas |
|----------------------------------------------------------------------------------------|---------|---------------|------------------|------------|-----------|-----------|--------------|
| [test_verify_groth16_proof_bn254](docs/benchmarks/test_verify_groth16_proof_bn254.png) | 228,557 | 9,785 | 67,149 | 509 | 5,401 | 8,754 | 34,080,559 |
</details>
<details>
<summary><strong>└── noir_ultra_keccak_honk_example_integrationtest::test_contract</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Bitwise | Poseidon | Add Mod | Mul Mod | Sierra Gas |
|------------------------------------------------------------------------------------------------|-----------|---------------|------------------|-----------|------------|-----------|-----------|--------------|
| [test_verify_ultra_keccak_honk_proof](docs/benchmarks/test_verify_ultra_keccak_honk_proof.png) | 1,213,031 | 65,539 | 412,656 | 3,180 | 461 | 45,756 | 43,585 | 187,929,077 |
</details>
<details>
<summary><strong>└── noir_ultra_keccak_zk_honk_example_integrationtest::test_contract</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Bitwise | Poseidon | Add Mod | Mul Mod | Sierra Gas |
|------------------------------------------------------------------------------------------------------|-----------|---------------|------------------|-----------|------------|-----------|-----------|--------------|
| [test_verify_ultra_keccak_zk_honk_proof](docs/benchmarks/test_verify_ultra_keccak_zk_honk_proof.png) | 1,306,049 | 70,398 | 451,651 | 3,476 | 461 | 49,914 | 47,993 | 203,546,067 |
</details>
<details>
<summary><strong>└── noir_ultra_starknet_honk_example_integrationtest::test_contract</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Poseidon | Add Mod | Mul Mod | Sierra Gas |
|----------------------------------------------------------------------------------------------------|-----------|---------------|------------------|------------|-----------|-----------|--------------|
| [test_verify_ultra_starknet_honk_proof](docs/benchmarks/test_verify_ultra_starknet_honk_proof.png) | 1,127,871 | 61,433 | 412,522 | 992 | 45,742 | 43,569 | 177,512,050 |
</details>
<details>
<summary><strong>└── noir_ultra_starknet_zk_honk_example_integrationtest::test_contract</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Poseidon | Add Mod | Mul Mod | Sierra Gas |
|----------------------------------------------------------------------------------------------------------|-----------|---------------|------------------|------------|-----------|-----------|--------------|
| [test_verify_ultra_starknet_zk_honk_proof](docs/benchmarks/test_verify_ultra_starknet_zk_honk_proof.png) | 1,221,360 | 66,173 | 451,576 | 1,044 | 49,911 | 47,987 | 193,032,648 |
</details>
<details>
<summary><strong>└── risc0_verifier_bn254_integrationtest::test_contract</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Bitwise | Poseidon | Add Mod | Mul Mod | Sierra Gas |
|----------------------------------------------------------------------------------------------|---------|---------------|------------------|-----------|------------|-----------|-----------|--------------|
| [test_verify_r0_groth16_proof_bn254](docs/benchmarks/test_verify_r0_groth16_proof_bn254.png) | 264,545 | 12,069 | 74,896 | 6,698 | 509 | 6,303 | 9,541 | 42,860,813 |
</details>
<details>
<summary><strong>└── sp1_verifier_bn254_integrationtest::test_contract</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Bitwise | Poseidon | Add Mod | Mul Mod | Sierra Gas |
|------------------------------------------------------------------------------------------------|---------|---------------|------------------|-----------|------------|-----------|-----------|--------------|
| [test_verify_sp1_groth16_proof_bn254](docs/benchmarks/test_verify_sp1_groth16_proof_bn254.png) | 244,680 | 11,127 | 75,027 | 2,230 | 509 | 6,314 | 9,555 | 38,221,851 |
</details>
</details>
<details>
<summary><strong>garaga</strong></summary>
<details open>
<summary><strong>└── apps</strong></summary>
<details>
<summary><strong>│ └── drand::tests</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Bitwise | Add Mod | Mul Mod | Sierra Gas |
|--------------------------------------------------------------------------------------|---------|---------------|------------------|-----------|-----------|-----------|--------------|
| [test_decrypt_at_round](docs/benchmarks/test_decrypt_at_round.png) | 289,447 | 3,919 | 385,790 | 14,506 | 57,320 | 28,871 | 89,901,952 |
| [test_hash_to_curve](docs/benchmarks/test_hash_to_curve.png) | 26,526 | 971 | 4,559 | 12,289 | 422 | 602 | 10,601,029 |
| [test_hash_to_two_bls_felts](docs/benchmarks/test_hash_to_two_bls_felts.png) | 23,557 | 900 | 74 | 12,289 | 2 | 8 | 9,592,623 |
| [test_drand_quicknet_public_key](docs/benchmarks/test_drand_quicknet_public_key.png) | 12,861 | 68 | 14,864 | 0 | 1,490 | 1,674 | 3,477,040 |
| [test_isogeny](docs/benchmarks/test_isogeny.png) | 1,844 | 58 | 878 | 0 | 51 | 111 | 316,402 |
| [test_map_to_curve](docs/benchmarks/test_map_to_curve.png) | 647 | 11 | 264 | 0 | 6 | 39 | 105,190 |
</details>
<details open>
<summary><strong>│ └── noir</strong></summary>
<details>
<summary><strong>│ │ └── honk_transcript::tests</strong></summary>
| Test Name | Steps | Range Check | Bitwise | Poseidon | Sierra Gas |
|--------------------------------------------------------------------------|---------|---------------|-----------|------------|--------------|
| [test_transcript_keccak](docs/benchmarks/test_transcript_keccak.png) | 71,084 | 5,035 | 3,180 | 1 | 9,315,281 |
| [test_transcript_starknet](docs/benchmarks/test_transcript_starknet.png) | 19,758 | 1,103 | 0 | 532 | 2,314,222 |
</details>
<details>
<summary><strong>│ │ └── zk_honk_transcript::tests</strong></summary>
| Test Name | Steps | Range Check | Bitwise | Poseidon | Sierra Gas |
|--------------------------------------------------------------------------------|---------|---------------|-----------|------------|--------------|
| [test_zk_transcript_keccak](docs/benchmarks/test_zk_transcript_keccak.png) | 73,392 | 5,241 | 3,476 | 1 | 9,733,069 |
| [test_zk_transcript_starknet](docs/benchmarks/test_zk_transcript_starknet.png) | 21,173 | 1,185 | 0 | 584 | 2,486,994 |
</details>
</details>
<details>
<summary><strong>│ └── risc0::risc0_utils_tests</strong></summary>
| Test Name | Steps | Range Check | Bitwise | Sierra Gas |
|--------------------------------------------------------------|---------|---------------|-----------|--------------|
| [test_receipt_claim](docs/benchmarks/test_receipt_claim.png) | 11,117 | 433 | 5,591 | 4,401,563 |
| [test_output_digest](docs/benchmarks/test_output_digest.png) | 4,424 | 171 | 2,230 | 1,754,460 |
</details>
<details>
<summary><strong>│ └── sp1::tests</strong></summary>
| Test Name | Steps | Range Check | Sierra Gas |
|--------------------------------------------------------------------------|---------|---------------|--------------|
| [test_convert_u32_to_u128](docs/benchmarks/test_convert_u32_to_u128.png) | 58 | 3 | 6,010 |
</details>
</details>
<details>
<summary><strong>└── crypto::mmr::tests</strong></summary>
| Test Name | Steps | Range Check | Sierra Gas |
|--------------------------------------------------------------|---------|---------------|--------------|
| [test_trailing_ones](docs/benchmarks/test_trailing_ones.png) | 441 | 51 | 47,670 |
</details>
<details>
<summary><strong>└── ec::ec_ops_g2::tests</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Add Mod | Mul Mod | Sierra Gas |
|------------------------------------------------------|---------|---------------|------------------|-----------|-----------|--------------|
| [test_ec_mul_g2](docs/benchmarks/test_ec_mul_g2.png) | 105,060 | 1,074 | 87,664 | 8,551 | 9,755 | 23,349,114 |
</details>
<details>
<summary><strong>└── hashes::poseidon_bn254::tests</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Add Mod | Mul Mod | Sierra Gas |
|--------------------------------------------------------------------------------------------------|---------|---------------|------------------|-----------|-----------|--------------|
| [test_run_poseidon_grumpkin_circuit_1](docs/benchmarks/test_run_poseidon_grumpkin_circuit_1.png) | 9,913 | 327 | 6,393 | 353 | 919 | 2,008,464 |
</details>
<details open>
<summary><strong>└── tests</strong></summary>
<details open>
<summary><strong>│ └── autogenerated</strong></summary>
<details>
<summary><strong>│ │ └── ecdsa_tests</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Add Mod | Mul Mod | Sierra Gas |
|------------------------------------------------------------------|---------|---------------|------------------|-----------|-----------|--------------|
| [test_ecdsa_SECP256R1](docs/benchmarks/test_ecdsa_SECP256R1.png) | 14,099 | 1,072 | 20,022 | 2,367 | 2,184 | 4,469,718 |
| [test_ecdsa_SECP256K1](docs/benchmarks/test_ecdsa_SECP256K1.png) | 18,723 | 2,082 | 15,629 | 1,810 | 1,592 | 4,271,132 |
</details>
<details>
<summary><strong>│ │ └── eddsa_tests</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Bitwise | Add Mod | Mul Mod | Sierra Gas |
|------------------------------------------------------------|---------|---------------|------------------|-----------|-----------|-----------|--------------|
| [test_eddsa_32_64B](docs/benchmarks/test_eddsa_32_64B.png) | 88,025 | 13,786 | 20,762 | 3,288 | 2,412 | 2,276 | 14,776,560 |
| [test_eddsa_16_32B](docs/benchmarks/test_eddsa_16_32B.png) | 52,391 | 7,643 | 20,840 | 1,656 | 2,418 | 2,284 | 9,842,274 |
| [test_eddsa_0_0B](docs/benchmarks/test_eddsa_0_0B.png) | 51,814 | 7,549 | 20,865 | 1,656 | 2,419 | 2,286 | 9,780,832 |
</details>
<details>
<summary><strong>│ │ └── msm_tests</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Add Mod | Mul Mod | Sierra Gas |
|--------------------------------------------------------------------|---------|---------------|------------------|-----------|-----------|--------------|
| [test_msm_SECP256R1_3P](docs/benchmarks/test_msm_SECP256R1_3P.png) | 20,115 | 1,576 | 29,835 | 3,546 | 3,252 | 6,572,368 |
| [test_msm_SECP256K1_3P](docs/benchmarks/test_msm_SECP256K1_3P.png) | 26,954 | 3,087 | 23,194 | 2,707 | 2,359 | 6,257,800 |
| [test_msm_SECP256R1_2P](docs/benchmarks/test_msm_SECP256R1_2P.png) | 13,465 | 1,053 | 19,865 | 2,363 | 2,166 | 4,384,404 |
| [test_msm_SECP256K1_2P](docs/benchmarks/test_msm_SECP256K1_2P.png) | 17,919 | 2,061 | 15,369 | 1,799 | 1,564 | 4,155,260 |
| [test_msm_SECP256R1_1P](docs/benchmarks/test_msm_SECP256R1_1P.png) | 6,991 | 530 | 9,945 | 1,182 | 1,084 | 2,219,716 |
| [test_msm_SECP256K1_1P](docs/benchmarks/test_msm_SECP256K1_1P.png) | 9,221 | 1,037 | 7,697 | 900 | 783 | 2,105,654 |
</details>
<details>
<summary><strong>│ │ └── pairing_tests</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Poseidon | Add Mod | Mul Mod | Sierra Gas |
|----------------------------------------------------------------------------------------------------------------------------------------------|---------|---------------|------------------|------------|-----------|-----------|--------------|
| [test_BN254_mpcheck_3P_2F_with_extra_miller_loop_result](docs/benchmarks/test_BN254_mpcheck_3P_2F_with_extra_miller_loop_result.png) | 59,916 | 472 | 59,008 | 509 | 4,469 | 7,922 | 15,391,765 |
| [test_BLS12_381_mpcheck_3P_2F_with_extra_miller_loop_result](docs/benchmarks/test_BLS12_381_mpcheck_3P_2F_with_extra_miller_loop_result.png) | 54,316 | 356 | 44,885 | 586 | 3,482 | 5,791 | 12,556,430 |
| [test_BN254_mpcheck_2P_2F](docs/benchmarks/test_BN254_mpcheck_2P_2F.png) | 47,930 | 393 | 33,047 | 460 | 1,731 | 4,665 | 10,112,792 |
| [test_BLS12_381_mpcheck_2P_2F](docs/benchmarks/test_BLS12_381_mpcheck_2P_2F.png) | 45,132 | 308 | 25,250 | 544 | 1,420 | 3,340 | 8,559,824 |
</details>
<details>
<summary><strong>│ │ └── schnorr_tests</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Add Mod | Mul Mod | Sierra Gas |
|----------------------------------------------------------------------|---------|---------------|------------------|-----------|-----------|--------------|
| [test_schnorr_SECP256K1](docs/benchmarks/test_schnorr_SECP256K1.png) | 18,321 | 2,082 | 15,512 | 1,808 | 1,580 | 4,216,672 |
</details>
<details>
<summary><strong>│ │ └── tower_pairing_tests</strong></summary>
| Test Name | Steps | Range Check | Range Check 96 | Add Mod | Mul Mod | Sierra Gas |
|----------------------------------------------------------------------------------------|---------|---------------|------------------|-----------|-----------|--------------|
| [test_tower_pairing_BN254_3P](docs/benchmarks/test_tower_pairing_BN254_3P.png) | 268,869 | 474 | 626,255 | 94,555 | 50,514 | 114,248,466 |
| [test_tower_pairing_BLS12_381_3P](docs/benchmarks/test_tower_pairing_BLS12_381_3P.png) | 248,951 | 556 | 538,321 | 86,187 | 37,849 | 97,763,802 |
| [test_tower_pairing_BN254_2P](docs/benchmarks/test_tower_pairing_BN254_2P.png) | 219,367 | 398 | 486,548 | 73,494 | 38,661 | 89,466,112 |
| [test_tower_pairing_BLS12_381_2P](docs/benchmarks/test_tower_pairing_BLS12_381_2P.png) | 207,121 | 493 | 422,516 | 67,911 | 28,926 | 77,498,340 |
| [test_tower_pairing_BN254_1P](docs/benchmarks/test_tower_pairing_BN254_1P.png) | 169,865 | 322 | 346,841 | 52,433 | 26,808 | 64,683,758 |
| [test_tower_pairing_BLS12_381_1P](docs/benchmarks/test_tower_pairing_BLS12_381_1P.png) | 165,291 | 430 | 306,711 | 49,635 | 20,003 | 57,232,878 |
| [test_tower_final_exp_BN254](docs/benchmarks/test_tower_final_exp_BN254.png) | 120,363 | 246 | 207,134 | 31,372 | 14,955 | 39,901,404 |
| [test_tower_final_exp_BLS12_381](docs/benchmarks/test_tower_final_exp_BLS12_381.png) | 123,509 | 367 | 190,906 | 31,359 | 11,080 | 36,972,216 |
</details>
</details>
<details>
<summary><strong>│ └── calldata_tests</strong></summary>
| Test Name | Steps | Range Check | Sierra Gas |
|--------------------------------------------------------------------------------------------------------------------------|---------|---------------|--------------|
| [test_deserialize_full_proof_with_hints_bls12_381](docs/benchmarks/test_deserialize_full_proof_with_hints_bls12_381.png) | 22,272 | 4,714 | 2,557,180 |
</details>
<details>
<summary><strong>│ └── sha512_tests</strong></summary>
| Test Name | Steps | Range Check | Bitwise | Sierra Gas |
|------------------------------------------------------------------------|---------|---------------|-----------|--------------|
| [test_sha512_lorem_ipsum](docs/benchmarks/test_sha512_lorem_ipsum.png) | 102,856 | 18,169 | 4,904 | 14,416,462 |
| [test_size_zero](docs/benchmarks/test_size_zero.png) | 37,579 | 6,404 | 1,640 | 5,162,300 |
| [test_sha512_size_one](docs/benchmarks/test_sha512_size_one.png) | 37,564 | 6,403 | 1,640 | 5,160,730 |
</details>
</details>
<details>
<summary><strong>└── utils::neg_3::tests</strong></summary>
| Test Name | Steps | Range Check | Sierra Gas |
|------------------------------------------------------------------------------|---------|---------------|--------------|
| [test_scalar_to_epns](docs/benchmarks/test_scalar_to_epns.png) | 6,103 | 928 | 675,260 |
| [test_scalar_to_epns_single](docs/benchmarks/test_scalar_to_epns_single.png) | 1,940 | 297 | 214,790 |
</details>
</details>
---
🔄 **To regenerate these benchmarks:** Run `make profile-test` from the project root.
## Support & How to Contribute
We warmly welcome contributions and support from the community! Here's how you can help Garaga grow and improve:
### Reporting Issues & Requesting Features
- **Spot a bug? Have a feature request?** Check out our [issues page](https://github.com/keep-starknet-strange/garaga/issues) to see if it's already been reported or to open a new issue.
### Contributing to Garaga
- **Interested in contributing?** Please take a moment to read our [contribution guidelines](docs/CONTRIBUTING.md) for details on how to get started. Your contributions make the open-source community an incredible place for learning, inspiration, and creation.
### Showing Support
- **Love Garaga?** Give us a [star on GitHub](https://github.com/keep-starknet-strange/garaga) to show your support.
- **Spread the word:** Share your excitement about Garaga on social platforms like Twitter, [Dev.to](https://dev.to/), [Medium](https://medium.com/), or your personal blog.
- **Join the conversation:** Connect with us and other Garaga enthusiasts on our [Telegram group](https://t.me/GaragaPairingCairo).
Every contribution, whether it's code, feedback, or spreading the word, greatly benefits everyone and is deeply appreciated. Thank you for being a part of Garaga's journey!
## Security
Garaga follows good practices of security, but 100% security cannot be assured.
Garaga is provided **"as is"** without any **warranty**. Use at your own risk.
_For more information and to report security issues, please refer to our
[security documentation](docs/SECURITY.md)._
## License
This project is licensed under the **MIT license**.
See [LICENSE](LICENSE) for more information.
## Acknowledgements
- Huge props to [tekkac](https://github.com/tekkac) and [feltroidprime](https://github.com/feltroidprime) for their initial work on provable pairing-based cryptography in StarkNet.
- Credits to [Nethermind](https://github.com/NethermindEth/) for their [initial work on optimized modular arithmetic](https://github.com/NethermindEth/research-basic-Cairo-operations-big-integers/tree/main/lib).
- [Herodotus](https://www.herodotus.dev/) for supporting this project.
- [Gnark project](https://github.com/ConsenSys/gnark-crypto) and team, especially [yelhousni](https://github.com/yelhousni) for his amazing knowledge and support.
- [OnlyDust](https://www.onlydust.xyz/) and [Starkware](https://starkware.co/).
- Liam Eagen and Andrija Novakovic for their support and amazing research.
## Resources
- Craig Costello, [Pairing for beginners](https://static1.squarespace.com/static/5fdbb09f31d71c1227082339/t/5ff394720493bd28278889c6/1609798774687/PairingsForBeginners.pdf)
- Y. El Housni, "Pairings in Rank-1 Constraint Systems," Cryptology ePrint Archive, Report 2022/1162, 2022. Available: [https://eprint.iacr.org/2022/1162](https://eprint.iacr.org/2022/1162).
- feltroidprime. "Faster Extension Field multiplications for Emulated Pairing Circuits." HackMD, [https://hackmd.io/@feltroidprime/B1eyHHXNT](https://hackmd.io/@feltroidprime/B1eyHHXNT).
- Liam Eagen, "Zero Knowledge Proofs of Elliptic Curve Inner Products from Principal Divisors and Weil Reciprocity," Cryptology ePrint Archive, Report 2022/596, 2022. Available: [https://eprint.iacr.org/2022/596](https://eprint.iacr.org/2022/596)
- Andrija Novakovic and Liam Eagen, "On Proving Pairings," Cryptology ePrint Archive, Paper 2024/640, 2024. Available: [https://eprint.iacr.org/2024/640](https://eprint.iacr.org/2024/640)
- Liam Eagen, Youssef El Housni, Simon Masson, and Thomas Piellard, "Fast elliptic curve scalar multiplications in SN(T)ARK circuits," Cryptology ePrint Archive, Paper 2025/933, 2025. Available: [https://eprint.iacr.org/2025/933](https://eprint.iacr.org/2025/933)
> **Note:** This list is not exhaustive, and is not intended to be.
## Contributors
For a full list of all authors and contributors, see
[the contributors page](https://github.com/keep-starknet-strange/garaga/contributors).
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/feltroidprime"><img src="https://avatars.githubusercontent.com/u/96737978?v=4?s=100" width="100px;" alt="Feltroid Prime"/><br /><sub><b>Feltroid Prime</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/garaga/commits?author=feltroidprime" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/abdelhamidbakhta"><img src="https://avatars.githubusercontent.com/u/45264458?v=4?s=100" width="100px;" alt="Abdel @ StarkWare "/><br /><sub><b>Abdel @ StarkWare </b></sub></a><br /><a href="https://github.com/keep-starknet-strange/garaga/commits?author=abdelhamidbakhta" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/tekkac"><img src="https://avatars.githubusercontent.com/u/98529704?v=4?s=100" width="100px;" alt="Tarik K."/><br /><sub><b>Tarik K.</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/garaga/commits?author=tekkac" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bacharif"><img src="https://avatars.githubusercontent.com/u/22233193?v=4?s=100" width="100px;" alt="Bachir Arif"/><br /><sub><b>Bachir Arif</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/garaga/commits?author=bacharif" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rdubois-crypto"><img src="https://avatars.githubusercontent.com/u/103030189?v=4?s=100" width="100px;" alt="Renaud Dubois"/><br /><sub><b>Renaud Dubois</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/garaga/commits?author=rdubois-crypto" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://raugfer.com/"><img src="https://avatars.githubusercontent.com/u/725060?v=4?s=100" width="100px;" alt="Rodrigo Ferreira"/><br /><sub><b>Rodrigo Ferreira</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/garaga/commits?author=raugfer" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/luiz-lvj"><img src="https://avatars.githubusercontent.com/u/64055364?v=4?s=100" width="100px;" alt="Luiz Vasconcelos Júnior"/><br /><sub><b>Luiz Vasconcelos Júnior</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/garaga/commits?author=luiz-lvj" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://shramee.me/"><img src="https://avatars.githubusercontent.com/u/11048263?v=4?s=100" width="100px;" alt="Shramee Srivastav"/><br /><sub><b>Shramee Srivastav</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/garaga/commits?author=shramee" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/akinovak"><img src="https://avatars.githubusercontent.com/u/28649205?v=4?s=100" width="100px;" alt="Andrija Novakovic"/><br /><sub><b>Andrija Novakovic</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/garaga/commits?author=akinovak" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Liam-Eagen"><img src="https://avatars.githubusercontent.com/u/5618692?v=4?s=100" width="100px;" alt="Liam Eagen"/><br /><sub><b>Liam Eagen</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/garaga/commits?author=Liam-Eagen" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/petscheit"><img src="https://avatars.githubusercontent.com/u/10947187?v=4?s=100" width="100px;" alt="Paul Etscheit"/><br /><sub><b>Paul Etscheit</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/garaga/commits?author=petscheit" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/stefanMadzharov"><img src="https://avatars.githubusercontent.com/u/83451593?v=4?s=100" width="100px;" alt="stefanMadzharov"/><br /><sub><b>stefanMadzharov</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/garaga/commits?author=stefanMadzharov" title="Code">💻</a></td>
</tr>
</tbody>
<tfoot>
<tr>
<td align="center" size="13px" colspan="7">
<img src="https://raw.githubusercontent.com/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg">
<a href="https://all-contributors.js.org/docs/en/bot/usage">Add your contributions</a>
</img>
</td>
</tr>
</tfoot>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
================================================
FILE: Scarb.toml
================================================
[workspace]
members = [
"src/",
"src/corelib_imports",
]
[workspace.dependencies]
cairo_test = "2.16.1"
starknet = "2.16.1"
[workspace.scripts]
test = "snforge test -p garaga --include-ignored"
[cairo]
sierra-replace-ids = false
================================================
FILE: docs/CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainer using any of the [private contact addresses](https://github.com/keep-starknet-strange/garaga#support). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4, available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>
For answers to common questions about this code of conduct, see <https://www.contributor-covenant.org/faq>
================================================
FILE: docs/CONTRIBUTING.md
================================================
# Contributing
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Please note we have a [code of conduct](CODE_OF_CONDUCT.md), please follow it in all your interactions with the project.
## Development environment setup
> **[?]**
> Proceed to describe how to setup local development environment.
> e.g:
To set up a development environment, please follow these steps:
1. Clone the repo and run setup (Python 3.10-3.14 and [uv](https://docs.astral.sh/uv/) are installed automatically if needed):
```sh
git clone https://github.com/keep-starknet-strange/garaga
cd garaga
make setup
source venv/bin/activate
```
2. You also need [Rust](https://www.rust-lang.org/tools/install) and [Scarb 2.16.1](https://docs.swmansion.com/scarb/download.html) installed.
## Issues and feature requests
You've found a bug in the source code, a mistake in the documentation or maybe you'd like a new feature?Take a look at [GitHub Discussions](https://github.com/keep-starknet-strange/garaga/discussions) to see if it's already being discussed. You can help us by [submitting an issue on GitHub](https://github.com/keep-starknet-strange/garaga/issues). Before you create an issue, make sure to search the issue archive -- your issue may have already been addressed!
Please try to create bug reports that are:
- _Reproducible._ Include steps to reproduce the problem.
- _Specific._ Include as much detail as possible: which version, what environment, etc.
- _Unique._ Do not duplicate existing opened issues.
- _Scoped to a Single Bug._ One bug per report.
**Even better: Submit a pull request with a fix or new feature!**
### How to submit a Pull Request
1. Search our repository for open or closed
[Pull Requests](https://github.com/keep-starknet-strange/garaga/pulls)
that relate to your submission. You don't want to duplicate effort.
2. Fork the project
3. Create your feature branch (`git checkout -b feat/amazing_feature`)
4. Commit your changes (`git commit -m 'feat: add amazing_feature'`)
5. Push to the branch (`git push origin feat/amazing_feature`)
6. [Open a Pull Request](https://github.com/keep-starknet-strange/garaga/compare?expand=1)
================================================
FILE: docs/PYPI_README.md
================================================
# Garaga 🐺
State-of-the-art Elliptic Curve operations and SNARKS verification for Cairo & Starknet.
## Quick Start
```bash
pip install garaga
```
**Requirements:** Python 3.10 through 3.14
## What is Garaga?
Garaga provides optimized cryptographic primitives for:
- **Elliptic Curve Operations** - High-performance curve arithmetic
- **SNARK Verification** - Groth16, Honk, and other proof systems
- **Pairing-Based Cryptography** - BN254, BLS12-381 curves
- **Cairo/Starknet Integration** - Native integration with Starknet ecosystem
## CLI Usage
After installation, access the CLI:
```bash
garaga --help
```
Generate SNARK verifier contracts:
```bash
garaga gen
```
## Key Features
✅ **Multi-Curve Support** - BN254, BLS12-381, and more
✅ **SNARK Verifiers** - Groth16, Noir Honk proof verification
✅ **Cairo Integration** - Seamless Starknet development
✅ **Rust Performance** - Optimized core operations
## Documentation & Links
- 📖 **Documentation**: [garaga.gitbook.io](https://garaga.gitbook.io/)
- 🔧 **GitHub**: [github.com/keep-starknet-strange/garaga](https://github.com/keep-starknet-strange/garaga)
- 🐛 **Issues**: [Report bugs](https://github.com/keep-starknet-strange/garaga/issues)
## Version Management
Install specific version:
```bash
pip install garaga==1.1.0
```
Install from Git commit:
```bash
pip install git+https://github.com/keep-starknet-strange/garaga.git@COMMIT_HASH
```
## License
MIT License - see [LICENSE](https://github.com/keep-starknet-strange/garaga/blob/main/LICENSE)
================================================
FILE: docs/SECURITY.md
================================================
# Security Policy
## Reporting a Vulnerability
If there are any vulnerabilities in **Garaga**, don't hesitate to _report them_.
1. Use any of the [private contact addresses](https://github.com/keep-starknet-strange/garaga#support).
2. Describe the vulnerability.
If you have a fix, that is most welcome -- please attach or summarize it in your message!
3. We will evaluate the vulnerability and, if necessary, release a fix or mitigating steps to address it. We will contact you to let you know the outcome, and will credit you in the report.
Please **do not disclose the vulnerability publicly** until a fix is released!
4. Once we have either a) published a fix, or b) declined to address the vulnerability for whatever reason, you are free to publicly disclose it.
================================================
FILE: docs/benchmarks/test_summary.json
================================================
{
"test_trailing_ones": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::crypto::mmr::tests::test_trailing_ones",
"test_name": "test_trailing_ones",
"steps": 441,
"sierra_gas": 47670,
"image_path": "docs/benchmarks/test_trailing_ones.png",
"category": "garaga",
"range_check": 51,
"range_check96": 0,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 0,
"mul_mod": 0
}
},
"test_receipt_claim": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::apps::risc0::risc0_utils_tests::test_receipt_claim",
"test_name": "test_receipt_claim",
"steps": 11117,
"sierra_gas": 4401563,
"image_path": "docs/benchmarks/test_receipt_claim.png",
"category": "garaga",
"range_check": 433,
"range_check96": 0,
"keccak": 0,
"pedersen": 0,
"bitwise": 5591,
"ecop": 0,
"poseidon": 0,
"add_mod": 0,
"mul_mod": 0
}
},
"test_zk_transcript_keccak": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::apps::noir::zk_honk_transcript::tests::test_zk_transcript_keccak",
"test_name": "test_zk_transcript_keccak",
"steps": 73392,
"sierra_gas": 9733069,
"image_path": "docs/benchmarks/test_zk_transcript_keccak.png",
"category": "garaga",
"range_check": 5241,
"range_check96": 0,
"keccak": 0,
"pedersen": 0,
"bitwise": 3476,
"ecop": 0,
"poseidon": 1,
"add_mod": 0,
"mul_mod": 0
}
},
"test_output_digest": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::apps::risc0::risc0_utils_tests::test_output_digest",
"test_name": "test_output_digest",
"steps": 4424,
"sierra_gas": 1754460,
"image_path": "docs/benchmarks/test_output_digest.png",
"category": "garaga",
"range_check": 171,
"range_check96": 0,
"keccak": 0,
"pedersen": 0,
"bitwise": 2230,
"ecop": 0,
"poseidon": 0,
"add_mod": 0,
"mul_mod": 0
}
},
"test_ecdsa_SECP256R1": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::ecdsa_tests::test_ecdsa_SECP256R1",
"test_name": "test_ecdsa_SECP256R1",
"steps": 14099,
"sierra_gas": 4469718,
"image_path": "docs/benchmarks/test_ecdsa_SECP256R1.png",
"category": "garaga",
"range_check": 1072,
"range_check96": 20022,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 2367,
"mul_mod": 2184
}
},
"test_scalar_to_epns": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::utils::neg_3::tests::test_scalar_to_epns",
"test_name": "test_scalar_to_epns",
"steps": 6103,
"sierra_gas": 675260,
"image_path": "docs/benchmarks/test_scalar_to_epns.png",
"category": "garaga",
"range_check": 928,
"range_check96": 0,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 0,
"mul_mod": 0
}
},
"test_run_poseidon_grumpkin_circuit_1": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::hashes::poseidon_bn254::tests::test_run_poseidon_grumpkin_circuit_1",
"test_name": "test_run_poseidon_grumpkin_circuit_1",
"steps": 9913,
"sierra_gas": 2008464,
"image_path": "docs/benchmarks/test_run_poseidon_grumpkin_circuit_1.png",
"category": "garaga",
"range_check": 327,
"range_check96": 6393,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 353,
"mul_mod": 919
}
},
"test_hash_to_curve": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::apps::drand::tests::test_hash_to_curve",
"test_name": "test_hash_to_curve",
"steps": 26526,
"sierra_gas": 10601029,
"image_path": "docs/benchmarks/test_hash_to_curve.png",
"category": "garaga",
"range_check": 971,
"range_check96": 4559,
"keccak": 0,
"pedersen": 0,
"bitwise": 12289,
"ecop": 0,
"poseidon": 0,
"add_mod": 422,
"mul_mod": 602
}
},
"test_transcript_keccak": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::apps::noir::honk_transcript::tests::test_transcript_keccak",
"test_name": "test_transcript_keccak",
"steps": 71084,
"sierra_gas": 9315281,
"image_path": "docs/benchmarks/test_transcript_keccak.png",
"category": "garaga",
"range_check": 5035,
"range_check96": 0,
"keccak": 0,
"pedersen": 0,
"bitwise": 3180,
"ecop": 0,
"poseidon": 1,
"add_mod": 0,
"mul_mod": 0
}
},
"test_zk_transcript_starknet": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::apps::noir::zk_honk_transcript::tests::test_zk_transcript_starknet",
"test_name": "test_zk_transcript_starknet",
"steps": 21173,
"sierra_gas": 2486994,
"image_path": "docs/benchmarks/test_zk_transcript_starknet.png",
"category": "garaga",
"range_check": 1185,
"range_check96": 0,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 584,
"add_mod": 0,
"mul_mod": 0
}
},
"test_convert_u32_to_u128": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::apps::sp1::tests::test_convert_u32_to_u128",
"test_name": "test_convert_u32_to_u128",
"steps": 58,
"sierra_gas": 6010,
"image_path": "docs/benchmarks/test_convert_u32_to_u128.png",
"category": "garaga",
"range_check": 3,
"range_check96": 0,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 0,
"mul_mod": 0
}
},
"test_ecdsa_SECP256K1": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::ecdsa_tests::test_ecdsa_SECP256K1",
"test_name": "test_ecdsa_SECP256K1",
"steps": 18723,
"sierra_gas": 4271132,
"image_path": "docs/benchmarks/test_ecdsa_SECP256K1.png",
"category": "garaga",
"range_check": 2082,
"range_check96": 15629,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 1810,
"mul_mod": 1592
}
},
"test_drand_quicknet_public_key": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::apps::drand::tests::test_drand_quicknet_public_key",
"test_name": "test_drand_quicknet_public_key",
"steps": 12861,
"sierra_gas": 3477040,
"image_path": "docs/benchmarks/test_drand_quicknet_public_key.png",
"category": "garaga",
"range_check": 68,
"range_check96": 14864,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 1490,
"mul_mod": 1674
}
},
"test_scalar_to_epns_single": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::utils::neg_3::tests::test_scalar_to_epns_single",
"test_name": "test_scalar_to_epns_single",
"steps": 1940,
"sierra_gas": 214790,
"image_path": "docs/benchmarks/test_scalar_to_epns_single.png",
"category": "garaga",
"range_check": 297,
"range_check96": 0,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 0,
"mul_mod": 0
}
},
"test_hash_to_two_bls_felts": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::apps::drand::tests::test_hash_to_two_bls_felts",
"test_name": "test_hash_to_two_bls_felts",
"steps": 23557,
"sierra_gas": 9592623,
"image_path": "docs/benchmarks/test_hash_to_two_bls_felts.png",
"category": "garaga",
"range_check": 900,
"range_check96": 74,
"keccak": 0,
"pedersen": 0,
"bitwise": 12289,
"ecop": 0,
"poseidon": 0,
"add_mod": 2,
"mul_mod": 8
}
},
"test_transcript_starknet": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::apps::noir::honk_transcript::tests::test_transcript_starknet",
"test_name": "test_transcript_starknet",
"steps": 19758,
"sierra_gas": 2314222,
"image_path": "docs/benchmarks/test_transcript_starknet.png",
"category": "garaga",
"range_check": 1103,
"range_check96": 0,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 532,
"add_mod": 0,
"mul_mod": 0
}
},
"test_size_zero": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::sha512_tests::test_size_zero",
"test_name": "test_size_zero",
"steps": 37579,
"sierra_gas": 5162300,
"image_path": "docs/benchmarks/test_size_zero.png",
"category": "garaga",
"range_check": 6404,
"range_check96": 0,
"keccak": 0,
"pedersen": 0,
"bitwise": 1640,
"ecop": 0,
"poseidon": 0,
"add_mod": 0,
"mul_mod": 0
}
},
"test_isogeny": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::apps::drand::tests::test_isogeny",
"test_name": "test_isogeny",
"steps": 1844,
"sierra_gas": 316402,
"image_path": "docs/benchmarks/test_isogeny.png",
"category": "garaga",
"range_check": 58,
"range_check96": 878,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 51,
"mul_mod": 111
}
},
"test_sha512_lorem_ipsum": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::sha512_tests::test_sha512_lorem_ipsum",
"test_name": "test_sha512_lorem_ipsum",
"steps": 102856,
"sierra_gas": 14416462,
"image_path": "docs/benchmarks/test_sha512_lorem_ipsum.png",
"category": "garaga",
"range_check": 18169,
"range_check96": 0,
"keccak": 0,
"pedersen": 0,
"bitwise": 4904,
"ecop": 0,
"poseidon": 0,
"add_mod": 0,
"mul_mod": 0
}
},
"test_sha512_size_one": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::sha512_tests::test_sha512_size_one",
"test_name": "test_sha512_size_one",
"steps": 37564,
"sierra_gas": 5160730,
"image_path": "docs/benchmarks/test_sha512_size_one.png",
"category": "garaga",
"range_check": 6403,
"range_check96": 0,
"keccak": 0,
"pedersen": 0,
"bitwise": 1640,
"ecop": 0,
"poseidon": 0,
"add_mod": 0,
"mul_mod": 0
}
},
"test_map_to_curve": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::apps::drand::tests::test_map_to_curve",
"test_name": "test_map_to_curve",
"steps": 647,
"sierra_gas": 105190,
"image_path": "docs/benchmarks/test_map_to_curve.png",
"category": "garaga",
"range_check": 11,
"range_check96": 264,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 6,
"mul_mod": 39
}
},
"test_schnorr_SECP256K1": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::schnorr_tests::test_schnorr_SECP256K1",
"test_name": "test_schnorr_SECP256K1",
"steps": 18321,
"sierra_gas": 4216672,
"image_path": "docs/benchmarks/test_schnorr_SECP256K1.png",
"category": "garaga",
"range_check": 2082,
"range_check96": 15512,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 1808,
"mul_mod": 1580
}
},
"test_ec_mul_g2": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::ec::ec_ops_g2::tests::test_ec_mul_g2",
"test_name": "test_ec_mul_g2",
"steps": 105060,
"sierra_gas": 23349114,
"image_path": "docs/benchmarks/test_ec_mul_g2.png",
"category": "garaga",
"range_check": 1074,
"range_check96": 87664,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 8551,
"mul_mod": 9755
}
},
"test_decrypt_at_round": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::apps::drand::tests::test_decrypt_at_round",
"test_name": "test_decrypt_at_round",
"steps": 289447,
"sierra_gas": 89901952,
"image_path": "docs/benchmarks/test_decrypt_at_round.png",
"category": "garaga",
"range_check": 3919,
"range_check96": 385790,
"keccak": 0,
"pedersen": 0,
"bitwise": 14506,
"ecop": 0,
"poseidon": 0,
"add_mod": 57320,
"mul_mod": 28871
}
},
"test_verify_groth16_proof_bn254": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "groth16_example_bn254_integrationtest::test_contract::test_verify_groth16_proof_bn254",
"test_name": "test_verify_groth16_proof_bn254",
"steps": 228557,
"sierra_gas": 34080559,
"image_path": "docs/benchmarks/test_verify_groth16_proof_bn254.png",
"category": "contracts",
"range_check": 9785,
"range_check96": 67149,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 509,
"add_mod": 5401,
"mul_mod": 8754
}
},
"test_verify_ultra_keccak_honk_proof": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "noir_ultra_keccak_honk_example_integrationtest::test_contract::test_verify_ultra_keccak_honk_proof",
"test_name": "test_verify_ultra_keccak_honk_proof",
"steps": 1213031,
"sierra_gas": 187929077,
"image_path": "docs/benchmarks/test_verify_ultra_keccak_honk_proof.png",
"category": "contracts",
"range_check": 65539,
"range_check96": 412656,
"keccak": 0,
"pedersen": 0,
"bitwise": 3180,
"ecop": 0,
"poseidon": 461,
"add_mod": 45756,
"mul_mod": 43585
}
},
"test_msm_SECP256K1_3P": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::msm_tests::test_msm_SECP256K1_3P",
"test_name": "test_msm_SECP256K1_3P",
"steps": 26954,
"sierra_gas": 6257800,
"image_path": "docs/benchmarks/test_msm_SECP256K1_3P.png",
"category": "garaga",
"range_check": 3087,
"range_check96": 23194,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 2707,
"mul_mod": 2359
}
},
"test_msm_SECP256R1_2P": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::msm_tests::test_msm_SECP256R1_2P",
"test_name": "test_msm_SECP256R1_2P",
"steps": 13465,
"sierra_gas": 4384404,
"image_path": "docs/benchmarks/test_msm_SECP256R1_2P.png",
"category": "garaga",
"range_check": 1053,
"range_check96": 19865,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 2363,
"mul_mod": 2166
}
},
"test_BN254_mpcheck_3P_2F_with_extra_miller_loop_result": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::pairing_tests::test_BN254_mpcheck_3P_2F_with_extra_miller_loop_result",
"test_name": "test_BN254_mpcheck_3P_2F_with_extra_miller_loop_result",
"steps": 59916,
"sierra_gas": 15391765,
"image_path": "docs/benchmarks/test_BN254_mpcheck_3P_2F_with_extra_miller_loop_result.png",
"category": "garaga",
"range_check": 472,
"range_check96": 59008,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 509,
"add_mod": 4469,
"mul_mod": 7922
}
},
"test_BLS12_381_mpcheck_2P_2F": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::pairing_tests::test_BLS12_381_mpcheck_2P_2F",
"test_name": "test_BLS12_381_mpcheck_2P_2F",
"steps": 45132,
"sierra_gas": 8559824,
"image_path": "docs/benchmarks/test_BLS12_381_mpcheck_2P_2F.png",
"category": "garaga",
"range_check": 308,
"range_check96": 25250,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 544,
"add_mod": 1420,
"mul_mod": 3340
}
},
"test_BLS12_381_mpcheck_3P_2F_with_extra_miller_loop_result": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::pairing_tests::test_BLS12_381_mpcheck_3P_2F_with_extra_miller_loop_result",
"test_name": "test_BLS12_381_mpcheck_3P_2F_with_extra_miller_loop_result",
"steps": 54316,
"sierra_gas": 12556430,
"image_path": "docs/benchmarks/test_BLS12_381_mpcheck_3P_2F_with_extra_miller_loop_result.png",
"category": "garaga",
"range_check": 356,
"range_check96": 44885,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 586,
"add_mod": 3482,
"mul_mod": 5791
}
},
"test_eddsa_0_0B": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::eddsa_tests::test_eddsa_0_0B",
"test_name": "test_eddsa_0_0B",
"steps": 51814,
"sierra_gas": 9780832,
"image_path": "docs/benchmarks/test_eddsa_0_0B.png",
"category": "garaga",
"range_check": 7549,
"range_check96": 20865,
"keccak": 0,
"pedersen": 0,
"bitwise": 1656,
"ecop": 0,
"poseidon": 0,
"add_mod": 2419,
"mul_mod": 2286
}
},
"test_tower_final_exp_BN254": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::tower_pairing_tests::test_tower_final_exp_BN254",
"test_name": "test_tower_final_exp_BN254",
"steps": 120363,
"sierra_gas": 39901404,
"image_path": "docs/benchmarks/test_tower_final_exp_BN254.png",
"category": "garaga",
"range_check": 246,
"range_check96": 207134,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 31372,
"mul_mod": 14955
}
},
"test_tower_final_exp_BLS12_381": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::tower_pairing_tests::test_tower_final_exp_BLS12_381",
"test_name": "test_tower_final_exp_BLS12_381",
"steps": 123509,
"sierra_gas": 36972216,
"image_path": "docs/benchmarks/test_tower_final_exp_BLS12_381.png",
"category": "garaga",
"range_check": 367,
"range_check96": 190906,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 31359,
"mul_mod": 11080
}
},
"test_msm_SECP256K1_2P": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::msm_tests::test_msm_SECP256K1_2P",
"test_name": "test_msm_SECP256K1_2P",
"steps": 17919,
"sierra_gas": 4155260,
"image_path": "docs/benchmarks/test_msm_SECP256K1_2P.png",
"category": "garaga",
"range_check": 2061,
"range_check96": 15369,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 1799,
"mul_mod": 1564
}
},
"test_BN254_mpcheck_2P_2F": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::pairing_tests::test_BN254_mpcheck_2P_2F",
"test_name": "test_BN254_mpcheck_2P_2F",
"steps": 47930,
"sierra_gas": 10112792,
"image_path": "docs/benchmarks/test_BN254_mpcheck_2P_2F.png",
"category": "garaga",
"range_check": 393,
"range_check96": 33047,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 460,
"add_mod": 1731,
"mul_mod": 4665
}
},
"test_msm_SECP256K1_1P": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::msm_tests::test_msm_SECP256K1_1P",
"test_name": "test_msm_SECP256K1_1P",
"steps": 9221,
"sierra_gas": 2105654,
"image_path": "docs/benchmarks/test_msm_SECP256K1_1P.png",
"category": "garaga",
"range_check": 1037,
"range_check96": 7697,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 900,
"mul_mod": 783
}
},
"test_deserialize_full_proof_with_hints_bls12_381": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::calldata_tests::test_deserialize_full_proof_with_hints_bls12_381",
"test_name": "test_deserialize_full_proof_with_hints_bls12_381",
"steps": 22272,
"sierra_gas": 2557180,
"image_path": "docs/benchmarks/test_deserialize_full_proof_with_hints_bls12_381.png",
"category": "garaga",
"range_check": 4714,
"range_check96": 0,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 0,
"mul_mod": 0
}
},
"test_eddsa_16_32B": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::eddsa_tests::test_eddsa_16_32B",
"test_name": "test_eddsa_16_32B",
"steps": 52391,
"sierra_gas": 9842274,
"image_path": "docs/benchmarks/test_eddsa_16_32B.png",
"category": "garaga",
"range_check": 7643,
"range_check96": 20840,
"keccak": 0,
"pedersen": 0,
"bitwise": 1656,
"ecop": 0,
"poseidon": 0,
"add_mod": 2418,
"mul_mod": 2284
}
},
"test_eddsa_32_64B": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::eddsa_tests::test_eddsa_32_64B",
"test_name": "test_eddsa_32_64B",
"steps": 88025,
"sierra_gas": 14776560,
"image_path": "docs/benchmarks/test_eddsa_32_64B.png",
"category": "garaga",
"range_check": 13786,
"range_check96": 20762,
"keccak": 0,
"pedersen": 0,
"bitwise": 3288,
"ecop": 0,
"poseidon": 0,
"add_mod": 2412,
"mul_mod": 2276
}
},
"test_msm_SECP256R1_1P": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::msm_tests::test_msm_SECP256R1_1P",
"test_name": "test_msm_SECP256R1_1P",
"steps": 6991,
"sierra_gas": 2219716,
"image_path": "docs/benchmarks/test_msm_SECP256R1_1P.png",
"category": "garaga",
"range_check": 530,
"range_check96": 9945,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 1182,
"mul_mod": 1084
}
},
"test_msm_SECP256R1_3P": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::msm_tests::test_msm_SECP256R1_3P",
"test_name": "test_msm_SECP256R1_3P",
"steps": 20115,
"sierra_gas": 6572368,
"image_path": "docs/benchmarks/test_msm_SECP256R1_3P.png",
"category": "garaga",
"range_check": 1576,
"range_check96": 29835,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 3546,
"mul_mod": 3252
}
},
"test_verify_groth16_proof_bls12_381": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "groth16_example_bls12_381_integrationtest::test_contract::test_verify_groth16_proof_bls12_381",
"test_name": "test_verify_groth16_proof_bls12_381",
"steps": 353527,
"sierra_gas": 49754798,
"image_path": "docs/benchmarks/test_verify_groth16_proof_bls12_381.png",
"category": "contracts",
"range_check": 10972,
"range_check96": 90280,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 586,
"add_mod": 7506,
"mul_mod": 10868
}
},
"test_verify_ultra_keccak_zk_honk_proof": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "noir_ultra_keccak_zk_honk_example_integrationtest::test_contract::test_verify_ultra_keccak_zk_honk_proof",
"test_name": "test_verify_ultra_keccak_zk_honk_proof",
"steps": 1306049,
"sierra_gas": 203546067,
"image_path": "docs/benchmarks/test_verify_ultra_keccak_zk_honk_proof.png",
"category": "contracts",
"range_check": 70398,
"range_check96": 451651,
"keccak": 0,
"pedersen": 0,
"bitwise": 3476,
"ecop": 0,
"poseidon": 461,
"add_mod": 49914,
"mul_mod": 47993
}
},
"test_verify_ultra_starknet_honk_proof": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "noir_ultra_starknet_honk_example_integrationtest::test_contract::test_verify_ultra_starknet_honk_proof",
"test_name": "test_verify_ultra_starknet_honk_proof",
"steps": 1127871,
"sierra_gas": 177512050,
"image_path": "docs/benchmarks/test_verify_ultra_starknet_honk_proof.png",
"category": "contracts",
"range_check": 61433,
"range_check96": 412522,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 992,
"add_mod": 45742,
"mul_mod": 43569
}
},
"test_tower_pairing_BN254_1P": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::tower_pairing_tests::test_tower_pairing_BN254_1P",
"test_name": "test_tower_pairing_BN254_1P",
"steps": 169865,
"sierra_gas": 64683758,
"image_path": "docs/benchmarks/test_tower_pairing_BN254_1P.png",
"category": "garaga",
"range_check": 322,
"range_check96": 346841,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 52433,
"mul_mod": 26808
}
},
"test_tower_pairing_BLS12_381_1P": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::tower_pairing_tests::test_tower_pairing_BLS12_381_1P",
"test_name": "test_tower_pairing_BLS12_381_1P",
"steps": 165291,
"sierra_gas": 57232878,
"image_path": "docs/benchmarks/test_tower_pairing_BLS12_381_1P.png",
"category": "garaga",
"range_check": 430,
"range_check96": 306711,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 49635,
"mul_mod": 20003
}
},
"test_tower_pairing_BLS12_381_3P": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::tower_pairing_tests::test_tower_pairing_BLS12_381_3P",
"test_name": "test_tower_pairing_BLS12_381_3P",
"steps": 248951,
"sierra_gas": 97763802,
"image_path": "docs/benchmarks/test_tower_pairing_BLS12_381_3P.png",
"category": "garaga",
"range_check": 556,
"range_check96": 538321,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 86187,
"mul_mod": 37849
}
},
"test_verify_ultra_starknet_zk_honk_proof": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "noir_ultra_starknet_zk_honk_example_integrationtest::test_contract::test_verify_ultra_starknet_zk_honk_proof",
"test_name": "test_verify_ultra_starknet_zk_honk_proof",
"steps": 1221360,
"sierra_gas": 193032648,
"image_path": "docs/benchmarks/test_verify_ultra_starknet_zk_honk_proof.png",
"category": "contracts",
"range_check": 66173,
"range_check96": 451576,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 1044,
"add_mod": 49911,
"mul_mod": 47987
}
},
"test_tower_pairing_BLS12_381_2P": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::tower_pairing_tests::test_tower_pairing_BLS12_381_2P",
"test_name": "test_tower_pairing_BLS12_381_2P",
"steps": 207121,
"sierra_gas": 77498340,
"image_path": "docs/benchmarks/test_tower_pairing_BLS12_381_2P.png",
"category": "garaga",
"range_check": 493,
"range_check96": 422516,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 67911,
"mul_mod": 28926
}
},
"test_tower_pairing_BN254_3P": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::tower_pairing_tests::test_tower_pairing_BN254_3P",
"test_name": "test_tower_pairing_BN254_3P",
"steps": 268869,
"sierra_gas": 114248466,
"image_path": "docs/benchmarks/test_tower_pairing_BN254_3P.png",
"category": "garaga",
"range_check": 474,
"range_check96": 626255,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 94555,
"mul_mod": 50514
}
},
"test_tower_pairing_BN254_2P": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "garaga::tests::autogenerated::tower_pairing_tests::test_tower_pairing_BN254_2P",
"test_name": "test_tower_pairing_BN254_2P",
"steps": 219367,
"sierra_gas": 89466112,
"image_path": "docs/benchmarks/test_tower_pairing_BN254_2P.png",
"category": "garaga",
"range_check": 398,
"range_check96": 486548,
"keccak": 0,
"pedersen": 0,
"bitwise": 0,
"ecop": 0,
"poseidon": 0,
"add_mod": 73494,
"mul_mod": 38661
}
},
"test_verify_r0_groth16_proof_bn254": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "risc0_verifier_bn254_integrationtest::test_contract::test_verify_r0_groth16_proof_bn254",
"test_name": "test_verify_r0_groth16_proof_bn254",
"steps": 264545,
"sierra_gas": 42860813,
"image_path": "docs/benchmarks/test_verify_r0_groth16_proof_bn254.png",
"category": "contracts",
"range_check": 12069,
"range_check96": 74896,
"keccak": 0,
"pedersen": 0,
"bitwise": 6698,
"ecop": 0,
"poseidon": 509,
"add_mod": 6303,
"mul_mod": 9541
}
},
"test_verify_sp1_groth16_proof_bn254": {
"last_updated": "2025-10-30T15:26:00.944704",
"latest_metrics": {
"test_name_hierarchical": "sp1_verifier_bn254_integrationtest::test_contract::test_verify_sp1_groth16_proof_bn254",
"test_name": "test_verify_sp1_groth16_proof_bn254",
"steps": 244680,
"sierra_gas": 38221851,
"image_path": "docs/benchmarks/test_verify_sp1_groth16_proof_bn254.png",
"category": "contracts",
"range_check": 11127,
"range_check96": 75027,
"keccak": 0,
"pedersen": 0,
"bitwise": 2230,
"ecop": 0,
"poseidon": 509,
"add_mod": 6314,
"mul_mod": 9555
}
}
}
================================================
FILE: docs/gitbook/README.md
================================================
# Garaga
<figure><img src=".gitbook/assets/logo.png" alt="Garaga Logo" width="200"><figcaption></figcaption></figure>
## State-of-the-Art Elliptic Curve Tooling & ZK Proof Verification for Starknet
Garaga enables **efficient verification of zero-knowledge proofs** and **cryptographic operations** on Starknet. It achieves state-of-the-art performance through:
* A **dedicated builtin** from StarkWare for emulated modular arithmetic
* **Non-deterministic techniques** for extension field multiplication, pairings, and multi-scalar multiplication
* **Precomputed verification hints** that dramatically reduce on-chain computation
***
## What Can You Build?
<table data-view="cards"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>🛡️ ZK Proof Verification</strong></td><td>Verify Groth16 and Honk proofs on-chain with production-ready verifier contracts.</td><td><a href="smart-contract-generators/">Learn more →</a></td></tr><tr><td><strong>🔗 zkVM Integration</strong></td><td>Verify proofs from RISC Zero and SP1 using maintained, audited contracts.</td><td><a href="maintained-smart-contracts/">Learn more →</a></td></tr><tr><td><strong>✍️ Signature Verification</strong></td><td>ECDSA, Schnorr, and EdDSA verification across multiple elliptic curves.</td><td><a href="using-garaga-libraries-in-your-cairo-project/ec-signatures.md">Learn more →</a></td></tr><tr><td><strong>🎲 Randomness & Time-Lock Encryption</strong></td><td>On-chain drand verification for provably fair randomness, plus tlock encryption that only decrypts after a future time.</td><td><a href="maintained-smart-contracts/drand.md">Learn more →</a></td></tr><tr><td><strong>🧮 Elliptic Curve Operations</strong></td><td>Multi-scalar multiplication on 6 curves, pairing operations for BN254/BLS12-381.</td><td><a href="using-garaga-libraries-in-your-cairo-project/ec-multi-scalar-multiplication.md">Learn more →</a></td></tr><tr><td><strong>🔒 Privacy-Preserving dApps</strong></td><td>Build applications with Noir/Honk circuits for complex privacy logic.</td><td><a href="smart-contract-generators/noir.md">Learn more →</a></td></tr></tbody></table>
***
## Architecture Overview
```
┌──────────────────────────────────────────────────────────────────────────────┐
│ YOUR STARKNET DAPP │
├──────────────────────────────────────────────────────────────────────────────┤
│ │
│ Smart Contract Generators │ Cairo Libraries │
│ ───────────────────────── │ ─────────────── │
│ • Groth16 Verifier (BN254/BLS) │ • EC Operations (MS
gitextract_6da2_nl2/
├── .cargo/
│ └── config.toml
├── .claude/
│ ├── commands/
│ │ ├── bump-version.md
│ │ └── upgrade-cairo.md
│ └── skills/
│ ├── benchmarking-cairo/
│ │ ├── SKILL.md
│ │ ├── installation.md
│ │ └── profile.py
│ └── cairo-coding/
│ ├── SKILL.md
│ └── bounded_int_calc.py
├── .github/
│ ├── .all-contributorsrc
│ ├── CODEOWNERS
│ ├── ISSUE_TEMPLATE/
│ │ ├── 01_BUG_REPORT.md
│ │ ├── 02_FEATURE_REQUEST.md
│ │ ├── 03_CODEBASE_IMPROVEMENT.md
│ │ └── config.yml
│ ├── PULL_REQUEST_TEMPLATE.md
│ ├── labels.yml
│ ├── scripts/
│ │ ├── declare_maintained_contracts.py
│ │ └── verify_contracts.py
│ └── workflows/
│ ├── cairo.yml
│ ├── docs-sync.yml
│ ├── e2e.yml
│ ├── hydra.yml
│ ├── labels.yml
│ ├── maturin.yml
│ ├── node.yml
│ ├── setup.yml
│ └── wasm.yml
├── .gitignore
├── .pre-commit-config.yaml
├── .secrets.template
├── .tool-versions
├── CLAUDE.md
├── Cargo.toml
├── LICENSE
├── Makefile
├── README.md
├── Scarb.toml
├── docs/
│ ├── CODE_OF_CONDUCT.md
│ ├── CONTRIBUTING.md
│ ├── PYPI_README.md
│ ├── SECURITY.md
│ ├── benchmarks/
│ │ └── test_summary.json
│ └── gitbook/
│ ├── README.md
│ ├── SUMMARY.md
│ ├── building-powerful-applications.md
│ ├── developer-setup-and-guides/
│ │ ├── README.md
│ │ ├── garaga-rs-crate/
│ │ │ ├── README.md
│ │ │ ├── rust-greater-than-python-bindings.md
│ │ │ └── rust-greater-than-wasm-bindings.md
│ │ └── working-with-auto-generated-cairo-code.md
│ ├── installation/
│ │ ├── README.md
│ │ ├── cairo-library.md
│ │ ├── developer-setup.md
│ │ ├── npm-package.md
│ │ ├── python-package.md
│ │ └── rust-crate.md
│ ├── maintained-smart-contracts/
│ │ ├── README.md
│ │ ├── drand.md
│ │ ├── risczero.md
│ │ └── sp1.md
│ ├── security.md
│ ├── smart-contract-generators/
│ │ ├── README.md
│ │ ├── groth16/
│ │ │ ├── README.md
│ │ │ ├── generate-and-deploy-your-verifier-contract.md
│ │ │ └── generating-calldata-from-a-proof-and-using-your-deployed-contract/
│ │ │ ├── README.md
│ │ │ ├── using-python-garaga-cli.md
│ │ │ ├── using-rust.md
│ │ │ └── using-typescript.md
│ │ └── noir.md
│ ├── support.md
│ ├── updating-these-docs.md
│ └── using-garaga-libraries-in-your-cairo-project/
│ ├── README.md
│ ├── ec-multi-scalar-multiplication.md
│ ├── ec-signatures.md
│ ├── hashing-functions.md
│ └── rsa-signatures.md
├── hydra/
│ └── garaga/
│ ├── algebra.py
│ ├── curves.py
│ ├── drand/
│ │ ├── client.py
│ │ └── tlock.py
│ ├── extension_field_modulo_circuit.py
│ ├── hints/
│ │ ├── bls.py
│ │ ├── ecip.py
│ │ ├── eisenstein.py
│ │ ├── extf_mul.py
│ │ ├── fake_glv.py
│ │ ├── frobenius.py
│ │ ├── io.py
│ │ ├── keccak256.py
│ │ ├── multi_miller_witness.py
│ │ ├── neg_3.py
│ │ └── tower_backup.py
│ ├── modulo_circuit.py
│ ├── modulo_circuit_structs.py
│ ├── points.py
│ ├── poseidon_transcript.py
│ ├── precompiled_circuits/
│ │ ├── all_circuits.py
│ │ ├── cofactor_clearing.py
│ │ ├── compilable_circuits/
│ │ │ ├── apply_isogeny.py
│ │ │ ├── base.py
│ │ │ ├── cairo1_mpcheck_circuits.py
│ │ │ ├── cairo1_tower_pairing.py
│ │ │ ├── common_cairo_fustat_circuits.py
│ │ │ ├── rsa.py
│ │ │ └── ultra_honk.py
│ │ ├── ec.py
│ │ ├── final_exp.py
│ │ ├── fp2.py
│ │ ├── isogeny.py
│ │ ├── map_to_curve.py
│ │ ├── miller_tower.py
│ │ ├── multi_miller_loop.py
│ │ ├── multi_pairing_check.py
│ │ ├── poseidon_bn254.py
│ │ └── zk_honk.py
│ ├── rsa_rns.py
│ ├── signature.py
│ └── starknet/
│ ├── cli/
│ │ ├── declare.py
│ │ ├── deploy.py
│ │ ├── gen.py
│ │ ├── smart_contract_project.py
│ │ ├── starknet_cli.py
│ │ ├── utils.py
│ │ └── verify.py
│ ├── constants.py
│ ├── groth16_contract_generator/
│ │ ├── calldata.py
│ │ ├── examples/
│ │ │ ├── gnark_proof_bn254.json
│ │ │ ├── gnark_public_bn254.json
│ │ │ ├── gnark_vk_bn254.json
│ │ │ ├── proof_bls.json
│ │ │ ├── proof_bn254.json
│ │ │ ├── proof_risc0.json
│ │ │ ├── proof_sp1.json
│ │ │ ├── snarkjs_proof_bls12381.json
│ │ │ ├── snarkjs_proof_bn254.json
│ │ │ ├── snarkjs_public_bls12381.json
│ │ │ ├── snarkjs_public_bn254.json
│ │ │ ├── snarkjs_vk_bls12381.json
│ │ │ ├── snarkjs_vk_bn254.json
│ │ │ ├── vk_bls.json
│ │ │ ├── vk_bn254.json
│ │ │ ├── vk_risc0.json
│ │ │ └── vk_sp1.json
│ │ ├── generator.py
│ │ ├── generator_risc0.py
│ │ ├── generator_sp1.py
│ │ └── parsing_utils.py
│ ├── honk_contract_generator/
│ │ ├── calldata.py
│ │ └── generator_honk.py
│ └── tests_and_calldata_generators/
│ ├── drand_calldata.py
│ ├── map_to_curve.py
│ ├── mpcheck.py
│ ├── msm.py
│ ├── signatures.py
│ └── test_writer.py
├── pyproject.toml
├── src/
│ ├── .tool-versions
│ ├── Scarb.toml
│ ├── contracts/
│ │ ├── autogenerated/
│ │ │ ├── groth16_example_bls12_381/
│ │ │ │ ├── .tool-versions
│ │ │ │ ├── Scarb.toml
│ │ │ │ ├── src/
│ │ │ │ │ ├── groth16_verifier.cairo
│ │ │ │ │ ├── groth16_verifier_constants.cairo
│ │ │ │ │ └── lib.cairo
│ │ │ │ └── tests/
│ │ │ │ ├── proof_calldata.txt
│ │ │ │ └── test_contract.cairo
│ │ │ ├── groth16_example_bn254/
│ │ │ │ ├── .tool-versions
│ │ │ │ ├── Scarb.toml
│ │ │ │ ├── src/
│ │ │ │ │ ├── groth16_verifier.cairo
│ │ │ │ │ ├── groth16_verifier_constants.cairo
│ │ │ │ │ └── lib.cairo
│ │ │ │ └── tests/
│ │ │ │ ├── proof_calldata.txt
│ │ │ │ └── test_contract.cairo
│ │ │ ├── noir_ultra_keccak_zk_honk_example/
│ │ │ │ ├── .tool-versions
│ │ │ │ ├── Scarb.toml
│ │ │ │ ├── src/
│ │ │ │ │ ├── honk_verifier.cairo
│ │ │ │ │ ├── honk_verifier_circuits.cairo
│ │ │ │ │ ├── honk_verifier_constants.cairo
│ │ │ │ │ └── lib.cairo
│ │ │ │ └── tests/
│ │ │ │ ├── proof_calldata.txt
│ │ │ │ └── test_contract.cairo
│ │ │ ├── risc0_verifier_bn254/
│ │ │ │ ├── .tool-versions
│ │ │ │ ├── Scarb.toml
│ │ │ │ ├── src/
│ │ │ │ │ ├── groth16_verifier.cairo
│ │ │ │ │ ├── groth16_verifier_constants.cairo
│ │ │ │ │ └── lib.cairo
│ │ │ │ └── tests/
│ │ │ │ ├── proof_calldata.txt
│ │ │ │ └── test_contract.cairo
│ │ │ └── sp1_verifier_bn254/
│ │ │ ├── .tool-versions
│ │ │ ├── Scarb.toml
│ │ │ ├── src/
│ │ │ │ ├── groth16_verifier.cairo
│ │ │ │ └── lib.cairo
│ │ │ └── tests/
│ │ │ ├── proof_calldata.txt
│ │ │ └── test_contract.cairo
│ │ ├── drand_decrypt_quicknet/
│ │ │ ├── Scarb.toml
│ │ │ └── src/
│ │ │ ├── drand_decrypt.cairo
│ │ │ ├── drand_decrypt_constants.cairo
│ │ │ └── lib.cairo
│ │ ├── drand_quicknet/
│ │ │ ├── .tool-versions
│ │ │ ├── Scarb.toml
│ │ │ └── src/
│ │ │ ├── drand_verifier.cairo
│ │ │ ├── drand_verifier_constants.cairo
│ │ │ └── lib.cairo
│ │ ├── mutator_set/
│ │ │ ├── .tool-versions
│ │ │ ├── Makefile
│ │ │ ├── Scarb.toml
│ │ │ ├── scripts/
│ │ │ │ ├── prover.py
│ │ │ │ └── regenerate_verifier.py
│ │ │ ├── snfoundry.toml
│ │ │ ├── src/
│ │ │ │ ├── lib.cairo
│ │ │ │ ├── mutator_set_contract.cairo
│ │ │ │ └── zk_verifier/
│ │ │ │ ├── honk_verifier_circuits.cairo
│ │ │ │ ├── honk_verifier_constants.cairo
│ │ │ │ └── honk_verifier_contract.cairo
│ │ │ ├── tests/
│ │ │ │ └── test_contract.cairo
│ │ │ └── zk_program/
│ │ │ ├── Nargo.toml
│ │ │ ├── Prover.toml
│ │ │ └── src/
│ │ │ ├── main.nr
│ │ │ ├── mmr.nr
│ │ │ └── mmr_tests.nr
│ │ ├── risc0_sample_app/
│ │ │ ├── README.md
│ │ │ ├── fibonacci_prover/
│ │ │ │ ├── .gitignore
│ │ │ │ ├── Cargo.toml
│ │ │ │ ├── README.md
│ │ │ │ ├── host/
│ │ │ │ │ ├── Cargo.toml
│ │ │ │ │ └── src/
│ │ │ │ │ └── main.rs
│ │ │ │ ├── methods/
│ │ │ │ │ ├── Cargo.toml
│ │ │ │ │ ├── build.rs
│ │ │ │ │ ├── guest/
│ │ │ │ │ │ ├── Cargo.toml
│ │ │ │ │ │ └── src/
│ │ │ │ │ │ └── main.rs
│ │ │ │ │ └── src/
│ │ │ │ │ └── lib.rs
│ │ │ │ └── rust-toolchain.toml
│ │ │ └── fibonacci_sequencer/
│ │ │ ├── .gitignore
│ │ │ ├── Scarb.toml
│ │ │ ├── snfoundry.toml
│ │ │ ├── src/
│ │ │ │ └── lib.cairo
│ │ │ └── tests/
│ │ │ └── test_contract.cairo
│ │ └── universal_ecip/
│ │ ├── Scarb.toml
│ │ └── src/
│ │ └── lib.cairo
│ ├── corelib_imports/
│ │ ├── README.md
│ │ ├── Scarb.toml
│ │ └── src/
│ │ └── lib.cairo
│ └── src/
│ ├── apps/
│ │ ├── drand.cairo
│ │ ├── noir/
│ │ │ └── zk_honk_transcript.cairo
│ │ ├── noir.cairo
│ │ ├── risc0.cairo
│ │ ├── sp1.cairo
│ │ └── sp1_constants.cairo
│ ├── basic_field_ops.cairo
│ ├── circuits/
│ │ ├── README.md
│ │ ├── dummy.cairo
│ │ ├── ec.cairo
│ │ ├── extf_mul.cairo
│ │ ├── isogeny.cairo
│ │ ├── multi_pairing_check.cairo
│ │ ├── rsa.cairo
│ │ └── tower_circuits.cairo
│ ├── core/
│ │ └── circuit.cairo
│ ├── crypto/
│ │ └── mmr.cairo
│ ├── definitions/
│ │ ├── curves.cairo
│ │ └── structs/
│ │ ├── fields.cairo
│ │ └── points.cairo
│ ├── definitions.cairo
│ ├── ec/
│ │ ├── ec_ops.cairo
│ │ ├── ec_ops_g2.cairo
│ │ ├── generate_selector_code.py
│ │ ├── pairing/
│ │ │ ├── groth16.cairo
│ │ │ ├── pairing_check.cairo
│ │ │ └── single_pairing_tower.cairo
│ │ └── selectors.cairo
│ ├── hashes/
│ │ ├── poseidon_bn254.cairo
│ │ └── sha_512.cairo
│ ├── lib.cairo
│ ├── signatures/
│ │ ├── ecdsa.cairo
│ │ ├── eddsa_25519.cairo
│ │ ├── rsa.cairo
│ │ └── schnorr.cairo
│ ├── tests/
│ │ ├── autogenerated/
│ │ │ ├── ecdsa_tests.cairo
│ │ │ ├── eddsa_tests.cairo
│ │ │ ├── msm_tests.cairo
│ │ │ ├── pairing_tests.cairo
│ │ │ ├── rsa_tests.cairo
│ │ │ ├── schnorr_tests.cairo
│ │ │ └── tower_pairing_tests.cairo
│ │ ├── calldata_tests.cairo
│ │ ├── proof_calldata.txt
│ │ ├── sha512_tests.cairo
│ │ └── sp1_groth_16_tests.cairo
│ └── utils/
│ ├── calldata.cairo
│ ├── hashing.cairo
│ └── neg_3.cairo
├── tests/
│ ├── benchmarks_compiled.py
│ ├── benchmarks_manual.py
│ ├── conftest.py
│ ├── contracts_e2e/
│ │ ├── __init__.py
│ │ ├── e2e_test.py
│ │ ├── fixtures/
│ │ │ ├── __init__.py
│ │ │ ├── accounts.py
│ │ │ ├── clients.py
│ │ │ ├── constants.py
│ │ │ └── devnet.py
│ │ ├── install_devnet.sh
│ │ ├── test-variables.env.template
│ │ └── utils.py
│ ├── ed25519_test_vectors.json
│ └── hydra/
│ ├── algebra/
│ │ ├── test_polynomial.py
│ │ ├── test_pyfelt.py
│ │ └── test_tower_final_exp.py
│ ├── circuits/
│ │ ├── test_ec.py
│ │ ├── test_honk.py
│ │ └── test_multi_miller_loop.py
│ ├── hints/
│ │ ├── test_ecip.py
│ │ ├── test_eisenstein.py
│ │ ├── test_fake_glv.py
│ │ ├── test_final_exp_witness.py
│ │ ├── test_frobenius.py
│ │ └── test_neg3.py
│ ├── starknet/
│ │ ├── test_calldata.py
│ │ ├── test_groth16_vk_proof_parsing.py
│ │ ├── test_honk_vk_proof_parsing.py
│ │ └── test_signatures_calldata.py
│ ├── test_bls18_381_map_to_curve.py
│ ├── test_cofactor_clearing.py
│ ├── test_drand.py
│ ├── test_extension_field_modulo_circuit.py
│ ├── test_g1_point.py
│ ├── test_g2_point.py
│ ├── test_isogeny.py
│ ├── test_poseidon_hash.py
│ └── test_rsa_rns.py
└── tools/
├── addchain/
│ ├── bls12_381_e.acc
│ ├── bls12_381_h3_s.acc
│ ├── bn254_exp.acc
│ ├── bn254_exp0.acc
│ ├── bn254_r_m_d_inv.acc
│ └── gen_rust_addchain.py
├── garaga_rs/
│ ├── Cargo.toml
│ └── src/
│ ├── algebra/
│ │ ├── extf_mul.rs
│ │ ├── g1g2pair.rs
│ │ ├── g1point.rs
│ │ ├── g2point.rs
│ │ ├── polynomial.rs
│ │ └── rational_function.rs
│ ├── calldata/
│ │ ├── drand_calldata.rs
│ │ ├── drand_tlock_calldata.rs
│ │ ├── full_proof_with_hints/
│ │ │ ├── groth16.rs
│ │ │ └── zk_honk.rs
│ │ ├── mod.rs
│ │ ├── mpc_calldata.rs
│ │ ├── msm_calldata.rs
│ │ └── signatures.rs
│ ├── constants.rs
│ ├── crypto/
│ │ ├── digest.rs
│ │ ├── merkle_tree.rs
│ │ ├── mmr/
│ │ │ ├── mmr_accumulator.rs
│ │ │ ├── mmr_membership_proof.rs
│ │ │ ├── mmr_successor_proof.rs
│ │ │ ├── mmr_trait.rs
│ │ │ ├── shared_advanced.rs
│ │ │ └── shared_basic.rs
│ │ └── poseidon_bn254.rs
│ ├── definitions.rs
│ ├── ecip/
│ │ ├── core.rs
│ │ └── ff.rs
│ ├── frobenius.rs
│ ├── hints/
│ │ ├── eisenstein.rs
│ │ └── fake_glv.rs
│ ├── io.rs
│ ├── lib.rs
│ ├── pairing/
│ │ ├── final_exp_witness/
│ │ │ ├── addchain_pow_generated.rs
│ │ │ ├── bls12_381_final_exp_witness.rs
│ │ │ ├── bn254_final_exp_witness.rs
│ │ │ └── mod.rs
│ │ ├── multi_miller_loop.rs
│ │ └── multi_pairing_check.rs
│ ├── poseidon_transcript.rs
│ ├── python_bindings/
│ │ ├── drand_calldata.rs
│ │ ├── ecip.rs
│ │ ├── extf_mul.rs
│ │ ├── final_exp_witness.rs
│ │ ├── g2.rs
│ │ ├── groth16_calldata.rs
│ │ ├── hades_permutation.rs
│ │ ├── mod.rs
│ │ ├── mpc_calldata.rs
│ │ ├── msm.rs
│ │ ├── pairing.rs
│ │ ├── signatures.rs
│ │ └── zk_honk_calldata.rs
│ └── wasm_bindings.rs
├── make/
│ ├── bytecode_check.sh
│ ├── bytecode_check_max_log_n.sh
│ ├── check_sierra_size.py
│ ├── ci_cairo.sh
│ ├── ci_e2e.sh
│ ├── ci_hydra.sh
│ ├── ci_wasm.sh
│ ├── common.sh
│ ├── constants.json
│ ├── generate_constants.py
│ ├── rewrite.sh
│ ├── setup.sh
│ ├── steps.sh
│ ├── test_contracts.sh
│ ├── update_bench_in_readme.py
│ ├── update_risc0_class_hash.sh
│ ├── wasm-test-gen.sh
│ └── wasm.sh
├── noir/
│ ├── Makefile
│ ├── hello/
│ │ ├── Nargo.toml
│ │ ├── Prover.toml
│ │ └── src/
│ │ └── main.nr
│ ├── run.sh
│ └── transcript.py
├── npm/
│ ├── garaga_ts/
│ │ ├── .gitignore
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── babel.config.cjs
│ │ ├── docker-compose.yml
│ │ ├── fix-chown.sh
│ │ ├── jest.config.ts
│ │ ├── patch.wasm.cjs
│ │ ├── rollup.config.js
│ │ ├── src/
│ │ │ ├── constants.ts
│ │ │ ├── node/
│ │ │ │ ├── api.ts
│ │ │ │ ├── definitions.ts
│ │ │ │ ├── hints/
│ │ │ │ │ └── io.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── starknet/
│ │ │ │ ├── groth16ContractGenerator/
│ │ │ │ │ └── parsingUtils.ts
│ │ │ │ └── honkContractGenerator/
│ │ │ │ └── parsingUtils.ts
│ │ │ └── wasm/
│ │ │ └── pkg/
│ │ │ ├── garaga_rs.d.ts
│ │ │ ├── garaga_rs.js
│ │ │ ├── garaga_rs_bg.wasm.d.ts
│ │ │ └── garaga_rs_bg.wasm.js
│ │ └── tests/
│ │ └── starknet/
│ │ ├── drandCalldata.test.ts
│ │ ├── drandTlockCalldata.test.ts
│ │ ├── groth16Calldata.test.ts
│ │ ├── groth16VkProofParsing.test.ts
│ │ ├── poseidonHash.test.ts
│ │ ├── signaturesCalldata.test.ts
│ │ └── zkHonkCalldata.test.ts
│ └── integration-test-suite/
│ ├── .gitignore
│ └── packages/
│ ├── nodejs-ts-cjs-tsc/
│ │ ├── .gitignore
│ │ ├── output.txt
│ │ └── src/
│ │ ├── examples.ts
│ │ └── index.ts
│ ├── nodejs-ts-esm-tsc/
│ │ ├── .gitignore
│ │ ├── output.txt
│ │ └── src/
│ │ ├── examples.ts
│ │ └── index.ts
│ ├── web-js-esm-react/
│ │ ├── .gitignore
│ │ ├── next.config.mjs
│ │ ├── output.txt
│ │ ├── scrape.cjs
│ │ └── src/
│ │ └── app/
│ │ ├── examples.js
│ │ ├── layout.js
│ │ └── page.js
│ └── web-js-esm-webpack/
│ ├── .gitignore
│ ├── output.txt
│ ├── scrape.cjs
│ ├── src/
│ │ ├── bootstrap.js
│ │ ├── examples.js
│ │ └── index.js
│ └── webpack.config.js
├── process_manager.py
└── profile_tests.py
Showing preview only (242K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (2854 symbols across 182 files)
FILE: .claude/skills/benchmarking-cairo/profile.py
function _check_tool (line 46) | def _check_tool(name: str) -> str:
function _fail (line 56) | def _fail(code: int, msg: str) -> None:
function _run (line 62) | def _run(
function _git_short_hash (line 70) | def _git_short_hash(repo_root: str) -> str:
function _profile_filename (line 85) | def _profile_filename(
function _find_package_dir (line 126) | def _find_package_dir(repo_root: str, package: str) -> str:
function _step_snforge (line 141) | def _step_snforge(pkg_dir: str, test_filter: str, tracked_resource: str)...
function _step_scarb (line 163) | def _step_scarb(pkg_dir: str, executable: str, args_file: str) -> None:
function _find_trace_snforge (line 182) | def _find_trace_snforge(pkg_dir: str, test_filter: str) -> str:
function _find_trace_scarb (line 235) | def _find_trace_scarb(pkg_dir: str, package: str) -> str:
function _step_build_profile (line 252) | def _step_build_profile(trace_path: str, output_path: str) -> None:
function _step_view_profile (line 276) | def _step_view_profile(profile_path: str, sample_name: str) -> None:
function _step_export_png (line 292) | def _step_export_png(
function build_parser (line 330) | def build_parser() -> argparse.ArgumentParser:
function main (line 388) | def main() -> int:
function _find_repo_root (line 471) | def _find_repo_root() -> str:
FILE: .claude/skills/cairo-coding/bounded_int_calc.py
function validate_felt252 (line 23) | def validate_felt252(value: int, name: str) -> None:
function format_bound (line 33) | def format_bound(value: int) -> str:
function calc_add (line 40) | def calc_add(a_lo: int, a_hi: int, b_lo: int, b_hi: int) -> tuple[int, i...
function calc_sub (line 47) | def calc_sub(a_lo: int, a_hi: int, b_lo: int, b_hi: int) -> tuple[int, i...
function calc_mul (line 54) | def calc_mul(a_lo: int, a_hi: int, b_lo: int, b_hi: int) -> tuple[int, i...
function calc_div (line 69) | def calc_div(
function generate_add_impl (line 98) | def generate_add_impl(a_lo: int, a_hi: int, b_lo: int, b_hi: int, name: ...
function generate_sub_impl (line 109) | def generate_sub_impl(a_lo: int, a_hi: int, b_lo: int, b_hi: int, name: ...
function generate_mul_impl (line 120) | def generate_mul_impl(a_lo: int, a_hi: int, b_lo: int, b_hi: int, name: ...
function generate_div_impl (line 131) | def generate_div_impl(a_lo: int, a_hi: int, b_lo: int, b_hi: int, name: ...
function main (line 145) | def main():
FILE: .github/scripts/declare_maintained_contracts.py
class Network (line 23) | class Network(Enum):
method to_starknet_chain_id (line 27) | def to_starknet_chain_id(self):
function get_account (line 36) | def get_account(network: Network):
function declare_contract_from_path (line 51) | async def declare_contract_from_path(path: Path, network: Network):
function declare_contract_from_path_both_networks (line 57) | async def declare_contract_from_path_both_networks(path: Path):
function main (line 63) | async def main():
FILE: .github/scripts/verify_contracts.py
class Network (line 17) | class Network(Enum):
method get_rpc_url (line 21) | def get_rpc_url(self):
function get_class_hash_from_generator (line 25) | def get_class_hash_from_generator():
function verify_network (line 41) | async def verify_network(network: Network, class_hash: str):
function verify_ecip_contract (line 59) | async def verify_ecip_contract():
function verify_contract_from_path (line 69) | async def verify_contract_from_path(path: Path):
FILE: hydra/garaga/algebra.py
class PyFelt (line 13) | class PyFelt:
method felt (line 32) | def felt(self) -> PyFelt:
method __repr__ (line 35) | def __repr__(self) -> str:
method __add__ (line 41) | def __add__(self, right: PyFelt | int) -> PyFelt:
method __neg__ (line 49) | def __neg__(self) -> PyFelt:
method __sub__ (line 53) | def __sub__(self, right: PyFelt | int) -> PyFelt:
method __mul__ (line 61) | def __mul__(self, right: PyFelt | int) -> PyFelt:
method __rmul__ (line 69) | def __rmul__(self, left: PyFelt | int) -> PyFelt:
method __inv__ (line 72) | def __inv__(self) -> PyFelt:
method __truediv__ (line 79) | def __truediv__(self, right: PyFelt) -> PyFelt:
method __pow__ (line 85) | def __pow__(self, exponent: int) -> PyFelt:
method __eq__ (line 88) | def __eq__(self, other: object) -> bool:
method __lt__ (line 95) | def __lt__(self, other: PyFelt | int) -> bool:
method __le__ (line 102) | def __le__(self, other: PyFelt | int) -> bool:
method __gt__ (line 109) | def __gt__(self, other: PyFelt | int) -> bool:
method __ge__ (line 116) | def __ge__(self, other: PyFelt | int) -> bool:
method __rlt__ (line 123) | def __rlt__(self, left: int) -> bool:
method __rle__ (line 126) | def __rle__(self, left: int) -> bool:
method __rgt__ (line 129) | def __rgt__(self, left: int) -> bool:
method __rge__ (line 132) | def __rge__(self, left: int) -> bool:
method __ne__ (line 135) | def __ne__(self, other: object) -> bool:
method __radd__ (line 138) | def __radd__(self, left: PyFelt | int) -> PyFelt:
method __rsub__ (line 141) | def __rsub__(self, left: PyFelt | int) -> PyFelt:
method __rtruediv__ (line 144) | def __rtruediv__(self, left: PyFelt | int) -> PyFelt:
method is_quad_residue (line 147) | def is_quad_residue(self) -> bool:
method sqrt (line 152) | def sqrt(self, min_root: bool = True) -> PyFelt:
class Fp2 (line 163) | class Fp2:
method __post_init__ (line 167) | def __post_init__(self):
method p (line 171) | def p(self) -> int:
method value (line 175) | def value(self) -> tuple[int, int]:
method random (line 179) | def random(p: int, max_value: int = None) -> Fp2:
method one (line 191) | def one(p: int) -> Fp2:
method zero (line 195) | def zero(p: int) -> Fp2:
method __repr__ (line 198) | def __repr__(self) -> str:
method __add__ (line 201) | def __add__(self, other: Fp2) -> Fp2:
method __eq__ (line 207) | def __eq__(self, other: object) -> bool:
method __neg__ (line 213) | def __neg__(self) -> Fp2:
method __sub__ (line 216) | def __sub__(self, other: Fp2) -> Fp2:
method __mul__ (line 219) | def __mul__(self, other: Fp2 | PyFelt | int) -> Fp2:
method __rmul__ (line 234) | def __rmul__(self, other):
method __truediv__ (line 237) | def __truediv__(self, other):
method __rtruediv__ (line 245) | def __rtruediv__(self, other) -> Fp2:
method __inv__ (line 253) | def __inv__(self) -> Fp2:
method __pow__ (line 259) | def __pow__(self, p: int) -> Fp2:
method norm (line 291) | def norm(self) -> PyFelt:
method legendre (line 294) | def legendre(self) -> int:
method is_quad_residue (line 298) | def is_quad_residue(self) -> bool:
method sqrt (line 301) | def sqrt(self) -> Fp2:
method lexicographically_largest (line 325) | def lexicographically_largest(self) -> bool:
class BaseField (line 335) | class BaseField:
method __call__ (line 338) | def __call__(self, integer: int) -> PyFelt:
method zero (line 341) | def zero(self) -> PyFelt:
method one (line 344) | def one(self) -> PyFelt:
method random (line 347) | def random(self, max_value: int = None) -> PyFelt:
method type (line 353) | def type(self) -> type[PyFelt]:
class BaseFp2Field (line 358) | class BaseFp2Field:
method __call__ (line 361) | def __call__(self, a: tuple[int, int] | int) -> Fp2:
method zero (line 368) | def zero(self) -> Fp2:
method one (line 371) | def one(self) -> Fp2:
method random (line 374) | def random(self) -> Fp2:
method type (line 378) | def type(self) -> type[Fp2]:
class ModuloCircuitElement (line 383) | class ModuloCircuitElement:
method value (line 398) | def value(self) -> int:
method p (line 402) | def p(self) -> int:
method felt (line 406) | def felt(self) -> PyFelt:
class Polynomial (line 410) | class Polynomial(Generic[T]):
method __init__ (line 442) | def __init__(self, coefficients: list[T], raw_init: tuple = None):
method _raw_init (line 458) | def _raw_init(
method _initialize (line 474) | def _initialize(
method __repr__ (line 484) | def __repr__(self) -> str:
method print_as_sage_poly (line 490) | def print_as_sage_poly(self, var_name: str = "z", as_hex: bool = False...
method __getitem__ (line 517) | def __getitem__(self, i: int) -> PyFelt:
method __len__ (line 523) | def __len__(self) -> int:
method degree (line 526) | def degree(self) -> int:
method get_coeffs (line 532) | def get_coeffs(self) -> list[T]:
method get_value_coeffs (line 540) | def get_value_coeffs(self) -> list[int]:
method differentiate (line 546) | def differentiate(self) -> "Polynomial":
method __add__ (line 570) | def __add__(self, other: Polynomial) -> Polynomial:
method __neg__ (line 597) | def __neg__(self) -> "Polynomial":
method __sub__ (line 609) | def __sub__(self, other: Polynomial) -> Polynomial:
method __mul__ (line 637) | def __mul__(
method __rmul__ (line 701) | def __rmul__(
method __truediv__ (line 706) | def __truediv__(self, other):
method __floordiv__ (line 713) | def __floordiv__(self, other: "Polynomial") -> "Polynomial":
method __mod__ (line 717) | def __mod__(self, other: "Polynomial") -> "Polynomial":
method __divmod__ (line 721) | def __divmod__(self, denominator: "Polynomial") -> tuple[Polynomial, P...
method __eq__ (line 777) | def __eq__(self, other: object) -> bool:
method __neq__ (line 789) | def __neq__(self, other: object) -> bool:
method leading_coefficient (line 792) | def leading_coefficient(self) -> PyFelt:
method is_zero (line 795) | def is_zero(self) -> bool:
method zero (line 804) | def zero(p: int, type: type[T] = PyFelt) -> "Polynomial[T]":
method one (line 813) | def one(p: int, type: type[T] = PyFelt) -> "Polynomial[T]":
method evaluate (line 821) | def evaluate(self, point: PyFelt | Fp2) -> PyFelt | Fp2:
method __pow__ (line 832) | def __pow__(self, exponent: int) -> "Polynomial":
method pow (line 842) | def pow(self, exponent: int, modulo_poly: "Polynomial") -> "Polynomial":
method inv (line 857) | def inv(self, modulo_poly: "Polynomial") -> "Polynomial":
method xgcd (line 876) | def xgcd(x: Polynomial, y: Polynomial) -> tuple[Polynomial, Polynomial...
method lagrange_interpolation (line 918) | def lagrange_interpolation(
method sparsity (line 952) | def sparsity(self) -> list[int]:
function get_sparsity (line 956) | def get_sparsity(X: list[PyFelt | ModuloCircuitElement]) -> list[int]:
class RationalFunction (line 975) | class RationalFunction(Generic[T]):
method field (line 980) | def field(self) -> BaseField | BaseFp2Field:
method zero (line 984) | def zero(cls, p: int, type: type[T] = PyFelt) -> "RationalFunction[T]":
method one (line 988) | def one(cls, p: int, type: type[T] = PyFelt) -> "RationalFunction[T]":
method simplify (line 991) | def simplify(self) -> "RationalFunction":
method __add__ (line 1000) | def __add__(self, other: "RationalFunction") -> "RationalFunction":
method __mul__ (line 1006) | def __mul__(self, other: int | PyFelt) -> "RationalFunction":
method evaluate (line 1015) | def evaluate(self, x: PyFelt | Fp2) -> PyFelt | Fp2:
method degrees_infos (line 1018) | def degrees_infos(self) -> dict[str, int]:
class FunctionFelt (line 1026) | class FunctionFelt(Generic[T]):
method field (line 1032) | def field(self) -> BaseField | BaseFp2Field:
method zero (line 1036) | def zero(cls, p: int, type: type[T] = PyFelt) -> "FunctionFelt[T]":
method one (line 1040) | def one(cls, p: int, type: type[T] = PyFelt) -> "FunctionFelt[T]":
method simplify (line 1043) | def simplify(self) -> "FunctionFelt":
method __add__ (line 1046) | def __add__(self, other: "FunctionFelt") -> "FunctionFelt":
method __mul__ (line 1049) | def __mul__(self, other: PyFelt | int) -> "FunctionFelt":
method __rmul__ (line 1052) | def __rmul__(self, other: PyFelt | int) -> "FunctionFelt":
method evaluate (line 1055) | def evaluate(self, x: PyFelt | Fp2, y: PyFelt | Fp2) -> PyFelt | Fp2:
method degrees_infos (line 1065) | def degrees_infos(self) -> dict[str, dict[str, int]]:
method validate_degrees (line 1071) | def validate_degrees(self, msm_size: int, batched: bool = True) -> bool:
method print_as_sage_poly (line 1083) | def print_as_sage_poly(self, var: str = "x", as_hex: bool = False) -> ...
FILE: hydra/garaga/curves.py
class ProofSystem (line 19) | class ProofSystem(Enum):
method supported_curves (line 25) | def supported_curves(self) -> set[int]:
class CurveID (line 39) | class CurveID(Enum):
method from_str (line 48) | def from_str(s: str) -> "CurveID":
method p (line 52) | def p(self) -> int:
method find_value_in_string (line 56) | def find_value_in_string(s: str) -> int | None:
method get_proving_system_curve (line 70) | def get_proving_system_curve(
class SWUParams (line 91) | class SWUParams:
class WeierstrassCurve (line 98) | class WeierstrassCurve:
method is_endomorphism_available (line 113) | def is_endomorphism_available(self) -> bool:
method to_cairo_zero (line 116) | def to_cairo_zero(self) -> str:
method to_cairo_one (line 140) | def to_cairo_one(self) -> str:
class TwistedEdwardsCurve (line 155) | class TwistedEdwardsCurve(WeierstrassCurve):
method __init__ (line 165) | def __init__(
method to_weierstrass (line 219) | def to_weierstrass(self, x_twisted, y_twisted):
method to_twistededwards (line 231) | def to_twistededwards(self, x_weirstrass: int, y_weirstrass: int):
class PairingCurve (line 248) | class PairingCurve(WeierstrassCurve):
function NAF (line 264) | def NAF(x):
function jy00 (line 271) | def jy00(value: int) -> list[int]:
function is_generator (line 471) | def is_generator(g: int, p: int) -> bool:
function get_base_field (line 534) | def get_base_field(
function get_irreducible_poly (line 563) | def get_irreducible_poly(curve_id: int | CurveID, extension_degree: int)...
function replace_consecutive_zeros (line 574) | def replace_consecutive_zeros(lst):
function recode_naf_bits (line 590) | def recode_naf_bits(lst):
function print_nbits_and_nG_glv_fake_glv (line 626) | def print_nbits_and_nG_glv_fake_glv():
function print_min_one_order (line 637) | def print_min_one_order():
function print_third_root_of_unity (line 646) | def print_third_root_of_unity():
FILE: hydra/garaga/drand/client.py
class DrandNetwork (line 17) | class DrandNetwork(Enum):
function digest_func (line 22) | def digest_func(round_number: int) -> bytes:
class NetworkInfo (line 31) | class NetworkInfo:
class RandomnessBeacon (line 42) | class RandomnessBeacon:
method signature_point (line 49) | def signature_point(self) -> G1Point | G2Point:
function make_request (line 61) | def make_request(endpoint: str) -> requests.Response:
function deserialize_bls_point (line 80) | def deserialize_bls_point(s_string: bytes) -> Union[G1Point, G2Point]:
function get_chains (line 151) | def get_chains() -> List[str]:
function get_chain_info (line 163) | def get_chain_info(chain_hash: str) -> NetworkInfo:
function get_latest_randomness (line 187) | def get_latest_randomness(chain_hash: str) -> RandomnessBeacon:
function get_randomness (line 192) | def get_randomness(chain_hash: str, round_number: int) -> RandomnessBeacon:
function _parse_randomness_beacon (line 197) | def _parse_randomness_beacon(data: dict) -> RandomnessBeacon:
function print_all_chain_info (line 207) | def print_all_chain_info() -> dict[DrandNetwork, NetworkInfo]:
function generate_precomputed_lines_code (line 315) | def generate_precomputed_lines_code(precomputed_lines: StructArray) -> str:
FILE: hydra/garaga/drand/tlock.py
class CipherText (line 15) | class CipherText:
method __post_init__ (line 20) | def __post_init__(self):
method serialize_to_cairo (line 23) | def serialize_to_cairo(self):
method serialize_to_calldata (line 32) | def serialize_to_calldata(self) -> list[int]:
function encrypt_for_round (line 45) | def encrypt_for_round(
function decrypt_at_round (line 116) | def decrypt_at_round(signature_at_round: G1Point, c: CipherText):
function expand_message_drand (line 165) | def expand_message_drand(msg: bytes, buf_size: int) -> bytes:
function write_cairo1_test (line 189) | def write_cairo1_test(msg: bytes, round: int, network: DrandNetwork):
FILE: hydra/garaga/extension_field_modulo_circuit.py
class EuclideanPolyAccumulator (line 22) | class EuclideanPolyAccumulator:
class AccPolyInstructionType (line 28) | class AccPolyInstructionType(Enum):
class AccumulatePolyInstructions (line 35) | class AccumulatePolyInstructions:
method append (line 46) | def append(
class ExtensionFieldModuloCircuit (line 66) | class ExtensionFieldModuloCircuit(Fp2Circuits):
method __init__ (line 67) | def __init__(
method _init_accumulator (line 110) | def _init_accumulator(self, extension_degree: int = None):
method commitments (line 127) | def commitments(self):
method circuit_input (line 134) | def circuit_input(self):
method create_lines_z_powers (line 140) | def create_lines_z_powers(self, z: PyFelt, add_extf_power: bool = False):
method create_powers_of_Z (line 186) | def create_powers_of_Z(
method eval_poly_in_precomputed_Z (line 209) | def eval_poly_in_precomputed_Z(
method extf_mul (line 294) | def extf_mul(
method extf_div (line 335) | def extf_div(
method extf_inv (line 357) | def extf_inv(
method conjugate_e12d (line 388) | def conjugate_e12d(
method update_LHS_state (line 407) | def update_LHS_state(
method update_RHS_state (line 468) | def update_RHS_state(
method finalize_circuit (line 535) | def finalize_circuit(
method summarize (line 641) | def summarize(self):
method compile_circuit_cairo_zero (line 659) | def compile_circuit_cairo_zero(
FILE: hydra/garaga/hints/bls.py
function get_root_and_scaling_factor_bls (line 58) | def get_root_and_scaling_factor_bls(mlo: E12) -> tuple[E12, E12]:
FILE: hydra/garaga/hints/ecip.py
function get_field_type_from_ec_point (line 18) | def get_field_type_from_ec_point(P: G1Point | G2Point) -> type[T]:
function get_ec_group_class_from_ec_point (line 32) | def get_ec_group_class_from_ec_point(P: G1Point | G2Point) -> type[G1Poi...
function derive_ec_point_from_X (line 46) | def derive_ec_point_from_X(
function zk_ecip_hint (line 121) | def zk_ecip_hint(
function verify_ecip (line 172) | def verify_ecip(
function slope_intercept (line 255) | def slope_intercept(
function eval_point_challenge (line 276) | def eval_point_challenge(
function eval_point_challenge_signed (line 290) | def eval_point_challenge_signed(
function line (line 298) | def line(P: G1Point | G2Point, Q: G1Point | G2Point) -> FF[T]:
class FF (line 347) | class FF:
method __init__ (line 361) | def __init__(self, coeffs: list[Polynomial[T]], curve_id: CurveID):
method degree (line 376) | def degree(self) -> int:
method __getitem__ (line 379) | def __getitem__(self, i: int) -> Polynomial:
method __add__ (line 385) | def __add__(self, other: FF) -> FF:
method __mul__ (line 401) | def __mul__(self, other: "FF" | Polynomial | PyFelt) -> "FF":
method neg_y (line 423) | def neg_y(self) -> "FF":
method reduce (line 431) | def reduce(self) -> "FF":
method to_poly (line 455) | def to_poly(self) -> Polynomial[T]:
method div_by_poly (line 462) | def div_by_poly(self, poly: Polynomial[T]) -> "FF":
method normalize (line 465) | def normalize(self) -> "FF":
class EmptyListOfPoints (line 473) | class EmptyListOfPoints(Exception):
function construct_function (line 477) | def construct_function(Ps: list[G1Point] | list[G2Point]) -> FF:
function row_function (line 517) | def row_function(
function ecip_functions (line 544) | def ecip_functions(
function dlog (line 559) | def dlog(d: FF) -> FunctionFelt:
function print_ff (line 646) | def print_ff(ff: FF):
function n_points_from_n_coeffs (line 665) | def n_points_from_n_coeffs(n_coeffs: int, batched: bool) -> int:
function n_coeffs_from_n_points (line 677) | def n_coeffs_from_n_points(n_points: int, batched: bool) -> tuple[int, i...
function build_cairo1_tests_derive_ec_point_from_X (line 699) | def build_cairo1_tests_derive_ec_point_from_X(x: int, curve_id: CurveID,...
FILE: hydra/garaga/hints/eisenstein.py
function _round_nearest (line 34) | def _round_nearest(z: int, d: int) -> int:
class EisensteinInteger (line 51) | class EisensteinInteger:
method __init__ (line 74) | def __init__(self, a0: int = 0, a1: int = 0):
method copy (line 80) | def copy(self) -> "EisensteinInteger":
method is_zero (line 84) | def is_zero(self) -> bool:
method __str__ (line 87) | def __str__(self) -> str:
method __repr__ (line 107) | def __repr__(self) -> str:
method __eq__ (line 114) | def __eq__(self, other: object) -> bool: # called by z1 == z2
method __neg__ (line 121) | def __neg__(self) -> "EisensteinInteger": # −z
method conjugate (line 127) | def conjugate(self) -> "EisensteinInteger":
method __add__ (line 136) | def __add__(self, other: "EisensteinInteger") -> "EisensteinInteger":
method __sub__ (line 139) | def __sub__(self, other: "EisensteinInteger") -> "EisensteinInteger":
method __mul__ (line 142) | def __mul__(self, other: object) -> "EisensteinInteger":
method norm (line 162) | def norm(self) -> int:
method quo_rem (line 171) | def quo_rem(
method __floordiv__ (line 217) | def __floordiv__(self, other: "EisensteinInteger") -> "EisensteinInteg...
method __mod__ (line 220) | def __mod__(self, other: "EisensteinInteger") -> "EisensteinInteger":
function half_gcd (line 233) | def half_gcd(
FILE: hydra/garaga/hints/extf_mul.py
function nondeterministic_extension_field_mul_divmod (line 12) | def nondeterministic_extension_field_mul_divmod(
function nondeterministic_square_torus (line 33) | def nondeterministic_square_torus(
function nondeterministic_extension_field_div (line 48) | def nondeterministic_extension_field_div(
function print_as_sage_poly (line 114) | def print_as_sage_poly(X: Polynomial, var_name="z"):
FILE: hydra/garaga/hints/fake_glv.py
class Lattice (line 13) | class Lattice:
function half_gcd (line 31) | def half_gcd(mod: int, input_val: int) -> Tuple[int, int]:
function precompute_lattice (line 53) | def precompute_lattice(r: int, lam: int) -> Lattice:
function split_scalar (line 187) | def split_scalar(s: int, l: Lattice) -> Tuple[int, int]:
function half_gcd_eisenstein_hint (line 231) | def half_gcd_eisenstein_hint(
function split (line 254) | def split(x):
function get_glv_fake_glv_hint (line 258) | def get_glv_fake_glv_hint(
function encode (line 273) | def encode(value: int) -> int:
function encode_glv_fake_glv_hint (line 277) | def encode_glv_fake_glv_hint(
function get_fake_glv_hint (line 284) | def get_fake_glv_hint(point: G1Point, scalar: int) -> tuple[G1Point, int...
function scalar_mul_glv_and_fake_glv (line 299) | def scalar_mul_glv_and_fake_glv(point: G1Point, scalar: int) -> G1Point:
function _to_bits_le (line 546) | def _to_bits_le(value: int, length: int) -> List[int]:
function scalar_mul_fake_glv (line 554) | def scalar_mul_fake_glv(point: G1Point, scalar: int) -> G1Point:
FILE: hydra/garaga/hints/frobenius.py
function get_p_powers_of_V (line 12) | def get_p_powers_of_V(curve_id: int, extension_degree: int, k: int) -> l...
function get_V_torus_powers (line 45) | def get_V_torus_powers(curve_id: int, extension_degree: int, k: int) -> ...
function frobenius (line 73) | def frobenius(
function generate_frobenius_maps (line 100) | def generate_frobenius_maps(
function get_frobenius_maps (line 135) | def get_frobenius_maps(curve_id, extension_degree, frob_power):
function test_frobenius_maps (line 1026) | def test_frobenius_maps():
FILE: hydra/garaga/hints/io.py
function assert_integer (line 8) | def assert_integer(val):
function as_int (line 15) | def as_int(val, prime):
function to_hex_str (line 24) | def to_hex_str(value: str | int):
function bigint_split (line 50) | def bigint_split(
function bytes_to_u32_array (line 72) | def bytes_to_u32_array(bytes_array: bytes, name: str) -> str:
function to_int (line 85) | def to_int(value: str | int | bytes) -> int:
function int_to_u2XX (line 109) | def int_to_u2XX(x: int | PyFelt, curve_id: int = 0, as_hex=True) -> str:
function int_to_u288 (line 116) | def int_to_u288(x: int | PyFelt, as_hex=True) -> str:
function int_to_u384 (line 124) | def int_to_u384(x: int | PyFelt, as_hex=True) -> str:
function int_to_u256 (line 132) | def int_to_u256(x: int | PyFelt) -> str:
function int_to_u128 (line 138) | def int_to_u128(x: int | PyFelt) -> str:
function int_array_to_u256_array (line 143) | def int_array_to_u256_array(x: list[int] | list[PyFelt]) -> str:
function int_array_to_u128_array (line 147) | def int_array_to_u128_array(x: list[int] | list[PyFelt]) -> str:
function int_array_to_u384_array (line 151) | def int_array_to_u384_array(x: list[int] | list[PyFelt], const=False) ->...
function int_array_to_u288_array (line 158) | def int_array_to_u288_array(x: list[int] | list[PyFelt], const=False) ->...
function int_array_to_u2XX_array (line 165) | def int_array_to_u2XX_array(
function bigint_pack (line 174) | def bigint_pack(x: object, n_limbs: int, base: int) -> int:
function bigint_pack_ptr (line 181) | def bigint_pack_ptr(memory: object, ptr: object, n_limbs: int, base: int...
function pack_e12d (line 188) | def pack_e12d(x: object, n_limbs: int, base: int):
function pack_e6d (line 195) | def pack_e6d(x: object, n_limbs, base):
function pack_bigint_array (line 203) | def pack_bigint_array(
function pack_felt_ptr (line 212) | def pack_felt_ptr(memory: object, ptr: object, n_elements: int):
function pack_bigint_ptr (line 219) | def pack_bigint_ptr(
function bigint_fill (line 235) | def bigint_fill(x: int, ids: object, n_limbs: int, base: int):
function fill_felt_ptr (line 242) | def fill_felt_ptr(x: list, memory: object, address: int):
function fill_limbs (line 247) | def fill_limbs(limbs: list, ids: object):
function bigint_split_array (line 257) | def bigint_split_array(
function fill_bigint_array_into_felt_ptr (line 271) | def fill_bigint_array_into_felt_ptr(
function fill_e6d (line 280) | def fill_e6d(x: list, ids: object, n_limbs: int, base: int):
function fill_e12d (line 286) | def fill_e12d(x: list, ids: object, n_limbs: int, base: int):
function fill_uint256 (line 292) | def fill_uint256(x: int, ids: object):
function padd_function_felt (line 299) | def padd_function_felt(
function fill_sum_dlog_div (line 330) | def fill_sum_dlog_div(f: FunctionFelt, n: int, ref: object, segments: ob...
function fill_g1_point (line 339) | def fill_g1_point(p: tuple[int, int], ref: object):
function flatten (line 348) | def flatten(t):
function split_128 (line 358) | def split_128(a: int) -> tuple[int, int]:
function rgetattr (line 366) | def rgetattr(obj, attr, *args):
function rsetattr (line 373) | def rsetattr(obj, attr, val):
FILE: hydra/garaga/hints/keccak256.py
function bits2bytes (line 45) | def bits2bytes(x):
function rol (line 49) | def rol(value, left, bits):
function multirate_padding (line 59) | def multirate_padding(used_bytes, align_bytes):
function keccak_f (line 73) | def keccak_f(state):
class KeccakState (line 115) | class KeccakState:
method zero (line 129) | def zero():
method format (line 136) | def format(st):
method lane2bytes (line 153) | def lane2bytes(s, w):
method bytes2lane (line 164) | def bytes2lane(bb):
method ilist2bytes (line 174) | def ilist2bytes(bb):
method bytes2ilist (line 181) | def bytes2ilist(ss):
method __init__ (line 187) | def __init__(self, bitrate, b):
method __str__ (line 200) | def __str__(self):
method absorb (line 203) | def absorb(self, bb):
method squeeze (line 217) | def squeeze(self):
method get_bytes (line 223) | def get_bytes(self):
method set_bytes (line 236) | def set_bytes(self, bb):
class KeccakSponge (line 248) | class KeccakSponge:
method __init__ (line 249) | def __init__(self, bitrate, width, padfn, permfn):
method copy (line 255) | def copy(self):
method absorb_block (line 258) | def absorb_block(self, bb):
method absorb (line 263) | def absorb(self, s):
method absorb_final (line 270) | def absorb_final(self):
method squeeze_once (line 275) | def squeeze_once(self):
method squeeze (line 280) | def squeeze(self, l):
class KeccakHash (line 287) | class KeccakHash:
method __init__ (line 292) | def __init__(self, bitrate_bits, capacity_bits, output_bits):
method __repr__ (line 304) | def __repr__(self):
method copy (line 312) | def copy(self):
method update (line 315) | def update(self, s):
method digest (line 318) | def digest(self):
method hexdigest (line 324) | def hexdigest(self):
method preset (line 328) | def preset(bitrate_bits, capacity_bits, output_bits):
FILE: hydra/garaga/hints/multi_miller_witness.py
function get_final_exp_witness (line 11) | def get_final_exp_witness(
function get_lambda (line 41) | def get_lambda(curve_id: CurveID) -> int:
function get_m_dash_root (line 56) | def get_m_dash_root(f: E12) -> E12:
function decompose_scalar_into_b_powers_and_remainder (line 93) | def decompose_scalar_into_b_powers_and_remainder(scalar: int, b: int):
function pow_3_ord (line 109) | def pow_3_ord(a: E12):
function find_cube_root (line 118) | def find_cube_root(a: E12, w: E12, q: int) -> E12:
function find_c_e12 (line 142) | def find_c_e12(f: E12, w: E12) -> tuple[E12, E12]:
function get_rth_root (line 180) | def get_rth_root(f: E12) -> E12:
function get_27th_bn254_root (line 192) | def get_27th_bn254_root():
function get_miller_loop_output (line 219) | def get_miller_loop_output(curve_id: CurveID, will_be_one: bool = True) ...
function test_bn254 (line 237) | def test_bn254():
FILE: hydra/garaga/hints/neg_3.py
function neg_3_base_le (line 1) | def neg_3_base_le(scalar: int) -> list[int]:
function construct_digit_vectors (line 25) | def construct_digit_vectors(es: list[int]) -> list[list[int]]:
function positive_negative_multiplicities (line 34) | def positive_negative_multiplicities(digits: list[int]) -> tuple[int, int]:
function scalar_to_base_neg3_le (line 42) | def scalar_to_base_neg3_le(u128: int) -> tuple[int, int, int, int]:
FILE: hydra/garaga/hints/tower_backup.py
class E2 (line 15) | class E2:
method __str__ (line 20) | def __str__(self) -> str:
method __eq__ (line 23) | def __eq__(self, other):
method zero (line 27) | def zero(p: int):
method one (line 31) | def one(p: int):
method random (line 35) | def random(p: int):
method felt_coeffs (line 39) | def felt_coeffs(self) -> list[PyFelt]:
method __add__ (line 42) | def __add__(self, other):
method __radd__ (line 47) | def __radd__(self, other):
method __sub__ (line 50) | def __sub__(self, other):
method __rsub__ (line 59) | def __rsub__(self, other):
method __mul__ (line 62) | def __mul__(self, other):
method __rmul__ (line 71) | def __rmul__(self, other):
method __inv__ (line 74) | def __inv__(self):
method div (line 80) | def div(self, other):
method __pow__ (line 85) | def __pow__(self, p: int):
method __truediv__ (line 117) | def __truediv__(self, other):
method __rtruediv__ (line 125) | def __rtruediv__(self, other):
method __neg__ (line 133) | def __neg__(self):
method conjugate (line 136) | def conjugate(self):
class E6 (line 141) | class E6:
method __init__ (line 148) | def __init__(self, x: list[int | PyFelt | E2], curve_id: int):
method coeffs (line 168) | def coeffs(self) -> list[int]:
method felt_coeffs (line 172) | def felt_coeffs(self) -> list[PyFelt]:
method value_coeffs (line 176) | def value_coeffs(self) -> list[int]:
method from_poly (line 187) | def from_poly(poly: Polynomial, curve_id: int):
method to_poly (line 194) | def to_poly(self) -> Polynomial:
method zero (line 201) | def zero(curve_id: int):
method one (line 206) | def one(curve_id: int):
method random (line 211) | def random(curve_id: int):
method __str__ (line 215) | def __str__(self) -> str:
method __add__ (line 218) | def __add__(self, other):
method __sub__ (line 226) | def __sub__(self, other):
method __neg__ (line 234) | def __neg__(self):
method __mul__ (line 237) | def __mul__(self, other):
method __rmul__ (line 250) | def __rmul__(self, other):
method __inv__ (line 253) | def __inv__(self):
method mul_by_non_residue (line 267) | def mul_by_non_residue(self):
method square_torus (line 270) | def square_torus(self):
method div (line 279) | def div(self, other):
method __pow__ (line 284) | def __pow__(self, p: int):
class E12 (line 320) | class E12:
method __init__ (line 325) | def __init__(self, x: list[PyFelt | int | E6], curve_id: int):
method __hash__ (line 336) | def __hash__(self):
method value_coeffs (line 340) | def value_coeffs(self) -> list[int]:
method print_as_sage_poly (line 356) | def print_as_sage_poly(self, var_name: str = "x"):
method from_poly (line 363) | def from_poly(poly: Polynomial, curve_id: int):
method from_direct (line 371) | def from_direct(coeffs: list[PyFelt | ModuloCircuitElement], curve_id:...
method to_poly (line 375) | def to_poly(self) -> Polynomial:
method to_direct (line 381) | def to_direct(self) -> list[PyFelt]:
method order (line 388) | def order(self):
method felt_coeffs (line 392) | def felt_coeffs(self) -> list[PyFelt]:
method one (line 396) | def one(curve_id: int):
method zero (line 400) | def zero(curve_id: int):
method random (line 404) | def random(curve_id: int):
method __mul__ (line 408) | def __mul__(self, other):
method conjugate (line 419) | def conjugate(self):
method square (line 422) | def square(self):
method __inv__ (line 432) | def __inv__(self):
method div (line 441) | def div(self, other):
method __pow__ (line 446) | def __pow__(self, p: int):
method final_exp (line 480) | def final_exp(self, use_rust: bool = True):
method serialize (line 493) | def serialize(self) -> bytes:
function get_tower_object (line 504) | def get_tower_object(x: list[PyFelt], curve_id: int, extension_degree: i...
FILE: hydra/garaga/modulo_circuit.py
class WriteOps (line 19) | class WriteOps(Enum):
class ModBuiltinOps (line 39) | class ModBuiltinOps(Enum):
class CairoVMOps (line 48) | class CairoVMOps(Enum):
class ModuloCircuitInstruction (line 53) | class ModuloCircuitInstruction:
class ValueSegmentItem (line 62) | class ValueSegmentItem:
method value (line 68) | def value(self) -> int:
method p (line 72) | def p(self):
method felt (line 76) | def felt(self):
class ValueSegment (line 81) | class ValueSegment:
method __init__ (line 92) | def __init__(self, name: str, debug: bool = False, compilation_mode: i...
method __len__ (line 103) | def __len__(self) -> int:
method __getitem__ (line 106) | def __getitem__(self, key: int) -> ValueSegmentItem:
method input (line 110) | def input(self) -> list[ModuloCircuitElement]:
method write_to_segment (line 128) | def write_to_segment(self, item: ValueSegmentItem) -> int:
method non_interactive_transform (line 137) | def non_interactive_transform(self) -> "ValueSegment":
method get_dw_lookups (line 219) | def get_dw_lookups(self) -> dict:
method print (line 267) | def print(self):
method summarize (line 292) | def summarize(self):
class ModuloCircuit (line 311) | class ModuloCircuit:
method __init__ (line 326) | def __init__(
method values_offset (line 356) | def values_offset(self) -> int:
method output (line 360) | def output(self) -> list[ModuloCircuitElement]:
method input (line 364) | def input(self) -> list[ModuloCircuitElement]:
method output_structs (line 368) | def output_structs(self) -> list[Cairo1SerializableStruct]:
method continuous_output (line 372) | def continuous_output(self) -> bool:
method witnesses (line 380) | def witnesses(self) -> list[PyFelt]:
method is_empty_circuit (line 387) | def is_empty_circuit(self) -> bool:
method write_element (line 390) | def write_element(
method write_struct (line 415) | def write_struct(
method write_elements (line 447) | def write_elements(
method write_cairo_native_felt (line 469) | def write_cairo_native_felt(self, native_felt: PyFelt):
method write_sparse_constant_elements (line 480) | def write_sparse_constant_elements(
method set_or_get_constant (line 497) | def set_or_get_constant(self, val: PyFelt | int) -> ModuloCircuitElement:
method add (line 506) | def add(
method sum (line 528) | def sum(self, args: list[ModuloCircuitElement], comment: str | None = ...
method product (line 537) | def product(self, args: list[ModuloCircuitElement], comment: str | Non...
method double (line 546) | def double(self, a: ModuloCircuitElement) -> ModuloCircuitElement:
method mul (line 549) | def mul(
method square (line 569) | def square(
method neg (line 574) | def neg(
method sub (line 583) | def sub(
method inv (line 597) | def inv(
method div (line 628) | def div(
method fp_sqrt (line 647) | def fp_sqrt(self, element: ModuloCircuitElement) -> ModuloCircuitElement:
method fp_is_non_zero (line 663) | def fp_is_non_zero(self, a: ModuloCircuitElement) -> ModuloCircuitElem...
method vector_sub (line 730) | def vector_sub(
method vector_scale (line 738) | def vector_scale(
method vector_add (line 753) | def vector_add(
method vector_neg (line 766) | def vector_neg(self, X: list[ModuloCircuitElement]) -> list[ModuloCirc...
method sub_and_assert (line 776) | def sub_and_assert(
method add_and_assert (line 798) | def add_and_assert(
method mul_and_assert (line 820) | def mul_and_assert(
method eval_horner (line 837) | def eval_horner(
method eval_poly (line 866) | def eval_poly(
method extend_output (line 897) | def extend_output(self, elmts: list[ModuloCircuitElement]):
method extend_struct_output (line 906) | def extend_struct_output(self, struct: Cairo1SerializableStruct):
method print_value_segment (line 918) | def print_value_segment(self):
method compile_circuit (line 921) | def compile_circuit(
method compile_circuit_cairo_zero (line 939) | def compile_circuit_cairo_zero(
method write_cairo1_input_stack (line 1040) | def write_cairo1_input_stack(
method fill_cairo_1_constants (line 1089) | def fill_cairo_1_constants(self) -> tuple[str, str]:
method write_cairo1_circuit (line 1122) | def write_cairo1_circuit(self, offset_to_reference_map: dict[int, str]...
method compile_circuit_cairo_1 (line 1162) | def compile_circuit_cairo_1(
method summarize (line 1334) | def summarize(self):
FILE: hydra/garaga/modulo_circuit_structs.py
class CairoOption (line 23) | class CairoOption(Enum):
class Cairo1SerializableStruct (line 30) | class Cairo1SerializableStruct(ABC):
method __post_init__ (line 34) | def __post_init__(self):
method struct_name (line 52) | def struct_name(self) -> str:
method bits (line 56) | def bits(self) -> int:
method serialize_input_signature (line 59) | def serialize_input_signature(self) -> str:
method serialize (line 63) | def serialize(self, raw: bool = False) -> str:
method extract_from_circuit_output (line 67) | def extract_from_circuit_output(
method dump_to_circuit_input (line 73) | def dump_to_circuit_input(self) -> str:
method __len__ (line 77) | def __len__(self) -> int:
method _serialize_to_calldata (line 80) | def _serialize_to_calldata(self) -> list[int]:
method serialize_to_calldata (line 83) | def serialize_to_calldata(self, *args, **kwargs) -> list[int]:
class StructArray (line 91) | class StructArray(Cairo1SerializableStruct, Generic[T]):
method struct_name (line 95) | def struct_name(self) -> str:
method dump_to_circuit_input (line 98) | def dump_to_circuit_input(self) -> str:
method __len__ (line 104) | def __len__(self) -> int:
method extract_from_circuit_output (line 107) | def extract_from_circuit_output(
method serialize (line 112) | def serialize(self, raw: bool = False, const: bool = False) -> str:
method serialize_to_calldata (line 126) | def serialize_to_calldata(self) -> list[int]:
class Struct (line 133) | class Struct(Cairo1SerializableStruct):
method __init__ (line 136) | def __init__(
method struct_name (line 143) | def struct_name(self) -> str:
method __post_init__ (line 146) | def __post_init__(self):
method dump_to_circuit_input (line 149) | def dump_to_circuit_input(self) -> str:
method extract_from_circuit_output (line 152) | def extract_from_circuit_output(
method serialize (line 157) | def serialize(self, raw: bool = False) -> str:
method __len__ (line 170) | def __len__(self) -> int:
method _serialize_to_calldata (line 173) | def _serialize_to_calldata(self) -> list[int]:
class StructSpan (line 180) | class StructSpan(Cairo1SerializableStruct, Generic[T]):
method struct_name (line 184) | def struct_name(self) -> str:
method dump_to_circuit_input (line 187) | def dump_to_circuit_input(self) -> str:
method __len__ (line 196) | def __len__(self) -> int:
method extract_from_circuit_output (line 199) | def extract_from_circuit_output(
method serialize (line 204) | def serialize(self, raw: bool = False, is_option: bool = False) -> str:
method _serialize_to_calldata (line 223) | def _serialize_to_calldata(
class u384 (line 277) | class u384(Cairo1SerializableStruct):
method serialize (line 278) | def serialize(self, raw: bool = False) -> str:
method _serialize_to_calldata (line 286) | def _serialize_to_calldata(self) -> list[int]:
method extract_from_circuit_output (line 290) | def extract_from_circuit_output(
method dump_to_circuit_input (line 296) | def dump_to_circuit_input(self) -> str:
method __len__ (line 299) | def __len__(self) -> int:
class RSA2048Chunks (line 307) | class RSA2048Chunks(Cairo1SerializableStruct):
method __init__ (line 308) | def __init__(self, name: str, elmts: list[ModuloCircuitElement]):
method struct_name (line 313) | def struct_name(self) -> str:
method serialize (line 316) | def serialize(self, raw: bool = False) -> str:
method _serialize_to_calldata (line 331) | def _serialize_to_calldata(self) -> list[int]:
method extract_from_circuit_output (line 335) | def extract_from_circuit_output(
method dump_to_circuit_input (line 341) | def dump_to_circuit_input(self) -> str:
method __len__ (line 347) | def __len__(self) -> int:
class RSA2048ReductionWitness (line 355) | class RSA2048ReductionWitness(Cairo1SerializableStruct):
method __init__ (line 358) | def __init__(self, name: str, elmts: list[ModuloCircuitElement]):
method struct_name (line 363) | def struct_name(self) -> str:
method serialize (line 366) | def serialize(self, raw: bool = False) -> str:
method _serialize_to_calldata (line 382) | def _serialize_to_calldata(self) -> list[int]:
method extract_from_circuit_output (line 386) | def extract_from_circuit_output(
method dump_to_circuit_input (line 391) | def dump_to_circuit_input(self) -> str:
method __len__ (line 398) | def __len__(self) -> int:
class GenericT (line 402) | class GenericT(Cairo1SerializableStruct):
method struct_name (line 406) | def struct_name(self) -> str:
method serialize (line 409) | def serialize(self, raw: bool = False) -> str:
method _serialize_to_calldata (line 421) | def _serialize_to_calldata(self) -> list[int]:
method extract_from_circuit_output (line 428) | def extract_from_circuit_output(
method dump_to_circuit_input (line 433) | def dump_to_circuit_input(self) -> str:
method __len__ (line 436) | def __len__(self) -> int:
class u256 (line 444) | class u256(Cairo1SerializableStruct):
method serialize (line 445) | def serialize(self, raw: bool = False) -> str:
method _serialize_to_calldata (line 453) | def _serialize_to_calldata(self) -> list[int]:
method extract_from_circuit_output (line 457) | def extract_from_circuit_output(
method dump_to_circuit_input (line 462) | def dump_to_circuit_input(self) -> str:
method __len__ (line 465) | def __len__(self) -> int:
class u256Span (line 473) | class u256Span(Cairo1SerializableStruct):
method struct_name (line 475) | def struct_name(self) -> str:
method serialize (line 478) | def serialize(self, raw: bool = False) -> str:
method _serialize_to_calldata (line 485) | def _serialize_to_calldata(self) -> list[int]:
method dump_to_circuit_input (line 490) | def dump_to_circuit_input(self) -> str:
method extract_from_circuit_output (line 497) | def extract_from_circuit_output(
method __len__ (line 502) | def __len__(self) -> int:
class u128 (line 509) | class u128(Cairo1SerializableStruct):
method serialize (line 510) | def serialize(self, raw: bool = False) -> str:
method _serialize_to_calldata (line 519) | def _serialize_to_calldata(self) -> list[int]:
method extract_from_circuit_output (line 524) | def extract_from_circuit_output(
method dump_to_circuit_input (line 529) | def dump_to_circuit_input(self) -> str:
method __len__ (line 532) | def __len__(self) -> int:
class u128Span (line 540) | class u128Span(Cairo1SerializableStruct):
method struct_name (line 542) | def struct_name(self) -> str:
method serialize (line 545) | def serialize(self, raw: bool = False) -> str:
method _serialize_to_calldata (line 552) | def _serialize_to_calldata(self) -> list[int]:
method dump_to_circuit_input (line 557) | def dump_to_circuit_input(self) -> str:
method extract_from_circuit_output (line 564) | def extract_from_circuit_output(
method __len__ (line 569) | def __len__(self) -> int:
class Tuple (line 576) | class Tuple(Cairo1SerializableStruct):
method __init__ (line 579) | def __init__(self, name: str, elmts: list[Cairo1SerializableStruct]):
method struct_name (line 584) | def struct_name(self) -> str:
method serialize (line 587) | def serialize(self, raw: bool = False) -> str:
method _serialize_to_calldata (line 595) | def _serialize_to_calldata(self) -> list[int]:
method extract_from_circuit_output (line 601) | def extract_from_circuit_output(
method dump_to_circuit_input (line 606) | def dump_to_circuit_input(self) -> str:
method __len__ (line 619) | def __len__(self) -> int:
class felt252 (line 623) | class felt252(Cairo1SerializableStruct):
method serialize (line 624) | def serialize(self, raw: bool = False) -> str:
method _serialize_to_calldata (line 632) | def _serialize_to_calldata(self) -> list[int]:
method extract_from_circuit_output (line 636) | def extract_from_circuit_output(
method dump_to_circuit_input (line 641) | def dump_to_circuit_input(self) -> str:
method __len__ (line 646) | def __len__(self) -> int:
class u384Array (line 654) | class u384Array(Cairo1SerializableStruct):
method serialize (line 655) | def serialize(self, raw: bool = False) -> str:
method _serialize_to_calldata (line 673) | def _serialize_to_calldata(self) -> list[int]:
method struct_name (line 683) | def struct_name(self) -> str:
method extract_from_circuit_output (line 692) | def extract_from_circuit_output(
method dump_to_circuit_input (line 697) | def dump_to_circuit_input(self) -> str:
method __len__ (line 705) | def __len__(self) -> int:
class FunctionFeltCircuit (line 712) | class FunctionFeltCircuit(Cairo1SerializableStruct):
method __init__ (line 713) | def __init__(self, name: str, elmts: list[u384Span]):
method a_num (line 718) | def a_num(self) -> list[ModuloCircuitElement | PyFelt]:
method a_den (line 722) | def a_den(self) -> list[ModuloCircuitElement | PyFelt]:
method b_num (line 726) | def b_num(self) -> list[ModuloCircuitElement | PyFelt]:
method b_den (line 730) | def b_den(self) -> list[ModuloCircuitElement | PyFelt]:
method struct_name (line 734) | def struct_name(self) -> str:
method from_FunctionFelt (line 738) | def from_FunctionFelt(
method _serialize_to_calldata (line 754) | def _serialize_to_calldata(self) -> list[int]:
method serialize_input_signature (line 770) | def serialize_input_signature(self) -> str:
method serialize (line 773) | def serialize(self, raw: bool = False) -> str:
method dump_to_circuit_input (line 780) | def dump_to_circuit_input(self) -> str:
method extract_from_circuit_output (line 790) | def extract_from_circuit_output(
method __len__ (line 795) | def __len__(self) -> int:
class u384Span (line 799) | class u384Span(Cairo1SerializableStruct):
method serialize (line 800) | def serialize(self, raw: bool = False) -> str:
method _serialize_to_calldata (line 807) | def _serialize_to_calldata(self) -> list[int]:
method struct_name (line 811) | def struct_name(self) -> str:
method extract_from_circuit_output (line 814) | def extract_from_circuit_output(
method dump_to_circuit_input (line 819) | def dump_to_circuit_input(self) -> str:
method __len__ (line 827) | def __len__(self) -> int:
class BLSProcessedPair (line 834) | class BLSProcessedPair(Cairo1SerializableStruct):
method __init__ (line 835) | def __init__(self, name: str, elmts: list[ModuloCircuitElement]):
method struct_name (line 840) | def struct_name(self) -> str:
method serialize (line 843) | def serialize(self) -> str:
method extract_from_circuit_output (line 847) | def extract_from_circuit_output(
method dump_to_circuit_input (line 853) | def dump_to_circuit_input(self) -> str:
method __len__ (line 859) | def __len__(self) -> int:
class BNProcessedPair (line 867) | class BNProcessedPair(Cairo1SerializableStruct):
method __init__ (line 868) | def __init__(self, name: str, elmts: list[ModuloCircuitElement]):
method struct_name (line 873) | def struct_name(self) -> str:
method serialize (line 876) | def serialize(self) -> str:
method extract_from_circuit_output (line 888) | def extract_from_circuit_output(
method dump_to_circuit_input (line 894) | def dump_to_circuit_input(self) -> str:
method __len__ (line 900) | def __len__(self) -> int:
class G1PointCircuit (line 908) | class G1PointCircuit(Cairo1SerializableStruct):
method __init__ (line 909) | def __init__(self, name: str, elmts: list[ModuloCircuitElement]):
method from_G1Point (line 914) | def from_G1Point(name: str, point: G1Point) -> "G1PointCircuit":
method struct_name (line 919) | def struct_name(self) -> str:
method serialize (line 922) | def serialize(self, raw: bool = False) -> str:
method _serialize_to_calldata (line 930) | def _serialize_to_calldata(self) -> list[int]:
method extract_from_circuit_output (line 933) | def extract_from_circuit_output(
method dump_to_circuit_input (line 939) | def dump_to_circuit_input(self) -> str:
method __len__ (line 945) | def __len__(self) -> int:
class G2PointCircuit (line 953) | class G2PointCircuit(Cairo1SerializableStruct):
method __init__ (line 954) | def __init__(self, name: str, elmts: list[ModuloCircuitElement]):
method from_G2Point (line 959) | def from_G2Point(name: str, point: G2Point) -> "G2PointCircuit":
method struct_name (line 972) | def struct_name(self) -> str:
method serialize (line 975) | def serialize(self, raw: bool = False) -> str:
method extract_from_circuit_output (line 983) | def extract_from_circuit_output(
method dump_to_circuit_input (line 989) | def dump_to_circuit_input(self) -> str:
method __len__ (line 995) | def __len__(self) -> int:
class G2Line (line 1003) | class G2Line(Cairo1SerializableStruct):
method __init__ (line 1004) | def __init__(self, name: str, elmts: list[ModuloCircuitElement]):
method serialize_input_signature (line 1008) | def serialize_input_signature(self) -> str:
method serialize (line 1015) | def serialize(self, raw: bool = False) -> str:
method extract_from_circuit_output (line 1029) | def extract_from_circuit_output(
method dump_to_circuit_input (line 1035) | def dump_to_circuit_input(self) -> str:
method __len__ (line 1044) | def __len__(self) -> int:
class FunctionFeltEvaluations (line 1052) | class FunctionFeltEvaluations(Cairo1SerializableStruct):
method __init__ (line 1053) | def __init__(self, name: str, elmts: list[ModuloCircuitElement]):
method serialize (line 1057) | def serialize(self) -> str:
method extract_from_circuit_output (line 1061) | def extract_from_circuit_output(
method dump_to_circuit_input (line 1067) | def dump_to_circuit_input(self) -> str:
method __len__ (line 1073) | def __len__(self) -> int:
class G1G2PairCircuit (line 1081) | class G1G2PairCircuit(Cairo1SerializableStruct):
method __init__ (line 1082) | def __init__(self, name: str, elmts: list[ModuloCircuitElement]):
method struct_name (line 1087) | def struct_name(self) -> str:
method serialize (line 1090) | def serialize(self) -> str:
method extract_from_circuit_output (line 1097) | def extract_from_circuit_output(
method dump_to_circuit_input (line 1103) | def dump_to_circuit_input(self) -> str:
method __len__ (line 1109) | def __len__(self) -> int:
class E12D (line 1117) | class E12D(Cairo1SerializableStruct):
method extract_from_circuit_output (line 1118) | def extract_from_circuit_output(
method struct_name (line 1133) | def struct_name(self) -> str:
method serialize (line 1140) | def serialize(self, raw: bool = False, is_option: bool = False) -> str:
method _serialize_to_calldata (line 1166) | def _serialize_to_calldata(self) -> list[int]:
method dump_to_circuit_input (line 1175) | def dump_to_circuit_input(self) -> str:
method __len__ (line 1183) | def __len__(self) -> int:
class E12T (line 1191) | class E12T(Cairo1SerializableStruct):
method __init__ (line 1192) | def __init__(self, name: str, elmts: list[ModuloCircuitElement]):
method extract_from_circuit_output (line 1209) | def extract_from_circuit_output(
method serialize (line 1221) | def serialize(self, raw: bool = False, is_option: bool = False) -> str:
method _serialize_to_calldata (line 1242) | def _serialize_to_calldata(self) -> list[int]:
method dump_to_circuit_input (line 1245) | def dump_to_circuit_input(self) -> str:
method __len__ (line 1251) | def __len__(self) -> int:
class E12DMulQuotient (line 1259) | class E12DMulQuotient(Cairo1SerializableStruct):
method extract_from_circuit_output (line 1260) | def extract_from_circuit_output(
method struct_name (line 1275) | def struct_name(self) -> str:
method serialize (line 1282) | def serialize(self, raw: bool = False, is_option: bool = False) -> str:
method _serialize_to_calldata (line 1308) | def _serialize_to_calldata(self) -> list[int]:
method dump_to_circuit_input (line 1317) | def dump_to_circuit_input(self) -> str:
method __len__ (line 1324) | def __len__(self) -> int:
class MillerLoopResultScalingFactor (line 1332) | class MillerLoopResultScalingFactor(Cairo1SerializableStruct):
method __init__ (line 1333) | def __init__(self, name: str, elmts: list[ModuloCircuitElement]):
method extract_from_circuit_output (line 1337) | def extract_from_circuit_output(
method serialize_input_signature (line 1342) | def serialize_input_signature(self) -> str:
method dump_to_circuit_input (line 1349) | def dump_to_circuit_input(self) -> str:
method serialize (line 1358) | def serialize(self, raw: bool = False) -> str:
method _serialize_to_calldata (line 1371) | def _serialize_to_calldata(self) -> list[int]:
method __len__ (line 1378) | def __len__(self) -> int:
class SlopeInterceptOutput (line 1386) | class SlopeInterceptOutput(Cairo1SerializableStruct):
method __init__ (line 1387) | def __init__(self, name: str, elmts: list[ModuloCircuitElement]):
method serialize (line 1391) | def serialize(self, raw: bool = False) -> str:
method extract_from_circuit_output (line 1399) | def extract_from_circuit_output(
method dump_to_circuit_input (line 1411) | def dump_to_circuit_input(self) -> str:
method __len__ (line 1417) | def __len__(self) -> int:
FILE: hydra/garaga/points.py
class G1Point (line 20) | class G1Point:
method __repr__ (line 35) | def __repr__(self) -> str:
method __str__ (line 38) | def __str__(self) -> str:
method __hash__ (line 41) | def __hash__(self):
method __eq__ (line 44) | def __eq__(self, other: object) -> bool:
method __post_init__ (line 63) | def __post_init__(self):
method infinity (line 73) | def infinity(curve_id: CurveID) -> "G1Point":
method is_infinity (line 85) | def is_infinity(self) -> bool:
method to_cairo_1 (line 94) | def to_cairo_1(self, as_hex: bool = True) -> str:
method gen_random_point_not_in_subgroup (line 104) | def gen_random_point_not_in_subgroup(
method is_in_prime_order_subgroup_generic (line 140) | def is_in_prime_order_subgroup_generic(self) -> bool:
method is_in_prime_order_subgroup (line 149) | def is_in_prime_order_subgroup(self) -> bool:
method is_on_curve (line 168) | def is_on_curve(self) -> bool:
method gen_random_point (line 188) | def gen_random_point(curve_id: CurveID) -> "G1Point":
method get_nG (line 203) | def get_nG(curve_id: CurveID, n: int) -> "G1Point":
method msm (line 225) | def msm(points: list["G1Point"], scalars: list[int]) -> "G1Point":
method scalar_mul (line 243) | def scalar_mul(self, scalar: int) -> "G1Point":
method add (line 281) | def add(self, other: "G1Point") -> "G1Point":
method __neg__ (line 324) | def __neg__(self) -> "G1Point":
method to_pyfelt_list (line 338) | def to_pyfelt_list(self) -> list[PyFelt]:
method serialize_to_cairo (line 342) | def serialize_to_cairo(self, name: str, raw: bool = False) -> str:
class G2Point (line 351) | class G2Point:
method __repr__ (line 360) | def __repr__(self):
method __post_init__ (line 363) | def __post_init__(self):
method infinity (line 371) | def infinity(curve_id: CurveID) -> "G2Point":
method __eq__ (line 374) | def __eq__(self, other: "G2Point") -> bool:
method is_infinity (line 383) | def is_infinity(self) -> bool:
method is_on_curve (line 386) | def is_on_curve(self) -> bool:
method gen_random_point (line 402) | def gen_random_point(curve_id: CurveID) -> "G2Point":
method is_in_prime_order_subgroup_generic (line 415) | def is_in_prime_order_subgroup_generic(self) -> bool:
method is_in_prime_order_subgroup (line 418) | def is_in_prime_order_subgroup(self) -> bool:
method gen_random_point_not_in_subgroup (line 457) | def gen_random_point_not_in_subgroup(
method get_nG (line 494) | def get_nG(curve_id: CurveID, n: int) -> "G2Point":
method scalar_mul (line 514) | def scalar_mul(self, scalar: int) -> "G2Point":
method add (line 532) | def add(self, other: "G2Point") -> "G2Point":
method __neg__ (line 549) | def __neg__(self) -> "G2Point":
method msm (line 556) | def msm(points: list["G2Point"], scalars: list[int]) -> "G2Point":
method to_pyfelt_list (line 563) | def to_pyfelt_list(self) -> list[PyFelt]:
method serialize_to_cairo (line 567) | def serialize_to_cairo(self, name: str, raw: bool = False) -> str:
class G1G2Pair (line 576) | class G1G2Pair:
method __hash__ (line 581) | def __hash__(self):
method __post_init__ (line 584) | def __post_init__(self):
method to_pyfelt_list (line 589) | def to_pyfelt_list(self) -> list[PyFelt]:
method pair (line 604) | def pair(pairs: list["G1G2Pair"], curve_id: CurveID = None):
method miller (line 630) | def miller(pairs: list["G1G2Pair"], curve_id: CurveID = None):
function tower_to_direct (line 664) | def tower_to_direct(
function direct_to_tower (line 688) | def direct_to_tower(
function TD6 (line 713) | def TD6(X: list[PyFelt], curve_id: int) -> list[PyFelt]:
function DT6 (line 727) | def DT6(X: list[PyFelt], curve_id: int) -> list[PyFelt]:
function TD12 (line 741) | def TD12(X: list[PyFelt], curve_id: int) -> list[PyFelt]:
function DT12 (line 761) | def DT12(X: list[PyFelt], curve_id: int) -> list[PyFelt]:
function precompute_lineline_sparsity (line 782) | def precompute_lineline_sparsity(curve_id: int):
FILE: hydra/garaga/poseidon_transcript.py
function hades_permutation (line 9) | def hades_permutation(s0: int, s1: int, s2: int) -> tuple[int, int, int]:
class CairoPoseidonTranscript (line 22) | class CairoPoseidonTranscript:
method __init__ (line 28) | def __init__(self, init_hash: int, three_limbs_only: bool = False) -> ...
method continuable_hash (line 41) | def continuable_hash(self) -> int:
method RLC_coeff (line 45) | def RLC_coeff(self):
method update_sponge_state (line 53) | def update_sponge_state(self, x, y):
method hash_element (line 56) | def hash_element(self, x: PyFelt | ModuloCircuitElement, debug: bool =...
method hash_quadruple_u288 (line 70) | def hash_quadruple_u288(
method hash_u256 (line 95) | def hash_u256(self, x: PyFelt | int):
method hash_u128 (line 107) | def hash_u128(self, x: PyFelt | int):
method hash_u256_multi (line 116) | def hash_u256_multi(self, X: list[PyFelt | int]):
method hash_limbs_multi (line 121) | def hash_limbs_multi(
function gen_cairo_test_vectors (line 153) | def gen_cairo_test_vectors(n_elmts: int):
FILE: hydra/garaga/precompiled_circuits/all_circuits.py
class CircuitID (line 70) | class CircuitID(Enum):
function initialize_compilation (line 446) | def initialize_compilation(
function write_headers (line 481) | def write_headers(
function compile_circuits (line 538) | def compile_circuits(
function generate_cairo1_tests (line 590) | def generate_cairo1_tests(
function write_compiled_circuits (line 617) | def write_compiled_circuits(
function write_cairo1_tests (line 638) | def write_cairo1_tests(
function main (line 654) | def main(
FILE: hydra/garaga/precompiled_circuits/cofactor_clearing.py
class SlowG2CofactorClearing (line 6) | class SlowG2CofactorClearing(BasicECG2):
method h2_chain (line 12) | def h2_chain(
method mx_chain (line 221) | def mx_chain(self, P):
method clear_cofactor (line 237) | def clear_cofactor(self, P):
class FastG2CofactorClearing (line 282) | class FastG2CofactorClearing(BasicECG2):
method psi (line 297) | def psi(
method mul_by_x (line 355) | def mul_by_x(
method double_psi (line 393) | def double_psi(
method clear_cofactor (line 410) | def clear_cofactor(
class G1CofactorClearing (line 454) | class G1CofactorClearing(BasicEC):
method mul_by_x (line 456) | def mul_by_x(
method clear_cofactor (line 494) | def clear_cofactor(
FILE: hydra/garaga/precompiled_circuits/compilable_circuits/apply_isogeny.py
class ApplyIsogenyCircuit (line 11) | class ApplyIsogenyCircuit(BaseModuloCircuit):
method __init__ (line 12) | def __init__(
method build_input (line 22) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 25) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
FILE: hydra/garaga/precompiled_circuits/compilable_circuits/base.py
function get_circuit_definition_impl_template (line 13) | def get_circuit_definition_impl_template(num_outputs: int):
class BaseModuloCircuit (line 46) | class BaseModuloCircuit(ABC):
method __init__ (line 62) | def __init__(
method build_input (line 80) | def build_input(self) -> list[PyFelt]:
method full_input_cairo1 (line 88) | def full_input_cairo1(self) -> list[PyFelt] | list[Cairo1SerializableS...
method _run_circuit_inner (line 98) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
method run_circuit (line 111) | def run_circuit(self, input: list[int]) -> ModuloCircuit:
class BaseEXTFCircuit (line 123) | class BaseEXTFCircuit(BaseModuloCircuit):
method __init__ (line 129) | def __init__(
function compilation_mode_to_file_header (line 141) | def compilation_mode_to_file_header(
function cairo1_tests_header (line 198) | def cairo1_tests_header() -> str:
function parse_struct_name (line 214) | def parse_struct_name(struct_name: str) -> list[str]:
function collect_struct_dependencies (line 245) | def collect_struct_dependencies(circuit_instances: list[BaseModuloCircui...
function to_snake_case (line 287) | def to_snake_case(s: str) -> str:
function create_circuit_instances (line 291) | def create_circuit_instances(
function compile_single_circuit (line 318) | def compile_single_circuit(
function compile_circuit (line 337) | def compile_circuit(
function create_cairo1_test (line 364) | def create_cairo1_test(function_name: str, input: list, output: list, cu...
function format_cairo_files_in_parallel (line 405) | def format_cairo_files_in_parallel(
FILE: hydra/garaga/precompiled_circuits/compilable_circuits/cairo1_mpcheck_circuits.py
function split_4_sized_object_into_tuple_of_2_size (line 24) | def split_4_sized_object_into_tuple_of_2_size(
function parse_precomputed_g1_consts_and_g2_points (line 33) | def parse_precomputed_g1_consts_and_g2_points(
class BaseFixedG2PointsMPCheck (line 57) | class BaseFixedG2PointsMPCheck(BaseEXTFCircuit, ABC):
method __init__ (line 58) | def __init__(
method _initialize_circuit (line 88) | def _initialize_circuit(self):
method input_map (line 101) | def input_map(
method _base_input_map (line 118) | def _base_input_map(self, bit_type: str) -> dict:
method _process_input (line 161) | def _process_input(
method build_input (line 212) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 229) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
method _execute_circuit_logic (line 236) | def _execute_circuit_logic(self, circuit, vars) -> ModuloCircuit:
method _execute_circuit_bit_logic_base (line 241) | def _execute_circuit_bit_logic_base(self, circuit: ModuloCircuit, vars...
method _process_points (line 287) | def _process_points(
method _multiply_line_evaluations (line 388) | def _multiply_line_evaluations(
method _extend_output (line 405) | def _extend_output(self, circuit, new_points, lhs_i_plus_one):
class FixedG2MPCheckBitBase (line 429) | class FixedG2MPCheckBitBase(BaseFixedG2PointsMPCheck):
method __init__ (line 436) | def __init__(
method input_map (line 458) | def input_map(self):
method _execute_circuit_logic (line 461) | def _execute_circuit_logic(self, circuit, vars) -> ModuloCircuit:
class FixedG2MPCheckBit0 (line 465) | class FixedG2MPCheckBit0(FixedG2MPCheckBitBase):
class FixedG2MPCheckBit00 (line 469) | class FixedG2MPCheckBit00(FixedG2MPCheckBitBase):
class FixedG2MPCheckBit1 (line 473) | class FixedG2MPCheckBit1(FixedG2MPCheckBitBase):
class FixedG2MPCheckBit01 (line 477) | class FixedG2MPCheckBit01(FixedG2MPCheckBitBase):
class FixedG2MPCheckBit10 (line 481) | class FixedG2MPCheckBit10(FixedG2MPCheckBitBase):
class FixedG2MPCheckInitBit (line 485) | class FixedG2MPCheckInitBit(BaseFixedG2PointsMPCheck):
method __init__ (line 486) | def __init__(
method input_map (line 504) | def input_map(self):
method _execute_circuit_logic (line 531) | def _execute_circuit_logic(self, circuit, vars) -> ModuloCircuit:
class MPCheckFinalizeBN (line 613) | class MPCheckFinalizeBN(BaseFixedG2PointsMPCheck):
method __init__ (line 614) | def __init__(
method input_map (line 639) | def input_map(self):
method _execute_circuit_logic (line 675) | def _execute_circuit_logic(
class MPCheckFinalizeBLS (line 759) | class MPCheckFinalizeBLS(BaseFixedG2PointsMPCheck):
method __init__ (line 760) | def __init__(
method input_map (line 784) | def input_map(self):
method _execute_circuit_logic (line 799) | def _execute_circuit_logic(self, circuit: ModuloCircuit, vars) -> Modu...
class MPCheckPreparePairs (line 852) | class MPCheckPreparePairs(BaseFixedG2PointsMPCheck):
method __init__ (line 859) | def __init__(
method input_map (line 879) | def input_map(self):
method _initialize_circuit (line 888) | def _initialize_circuit(self):
method _execute_circuit_logic (line 896) | def _execute_circuit_logic(self, circuit, vars) -> ModuloCircuit:
class InitializeMPCheck (line 922) | class InitializeMPCheck(BaseFixedG2PointsMPCheck):
method __init__ (line 923) | def __init__(
method input_map (line 946) | def input_map(self):
method _execute_circuit_logic (line 962) | def _execute_circuit_logic(
method _execute_bls12_381_logic (line 996) | def _execute_bls12_381_logic(
method _execute_bn254_logic (line 1011) | def _execute_bn254_logic(
method _execute_shared_logic (line 1024) | def _execute_shared_logic(
method _execute_bls12_381_frobenius_logic (line 1053) | def _execute_bls12_381_frobenius_logic(
method _execute_bn254_frobenius_logic (line 1067) | def _execute_bn254_frobenius_logic(
class FP12MulAssertOne (line 1110) | class FP12MulAssertOne(BaseEXTFCircuit):
method __init__ (line 1111) | def __init__(
method build_input (line 1122) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 1132) | def _run_circuit_inner(self, input: list[PyFelt]) -> ExtensionFieldMod...
class EvalE12D (line 1171) | class EvalE12D(BaseEXTFCircuit):
method __init__ (line 1172) | def __init__(
method build_input (line 1181) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 1188) | def _run_circuit_inner(self, input: list[PyFelt]) -> ExtensionFieldMod...
FILE: hydra/garaga/precompiled_circuits/compilable_circuits/cairo1_tower_pairing.py
function split_4_sized_object_into_tuple_of_2_size (line 21) | def split_4_sized_object_into_tuple_of_2_size(
function parse_precomputed_g1_consts_and_g2_points (line 30) | def parse_precomputed_g1_consts_and_g2_points(
class BaseTowerMillerLoop (line 54) | class BaseTowerMillerLoop(BaseEXTFCircuit, ABC):
method __init__ (line 55) | def __init__(
method _initialize_circuit (line 73) | def _initialize_circuit(self):
method input_map (line 83) | def input_map(
method _base_input_map (line 100) | def _base_input_map(self, bit_type: str) -> dict:
method _process_input (line 118) | def _process_input(self, circuit: MillerTowerCircuit, input: list[PyFe...
method build_input (line 167) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 184) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
method _execute_circuit_logic (line 191) | def _execute_circuit_logic(self, circuit, vars) -> ModuloCircuit:
method _execute_circuit_bit_logic_base (line 196) | def _execute_circuit_bit_logic_base(
method _process_points (line 216) | def _process_points(
method _multiply_line_evaluations (line 256) | def _multiply_line_evaluations(
method _extend_output (line 267) | def _extend_output(self, circuit: ModuloCircuit, new_points, Mi_plus_o...
class TowerMillerBit0 (line 293) | class TowerMillerBit0(BaseTowerMillerLoop):
method __init__ (line 294) | def __init__(
method input_map (line 310) | def input_map(self):
method _execute_circuit_logic (line 313) | def _execute_circuit_logic(self, circuit, vars) -> ModuloCircuit:
class TowerMillerBit1 (line 317) | class TowerMillerBit1(BaseTowerMillerLoop):
method __init__ (line 318) | def __init__(
method input_map (line 335) | def input_map(self):
method _execute_circuit_logic (line 338) | def _execute_circuit_logic(self, circuit, vars) -> ModuloCircuit:
class TowerMillerInitBit (line 342) | class TowerMillerInitBit(BaseTowerMillerLoop):
method __init__ (line 343) | def __init__(
method input_map (line 359) | def input_map(self):
method _execute_circuit_logic (line 370) | def _execute_circuit_logic(
class TowerMillerFinalizeBN (line 428) | class TowerMillerFinalizeBN(BaseTowerMillerLoop):
method __init__ (line 429) | def __init__(
method input_map (line 446) | def input_map(self):
method _execute_circuit_logic (line 461) | def _execute_circuit_logic(self, circuit: MillerTowerCircuit, vars):
class E12TMulCircuit (line 506) | class E12TMulCircuit(BaseEXTFCircuit):
method __init__ (line 507) | def __init__(
method build_input (line 516) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 523) | def _run_circuit_inner(self, input: list[PyFelt]) -> MillerTowerCircuit:
class FP6NegCircuit (line 537) | class FP6NegCircuit(BaseModuloCircuit):
method __init__ (line 538) | def __init__(
method build_input (line 546) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 552) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class E12TInverseCircuit (line 581) | class E12TInverseCircuit(BaseEXTFCircuit):
method __init__ (line 582) | def __init__(
method build_input (line 593) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 599) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class E12TFrobeniusCircuit (line 610) | class E12TFrobeniusCircuit(BaseEXTFCircuit):
method __init__ (line 611) | def __init__(
method build_input (line 622) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 628) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class E12TFrobeniusSquareCircuit (line 639) | class E12TFrobeniusSquareCircuit(BaseEXTFCircuit):
method __init__ (line 640) | def __init__(
method build_input (line 651) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 657) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class E12TFrobeniusCubeCircuit (line 668) | class E12TFrobeniusCubeCircuit(BaseEXTFCircuit):
method __init__ (line 669) | def __init__(
method build_input (line 680) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 686) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class E12TCyclotomicSquareCircuit (line 697) | class E12TCyclotomicSquareCircuit(BaseEXTFCircuit):
method __init__ (line 698) | def __init__(
method build_input (line 709) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 715) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class E12TCyclotomicSquareCompressedCircuit (line 726) | class E12TCyclotomicSquareCompressedCircuit(BaseEXTFCircuit):
method __init__ (line 727) | def __init__(
method build_input (line 742) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 748) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class E12TDecompressKarabinaPtIZCircuit (line 793) | class E12TDecompressKarabinaPtIZCircuit(BaseEXTFCircuit):
method __init__ (line 794) | def __init__(
method build_input (line 805) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 811) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class E12TDecompressKarabinaPtINZCircuit (line 834) | class E12TDecompressKarabinaPtINZCircuit(BaseEXTFCircuit):
method __init__ (line 835) | def __init__(
method build_input (line 846) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 852) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class E12TDecompressKarabinaPtIICircuit (line 893) | class E12TDecompressKarabinaPtIICircuit(BaseEXTFCircuit):
method __init__ (line 894) | def __init__(
method build_input (line 905) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 911) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
FILE: hydra/garaga/precompiled_circuits/compilable_circuits/common_cairo_fustat_circuits.py
class DummyCircuit (line 29) | class DummyCircuit(BaseModuloCircuit):
method __init__ (line 30) | def __init__(
method build_input (line 40) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 43) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class IsOnCurveG1G2Circuit (line 62) | class IsOnCurveG1G2Circuit(BaseModuloCircuit):
method __init__ (line 63) | def __init__(self, curve_id: int, auto_run: bool = True, compilation_m...
method build_input (line 71) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 85) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class IsOnCurveG1Circuit (line 110) | class IsOnCurveG1Circuit(BaseModuloCircuit):
method __init__ (line 111) | def __init__(self, curve_id: int, auto_run: bool = True, compilation_m...
method build_input (line 119) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 128) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class IsOnCurveG2Circuit (line 143) | class IsOnCurveG2Circuit(BaseModuloCircuit):
method __init__ (line 144) | def __init__(self, curve_id: int, auto_run: bool = True, compilation_m...
method build_input (line 152) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 164) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class AddECPointsG2Circuit (line 183) | class AddECPointsG2Circuit(BaseModuloCircuit):
method __init__ (line 184) | def __init__(self, curve_id: int, auto_run: bool = True, compilation_m...
method build_input (line 192) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 206) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class DoubleECPointG2AEq0Circuit (line 226) | class DoubleECPointG2AEq0Circuit(BaseModuloCircuit):
method __init__ (line 227) | def __init__(self, curve_id: int, auto_run: bool = True, compilation_m...
method build_input (line 235) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 245) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class DoubleAndAddECPointsG2Circuit (line 260) | class DoubleAndAddECPointsG2Circuit(BaseModuloCircuit):
method __init__ (line 261) | def __init__(self, curve_id: int, auto_run: bool = True, compilation_m...
method build_input (line 269) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 283) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class PsiG2BLS12_381Circuit (line 303) | class PsiG2BLS12_381Circuit(BaseModuloCircuit):
method __init__ (line 304) | def __init__(self, curve_id: int, auto_run: bool = True, compilation_m...
method build_input (line 312) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 321) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class SlopeInterceptSamePointCircuit (line 350) | class SlopeInterceptSamePointCircuit(BaseModuloCircuit):
method __init__ (line 351) | def __init__(
method build_input (line 361) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 369) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class AccumulateEvalPointChallengeSignedCircuit (line 392) | class AccumulateEvalPointChallengeSignedCircuit(BaseModuloCircuit):
method __init__ (line 393) | def __init__(
method build_input (line 403) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 422) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class RHSFinalizeAccCircuit (line 449) | class RHSFinalizeAccCircuit(BaseModuloCircuit):
method __init__ (line 450) | def __init__(
method build_input (line 460) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 473) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class EvalFunctionChallengeSingleCircuit (line 493) | class EvalFunctionChallengeSingleCircuit(BaseModuloCircuit):
method __init__ (line 494) | def __init__(
method build_input (line 513) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 526) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class EvalFunctionChallengeDuplCircuit (line 580) | class EvalFunctionChallengeDuplCircuit(BaseModuloCircuit):
method __init__ (line 581) | def __init__(
method build_input (line 600) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 613) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class InitFunctionChallengeDuplCircuit (line 673) | class InitFunctionChallengeDuplCircuit(BaseModuloCircuit):
method __init__ (line 674) | def __init__(
method build_input (line 691) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 699) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class AccumulateFunctionChallengeDuplCircuit (line 749) | class AccumulateFunctionChallengeDuplCircuit(BaseModuloCircuit):
method __init__ (line 750) | def __init__(
method build_input (line 763) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 777) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class FinalizeFunctionChallengeDuplCircuit (line 829) | class FinalizeFunctionChallengeDuplCircuit(BaseModuloCircuit):
method __init__ (line 830) | def __init__(
method build_input (line 843) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 850) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class AddECPointCircuit (line 873) | class AddECPointCircuit(BaseModuloCircuit):
method __init__ (line 874) | def __init__(
method build_input (line 887) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 897) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class DoubleECPointCircuit (line 910) | class DoubleECPointCircuit(BaseModuloCircuit):
method __init__ (line 911) | def __init__(
method build_input (line 924) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 932) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class PrepareGLVFakeGLVPtsCircuit (line 945) | class PrepareGLVFakeGLVPtsCircuit(BaseModuloCircuit):
method __init__ (line 946) | def __init__(self, curve_id: int, auto_run: bool = True, compilation_m...
method build_input (line 954) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 970) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class PrepareFakeGLVPtsCircuit (line 1036) | class PrepareFakeGLVPtsCircuit(BaseModuloCircuit):
method __init__ (line 1037) | def __init__(self, curve_id: int, auto_run: bool = True, compilation_m...
method build_input (line 1045) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 1056) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class QuadrupleAndAdd9Circuit (line 1114) | class QuadrupleAndAdd9Circuit(BaseModuloCircuit):
method __init__ (line 1115) | def __init__(self, curve_id: int, auto_run: bool = True, compilation_m...
method build_input (line 1123) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 1134) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
class ClearCofactorBLS12_381Circuit (line 1160) | class ClearCofactorBLS12_381Circuit(BaseModuloCircuit):
method __init__ (line 1161) | def __init__(self, curve_id: int, auto_run: bool = True, compilation_m...
method build_input (line 1169) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 1175) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
FILE: hydra/garaga/precompiled_circuits/compilable_circuits/rsa.py
class RSAFullVerificationCircuit (line 15) | class RSAFullVerificationCircuit(BaseModuloCircuit):
method __init__ (line 28) | def __init__(
method build_input (line 41) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 57) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
FILE: hydra/garaga/precompiled_circuits/compilable_circuits/ultra_honk.py
class BaseUltraHonkCircuit (line 24) | class BaseUltraHonkCircuit(BaseModuloCircuit):
method __init__ (line 25) | def __init__(
method _initialize_circuit (line 41) | def _initialize_circuit(self) -> ZKHonkVerifierCircuits:
method _process_input (line 48) | def _process_input(
method input_map (line 107) | def input_map(
method build_input (line 125) | def build_input(self) -> list[PyFelt]:
method _run_circuit_inner (line 143) | def _run_circuit_inner(self, input: list[PyFelt]) -> ModuloCircuit:
method _execute_circuit_logic (line 150) | def _execute_circuit_logic(self, circuit, vars) -> ModuloCircuit:
class ZKBaseUltraHonkCircuit (line 156) | class ZKBaseUltraHonkCircuit(BaseUltraHonkCircuit):
method __init__ (line 157) | def __init__(
method _initialize_circuit (line 173) | def _initialize_circuit(self) -> ZKHonkVerifierCircuits:
class ZKSumCheckCircuit (line 181) | class ZKSumCheckCircuit(ZKBaseUltraHonkCircuit):
method __init__ (line 182) | def __init__(
method input_map (line 202) | def input_map(self) -> dict:
method _execute_circuit_logic (line 241) | def _execute_circuit_logic(
class ZKPrepareScalarsCircuit (line 295) | class ZKPrepareScalarsCircuit(ZKBaseUltraHonkCircuit):
method __init__ (line 296) | def __init__(
method input_map (line 311) | def input_map(self) -> dict:
method _execute_circuit_logic (line 329) | def _execute_circuit_logic(
class ZKEvalsConsistencyCircuit (line 372) | class ZKEvalsConsistencyCircuit(ZKBaseUltraHonkCircuit):
method __init__ (line 373) | def __init__(
method input_map (line 387) | def input_map(self) -> dict:
method _execute_circuit_logic (line 400) | def _execute_circuit_logic(
class ZKEvalsConsistencyInitCircuit (line 419) | class ZKEvalsConsistencyInitCircuit(ZKBaseUltraHonkCircuit):
method __init__ (line 420) | def __init__(
method input_map (line 434) | def input_map(self) -> dict:
method _execute_circuit_logic (line 441) | def _execute_circuit_logic(
class ZKEvalsConsistencyLoopCircuit (line 463) | class ZKEvalsConsistencyLoopCircuit(ZKBaseUltraHonkCircuit):
method __init__ (line 464) | def __init__(
method input_map (line 478) | def input_map(self) -> dict:
method _execute_circuit_logic (line 487) | def _execute_circuit_logic(
class ZKEvalsConsistencyDoneCircuit (line 511) | class ZKEvalsConsistencyDoneCircuit(ZKBaseUltraHonkCircuit):
method __init__ (line 512) | def __init__(
method input_map (line 526) | def input_map(self) -> dict:
method _execute_circuit_logic (line 537) | def _execute_circuit_logic(
FILE: hydra/garaga/precompiled_circuits/ec.py
function is_quad_residue (line 8) | def is_quad_residue(n, p):
function sqrt_mod_p (line 15) | def sqrt_mod_p(n, p):
class IsOnCurveCircuit (line 22) | class IsOnCurveCircuit(Fp2Circuits):
method __init__ (line 23) | def __init__(self, name: str, curve_id: int, compilation_mode: int = 0):
method set_consts (line 32) | def set_consts(
method _is_on_curve_G1 (line 44) | def _is_on_curve_G1(
method _is_on_curve_G2 (line 62) | def _is_on_curve_G2(
class DerivePointFromX (line 86) | class DerivePointFromX(ModuloCircuit):
method __init__ (line 87) | def __init__(self, name: str, curve_id: int, compilation_mode: int = 0):
method _derive_point_from_x (line 96) | def _derive_point_from_x(
class DecompressG1Point (line 138) | class DecompressG1Point(ModuloCircuit):
method __init__ (line 148) | def __init__(self, name: str, curve_id: int, compilation_mode: int = 0):
method derive_y_from_x (line 157) | def derive_y_from_x(
class ECIPCircuits (line 191) | class ECIPCircuits(ModuloCircuit):
method __init__ (line 192) | def __init__(
method _slope_intercept_same_point (line 207) | def _slope_intercept_same_point(
method _accumulate_eval_point_challenge_signed_same_point (line 261) | def _accumulate_eval_point_challenge_signed_same_point(
method _RHS_finalize_acc (line 298) | def _RHS_finalize_acc(
method _eval_function_challenge_single (line 321) | def _eval_function_challenge_single(
method _eval_function_challenge_dupl (line 361) | def _eval_function_challenge_dupl(
method _init_function_challenge_dupl (line 404) | def _init_function_challenge_dupl(
method _accumulate_function_challenge_dupl (line 468) | def _accumulate_function_challenge_dupl(
method _finalize_function_challenge_dupl (line 532) | def _finalize_function_challenge_dupl(
class BasicEC (line 563) | class BasicEC(ModuloCircuit):
method __init__ (line 564) | def __init__(self, name: str, curve_id: int, compilation_mode: int = 0):
method _compute_adding_slope (line 573) | def _compute_adding_slope(
method _compute_doubling_slope (line 583) | def _compute_doubling_slope(
method add_points (line 601) | def add_points(
method double_point (line 614) | def double_point(
method scalar_mul_2_pow_k (line 626) | def scalar_mul_2_pow_k(
method _is_on_curve_G1_weirstrass (line 636) | def _is_on_curve_G1_weirstrass(
method negate_point (line 650) | def negate_point(
method add_points (line 657) | def add_points(
method double_point_a_eq_0 (line 671) | def double_point_a_eq_0(
method triple_point (line 686) | def triple_point(
method double_n_times (line 716) | def double_n_times(
method n_quadruple_and_add (line 725) | def n_quadruple_and_add(
method double_and_add (line 738) | def double_and_add(
class BasicECG2 (line 771) | class BasicECG2(Fp2Circuits):
method __init__ (line 772) | def __init__(self, name: str, curve_id: int, compilation_mode: int = 0):
method _is_on_curve_G2_weirstrass (line 781) | def _is_on_curve_G2_weirstrass(
method _compute_adding_slope (line 804) | def _compute_adding_slope(
method _compute_doubling_slope_a_eq_0 (line 820) | def _compute_doubling_slope_a_eq_0(
method add_points (line 834) | def add_points(
method double_point_a_eq_0 (line 847) | def double_point_a_eq_0(
method double_n_times (line 858) | def double_n_times(self, P, n):
method negate_point (line 864) | def negate_point(
method double_and_add (line 870) | def double_and_add(
class FakeGLVCircuits (line 903) | class FakeGLVCircuits(BasicEC):
method __init__ (line 904) | def __init__(self, name: str, curve_id: int, compilation_mode: int = 0):
method prepare_points_glv_fake_glv (line 907) | def prepare_points_glv_fake_glv(
method prepare_points_fake_glv (line 975) | def prepare_points_fake_glv(
FILE: hydra/garaga/precompiled_circuits/final_exp.py
class FinalExpTorusCircuit (line 27) | class FinalExpTorusCircuit(ExtensionFieldModuloCircuit):
method __init__ (line 28) | def __init__(
method final_exp_part1 (line 54) | def final_exp_part1(self, X: list[PyFelt]) -> list[ModuloCircuitElement]:
method square_torus (line 57) | def square_torus(
method n_square_torus (line 99) | def n_square_torus(self, X: list[PyFelt], n: int) -> list[PyFelt]:
method mul_torus (line 105) | def mul_torus(
method inverse_torus (line 120) | def inverse_torus(self, X: list[ModuloCircuitElement]):
method decompress_torus (line 123) | def decompress_torus(
method frobenius_torus (line 149) | def frobenius_torus(
method easy_part (line 180) | def easy_part(
method final_exp_finalize (line 199) | def final_exp_finalize(self, t0: list[PyFelt], t2: list[PyFelt]):
class GaragaBLS12_381FinalExp (line 217) | class GaragaBLS12_381FinalExp(FinalExpTorusCircuit):
method __init__ (line 218) | def __init__(
method expt_half_torus (line 230) | def expt_half_torus(self, X: list[ModuloCircuitElement]):
method expt_torus (line 246) | def expt_torus(self, X):
method final_exp_part1 (line 250) | def final_exp_part1(self, num: list[PyFelt], den: list[PyFelt]) -> lis...
class GaragaBN254FinalExp (line 293) | class GaragaBN254FinalExp(FinalExpTorusCircuit):
method __init__ (line 294) | def __init__(
method expt_torus (line 306) | def expt_torus(self, X: list[PyFelt]):
method final_exp_part1 (line 339) | def final_exp_part1(
function test_final_exp (line 398) | def test_final_exp(curve_id: CurveID):
FILE: hydra/garaga/precompiled_circuits/fp2.py
class Fp2Circuits (line 6) | class Fp2Circuits(ModuloCircuit):
method __init__ (line 11) | def __init__(
method fp2_is_non_zero (line 25) | def fp2_is_non_zero(
method fp2_mul (line 48) | def fp2_mul(self, X: list[ModuloCircuitElement], Y: list[ModuloCircuit...
method fp2_mul_by_non_residue (line 68) | def fp2_mul_by_non_residue(self, X: list[ModuloCircuitElement]):
method fp2_square (line 94) | def fp2_square(self, X: list[ModuloCircuitElement]):
method fp2_sqrt (line 104) | def fp2_sqrt(
method fp2_inv (line 126) | def fp2_inv(self, X: list[ModuloCircuitElement]):
method fp2_div (line 136) | def fp2_div(self, X: list[ModuloCircuitElement], Y: list[ModuloCircuit...
method fp2_frobenius_map (line 159) | def fp2_frobenius_map(
method fp2_add (line 175) | def fp2_add(
method fp2_sub (line 181) | def fp2_sub(self, X: list[ModuloCircuitElement], Y: list[ModuloCircuit...
method fp2_mul_and_assert (line 185) | def fp2_mul_and_assert(
method fp2_eval_horner (line 228) | def fp2_eval_horner(
FILE: hydra/garaga/precompiled_circuits/isogeny.py
class IsogenyG2 (line 8) | class IsogenyG2(Fp2Circuits):
method __init__ (line 9) | def __init__(self, name: str, curve_id: int, compilation_mode: int = 0):
method set_consts (line 18) | def set_consts(self):
method run_isogeny (line 33) | def run_isogeny(
class IsogenyG1 (line 52) | class IsogenyG1(ModuloCircuit):
method __init__ (line 53) | def __init__(self, name: str, curve_id: int, compilation_mode: int = 0):
method set_consts (line 62) | def set_consts(self):
method run_isogeny (line 81) | def run_isogeny(
FILE: hydra/garaga/precompiled_circuits/map_to_curve.py
class MapToCurveG2 (line 8) | class MapToCurveG2(Fp2Circuits):
method __init__ (line 9) | def __init__(self, name: str, curve_id: int, compilation_mode: int = 0):
method set_consts (line 18) | def set_consts(self):
method map_to_curve_part_1 (line 46) | def map_to_curve_part_1(self, input_value: list[ModuloCircuitElement]):
method compute_initial_coordinates_quadratic (line 98) | def compute_initial_coordinates_quadratic(
method compute_initial_coordinates_non_quadratic (line 144) | def compute_initial_coordinates_non_quadratic(
method adjust_y_sign (line 200) | def adjust_y_sign(
method fp2_parity (line 245) | def fp2_parity(
class MapToCurveG1 (line 328) | class MapToCurveG1(ModuloCircuit):
method __init__ (line 329) | def __init__(self, name: str, curve_id: int, compilation_mode: int = 0):
method set_consts (line 338) | def set_consts(self):
method map_to_curve_part_1 (line 346) | def map_to_curve_part_1(self, input_value: ModuloCircuitElement):
method compute_initial_coordinates_quadratic (line 405) | def compute_initial_coordinates_quadratic(
method compute_initial_coordinates_non_quadratic (line 454) | def compute_initial_coordinates_non_quadratic(
method adjust_y_sign (line 510) | def adjust_y_sign(
method fp_parity (line 550) | def fp_parity(self, element: ModuloCircuitElement) -> ModuloCircuitEle...
FILE: hydra/garaga/precompiled_circuits/miller_tower.py
function tower_line_function_sparsity (line 8) | def tower_line_function_sparsity(curve_id: int) -> list[int]:
class MillerTowerCircuit (line 18) | class MillerTowerCircuit(MultiMillerLoopCircuit):
method __init__ (line 19) | def __init__(
method eval_tower_line (line 33) | def eval_tower_line(self, line: Iterator[ModuloCircuitElement], yInv, ...
method mul_by_line_tower (line 55) | def mul_by_line_tower(
method mul_by_line_line_tower (line 125) | def mul_by_line_line_tower(self, tower_fp12, line_line):
method mul_line_by_line_tower (line 130) | def mul_line_by_line_tower(self, l1, l2):
method _fp6_by_01 (line 171) | def _fp6_by_01(self, e6: list[ModuloCircuitElement], c0, c1):
method fp6_mul_by_non_residue (line 201) | def fp6_mul_by_non_residue(self, a: list[ModuloCircuitElement]):
method fp12_square (line 207) | def fp12_square(self, a: list[ModuloCircuitElement]):
method fp12_mul (line 220) | def fp12_mul(self, x: list[ModuloCircuitElement], y: list[ModuloCircui...
method fp6_mul (line 239) | def fp6_mul(self, a: list[ModuloCircuitElement], b: list[ModuloCircuit...
method fp12_inverse (line 276) | def fp12_inverse(self, a: list[ModuloCircuitElement]):
method fp6_inverse (line 293) | def fp6_inverse(self, a: list[ModuloCircuitElement]):
method fp6_square (line 341) | def fp6_square(self, a: list[ModuloCircuitElement]):
method fp12_conjugate (line 363) | def fp12_conjugate(self, a: list[ModuloCircuitElement]):
method fp12_cyclotomic_square (line 368) | def fp12_cyclotomic_square(self, a: list[ModuloCircuitElement]):
method fp2_conjugate (line 433) | def fp2_conjugate(self, a: list[ModuloCircuitElement]):
method mul_by_non_residue_k_power_n (line 437) | def mul_by_non_residue_k_power_n(
method fp12_frob (line 457) | def fp12_frob(self, a: list[ModuloCircuitElement]):
method fp12_frob_square (line 478) | def fp12_frob_square(self, a: list[ModuloCircuitElement]):
method fp12_frob_cube (line 492) | def fp12_frob_cube(self, a: list[ModuloCircuitElement]):
method fp12_cyclotomic_square_compressed (line 513) | def fp12_cyclotomic_square_compressed(
method fp12_decompress_karabina_pt_I_c1b2_Z (line 562) | def fp12_decompress_karabina_pt_I_c1b2_Z(self, xc0b1, xc1b2):
method fp12_decompress_karabina_pt_I_c1b2_NZ (line 573) | def fp12_decompress_karabina_pt_I_c1b2_NZ(
method fp12_decompress_karabina_pt_II (line 594) | def fp12_decompress_karabina_pt_II(
FILE: hydra/garaga/precompiled_circuits/multi_miller_loop.py
class MultiMillerLoopCircuit (line 13) | class MultiMillerLoopCircuit(ExtensionFieldModuloCircuit):
method __init__ (line 14) | def __init__(
method _create_precomputed_lines_generator (line 60) | def _create_precomputed_lines_generator(
method get_next_precomputed_line (line 82) | def get_next_precomputed_line(
method write_p_and_q (line 87) | def write_p_and_q(self, P: list[G1Point], Q: list[G2Point]):
method write_p_and_q_raw (line 100) | def write_p_and_q_raw(self, input: list[PyFelt], precompute_consts: bo...
method precompute_consts (line 128) | def precompute_consts(self, n_pairs: int = None, skip_P_precompute: bo...
method compute_doubling_slope (line 145) | def compute_doubling_slope(
method compute_adding_slope (line 176) | def compute_adding_slope(
method build_sparse_line_eval (line 193) | def build_sparse_line_eval(
method _add (line 254) | def _add(
method add_step (line 274) | def add_step(
method _line_compute (line 289) | def _line_compute(
method line_compute (line 302) | def line_compute(
method _double (line 317) | def _double(
method double_step (line 345) | def double_step(
method _double_and_add (line 359) | def _double_and_add(
method double_and_add_step (line 401) | def double_and_add_step(
method _triple (line 424) | def _triple(
method triple_step (line 471) | def triple_step(
method bit_0_case (line 490) | def bit_0_case(
method bit_1_init_case (line 519) | def bit_1_init_case(
method bit_1_case (line 546) | def bit_1_case(
method _bn254_finalize_step (line 579) | def _bn254_finalize_step(
method bn254_finalize_step (line 655) | def bn254_finalize_step(
method miller_loop (line 679) | def miller_loop(self, n_pairs: int) -> list[ModuloCircuitElement]:
function precompute_lines (line 736) | def precompute_lines(Qs: list[G2Point]) -> list[PyFelt]:
FILE: hydra/garaga/precompiled_circuits/multi_pairing_check.py
function get_root_and_scaling_factor (line 11) | def get_root_and_scaling_factor(
function get_max_Q_degree (line 76) | def get_max_Q_degree(curve_id: int, n_pairs: int) -> int:
class MultiPairingCheckCircuit (line 105) | class MultiPairingCheckCircuit(MultiMillerLoopCircuit):
method __init__ (line 106) | def __init__(
method frobenius (line 134) | def frobenius(
method bit_0_case (line 155) | def bit_0_case(
method bit_00_case (line 184) | def bit_00_case(
method bit_01_case (line 225) | def bit_01_case(
method bit_10_case (line 263) | def bit_10_case(
method bit_1_init_case (line 300) | def bit_1_init_case(
method bit_1_case (line 328) | def bit_1_case(
method multi_pairing_check (line 363) | def multi_pairing_check(
function get_pairing_check_input (line 519) | def get_pairing_check_input(
FILE: hydra/garaga/precompiled_circuits/poseidon_bn254.py
function sigma (line 23) | def sigma(value):
function ark (line 30) | def ark(t, C, r, state):
function iterated_add (line 35) | def iterated_add(terms):
function iterated_mul (line 43) | def iterated_mul(terms):
function mix (line 51) | def mix(t, M, state):
function mix_last (line 59) | def mix_last(t, M, s, state):
function mix_s (line 64) | def mix_s(t, S, r, state):
function poseidon_hash (line 76) | def poseidon_hash(
FILE: hydra/garaga/precompiled_circuits/zk_honk.py
class HonkVk (line 62) | class HonkVk:
method __repr__ (line 97) | def __repr__(self) -> str:
method from_bytes (line 105) | def from_bytes(cls, vk_bytes: bytes) -> "HonkVk":
method to_cairo (line 156) | def to_cairo(self, name: str = "vk") -> str:
method to_circuit_elements (line 172) | def to_circuit_elements(self, circuit: ModuloCircuit) -> "HonkVk":
method flatten (line 190) | def flatten(self) -> list[int]:
class Transcript (line 203) | class Transcript(ABC):
method __init__ (line 204) | def __init__(self):
method reset (line 208) | def reset(self):
method update (line 212) | def update(self, data: bytes):
method digest (line 216) | def digest(self) -> bytes:
method digest_reset (line 219) | def digest_reset(self) -> bytes:
class Sha3Transcript (line 225) | class Sha3Transcript(Transcript):
method reset (line 226) | def reset(self):
method digest (line 229) | def digest(self) -> bytes:
method update (line 236) | def update(self, data: bytes):
class StarknetPoseidonTranscript (line 240) | class StarknetPoseidonTranscript(Transcript):
method reset (line 241) | def reset(self):
method digest (line 246) | def digest(self) -> bytes:
method update (line 250) | def update(self, data: bytes):
class ZKHonkProof (line 260) | class ZKHonkProof:
method __post_init__ (line 287) | def __post_init__(self):
method from_bytes (line 301) | def from_bytes(
method to_circuit_elements (line 445) | def to_circuit_elements(self, circuit: ModuloCircuit) -> "ZKHonkProof":
method to_cairo (line 510) | def to_cairo(self) -> str:
method serialize_to_calldata (line 551) | def serialize_to_calldata(self) -> list[int]:
method flatten (line 638) | def flatten(self) -> list[int]:
method calculate_proof_size (line 671) | def calculate_proof_size(log_circuit_size: int):
class ZKHonkTranscript (line 707) | class ZKHonkTranscript:
method from_proof (line 725) | def from_proof(
method to_circuit_elements (line 953) | def to_circuit_elements(self, circuit: ModuloCircuit) -> "ZKHonkTransc...
method to_cairo (line 972) | def to_cairo(self) -> str:
class ZKHonkVerifierCircuits (line 991) | class ZKHonkVerifierCircuits(ModuloCircuit):
method __init__ (line 992) | def __init__(
method compute_public_input_delta (line 1006) | def compute_public_input_delta(
method verify_sum_check (line 1053) | def verify_sum_check(
method compute_next_target_sum (line 1149) | def compute_next_target_sum(
method partially_evaluate_pow (line 1221) | def partially_evaluate_pow(
method accumulate_relation_evaluations (line 1239) | def accumulate_relation_evaluations(
method accumulate_arithmetic_relation (line 1309) | def accumulate_arithmetic_relation(
method accumulate_permutation_relation (line 1361) | def accumulate_permutation_relation(
method accumulate_log_derivative_lookup_relation (line 1403) | def accumulate_log_derivative_lookup_relation(
method accumulate_delta_range_relation (line 1470) | def accumulate_delta_range_relation(
method accumulate_elliptic_relation (line 1506) | def accumulate_elliptic_relation(
method accumulate_memory_relation (line 1602) | def accumulate_memory_relation(
method accumulate_nnf_relation (line 1739) | def accumulate_nnf_relation(
method accumulate_poseidon_external_relation (line 1828) | def accumulate_poseidon_external_relation(
method pow5 (line 1870) | def pow5(self, x: ModuloCircuitElement) -> ModuloCircuitElement:
method accumulate_poseidon_internal_relation (line 1875) | def accumulate_poseidon_internal_relation(
method compute_shplemini_msm_scalars (line 1923) | def compute_shplemini_msm_scalars(
method check_evals_consistency (line 2140) | def check_evals_consistency(
method check_evals_consistency_split (line 2212) | def check_evals_consistency_split(
method _check_evals_consistency_init (line 2239) | def _check_evals_consistency_init(
method _check_evals_consistency_loop (line 2251) | def _check_evals_consistency_loop(
method _check_evals_consistency_done (line 2276) | def _check_evals_consistency_done(
method pow (line 2333) | def pow(self, x: ModuloCircuitElement, e: int) -> ModuloCircuitElement:
function get_msm_points_from_vk_and_proof (line 2342) | def get_msm_points_from_vk_and_proof(
function honk_proof_from_bytes (line 2397) | def honk_proof_from_bytes(
function honk_transcript_from_proof (line 2409) | def honk_transcript_from_proof(
class AutoValueEnum (line 2416) | class AutoValueEnum(Enum):
method __new__ (line 2417) | def __new__(cls, value):
method __int__ (line 2422) | def __int__(self):
method __index__ (line 2425) | def __index__(self):
class Wire (line 2429) | class Wire(AutoValueEnum):
method unused_indexes (line 2473) | def unused_indexes():
method insert_unused_indexes_with_nones (line 2477) | def insert_unused_indexes_with_nones(array: list) -> list:
method replace_unused_indexes_with_nones (line 2488) | def replace_unused_indexes_with_nones(array: list) -> list:
method remove_unused_indexes (line 2494) | def remove_unused_indexes(array: list) -> list:
FILE: hydra/garaga/rsa_rns.py
function modinv (line 61) | def modinv(a: int, m: int) -> int:
function split_words_96 (line 65) | def split_words_96(x: int, n_words: int) -> list[int]:
function join_words_96 (line 69) | def join_words_96(words: Sequence[int]) -> int:
function split_limbs_2048 (line 78) | def split_limbs_2048(x: int) -> list[int]:
function join_limbs_2048 (line 87) | def join_limbs_2048(limbs: Sequence[int]) -> int:
function limbs_to_chunks (line 98) | def limbs_to_chunks(limbs: Sequence[int]) -> tuple[int, ...]:
function is_probable_prime (line 113) | def is_probable_prime(n: int, rounds: int = 24) -> bool:
function random_probable_prime (line 143) | def random_probable_prime(bits: int, rng: random.Random) -> int:
class RNSInteger (line 153) | class RNSInteger:
method from_int (line 167) | def from_int(x: int, channel_moduli: Sequence[int]) -> "RNSInteger":
method chunks (line 173) | def chunks(self) -> tuple[int, ...]:
method serialize_to_calldata (line 176) | def serialize_to_calldata(self) -> list[int]:
class ReductionWitness (line 184) | class ReductionWitness:
method serialize_to_calldata (line 195) | def serialize_to_calldata(self) -> list[int]:
class RSA2048ExponentiationWitness (line 203) | class RSA2048ExponentiationWitness:
method __post_init__ (line 216) | def __post_init__(self) -> None:
method serialize_public_key (line 222) | def serialize_public_key(self) -> list[int]:
method serialize_signature_with_hint (line 225) | def serialize_signature_with_hint(self) -> list[int]:
method serialize (line 234) | def serialize(self, prepend_public_key: bool = True) -> list[int]:
class RNSContext (line 242) | class RNSContext:
method __init__ (line 257) | def __init__(self, channel_moduli: Sequence[int]) -> None:
method encode (line 277) | def encode(self, x: int) -> RNSInteger:
method residues_from_limbs (line 280) | def residues_from_limbs(self, limbs: Sequence[int]) -> tuple[int, ...]:
method crt_reconstruct (line 291) | def crt_reconstruct(self, residues: Sequence[int]) -> int:
method is_consistent_encoding (line 304) | def is_consistent_encoding(self, ev: RNSInteger) -> bool:
method rns_congruences_hold (line 314) | def rns_congruences_hold(
method crt_exactness_holds (line 339) | def crt_exactness_holds(
method verify_exact_modular_product (line 351) | def verify_exact_modular_product(
function witness_modular_product (line 367) | def witness_modular_product(
function build_reduction_witness (line 383) | def build_reduction_witness(
function verified_mul_mod (line 397) | def verified_mul_mod(ctx: RNSContext, x: int, y: int, modulus: int) -> int:
function generate_demo_rsa_key (line 402) | def generate_demo_rsa_key(
function build_rsa2048_reductions (line 432) | def build_rsa2048_reductions(
function generate_rsa2048_witness (line 468) | def generate_rsa2048_witness(seed: int = 0) -> RSA2048ExponentiationWitn...
function pkcs1_v1_5_encode_sha256 (line 493) | def pkcs1_v1_5_encode_sha256(
function generate_rsa2048_sha256_witness (line 513) | def generate_rsa2048_sha256_witness(
function is_valid_rsa2048_witness (line 539) | def is_valid_rsa2048_witness(
function modular_exponentiation_with_proof (line 581) | def modular_exponentiation_with_proof(
function demo_context_summary (line 604) | def demo_context_summary(ctx: RNSContext) -> None:
function demo_crt_roundtrip (line 622) | def demo_crt_roundtrip(ctx: RNSContext, rng: random.Random) -> None:
function demo_single_exact_relation (line 635) | def demo_single_exact_relation(
function demo_negative_tests (line 661) | def demo_negative_tests(ctx: RNSContext, modulus: int, rng: random.Rando...
function demo_full_rsa_verification (line 688) | def demo_full_rsa_verification(ctx: RNSContext) -> None:
function run_self_tests (line 712) | def run_self_tests() -> None:
FILE: hydra/garaga/signature.py
class HashProtocol (line 17) | class HashProtocol(Protocol):
method update (line 24) | def update(self, data: bytes) -> None: ...
method digest (line 25) | def digest(self) -> bytes: ...
method hexdigest (line 26) | def hexdigest(self) -> str: ...
method copy (line 27) | def copy(self: T) -> T: ...
class ExpanderXmd (line 39) | class ExpanderXmd:
method __init__ (line 40) | def __init__(
method construct_dst_prime (line 52) | def construct_dst_prime(self) -> bytes:
method expand_message_xmd (line 65) | def expand_message_xmd(self, msg: bytes, n: int) -> bytes:
function get_len_per_elem (line 125) | def get_len_per_elem(p: int, sec_param: int = 128) -> int:
function hash_to_field (line 145) | def hash_to_field(
function hash_to_curve (line 169) | def hash_to_curve(
function map_to_curve (line 195) | def map_to_curve(field_element: PyFelt, curve_id: CurveID) -> G1Point:
function get_isogeny_to_g1_map (line 240) | def get_isogeny_to_g1_map(
function get_isogeny_to_g2_map (line 340) | def get_isogeny_to_g2_map(
function apply_isogeny (line 413) | def apply_isogeny(pt: G1Point) -> G1Point:
function test_hash_to_field (line 432) | def test_hash_to_field(message: bytes):
function test_map_to_curve (line 446) | def test_map_to_curve():
function test_isogeny (line 451) | def test_isogeny():
function test_hash_to_curve (line 469) | def test_hash_to_curve(message: bytes):
FILE: hydra/garaga/starknet/cli/declare.py
function declare (line 21) | def declare(
FILE: hydra/garaga/starknet/cli/deploy.py
function perform_contract_deployment (line 26) | async def perform_contract_deployment(
function print_contract_info (line 52) | def print_contract_info(contract: Contract, network: Network):
function deploy (line 62) | def deploy(
FILE: hydra/garaga/starknet/cli/gen.py
function check_nargo_version (line 22) | def check_nargo_version(version: str) -> tuple[bool, str]:
function check_bb_version (line 26) | def check_bb_version(version: str) -> tuple[bool, str]:
function check_version (line 30) | def check_version(cmd: str, version: str) -> tuple[bool, str]:
function _get_bb_oracle_hash_options (line 49) | def _get_bb_oracle_hash_options() -> list[str]:
function check_bb_starknet_support (line 79) | def check_bb_starknet_support(
function print_bb_warning (line 92) | def print_bb_warning(soft: bool = False, with_starknet: bool = False):
function gen (line 131) | def gen(
FILE: hydra/garaga/starknet/cli/smart_contract_project.py
class EmptyContract (line 23) | class EmptyContract(Exception):
function _get_cached_artifacts (line 34) | def _get_cached_artifacts(folder: Path) -> tuple[str, str]:
class SmartContractProject (line 48) | class SmartContractProject:
method __hash__ (line 51) | def __hash__(self) -> int:
method get_contract_artifacts (line 54) | def get_contract_artifacts(self) -> tuple[str, str]:
method get_casm_class_hash (line 61) | def get_casm_class_hash(self) -> int:
method get_sierra_class_hash (line 70) | def get_sierra_class_hash(self) -> int:
method get_abi (line 80) | def get_abi(self) -> str:
method _check_class_exists (line 87) | async def _check_class_exists(self, account: Account, class_hash: int)...
method declare_class_hash (line 97) | async def declare_class_hash(self, account: Account) -> tuple[int, str]:
class Groth16SmartContract (line 146) | class Groth16SmartContract(SmartContractProject):
method __hash__ (line 149) | def __hash__(self) -> int:
method generate_calldata (line 153) | def generate_calldata(
FILE: hydra/garaga/starknet/cli/starknet_cli.py
function version_callback (line 12) | def version_callback(value: bool):
function main (line 26) | def main(
FILE: hydra/garaga/starknet/cli/utils.py
function get_package_version (line 25) | def get_package_version():
class Network (line 34) | class Network(Enum):
function load_account (line 39) | def load_account(network: Network):
function get_contract_if_exists (line 61) | def get_contract_if_exists(account: Account, contract_address: int) -> C...
function get_contract_if_exists_async (line 74) | async def get_contract_if_exists_async(
function get_contract_iff_exists (line 89) | def get_contract_iff_exists(account: Account, contract_address: int) -> ...
function create_directory (line 99) | def create_directory(path: str):
function complete_pairing_curve_id (line 105) | def complete_pairing_curve_id(incomplete: str):
function complete_proof_system (line 110) | def complete_proof_system(incomplete: str):
function complete_network (line 115) | def complete_network(incomplete: str):
function get_voyager_network_prefix (line 120) | def get_voyager_network_prefix(network: Network) -> str:
function voyager_link_tx (line 124) | def voyager_link_tx(network: Network, tx_hash: int) -> str:
function voyager_link_class (line 129) | def voyager_link_class(network: Network, class_hash: int) -> str:
function scarb_build_contract_folder (line 134) | def scarb_build_contract_folder(contract_folder_path: str):
function _acquire_scarb_lock (line 158) | def _acquire_scarb_lock():
function _release_scarb_lock (line 184) | def _release_scarb_lock(lock_file: str):
function get_sierra_casm_artifacts (line 193) | def get_sierra_casm_artifacts(
function get_default_vk_path (line 261) | def get_default_vk_path(vk_type: str) -> Path:
FILE: hydra/garaga/starknet/cli/verify.py
function verify_onchain (line 42) | def verify_onchain(
class CalldataFormat (line 152) | class CalldataFormat(str, Enum):
function get_calldata_generic (line 158) | def get_calldata_generic(
function calldata (line 187) | def calldata(
FILE: hydra/garaga/starknet/groth16_contract_generator/calldata.py
function groth16_calldata_from_vk_and_proof (line 11) | def groth16_calldata_from_vk_and_proof(
function _groth16_calldata_from_vk_and_proof_rust (line 71) | def _groth16_calldata_from_vk_and_proof_rust(
FILE: hydra/garaga/starknet/groth16_contract_generator/generator.py
function precompute_lines_from_vk (line 21) | def precompute_lines_from_vk(vk: Groth16VerifyingKey) -> StructArray:
function gen_test_file (line 36) | def gen_test_file(
function get_scarb_toml_file (line 138) | def get_scarb_toml_file(package_name: str, cli_mode: bool, inlining_leve...
function write_test_calldata_file (line 173) | def write_test_calldata_file(
function create_verifier_directory_structure (line 186) | def create_verifier_directory_structure(
function write_tool_versions_file (line 205) | def write_tool_versions_file(output_folder_path: str) -> None:
function write_lib_cairo_file (line 212) | def write_lib_cairo_file(src_dir: str, modules: list[str] = None) -> None:
function write_verifier_files (line 224) | def write_verifier_files(
function write_test_calldata_file_generic (line 299) | def write_test_calldata_file_generic(
function gen_groth16_verifier (line 323) | def gen_groth16_verifier(
function _generate_verifier (line 481) | def _generate_verifier(vk_path):
FILE: hydra/garaga/starknet/groth16_contract_generator/generator_risc0.py
function gen_risc0_groth16_verifier (line 23) | def gen_risc0_groth16_verifier(
FILE: hydra/garaga/starknet/groth16_contract_generator/generator_sp1.py
function gen_sp1_groth16_verifier (line 17) | def gen_sp1_groth16_verifier(
FILE: hydra/garaga/starknet/groth16_contract_generator/parsing_utils.py
class KeyPatternNotFound (line 30) | class KeyPatternNotFound(Exception):
method __init__ (line 31) | def __init__(self, key_patterns):
function iterate_nested_dict (line 36) | def iterate_nested_dict(d):
function find_item_from_key_patterns (line 44) | def find_item_from_key_patterns(data: dict, key_patterns: List[str]) -> ...
function try_parse_g1_point_from_key (line 65) | def try_parse_g1_point_from_key(
function proj_to_affine (line 72) | def proj_to_affine(x, y, z, curve_id: CurveID) -> G1Point:
function try_parse_g1_point (line 81) | def try_parse_g1_point(point: Any, curve_id: CurveID = None) -> G1Point:
function try_parse_g2_point_from_key (line 103) | def try_parse_g2_point_from_key(
function try_parse_g2_point (line 110) | def try_parse_g2_point(point: Any, curve_id: CurveID = None) -> G2Point:
function try_guessing_curve_id_from_json (line 161) | def try_guessing_curve_id_from_json(data: dict) -> CurveID:
class Groth16VerifyingKey (line 183) | class Groth16VerifyingKey:
method __post_init__ (line 190) | def __post_init__(self):
method curve_id (line 206) | def curve_id(self) -> CurveID:
method from_dict (line 209) | def from_dict(data: dict) -> "Groth16VerifyingKey":
method from_json (line 250) | def from_json(file_path: str | Path) -> "Groth16VerifyingKey":
method serialize_to_cairo (line 264) | def serialize_to_cairo(self) -> str:
method flatten (line 294) | def flatten(self) -> list[int]:
function reverse_byte_order_uint256 (line 305) | def reverse_byte_order_uint256(value: int | bytes) -> int:
function split_digest (line 315) | def split_digest(digest: int | bytes):
class Groth16Proof (line 321) | class Groth16Proof:
method __post_init__ (line 331) | def __post_init__(self):
method is_risc0 (line 349) | def is_risc0(self) -> bool:
method is_sp1 (line 353) | def is_sp1(self) -> bool:
method vk_type (line 357) | def vk_type(self) -> str:
method from_dict (line 365) | def from_dict(
method from_json (line 428) | def from_json(
method _from_risc0 (line 453) | def _from_risc0(
method _from_sp1 (line 499) | def _from_sp1(
method serialize_to_calldata (line 539) | def serialize_to_calldata(self) -> list[int]:
method flatten (line 581) | def flatten(self, include_public_inputs: bool = True) -> list[int]:
class ExitCode (line 592) | class ExitCode:
method __init__ (line 593) | def __init__(self, system, user):
class Output (line 598) | class Output:
method __init__ (line 599) | def __init__(self, journal_digest, assumptions_digest):
method digest (line 603) | def digest(self):
class ReceiptClaim (line 612) | class ReceiptClaim:
method __init__ (line 613) | def __init__(
method digest (line 629) | def digest(self):
function ok (line 649) | def ok(image_id, journal_digest):
function parse_proof_and_signals (line 681) | def parse_proof_and_signals(proof: bytes) -> Groth16Proof:
FILE: hydra/garaga/starknet/honk_contract_generator/calldata.py
function filter_msm_scalars (line 21) | def filter_msm_scalars(
function extract_msm_scalars (line 32) | def extract_msm_scalars(
function get_ultra_flavor_honk_calldata_from_vk_and_proof (line 39) | def get_ultra_flavor_honk_calldata_from_vk_and_proof(
function _honk_calldata_from_vk_and_proof_rust (line 189) | def _honk_calldata_from_vk_and_proof_rust(
FILE: hydra/garaga/starknet/honk_contract_generator/generator_honk.py
function gen_honk_verifier (line 31) | def gen_honk_verifier(
function gen_honk_verifier_files (line 64) | def gen_honk_verifier_files(
function _get_msm_kzg_template (line 216) | def _get_msm_kzg_template(
function _get_circuit_code_header (line 281) | def _get_circuit_code_header():
function _gen_circuits_code (line 295) | def _gen_circuits_code(vk: HonkVk) -> tuple[str, str, str, list[str], st...
function _gen_contract_header (line 391) | def _gen_contract_header(function_names: list[str]) -> str:
function _gen_constants_code (line 446) | def _gen_constants_code(vk: HonkVk) -> str:
function _get_msm_points_array_code (line 465) | def _get_msm_points_array_code(log_n: int) -> tuple[str, tuple[int, int]]:
function _write_and_format_project_files (line 546) | def _write_and_format_project_files(
FILE: hydra/garaga/starknet/tests_and_calldata_generators/drand_calldata.py
function drand_round_to_calldata (line 23) | def drand_round_to_calldata(round_number: int, use_rust=False) -> list[i...
function _drand_round_to_calldata_rust (line 58) | def _drand_round_to_calldata_rust(
function drand_encrypt_to_calldata (line 73) | def drand_encrypt_to_calldata(
function _drand_encrypt_to_calldata (line 91) | def _drand_encrypt_to_calldata(
function generate_drand_decrypt_constants (line 106) | def generate_drand_decrypt_constants(
FILE: hydra/garaga/starknet/tests_and_calldata_generators/map_to_curve.py
class MapToCurveHint (line 11) | class MapToCurveHint:
method to_cairo (line 16) | def to_cairo(self) -> str:
method to_calldata (line 19) | def to_calldata(self) -> list[int]:
class HashToCurveHint (line 28) | class HashToCurveHint:
method to_cairo (line 32) | def to_cairo(self) -> str:
method to_calldata (line 36) | def to_calldata(self) -> list[int]:
function build_map_to_curve_hint (line 43) | def build_map_to_curve_hint(u: PyFelt) -> tuple[G1Point, MapToCurveHint]:
function build_hash_to_curve_hint (line 91) | def build_hash_to_curve_hint(message: bytes) -> HashToCurveHint:
FILE: hydra/garaga/starknet/tests_and_calldata_generators/mpcheck.py
class MPCheckCalldataBuilder (line 21) | class MPCheckCalldataBuilder:
method __hash__ (line 27) | def __hash__(self):
method __post_init__ (line 32) | def __post_init__(self):
method include_miller_loop_result (line 49) | def include_miller_loop_result(self):
method field (line 53) | def field(self):
method big_Q_expected_len (line 57) | def big_Q_expected_len(self):
method three_limbs_only (line 61) | def three_limbs_only(self):
method extra_miller_loop_result (line 65) | def extra_miller_loop_result(self) -> list[PyFelt] | None:
method lines (line 77) | def lines(self) -> list[PyFelt]:
method _init_circuit (line 82) | def _init_circuit(self) -> MultiPairingCheckCircuit:
method _retrieve_Pis_Qis_and_Ris_from_circuit (line 104) | def _retrieve_Pis_Qis_and_Ris_from_circuit(
method _get_passed_Ris_from_Ris (line 113) | def _get_passed_Ris_from_Ris(self, Ris: list[list[PyFelt]]) -> list[li...
method _init_transcript (line 120) | def _init_transcript(self) -> CairoPoseidonTranscript:
method _hash_hints_and_get_base_random_rlc_coeff (line 129) | def _hash_hints_and_get_base_random_rlc_coeff(
method _hash_big_Q_and_get_z (line 153) | def _hash_big_Q_and_get_z(
method _new_transcript (line 163) | def _new_transcript(self, stage_suffix: str = "") -> CairoPoseidonTran...
method _seed_transcript_with_base_rlc (line 170) | def _seed_transcript_with_base_rlc(
method _sanity_check_verify_rlc_equation (line 177) | def _sanity_check_verify_rlc_equation(
method build_mpcheck_hint (line 224) | def build_mpcheck_hint(
method _get_input_structs (line 327) | def _get_input_structs(self) -> list[structs.Cairo1SerializableStruct]:
method to_cairo_1_test (line 355) | def to_cairo_1_test(self):
method _serialize_to_calldata_rust (line 381) | def _serialize_to_calldata_rust(self) -> list[int]:
method serialize_to_calldata (line 393) | def serialize_to_calldata(
FILE: hydra/garaga/starknet/tests_and_calldata_generators/msm.py
class MSMCalldataBuilder (line 13) | class MSMCalldataBuilder:
method __post_init__ (line 18) | def __post_init__(self):
method __hash__ (line 29) | def __hash__(self) -> int:
method field (line 33) | def field(self):
method msm_size (line 37) | def msm_size(self):
method curve (line 41) | def curve(self) -> WeierstrassCurve:
method build_msm_hint (line 45) | def build_msm_hint(self) -> structs.StructArray:
method _get_input_structs (line 82) | def _get_input_structs(
method to_cairo_1_test (line 109) | def to_cairo_1_test(self, test_name: str = None, ignored=False):
method _serialize_to_calldata_rust (line 140) | def _serialize_to_calldata_rust(
method serialize_to_calldata (line 153) | def serialize_to_calldata(
FILE: hydra/garaga/starknet/tests_and_calldata_generators/signatures.py
class SchnorrSignature (line 23) | class SchnorrSignature:
method __post_init__ (line 42) | def __post_init__(self):
method sample (line 53) | def sample(cls, curve_id: CurveID) -> "SchnorrSignature":
method is_valid (line 96) | def is_valid(self) -> bool:
method serialize (line 103) | def serialize(self, prepend_public_key: bool = True) -> list[int]:
method serialize_with_hints (line 114) | def serialize_with_hints(
class ECDSASignature (line 153) | class ECDSASignature:
method __post_init__ (line 175) | def __post_init__(self):
method sample (line 189) | def sample(cls, curve_id: CurveID) -> "ECDSASignature":
method is_valid (line 237) | def is_valid(self) -> bool:
method serialize (line 263) | def serialize(self, prepend_public_key: bool = True) -> list[int]:
method serialize_with_hints (line 275) | def serialize_with_hints(
class RSA2048Signature (line 319) | class RSA2048Signature:
method from_bundle (line 328) | def from_bundle(cls, bundle: RSA2048ExponentiationWitness) -> "RSA2048...
method sample (line 337) | def sample(cls, seed: int = 0) -> "RSA2048Signature":
method tampered_residue_sample (line 341) | def tampered_residue_sample(cls, seed: int = 0) -> "RSA2048Signature":
method tampered_limb_sample (line 365) | def tampered_limb_sample(cls, seed: int = 0) -> "RSA2048Signature":
method tampered_expected_message_sample (line 389) | def tampered_expected_message_sample(cls, seed: int = 0) -> "RSA2048Si...
method _to_bundle (line 405) | def _to_bundle(self) -> RSA2048ExponentiationWitness:
method is_valid (line 413) | def is_valid(self) -> bool:
method serialize_public_key (line 418) | def serialize_public_key(self) -> list[int]:
method serialize_signature_with_hints (line 421) | def serialize_signature_with_hints(self) -> list[int]:
method serialize (line 424) | def serialize(self, prepend_public_key: bool = True) -> list[int]:
method serialize_with_hints (line 427) | def serialize_with_hints(
method from_sha256_message (line 450) | def from_sha256_message(cls, message: bytes, seed: int = 0) -> "RSA204...
method serialize_sha256_with_hints (line 454) | def serialize_sha256_with_hints(
function _serialize_byte_array (line 484) | def _serialize_byte_array(data: bytes) -> list[int]:
class EdDSA25519Signature (line 510) | class EdDSA25519Signature:
method __eq__ (line 520) | def __eq__(self, other) -> bool:
method __hash__ (line 530) | def __hash__(self) -> int:
method __post_init__ (line 533) | def __post_init__(self):
method curve_id (line 539) | def curve_id(self) -> CurveID:
method curve (line 543) | def curve(self) -> TwistedEdwardsCurve:
method from_json (line 547) | def from_json(cls, json):
method serialize (line 562) | def serialize(self, prepend_public_key: bool = True) -> list[int]:
method xrecover (line 574) | def xrecover(self, y: int) -> int:
method decode_point (line 587) | def decode_point(self, compressed_point_le: int) -> G1Point:
method deserialize_R_A_h (line 596) | def deserialize_R_A_h(self) -> tuple[G1Point, G1Point, int]:
method is_valid (line 610) | def is_valid(self) -> bool:
method serialize_with_hints (line 625) | def serialize_with_hints(
method __eq__ (line 663) | def __eq__(self, other) -> bool:
method __hash__ (line 673) | def __hash__(self) -> int:
FILE: hydra/garaga/starknet/tests_and_calldata_generators/test_writer.py
function generate_pairing_test (line 26) | def generate_pairing_test(curve_id, n_pairs, n_fixed_g2, include_m, seed):
function generate_msm_test (line 43) | def generate_msm_test(curve_id, n_points, seed):
function generate_msm_test_edge_cases (line 55) | def generate_msm_test_edge_cases(curve_id, n_points, seed):
function generate_tower_pairing_test (line 75) | def generate_tower_pairing_test(curve_id, n_pairs, seed):
function generate_tower_final_exp_test (line 115) | def generate_tower_final_exp_test(curve_id, seed):
function generate_schnorr_test (line 135) | def generate_schnorr_test(curve_id, seed):
function generate_ecdsa_test (line 153) | def generate_ecdsa_test(curve_id, seed):
function write_test_file (line 171) | def write_test_file(
function get_tower_pairing_config (line 203) | def get_tower_pairing_config():
function get_pairing_config (line 228) | def get_pairing_config():
function get_msm_config (line 250) | def get_msm_config():
function get_schnorr_config (line 277) | def get_schnorr_config():
function get_ecdsa_config (line 299) | def get_ecdsa_config():
function generate_eddsa_test (line 321) | def generate_eddsa_test(sig: EdDSA25519Signature, test_index: int) -> str:
function generate_test (line 339) | def generate_test(index, vector):
function generate_eddsa_test_file (line 344) | def generate_eddsa_test_file() -> str:
function generate_rsa_test (line 372) | def generate_rsa_test(
function generate_rsa_tests (line 388) | def generate_rsa_tests(seed: int) -> str:
function generate_rsa_sha256_test (line 413) | def generate_rsa_sha256_test(
function generate_rsa_sha256_tests (line 435) | def generate_rsa_sha256_tests(seed: int) -> str:
function generate_rsa_test_file (line 441) | def generate_rsa_test_file() -> str:
function write_all_tests (line 456) | def write_all_tests():
FILE: src/contracts/mutator_set/scripts/prover.py
class StorageElement (line 12) | class StorageElement:
class Proof (line 17) | class Proof:
class ProverConfig (line 23) | class ProverConfig:
method to_dict (line 31) | def to_dict(self) -> dict:
method save_to_toml (line 45) | def save_to_toml(self, filepath: str) -> None:
method load_from_toml (line 52) | def load_from_toml(cls, filepath: str) -> "ProverConfig":
function create_default_config (line 72) | def create_default_config() -> ProverConfig:
FILE: src/contracts/mutator_set/scripts/regenerate_verifier.py
class VerifierConfig (line 23) | class VerifierConfig:
method paths (line 33) | def paths(self) -> dict:
class VerifierGenerator (line 49) | class VerifierGenerator:
method __init__ (line 52) | def __init__(self, config: VerifierConfig):
method run_command (line 56) | def run_command(self, cmd: list, cwd: Optional[Path] = None) -> str:
method update_class_hash (line 68) | def update_class_hash(self, class_hash: str):
method generate (line 89) | def generate(self) -> bool:
function main (line 164) | def main():
FILE: src/contracts/risc0_sample_app/fibonacci_prover/host/src/main.rs
function main (line 10) | fn main() {
FILE: src/contracts/risc0_sample_app/fibonacci_prover/methods/build.rs
function main (line 1) | fn main() {
FILE: src/contracts/risc0_sample_app/fibonacci_prover/methods/guest/src/main.rs
function main (line 3) | fn main() {
FILE: src/src/ec/generate_selector_code.py
function generate_build_selectors_inlined (line 126) | def generate_build_selectors_inlined(n_bits: int) -> str:
function generate_build_selectors_inlined_fake_glv (line 196) | def generate_build_selectors_inlined_fake_glv(n_bits: int = 128) -> str:
function generate_double_and_add_n (line 279) | def generate_double_and_add_n(n_points: int) -> str:
FILE: tests/benchmarks_compiled.py
function benchmark_all_cairo_circuits (line 10) | def benchmark_all_cairo_circuits():
FILE: tests/benchmarks_manual.py
function test_extf_mul (line 19) | def test_extf_mul(curve_id: CurveID, extension_degree: int):
function test_extf_square (line 37) | def test_extf_square(curve_id: CurveID, extension_degree: int):
function test_extf_mul_circuit_full (line 54) | def test_extf_mul_circuit_full(curve_id: CurveID, extension_degree: int):
function test_square_torus_amortized (line 71) | def test_square_torus_amortized(curve_id: CurveID, extension_degree: int):
function test_mul_torus (line 87) | def test_mul_torus(curve_id: CurveID, extension_degree: int):
function test_final_exp_circuit (line 105) | def test_final_exp_circuit(curve_id: CurveID):
function test_miller_n (line 130) | def test_miller_n(curve_id, n):
function test_derive_point_from_x (line 165) | def test_derive_point_from_x(curve_id: CurveID):
function test_msm_n_points (line 179) | def test_msm_n_points(curve_id: CurveID, n: int):
function get_poseidon_cost (line 410) | def get_poseidon_cost(curve_name: CurveID) -> int:
function calculate_row_cost (line 417) | def calculate_row_cost(row):
FILE: tests/contracts_e2e/e2e_test.py
function get_contract_if_exists (line 84) | async def get_contract_if_exists(
function test_groth16_contracts (line 97) | async def test_groth16_contracts(account_devnet: BaseAccount, contract_i...
function test_drand_contract (line 189) | async def test_drand_contract(account_devnet: BaseAccount, contract_info...
function test_drand_decrypt_contract (line 263) | async def test_drand_decrypt_contract(account_devnet: BaseAccount, contr...
function test_honk_contracts (line 385) | async def test_honk_contracts(account_devnet: BaseAccount, contract_info...
function test_risc0_sample_app (line 464) | async def test_risc0_sample_app(account_devnet: BaseAccount):
FILE: tests/contracts_e2e/fixtures/accounts.py
class AccountPrerequisites (line 32) | class AccountPrerequisites:
function devnet_account_details (line 39) | async def devnet_account_details(
function mint_token_on_devnet (line 82) | async def mint_token_on_devnet(url: str, address: int, amount: int, unit...
function full_node_account (line 92) | def full_node_account(client_devnet: FullNodeClient) -> BaseAccount:
class AccountToBeDeployedDetailsFactory (line 108) | class AccountToBeDeployedDetailsFactory:
method get (line 113) | async def get(
function deploy_account_details_factory (line 141) | async def deploy_account_details_factory(
function pre_deployed_account_with_validate_deploy (line 161) | def pre_deployed_account_with_validate_deploy(client) -> BaseAccount:
function argent_account_v040_data (line 178) | async def argent_account_v040_data(
function argent_account_v040 (line 204) | async def argent_account_v040(
FILE: tests/contracts_e2e/fixtures/clients.py
function create_full_node_client_devnet (line 8) | def create_full_node_client_devnet(devnet) -> FullNodeClient:
function create_full_node_client_sepolia (line 13) | def create_full_node_client_sepolia() -> FullNodeClient:
FILE: tests/contracts_e2e/fixtures/constants.py
function _get_env_or_throw (line 10) | def _get_env_or_throw(env_name: str) -> str:
function _get_env_lambda (line 21) | def _get_env_lambda(env_name):
FILE: tests/contracts_e2e/fixtures/devnet.py
function get_available_port (line 13) | def get_available_port() -> int:
function start_devnet (line 20) | def start_devnet(fork_mode: bool = False):
function get_start_devnet_command (line 30) | def get_start_devnet_command(devnet_port: int, fork_mode: bool = False) ...
function devnet (line 61) | def devnet() -> Generator[str, None, None]:
function devnet_forking_mode (line 71) | def devnet_forking_mode() -> Generator[str, None, None]:
FILE: tests/contracts_e2e/utils.py
function _new_address (line 19) | def _new_address(
function prepay_account (line 35) | async def prepay_account(
function get_deploy_account_transaction (line 59) | async def get_deploy_account_transaction(
function _get_random_private_key_unsafe (line 80) | def _get_random_private_key_unsafe() -> int:
function create_empty_block (line 88) | async def create_empty_block(http_client: HttpClient) -> None:
FILE: tests/hydra/algebra/test_polynomial.py
function test_xgcd (line 13) | def test_xgcd(degree_x: int, degree_y: int):
function test_lagrange_interpolation (line 29) | def test_lagrange_interpolation(degree: int):
FILE: tests/hydra/algebra/test_pyfelt.py
function test_pyfelt_addition (line 9) | def test_pyfelt_addition():
function test_pyfelt_subtraction (line 18) | def test_pyfelt_subtraction():
function test_pyfelt_multiplication (line 27) | def test_pyfelt_multiplication():
function test_pyfelt_division (line 36) | def test_pyfelt_division():
function test_pyfelt_negation (line 44) | def test_pyfelt_negation():
function test_pyfelt_inversion (line 49) | def test_pyfelt_inversion():
function test_pyfelt_exponentiation (line 57) | def test_pyfelt_exponentiation():
function test_pyfelt_equality (line 63) | def test_pyfelt_equality():
function test_pyfelt_comparison (line 73) | def test_pyfelt_comparison():
function test_pyfelt_quadratic_residue (line 87) | def test_pyfelt_quadratic_residue():
function test_pyfelt_sqrt (line 94) | def test_pyfelt_sqrt():
function test_pyfelt_repr (line 102) | def test_pyfelt_repr():
function test_pyfelt_invalid_operations (line 107) | def test_pyfelt_invalid_operations():
FILE: tests/hydra/algebra/test_tower_final_exp.py
function test_tower_final_exp (line 10) | def test_tower_final_exp(curve_id):
function test_tower_final_exp_zero_numerator (line 24) | def test_tower_final_exp_zero_numerator(curve_id):
FILE: tests/hydra/circuits/test_ec.py
function test_double_point_g1 (line 10) | def test_double_point_g1(curve_id: CurveID):
function test_add_point_g1 (line 31) | def test_add_point_g1(curve_id: CurveID):
function test_double_point_g2 (line 51) | def test_double_point_g2(curve_id: CurveID):
function test_add_point_g2 (line 71) | def test_add_point_g2(curve_id: CurveID):
FILE: tests/hydra/circuits/test_honk.py
function convert_pairing_points_to_g1 (line 24) | def convert_pairing_points_to_g1(
function generate_recursion_separator (line 46) | def generate_recursion_separator(
function test_verify_honk_proof (line 78) | def test_verify_honk_proof(proof_path: str, system: ProofSystem):
function test_check_evals_consistency (line 198) | def test_check_evals_consistency(proof_path: str, system: ProofSystem):
FILE: tests/hydra/circuits/test_multi_miller_loop.py
function circuit_and_points (line 27) | def circuit_and_points(
function test_precomputed_and_without_precompute_gives_same_output (line 46) | def test_precomputed_and_without_precompute_gives_same_output(
function test_partially_precomputed_and_without_precompute_gives_same_output (line 71) | def test_partially_precomputed_and_without_precompute_gives_same_output(
function test_prod_miller_loop_equals_multi_miller_loop (line 95) | def test_prod_miller_loop_equals_multi_miller_loop(
FILE: tests/hydra/hints/test_ecip.py
function test_verify_ecip (line 15) | def test_verify_ecip(curve_id, msm_size):
function test_verify_ecip_edge_cases (line 41) | def test_verify_ecip_edge_cases(curve_id, msm_size):
FILE: tests/hydra/hints/test_eisenstein.py
function test_neg_twice_invariant (line 39) | def test_neg_twice_invariant(a: EisensteinInteger):
function test_conj_twice_invariant (line 46) | def test_conj_twice_invariant(a: EisensteinInteger):
function test_add_sub_invariant (line 53) | def test_add_sub_invariant(a: EisensteinInteger, b: EisensteinInteger):
function test_sub_add_invariant (line 60) | def test_sub_add_invariant(a: EisensteinInteger, b: EisensteinInteger):
function test_add_zero_invariant (line 67) | def test_add_zero_invariant(a: EisensteinInteger):
function test_mul_one_invariant (line 75) | def test_mul_one_invariant(a: EisensteinInteger):
function test_mul_zero (line 83) | def test_mul_zero(a: EisensteinInteger):
function test_add_commutative (line 91) | def test_add_commutative(a: EisensteinInteger, b: EisensteinInteger):
function test_add_associative (line 102) | def test_add_associative(
function test_mul_commutative (line 111) | def test_mul_commutative(a: EisensteinInteger, b: EisensteinInteger):
function test_mul_associative (line 122) | def test_mul_associative(
function test_distributive (line 135) | def test_distributive(a: EisensteinInteger, b: EisensteinInteger, c: Eis...
function test_sub_definition (line 143) | def test_sub_definition(a: EisensteinInteger, b: EisensteinInteger):
function test_norm_positive (line 150) | def test_norm_positive(a: EisensteinInteger):
function test_half_gcd (line 159) | def test_half_gcd(a: EisensteinInteger, b: EisensteinInteger):
function test_specific_cases (line 184) | def test_specific_cases():
function test_zero_division (line 202) | def test_zero_division():
function test_half_gcd_a_zero (line 231) | def test_half_gcd_a_zero():
FILE: tests/hydra/hints/test_fake_glv.py
function test_half_gcd_eisenstein_hint (line 22) | def test_half_gcd_eisenstein_hint(curve_id):
function test_glv_fake_glv (line 41) | def test_glv_fake_glv(curve_id):
function test_glv_fake_glv_bls12_381_2 (line 55) | def test_glv_fake_glv_bls12_381_2():
function test_glv_fake_glv_bls12_381_3 (line 77) | def test_glv_fake_glv_bls12_381_3():
function test_scalar_mul_fake_glv (line 96) | def test_scalar_mul_fake_glv(curve_id):
FILE: tests/hydra/hints/test_final_exp_witness.py
function test_final_exp_witness (line 23) | def test_final_exp_witness(seed, curve_id):
function test_mpcheck (line 92) | def test_mpcheck(curve_id: CurveID, n_pairs: int, include_m: bool):
FILE: tests/hydra/hints/test_frobenius.py
function test_get_frobenius_maps (line 10) | def test_get_frobenius_maps(curve_id, extension_degree, frob_power):
FILE: tests/hydra/hints/test_neg3.py
function test_params (line 9) | def test_params():
function test_neg_3_base_le (line 13) | def test_neg_3_base_le(test_params):
function test_positive_negative_multiplicities (line 20) | def test_positive_negative_multiplicities(test_params):
FILE: tests/hydra/starknet/test_calldata.py
function test_mpc_calldata_builder (line 23) | def test_mpc_calldata_builder(
function test_msm_calldata_builder (line 55) | def test_msm_calldata_builder(
function test_drand_randomness_to_calldata (line 91) | def test_drand_randomness_to_calldata(
function test_drand_encrypt_to_round_calldata (line 112) | def test_drand_encrypt_to_round_calldata(
FILE: tests/hydra/starknet/test_groth16_vk_proof_parsing.py
function test_vk_parsing (line 26) | def test_vk_parsing(vk_path: str):
function test_proof_parsing (line 46) | def test_proof_parsing(proof_path: str):
function test_proof_parsing_with_public_input (line 59) | def test_proof_parsing_with_public_input(proof_path: str, pub_inputs_pat...
function test_calldata_generation (line 84) | def test_calldata_generation(
FILE: tests/hydra/starknet/test_honk_vk_proof_parsing.py
function test_vk_parsing (line 18) | def test_vk_parsing(vk_path: str, vk_hash_path: str):
function test_proof_parsing (line 38) | def test_proof_parsing(
function test_calldata_generation (line 62) | def test_calldata_generation(
FILE: tests/hydra/starknet/test_signatures_calldata.py
function test_schnorr_calldata_builder (line 18) | def test_schnorr_calldata_builder(curve_id, prepend_public_key):
function test_ecdsa_calldata_builder (line 41) | def test_ecdsa_calldata_builder(curve_id, prepend_public_key):
function test_eddsa_25519_signatures (line 63) | def test_eddsa_25519_signatures(prepend_public_key, full=False):
function test_rsa2048_calldata_lengths (line 89) | def test_rsa2048_calldata_lengths(prepend_public_key):
function test_rsa2048_calldata_public_key_prefix (line 98) | def test_rsa2048_calldata_public_key_prefix():
function test_rsa2048_calldata_builder (line 109) | def test_rsa2048_calldata_builder(prepend_public_key):
function test_rsa2048_sha256_calldata_builder (line 128) | def test_rsa2048_sha256_calldata_builder(prepend_public_key, message):
FILE: tests/hydra/test_bls18_381_map_to_curve.py
function test_bls18_381_map_to_curve_g2_non_quadratic (line 5) | def test_bls18_381_map_to_curve_g2_non_quadratic():
function test_bls18_381_map_to_curve_g2_quadratic (line 86) | def test_bls18_381_map_to_curve_g2_quadratic():
function test_bls18_381_map_to_curve_g1_quadratic (line 167) | def test_bls18_381_map_to_curve_g1_quadratic():
function test_bls18_381_map_to_curve_g1_non_quadratic (line 214) | def test_bls18_381_map_to_curve_g1_non_quadratic():
FILE: tests/hydra/test_cofactor_clearing.py
function test_cofactor_clearing (line 11) | def test_cofactor_clearing():
function test_cofactor_clearing_g1 (line 84) | def test_cofactor_clearing_g1():
FILE: tests/hydra/test_drand.py
function test_drand_sig_verification (line 21) | def test_drand_sig_verification(round_number: int):
function test_tlock_encrypt_decrypt (line 54) | def test_tlock_encrypt_decrypt(round: int):
function test_tlock_encrypt_same_message_gives_different_ciphertexts (line 75) | def test_tlock_encrypt_same_message_gives_different_ciphertexts(round: i...
function test_all_base_urls_return_chains (line 103) | def test_all_base_urls_return_chains():
FILE: tests/hydra/test_extension_field_modulo_circuit.py
function circuit (line 19) | def circuit(request) -> tuple[ExtensionFieldModuloCircuit, list[ModuloCi...
function test_eval (line 38) | def test_eval(circuit: tuple[ExtensionFieldModuloCircuit, list[ModuloCir...
function generate_random_sparsity (line 49) | def generate_random_sparsity(
function test_eval_sparse (line 63) | def test_eval_sparse(
FILE: tests/hydra/test_g1_point.py
function test_weierstrass_to_twistededwards_and_back (line 11) | def test_weierstrass_to_twistededwards_and_back(curve_id):
function test_fp_generator (line 25) | def test_fp_generator(curve_id):
function test_g1point_equality (line 36) | def test_g1point_equality(curve_id):
function test_g1point_infinity (line 45) | def test_g1point_infinity(curve_id):
function test_g1point_on_curve (line 51) | def test_g1point_on_curve(curve_id):
function test_g1point_not_on_curve (line 57) | def test_g1point_not_on_curve(curve_id):
function test_g1point_scalar_mul (line 64) | def test_g1point_scalar_mul(curve_id):
function test_g1point_addition (line 71) | def test_g1point_addition(curve_id):
function test_g1point_addition_with_negative_point (line 79) | def test_g1point_addition_with_negative_point(curve_id):
function test_g1point_negation (line 87) | def test_g1point_negation(curve_id):
function test_g1point_msm (line 95) | def test_g1point_msm(curve_id):
function test_g1point_gen_random_point (line 105) | def test_g1point_gen_random_point(curve_id):
function test_g1point_gen_random_point_not_in_subgroup (line 111) | def test_g1point_gen_random_point_not_in_subgroup(curve_id):
function test_g1point_to_cairo_1 (line 120) | def test_g1point_to_cairo_1(curve_id):
function test_g1point_doubling (line 127) | def test_g1point_doubling(curve_id):
function test_g1point_addition_vs_doubling (line 134) | def test_g1point_addition_vs_doubling(curve_id):
function test_g1point_msm_vs_scalar_mul (line 142) | def test_g1point_msm_vs_scalar_mul(curve_id):
function test_g1point_scalar_mul_zero (line 152) | def test_g1point_scalar_mul_zero(curve_id):
function test_g1point_scalar_mul_one (line 159) | def test_g1point_scalar_mul_one(curve_id):
function test_g1point_scalar_mul_negative (line 166) | def test_g1point_scalar_mul_negative(curve_id):
function test_g1point_scalar_mul_large (line 173) | def test_g1point_scalar_mul_large(curve_id):
function test_g1point_scalar_mul_invalid (line 181) | def test_g1point_scalar_mul_invalid(curve_id):
function test_g1point_scalar_mul_order (line 188) | def test_g1point_scalar_mul_order(curve_id):
function test_g1point_scalar_mul_larger_than_order (line 195) | def test_g1point_scalar_mul_larger_than_order(curve_id):
function test_is_in_subgroup (line 205) | def test_is_in_subgroup(curve_id):
FILE: tests/hydra/test_g2_point.py
function get_g2_generator_point (line 12) | def get_g2_generator_point(curve_id):
function test_g2point_equality (line 17) | def test_g2point_equality(curve_id):
function test_ng2 (line 26) | def test_ng2(curve_id):
function test_g2point_infinity (line 34) | def test_g2point_infinity(curve_id):
function test_g2point_on_curve (line 40) | def test_g2point_on_curve(curve_id):
function test_g2point_not_on_curve (line 46) | def test_g2point_not_on_curve(curve_id):
function test_g2point_scalar_mul (line 52) | def test_g2point_scalar_mul(curve_id):
function test_g2point_addition (line 59) | def test_g2point_addition(curve_id):
function test_g2point_negation (line 67) | def test_g2point_negation(curve_id):
function test_g2point_msm (line 75) | def test_g2point_msm(curve_id):
function test_g2point_gen_random_point (line 85) | def test_g2point_gen_random_point(curve_id):
function test_g2point_scalar_mul_zero (line 91) | def test_g2point_scalar_mul_zero(curve_id):
function test_g2point_scalar_mul_one (line 98) | def test_g2point_scalar_mul_one(curve_id):
function test_g2point_scalar_mul_negative (line 105) | def test_g2point_scalar_mul_negative(curve_id):
function test_g2point_scalar_mul_large (line 112) | def test_g2point_scalar_mul_large(curve_id):
function test_g2point_scalar_mul_invalid (line 120) | def test_g2point_scalar_mul_invalid(curve_id):
function test_g2point_scalar_mul_order (line 127) | def test_g2point_scalar_mul_order(curve_id):
function test_g2point_scalar_mul_larger_than_order (line 134) | def test_g2point_scalar_mul_larger_than_order(curve_id):
function test_g2point_scalar_mul_larger_than_order_random_points (line 141) | def test_g2point_scalar_mul_larger_than_order_random_points(curve_id):
function test_is_in_subgroup (line 154) | def test_is_in_subgroup(curve_id):
FILE: tests/hydra/test_isogeny.py
function test_isogeny_g2 (line 5) | def test_isogeny_g2():
function test_isogeny_g1 (line 68) | def test_isogeny_g1():
FILE: tests/hydra/test_poseidon_hash.py
function test_poseidon_hash_bn254 (line 9) | def test_poseidon_hash_bn254():
FILE: tests/hydra/test_rsa_rns.py
function eval_chunks_mod (line 21) | def eval_chunks_mod(chunks: tuple[int, ...], step: int, modulus: int) ->...
function test_rsa_channel_moduli_are_pairwise_coprime (line 29) | def test_rsa_channel_moduli_are_pairwise_coprime():
function test_rsa_chunk_steps_match_chunk_radix_mod_channel_moduli (line 38) | def test_rsa_chunk_steps_match_chunk_radix_mod_channel_moduli():
function test_rsa_chunk_horner_evaluation_matches_residues (line 55) | def test_rsa_chunk_horner_evaluation_matches_residues():
function test_rsa_context_exactness_bound (line 78) | def test_rsa_context_exactness_bound():
function test_rsa_sample_is_valid (line 83) | def test_rsa_sample_is_valid():
function test_rsa_verification_path_uses_expected_reductions (line 92) | def test_rsa_verification_path_uses_expected_reductions():
function test_rsa_tampered_residue_is_invalid (line 105) | def test_rsa_tampered_residue_is_invalid():
function test_rsa_tampered_limb_is_invalid (line 109) | def test_rsa_tampered_limb_is_invalid():
function test_rsa_tampered_expected_message_is_invalid (line 113) | def test_rsa_tampered_expected_message_is_invalid():
function test_pkcs1_v1_5_encode_sha256_structure (line 117) | def test_pkcs1_v1_5_encode_sha256_structure():
function test_rsa2048_sha256_witness_is_valid (line 131) | def test_rsa2048_sha256_witness_is_valid():
function test_rsa2048_sha256_byte_array_serialization (line 144) | def test_rsa2048_sha256_byte_array_serialization():
FILE: tools/addchain/gen_rust_addchain.py
class Var (line 28) | class Var:
class Add (line 33) | class Add:
class Shift (line 39) | class Shift:
class Token (line 48) | class Token:
function tokenize (line 53) | def tokenize(expr: str) -> List[Token]:
class Parser (line 87) | class Parser:
method __init__ (line 88) | def __init__(self, tokens: List[Token]) -> None:
method _peek (line 92) | def _peek(self) -> Token | None:
method _peek_next (line 97) | def _peek_next(self) -> Token | None:
method _match (line 102) | def _match(self, kind: str, value: str | None = None) -> bool:
method _expect (line 111) | def _expect(self, kind: str, value: str | None = None) -> Token:
method parse (line 124) | def parse(self) -> Expr:
method _parse_expr (line 130) | def _parse_expr(self) -> Expr:
method _parse_chain (line 137) | def _parse_chain(self) -> Expr:
method _parse_term (line 149) | def _parse_term(self) -> Expr:
method _parse_atom (line 160) | def _parse_atom(self) -> Expr:
function parse_expr (line 179) | def parse_expr(expr: str) -> Expr:
function load_chain (line 184) | def load_chain(path: Path) -> Tuple[List[Tuple[str, Expr]], Expr]:
class Emitter (line 202) | class Emitter:
method __init__ (line 203) | def __init__(self) -> None:
method _temp (line 206) | def _temp(self) -> str:
method emit_expr (line 211) | def emit_expr(self, expr: Expr, lines: List[str]) -> str:
method emit_assignment (line 229) | def emit_assignment(self, name: str, expr: Expr, indent: str) -> str:
function emit_chain_function (line 240) | def emit_chain_function(name: str, defs: List[Tuple[str, Expr]], ret: Ex...
function main (line 251) | def main() -> int:
FILE: tools/garaga_rs/src/algebra/extf_mul.rs
function nondeterministic_extension_field_mul_divmod (line 9) | pub fn nondeterministic_extension_field_mul_divmod<F: IsPrimeField + Cur...
function nondeterministic_extension_field_div (line 31) | pub fn nondeterministic_extension_field_div<F, E2, E6, E12>(
function tower_to_direct (line 48) | pub fn tower_to_direct<F>(x: &[FieldElement<F>], ext_degree: usize) -> V...
function direct_to_tower (line 82) | pub fn direct_to_tower<F>(x: &[FieldElement<F>], ext_degree: usize) -> V...
function tower_mul (line 116) | pub fn tower_mul<F, E2, E6, E12>(
function tower_div (line 152) | pub fn tower_div<F, E2, E6, E12>(
function tower_inv (line 188) | pub fn tower_inv<F, E2, E6, E12>(a: &[FieldElement<F>], ext_degree: usiz...
function to_e2 (line 200) | pub fn to_e2<F, E2>(v: [FieldElement<F>; 2]) -> FieldElement<E2>
function to_e6 (line 208) | pub fn to_e6<F, E2, E6>(v: [FieldElement<F>; 6]) -> FieldElement<E6>
function to_e12 (line 218) | pub fn to_e12<F, E2, E6, E12>(v: [FieldElement<F>; 12]) -> FieldElement<...
function from_e2 (line 232) | pub fn from_e2<F, E2>(v: FieldElement<E2>) -> [FieldElement<F>; 2]
function from_e6 (line 241) | pub fn from_e6<F, E2, E6>(v: FieldElement<E6>) -> [FieldElement<F>; 6]
function from_e12 (line 254) | pub fn from_e12<F, E2, E6, E12>(v: FieldElement<E12>) -> [FieldElement<F...
function e2_conjugate (line 267) | pub fn e2_conjugate<F, E2>(a: FieldElement<E2>) -> FieldElement<E2>
function test_nondeterministic_extension_field_mul_divmod_1 (line 282) | fn test_nondeterministic_extension_field_mul_divmod_1() {
function test_nondeterministic_extension_field_mul_divmod_2 (line 368) | fn test_nondeterministic_extension_field_mul_divmod_2() {
function test_nondeterministic_extension_field_mul_divmod_3 (line 441) | fn test_nondeterministic_extension_field_mul_divmod_3() {
function nondeterministic_extension_field_div_1 (line 478) | fn nondeterministic_extension_field_div_1() {
function nondeterministic_extension_field_div_2 (line 519) | fn nondeterministic_extension_field_div_2() {
function nondeterministic_extension_field_div_3 (line 579) | fn nondeterministic_extension_field_div_3() {
FILE: tools/garaga_rs/src/algebra/g1g2pair.rs
type G1G2Pair (line 7) | pub struct G1G2Pair<F, E2>
function new (line 21) | pub fn new(g1: G1Point<F>, g2: G2Point<F, E2>) -> Self {
function flatten (line 24) | pub fn flatten(&self) -> Vec<FieldElement<F>> {
FILE: tools/garaga_rs/src/algebra/g1point.rs
type G1Point (line 6) | pub struct G1Point<F: IsPrimeField> {
function is_infinity (line 13) | pub fn is_infinity(&self) -> bool {
function representative (line 17) | pub fn representative(&self) -> String {
function get_coords (line 27) | pub fn get_coords(&self) -> ([FieldElement<F>; 1], [FieldElement<F>; 1]) {
function new (line 31) | pub fn new(x: FieldElement<F>, y: FieldElement<F>, iso_point: bool) -> R...
function new_unchecked (line 43) | pub fn new_unchecked(x: FieldElement<F>, y: FieldElement<F>, iso_point: ...
function add (line 47) | pub fn add(&self, other: &G1Point<F>) -> G1Point<F> {
function neg (line 87) | pub fn neg(&self) -> Self {
function scalar_mul_neg_3 (line 95) | pub fn scalar_mul_neg_3(&self) -> G1Point<F> {
function scalar_mul (line 100) | pub fn scalar_mul(&self, scalar: BigInt) -> G1Point<F> {
function is_on_curve (line 143) | pub fn is_on_curve(&self) -> bool {
function print (line 158) | pub fn print(&self) {
function generator (line 166) | pub fn generator() -> Self {
function msm (line 173) | pub fn msm(points: &[Self], scalars: &[BigUint]) -> Self {
function new_infinity (line 183) | pub fn new_infinity() -> Self {
method eq (line 189) | fn eq(&self, other: &Self) -> bool {
FILE: tools/garaga_rs/src/algebra/g2point.rs
type G2Point (line 9) | pub struct G2Point<F, E2>
function get_coords (line 23) | pub fn get_coords(&self) -> ([FieldElement<F>; 2], [FieldElement<F>; 2]) {
function representative (line 27) | pub fn representative(&self) -> String {
function new (line 37) | pub fn new(x: [FieldElement<F>; 2], y: [FieldElement<F>; 2]) -> Result<S...
function new_unchecked (line 55) | pub fn new_unchecked(x: FieldElement<E2>, y: FieldElement<E2>) -> Self {
function is_infinity (line 59) | pub fn is_infinity(&self) -> bool {
function neg (line 64) | pub fn neg(&self) -> Self {
function is_on_curve (line 72) | pub fn is_on_curve(&self) -> bool {
function generator (line 83) | pub fn generator() -> Self {
function compute_doubling_slope (line 94) | pub fn compute_doubling_slope(a: &Self) -> FieldElement<E2> {
function compute_adding_slope (line 103) | pub fn compute_adding_slope(a: &Self, b: &Self) -> FieldElement<E2> {
function new_infinity (line 107) | pub fn new_infinity() -> Self {
function add (line 112) | pub fn add<C>(&self, other: &G2Point<F, E2>) -> G2Point<F, E2>
function scalar_mul (line 119) | pub fn scalar_mul<C>(&self, scalar: BigInt) -> G2Point<F, E2>
function g2_point_add (line 150) | fn g2_point_add<F, E2, C>(a: G2Point<F, E2>, b: G2Point<F, E2>) -> G2Poi...
function g2_point_scalar_mul (line 171) | fn g2_point_scalar_mul<F, E2, C>(a: G2Point<F, E2>, k: BigUint) -> G2Poi...
FILE: tools/garaga_rs/src/algebra/polynomial.rs
type Polynomial (line 5) | pub struct Polynomial<F: IsPrimeField> {
function get_coefficients_ext_degree (line 12) | pub fn get_coefficients_ext_degree(&self, ext_degree: usize) -> Vec<Fiel...
function new (line 19) | pub fn new(mut coefficients: Vec<FieldElement<F>>) -> Self {
function print_as_sage_poly (line 41) | pub fn print_as_sage_poly(&self) -> String {
function degree (line 75) | pub fn degree(&self) -> isize {
function evaluate (line 80) | pub fn evaluate(&self, x: &FieldElement<F>) -> FieldElement<F> {
function leading_coefficient (line 93) | pub fn leading_coefficient(&self) -> FieldElement<F> {
function zero (line 100) | pub fn zero() -> Self {
function one (line 107) | pub fn one() -> Self {
function mul_with_ref (line 114) | pub fn mul_with_ref(&self, other: &Polynomial<F>) -> Polynomial<F> {
function divmod (line 135) | pub fn divmod(self, denominator: &Self) -> (Self, Self) {
function shift (line 169) | pub fn shift(&self, shift: usize) -> Self {
function divfloor (line 183) | pub fn divfloor(&self, denominator: &Self) -> Self {
function differentiate (line 188) | pub fn differentiate(&self) -> Self {
function xgcd (line 208) | pub fn xgcd(&self, other: &Polynomial<F>) -> (Polynomial<F>, Polynomial<...
function div_with_ref (line 240) | pub fn div_with_ref(self, dividend: &Self) -> Self {
function scale_by_coeff (line 245) | pub fn scale_by_coeff(&self, coeff: &FieldElement<F>) -> Polynomial<F> {
function pad_with_zero_coefficients_to_length (line 264) | pub fn pad_with_zero_coefficients_to_length<F: IsPrimeField>(pa: &mut Po...
function pad_with_zero_coefficients (line 270) | pub fn pad_with_zero_coefficients<F: IsPrimeField>(
type Output (line 286) | type Output = Polynomial<F>;
function add (line 288) | fn add(self, a_polynomial: &Polynomial<F>) -> Self::Output {
type Output (line 327) | type Output = Polynomial<F>;
function add (line 329) | fn add(self, other: Polynomial<F>) -> Polynomial<F> {
type Output (line 369) | type Output = Polynomial<F>;
function neg (line 371) | fn neg(self) -> Polynomial<F> {
type Output (line 384) | type Output = Polynomial<F>;
function neg (line 386) | fn neg(self) -> Polynomial<F> {
type Output (line 392) | type Output = Polynomial<F>;
function sub (line 394) | fn sub(self, other: Polynomial<F>) -> Polynomial<F> {
method eq (line 408) | fn eq(&self, other: &Self) -> bool {
type Output (line 431) | type Output = Polynomial<F>;
function mul (line 432) | fn mul(self, factor: &Polynomial<F>) -> Polynomial<F> {
type Output (line 438) | type Output = Polynomial<F>;
function mul (line 439) | fn mul(self, factor: Polynomial<F>) -> Polynomial<F> {
type Output (line 445) | type Output = Polynomial<F>;
function mul (line 446) | fn mul(self, factor: Polynomial<F>) -> Polynomial<F> {
type Output (line 452) | type Output = Polynomial<F>;
function mul (line 453) | fn mul(self, factor: &Polynomial<F>) -> Polynomial<F> {
FILE: tools/garaga_rs/src/algebra/rational_function.rs
type RationalFunction (line 6) | pub struct RationalFunction<F: IsPrimeField> {
function new (line 12) | pub fn new(numerator: Polynomial<F>, denominator: Polynomial<F>) -> Self {
function simplify (line 19) | pub fn simplify(&self) -> RationalFunction<F> {
function evaluate (line 30) | pub fn evaluate(&self, x: FieldElement<F>) -> FieldElement<F> {
function scale_by_coeff (line 34) | pub fn scale_by_coeff(&self, coeff: FieldElement<F>) -> RationalFunction...
type Output (line 43) | type Output = RationalFunction<F>;
function add (line 45) | fn add(self, other: RationalFunction<F>) -> RationalFunction<F> {
type FunctionFelt (line 55) | pub struct FunctionFelt<F: IsPrimeField> {
function new (line 61) | pub fn new(a: RationalFunction<F>, b: RationalFunction<F>) -> Self {
function simplify (line 65) | pub fn simplify(&self) -> FunctionFelt<F> {
function evaluate (line 69) | pub fn evaluate(&self, x: FieldElement<F>, y: &FieldElement<F>) -> Field...
function scale_by_coeff (line 73) | pub fn scale_by_coeff(&self, coeff: FieldElement<F>) -> FunctionFelt<F> {
function print_as_sage_poly (line 83) | pub fn print_as_sage_poly(&self) -> String {
type Output (line 95) | type Output = FunctionFelt<F>;
function add (line 97) | fn add(self, other: FunctionFelt<F>) -> FunctionFelt<F> {
FILE: tools/garaga_rs/src/calldata/drand_calldata.rs
function drand_calldata_builder (line 20) | pub fn drand_calldata_builder(values: &[BigUint]) -> Result<Vec<BigUint>...
function drand_randomness_to_calldata (line 57) | pub fn drand_randomness_to_calldata(round: RandomnessBeacon) -> Result<V...
function drand_round_to_calldata (line 95) | pub fn drand_round_to_calldata(round_number: usize) -> Result<Vec<BigUin...
function digest_func (line 101) | pub fn digest_func(round_number: u64) -> [u8; 32] {
function hash_to_curve (line 107) | pub fn hash_to_curve<F>(message: [u8; 32], hash_name: &str) -> Result<G1...
function map_to_curve (line 137) | fn map_to_curve<F>(field_element: FieldElement<F>) -> G1Point<F>
function hash_to_field (line 191) | fn hash_to_field<F>(
function hash_to_bytes (line 211) | fn hash_to_bytes<H: Hasher>(message: [u8; 32], count: usize, len_per_ele...
function get_len_per_elem (line 233) | fn get_len_per_elem<F>(sec_param: Option<usize>) -> usize
function is_quad_residue (line 244) | fn is_quad_residue<F: IsPrimeField>(element: &FieldElement<F>) -> bool {
function min_sqrt (line 252) | fn min_sqrt<F>(element: &FieldElement<F>) -> FieldElement<F>
function max_sqrt (line 265) | fn max_sqrt<F>(element: &FieldElement<F>) -> FieldElement<F>
type Hasher (line 278) | pub trait Hasher: Clone {
method new (line 279) | fn new() -> Self;
method reset (line 280) | fn reset(&mut self);
method update (line 281) | fn update(&mut self, bytes: &[u8]);
method digest_size (line 282) | fn digest_size(&self) -> usize;
method digest (line 283) | fn digest(&self) -> Vec<u8>;
method new (line 292) | fn new() -> Self {
method reset (line 295) | fn reset(&mut self) {
method update (line 298) | fn update(&mut self, bytes: &[u8]) {
method digest_size (line 301) | fn digest_size(&self) -> usize {
method digest (line 304) | fn digest(&self) -> Vec<u8> {
type Sha256Hasher (line 287) | pub struct Sha256Hasher {
constant G1_DOMAIN (line 309) | const G1_DOMAIN: &[u8] = b"BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_";
constant DST (line 310) | const DST: &[u8] = G1_DOMAIN;
constant LONG_DST_PREFIX (line 311) | const LONG_DST_PREFIX: &[u8] = b"H2C-OVERSIZE-DST-";
constant MAX_DST_LENGTH (line 312) | const MAX_DST_LENGTH: usize = 255;
type ExpanderXmd (line 314) | pub struct ExpanderXmd<H: Hasher> {
function new (line 321) | fn new(dst: &[u8], block_size: usize) -> Self {
function construct_dst_prime (line 328) | fn construct_dst_prime(&self) -> Vec<u8> {
function expand_message_xmd (line 340) | fn expand_message_xmd(&mut self, msg: &[u8], n: u16) -> Vec<u8> {
function apply_isogeny (line 390) | fn apply_isogeny<F>(pt: G1Point<F>) -> G1Point<F>
function get_isogeny_to_g1_map (line 402) | fn get_isogeny_to_g1_map<F>() -> (RationalFunction<F>, RationalFunction<F>)
type MapToCurveHint (line 491) | pub struct MapToCurveHint {
method to_calldata (line 498) | fn to_calldata(&self) -> Vec<BigUint> {
type HashToCurveHint (line 507) | pub struct HashToCurveHint {
method to_calldata (line 513) | fn to_calldata(&self) -> Result<Vec<BigUint>, String> {
function build_hash_to_curve_hint (line 521) | fn build_hash_to_curve_hint(message: [u8; 32]) -> Result<HashToCurveHint...
function build_map_to_curve_hint (line 530) | fn build_map_to_curve_hint(u: FieldElement<BLS12381PrimeField>) -> MapTo...
function get_base_urls (line 578) | pub fn get_base_urls() -> Vec<&'static str> {
type DrandNetwork (line 587) | pub enum DrandNetwork {
function get_chain_hash (line 592) | pub fn get_chain_hash(network: DrandNetwork) -> [u8; 32] {
type CurvePoint (line 603) | pub enum CurvePoint {
method g1_point (line 609) | pub fn g1_point(&self) -> Option<&G1Point<BLS12381PrimeField>> {
method g2_point (line 615) | pub fn g2_point(&self) -> Option<&G2Point<BLS12381PrimeField, BLS12381...
function deserialize_bls_point (line 623) | pub fn deserialize_bls_point(s_string: &[u8]) -> Result<CurvePoint, Stri...
type NetworkInfo (line 691) | pub struct NetworkInfo {
function get_chain_info (line 701) | pub fn get_chain_info(chain_hash: [u8; 32]) -> Result<NetworkInfo, Strin...
type RandomnessBeacon (line 750) | pub struct RandomnessBeacon {
function from_hex (line 757) | fn from_hex(hex: &str) -> [u8; 32] {
function get_randomness (line 766) | fn get_randomness(chain_hash: [u8; 32], round_number: u64) -> Randomness...
function test_drand_round_to_calldata_1 (line 817) | fn test_drand_round_to_calldata_1() {
function test_drand_round_to_calldata_2 (line 822) | fn test_drand_round_to_calldata_2() {
function test_drand_round_to_calldata_3 (line 827) | fn test_drand_round_to_calldata_3() {
FILE: tools/garaga_rs/src/calldata/drand_tlock_calldata.rs
function drand_tlock_encrypt_calldata_builder (line 19) | pub fn drand_tlock_encrypt_calldata_builder(values: &[BigUint]) -> Resul...
type CipherText (line 58) | pub struct CipherText {
method to_calldata (line 65) | pub fn to_calldata(&self) -> Vec<BigUint> {
function encrypt_for_round (line 83) | pub fn encrypt_for_round(
function bls12381_single_pairing (line 166) | fn bls12381_single_pairing(
function expand_message_drand (line 179) | fn expand_message_drand(msg: &[u8], buf_size: usize) -> Vec<u8> {
function sha256_digest (line 214) | fn sha256_digest(data: &[u8]) -> [u8; 32] {
function get_drand_round_at (line 218) | pub fn get_drand_round_at(genesis_time: usize, period: usize, time: usiz...
function get_drand_round_time (line 223) | pub fn get_drand_round_time(genesis_time: usize, period: usize, round_nu...
function test_encrypt_for_round_1 (line 233) | fn test_encrypt_for_round_1() {
FILE: tools/garaga_rs/src/calldata/full_proof_with_hints/groth16.rs
type Groth16Proof (line 21) | pub struct Groth16Proof {
method flatten (line 31) | pub fn flatten(&self) -> Vec<BigUint> {
method from (line 39) | pub fn from(
method serialize_to_calldata (line 58) | pub fn serialize_to_calldata(&self) -> Vec<BigUint> {
method from_risc0 (line 137) | pub fn from_risc0(seal: Vec<u8>, image_id: Vec<u8>, journal: Vec<u8>) ...
method from_sp1 (line 180) | pub fn from_sp1(vkey: Vec<u8>, public_values: Vec<u8>, proof: Vec<u8>)...
type Groth16VerificationKey (line 236) | pub struct Groth16VerificationKey {
method from (line 245) | pub fn from(values: Vec<BigUint>) -> Self {
function get_sp1_vk (line 265) | pub fn get_sp1_vk() -> Groth16VerificationKey {
function get_groth16_calldata_felt (line 297) | pub fn get_groth16_calldata_felt(
function get_groth16_calldata (line 307) | pub fn get_groth16_calldata(
function calculate_vk_x (line 374) | fn calculate_vk_x(
function vk_x_handle_curve (line 386) | fn vk_x_handle_curve<F>(vk: &Groth16VerificationKey, pub_inputs: &[BigUi...
function get_risc0_vk (line 424) | pub fn get_risc0_vk() -> Groth16VerificationKey {
function split_digest (line 462) | pub fn split_digest(digest: &BigUint) -> (BigUint, BigUint) {
type ExitCode (line 475) | struct ExitCode {
type Output (line 480) | struct Output {
method digest (line 486) | fn digest(&self) -> Vec<u8> {
type ReceiptClaim (line 496) | struct ReceiptClaim {
method digest (line 506) | fn digest(&self) -> Vec<u8> {
function ok_digest (line 520) | pub fn ok_digest(image_id: &[u8], journal_digest: &[u8]) -> Vec<u8> {
function test_ok_digest_1 (line 549) | fn test_ok_digest_1() {
function test_ok_digest_2 (line 580) | fn test_ok_digest_2() {
function test_from_sp1_invalid_selector (line 603) | fn test_from_sp1_invalid_selector() {
FILE: tools/garaga_rs/src/calldata/full_proof_with_hints/zk_honk.rs
constant NUMBER_OF_SUBRELATIONS (line 21) | pub const NUMBER_OF_SUBRELATIONS: usize = 28;
constant NUMBER_OF_ALPHAS (line 22) | pub const NUMBER_OF_ALPHAS: usize = NUMBER_OF_SUBRELATIONS - 1;
constant NUMBER_OF_ENTITIES (line 23) | pub const NUMBER_OF_ENTITIES: usize = 41;
constant NUMBER_UNSHIFTED (line 24) | pub const NUMBER_UNSHIFTED: usize = 36;
constant NUMBER_TO_BE_SHIFTED (line 25) | pub const NUMBER_TO_BE_SHIFTED: usize = 5;
constant SHIFTED_COMMITMENTS_START (line 26) | pub const SHIFTED_COMMITMENTS_START: usize = 30;
constant MAX_LOG_N (line 27) | pub const MAX_LOG_N: usize = 23;
constant MAX_CIRCUIT_SIZE (line 28) | pub const MAX_CIRCUIT_SIZE: usize = 1 << MAX_LOG_N;
constant PAIRING_POINT_OBJECT_LENGTH (line 29) | pub const PAIRING_POINT_OBJECT_LENGTH: usize = 16;
constant CONST_PROOF_SIZE_LOG_N (line 30) | pub const CONST_PROOF_SIZE_LOG_N: usize = 28;
constant NUM_WITNESS_ENTITIES (line 32) | pub const NUM_WITNESS_ENTITIES: usize = 8;
constant NUM_ELEMENTS_COMM (line 33) | pub const NUM_ELEMENTS_COMM: usize = 2;
constant NUM_ELEMENTS_FR (line 34) | pub const NUM_ELEMENTS_FR: usize = 1;
function calculate_proof_size (line 37) | pub fn calculate_proof_size(log_circuit_size: usize) -> usize {
constant ZK_BATCHED_RELATION_PARTIAL_LENGTH (line 50) | pub const ZK_BATCHED_RELATION_PARTIAL_LENGTH: usize = 9;
constant SUBGROUP_SIZE (line 51) | pub const SUBGROUP_SIZE: usize = 256;
constant LIBRA_COMMITMENTS (line 52) | pub const LIBRA_COMMITMENTS: usize = 3;
constant LIBRA_EVALUATIONS (line 53) | pub const LIBRA_EVALUATIONS: usize = 4;
constant LIBRA_UNIVARIATES_LENGTH (line 54) | pub const LIBRA_UNIVARIATES_LENGTH: usize = 9;
constant VK_NUM_POINTS (line 57) | pub const VK_NUM_POINTS: usize = 28;
type HonkVerificationKey (line 59) | pub struct HonkVerificationKey {
method from_bytes (line 95) | pub fn from_bytes(vk_bytes: &[u8]) -> Result<Self, String> {
type Hasher (line 201) | pub trait Hasher {
method reset (line 202) | fn reset(&mut self);
method digest_as_bytes (line 203) | fn digest_as_bytes(&self) -> Vec<u8>;
method update_bytes (line 204) | fn update_bytes(&mut self, data: &[u8]);
method digest (line 206) | fn digest(&self) -> BigUint {
method digest_reset (line 211) | fn digest_reset(&mut self) -> Vec<u8> {
method update (line 217) | fn update(&mut self, value: &BigUint) {
method update_point (line 226) | fn update_point(&mut self, point: &G1PointBigUint) {
method reset (line 249) | fn reset(&mut self) {
method update_bytes (line 253) | fn update_bytes(&mut self, data: &[u8]) {
method digest_as_bytes (line 257) | fn digest_as_bytes(&self) -> Vec<u8> {
type KeccakHasher (line 232) | pub struct KeccakHasher {
method new (line 243) | pub fn new() -> Self {
method default (line 237) | fn default() -> Self {
type ZKHonkProof (line 276) | pub struct ZKHonkProof {
method from_bytes (line 303) | pub fn from_bytes(
method from (line 338) | pub fn from(
type ZKHonkTranscript (line 500) | pub struct ZKHonkTranscript {
method from_proof (line 517) | pub fn from_proof(
function get_zk_honk_calldata (line 539) | pub fn get_zk_honk_calldata(
function compute_zk_transcript (line 883) | fn compute_zk_transcript<T: Hasher>(
function compute_shplemini_msm_scalars (line 1040) | fn compute_shplemini_msm_scalars(
function check_evals_consistency (line 1187) | fn check_evals_consistency(
function extract_msm_scalars (line 1250) | fn extract_msm_scalars(
FILE: tools/garaga_rs/src/calldata/mod.rs
type G1PointBigUint (line 15) | pub struct G1PointBigUint {
method neg (line 29) | pub fn neg(&self, curve_id: CurveID) -> Self {
method flatten (line 36) | pub fn flatten(&self) -> Vec<BigUint> {
method from (line 39) | pub fn from(values: Vec<BigUint>) -> Self {
type G2PointBigUint (line 21) | pub struct G2PointBigUint {
method flatten (line 48) | pub fn flatten(&self) -> Vec<BigUint> {
method from (line 56) | pub fn from(values: Vec<BigUint>) -> Self {
FILE: tools/garaga_rs/src/calldata/mpc_calldata.rs
function mpc_calldata_builder (line 16) | pub fn mpc_calldata_builder(
function handle_curve (line 67) | fn handle_curve<const USE_288: bool, F, E2, E6, E12>(
function extra_miller_loop_result (line 91) | fn extra_miller_loop_result<F, E2>(public_pair: &G1G2Pair<F, E2>) -> Pol...
function multi_pairing_check_result (line 103) | fn multi_pairing_check_result<F, E2, E6, E12>(
function hash_hints_and_get_base_random_rlc_coeff (line 148) | fn hash_hints_and_get_base_random_rlc_coeff<F, E2>(
function compute_big_q_coeffs (line 225) | fn compute_big_q_coeffs<F>(
function hash_big_q_and_get_z (line 255) | fn hash_big_q_and_get_z<F, E2>(
function build_mpcheck_hint (line 275) | fn build_mpcheck_hint<F, E2, E6, E12>(
function init_hash_label (line 336) | fn init_hash_label<F: IsPrimeField + CurveParamsProvider<F>>(
function seed_transcript_with_base_rlc (line 353) | fn seed_transcript_with_base_rlc<F>(
function new_transcript_from_text (line 364) | fn new_transcript_from_text(init_hash_text: String) -> CairoPoseidonTran...
function calldata_builder (line 378) | pub fn calldata_builder<const USE_288: bool, F, E2, E6, E12>(
FILE: tools/garaga_rs/src/calldata/msm_calldata.rs
function msm_calldata_builder (line 18) | pub fn msm_calldata_builder(
function handle_curve (line 75) | fn handle_curve<F>(
function calldata_builder (line 104) | pub fn calldata_builder<F: IsPrimeField + CurveParamsProvider<F>>(
function sqrt (line 216) | fn sqrt<F>(value: &FieldElement<F>) -> FieldElement<F>
FILE: tools/garaga_rs/src/calldata/signatures.rs
function get_curve_order (line 19) | pub fn get_curve_order(curve_id: CurveID) -> BigUint {
function schnorr_calldata_builder (line 39) | pub fn schnorr_calldata_builder(
function ecdsa_calldata_builder (line 124) | pub fn ecdsa_calldata_builder(
function eddsa_calldata_builder (line 202) | pub fn eddsa_calldata_builder(
constant PKCS1_SHA256_DIGEST_INFO_PREFIX (line 350) | const PKCS1_SHA256_DIGEST_INFO_PREFIX: [u8; 19] = [
function pkcs1_v1_5_encode_sha256 (line 358) | fn pkcs1_v1_5_encode_sha256(message_hash: &[u8; 32]) -> BigUint {
function serialize_byte_array (line 371) | fn serialize_byte_array(data: &[u8]) -> Vec<BigUint> {
function rsa_2048_sha256_calldata_builder (line 405) | pub fn rsa_2048_sha256_calldata_builder(
function serialize_rsa2048_integer (line 430) | fn serialize_rsa2048_integer(x: &BigUint) -> Vec<BigUint> {
function rsa_2048_calldata_builder (line 447) | pub fn rsa_2048_calldata_builder(
function test_pkcs1_v1_5_encode_sha256_structure (line 508) | fn test_pkcs1_v1_5_encode_sha256_structure() {
function test_serialize_byte_array_empty (line 526) | fn test_serialize_byte_array_empty() {
function test_serialize_byte_array_short (line 536) | fn test_serialize_byte_array_short() {
function test_serialize_byte_array_exact_word (line 547) | fn test_serialize_byte_array_exact_word() {
function test_serialize_byte_array_multi (line 559) | fn test_serialize_byte_array_multi() {
function test_rsa_2048_sha256_calldata_pkcs_encoding (line 568) | fn test_rsa_2048_sha256_calldata_pkcs_encoding() {
FILE: tools/garaga_rs/src/constants.rs
function get_risc0_constants (line 9) | pub fn get_risc0_constants() -> (BigUint, BigUint) {
constant SP1_VERIFIER_VERSION (line 25) | pub const SP1_VERIFIER_VERSION: &str = "v5.0.0";
constant SP1_VERIFIER_HASH (line 26) | pub const SP1_VERIFIER_HASH: &str =
constant RISC0_SYSTEM_STATE_ZERO_DIGEST (line 30) | pub const RISC0_SYSTEM_STATE_ZERO_DIGEST: &str =
constant RISC0_TAG_DIGEST (line 32) | pub const RISC0_TAG_DIGEST: &str =
constant RISC0_OUTPUT_TAG (line 34) | pub const RISC0_OUTPUT_TAG: &str =
FILE: tools/garaga_rs/src/crypto/digest.rs
type HashFunction (line 25) | pub trait HashFunction: Clone + Copy + fmt::Debug + PartialEq {
method hash_pair (line 30) | fn hash_pair(left: &Self::Element, right: &Self::Element) -> Self::Ele...
method hash_single (line 31) | fn hash_single(element: &Self::Element) -> Self::Element;
method random (line 32) | fn random() -> Self::Element;
type Element (line 56) | type Element = FieldElement<GrumpkinPrimeField>;
method hash_pair (line 58) | fn hash_pair(left: &Self::Element, right: &Self::Element) -> Self::Ele...
method hash_single (line 61) | fn hash_single(element: &Self::Element) -> Self::Element {
method random (line 65) | fn random() -> Self::Element {
type PoseidonBn254Hash (line 53) | pub struct PoseidonBn254Hash;
function random_elements (line 71) | pub fn random_elements<H: HashFunction>(n: usize) -> Vec<Digest<H>> {
type Digest (line 77) | pub struct Digest<H: HashFunction>
function all_zero (line 88) | pub(crate) fn all_zero() -> Self {
function value (line 94) | pub const fn value(self) -> H::Element {
function new (line 98) | pub const fn new(element: H::Element) -> Self {
function hash_pair (line 103) | pub fn hash_pair(left: &Self, right: &Self) -> Self {
function to_element (line 109) | pub fn to_element(self) -> H::Element {
function from_element (line 113) | pub fn from_element(element: H::Element) -> Self {
method default (line 119) | fn default() -> Self {
function fmt (line 125) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type TryFromDigestError (line 168) | pub struct TryFromDigestError;
type TryFromHexDigestError (line 171) | pub struct TryFromHexDigestError;
function from (line 305) | fn from(_digest: Digest<PoseidonBn254Hash>) -> Self {
function from (line 313) | fn from(_field: FieldElement<GrumpkinPrimeField>) -> Self {
function as_ref (line 387) | fn as_ref(&self) -> &H::Element {
function arbitrary (line 393) | fn arbitrary(_u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<...
FILE: tools/garaga_rs/src/crypto/merkle_tree.rs
constant DEFAULT_PARALLELIZATION_CUTOFF (line 14) | const DEFAULT_PARALLELIZATION_CUTOFF: usize = 512;
constant MAX_NUM_NODES (line 31) | const MAX_NUM_NODES: usize = 1 << (32 - 1);
constant MAX_NUM_LEAFS (line 32) | const MAX_NUM_LEAFS: usize = MAX_NUM_NODES / 2;
constant MAX_TREE_HEIGHT (line 35) | pub const MAX_TREE_HEIGHT: usize = MAX_NUM_LEAFS.ilog2() as usize;
type Result (line 37) | type Result<T> = result::Result<T, MerkleTreeError>;
type MerkleTree (line 47) | pub struct MerkleTree<H: HashFunction> {
type MerkleTreeInclusionProof (line 56) | pub struct MerkleTreeInclusionProof<H: HashFunction> {
type PartialMerkleTree (line 95) | pub(crate) struct PartialMerkleTree<H: HashFunction> {
constant ROOT_INDEX (line 105) | pub(crate) const ROOT_INDEX: usize = 1;
function sequential_new (line 115) | pub fn sequential_new(leafs: &[Digest<H>]) -> Result<Self> {
function par_new (line 136) | pub fn par_new(leafs: &[Digest<H>]) -> Result<Self> {
function initialize_merkle_tree_nodes (line 169) | fn initialize_merkle_tree_nodes(leafs: &[Digest<H>]) -> Result<Vec<Diges...
function authentication_structure_node_indices (line 193) | fn authentication_structure_node_indices(
function authentication_structure (line 260) | pub fn authentication_structure(&self, leaf_indices: &[usize]) -> Result...
function root (line 267) | pub fn root(&self) -> Digest<H> {
function num_leafs (line 271) | pub fn num_leafs(&self) -> usize {
function height (line 277) | pub fn height(&self) -> usize {
function nodes (line 284) | pub fn nodes(&self) -> &[Digest<H>] {
function node (line 289) | pub fn node(&self, index: usize) -> Option<Digest<H>> {
function leafs (line 294) | pub fn leafs(&self) -> &[Digest<H>] {
function leaf (line 300) | pub fn leaf(&self, index: usize) -> Option<Digest<H>> {
function indexed_leafs (line 305) | pub fn indexed_leafs(&self, indices: &[usize]) -> Result<Vec<(usize, Dig...
function inclusion_proof_for_leaf_indices (line 319) | pub fn inclusion_proof_for_leaf_indices(
function arbitrary (line 343) | fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
function leaf_indices (line 355) | fn leaf_indices(&self) -> impl Iterator<Item = &usize> {
function is_trivial (line 359) | fn is_trivial(&self) -> bool {
function verify (line 365) | pub fn verify(self, expected_root: Digest<H>) -> bool {
function into_authentication_paths (line 404) | pub fn into_authentication_paths(self) -> Result<Vec<Vec<Digest<H>>>> {
function root (line 411) | pub fn root(&self) -> Result<Digest<H>> {
function node (line 418) | fn node(&self, index: usize) -> Result<Digest<H>> {
function num_leafs (line 425) | fn num_leafs(&self) -> Result<usize> {
function fill (line 438) | pub fn fill(&mut self) -> Result<()> {
function first_layer_parent_node_indices (line 453) | fn first_layer_parent_node_indices(&self) -> Result<Vec<usize>> {
function insert_digest_for_index (line 464) | fn insert_digest_for_index(&mut self, parent_index: usize) -> Result<()> {
function children_of_node (line 475) | fn children_of_node(&self, parent_index: usize) -> Result<(Digest<H>, Di...
function move_indices_one_layer_up (line 485) | fn move_indices_one_layer_up(mut indices: Vec<usize>) -> Vec<usize> {
function into_authentication_paths (line 492) | fn into_authentication_paths(self) -> Result<Vec<Vec<Digest<H>>>> {
function authentication_path_for_index (line 504) | fn authentication_path_for_index(&self, leaf_index: usize) -> Result<Vec...
type Error (line 519) | type Error = MerkleTreeError;
function try_from (line 521) | fn try_from(proof: MerkleTreeInclusionProof<H>) -> Result<Self> {
type MerkleTreeError (line 562) | pub enum MerkleTreeError {
FILE: tools/garaga_rs/src/crypto/mmr/mmr_accumulator.rs
type MmrAccumulator (line 22) | pub struct MmrAccumulator<H: HashFunction> {
function init (line 28) | pub fn init(peaks: Vec<Digest<H>>, leaf_count: u64) -> Self {
function new_from_leafs (line 32) | pub fn new_from_leafs(digests: Vec<Digest<H>>) -> Self {
function is_consistent (line 46) | pub(crate) fn is_consistent(&self) -> bool {
function bag_peaks (line 54) | fn bag_peaks(&self) -> Digest<H> {
function peaks (line 60) | fn peaks(&self) -> Vec<Digest<H>> {
function is_empty (line 65) | fn is_empty(&self) -> bool {
function num_leafs (line 70) | fn num_leafs(&self) -> u64 {
function append (line 76) | fn append(&mut self, new_leaf: Digest<H>) -> MmrMembershipProof<H> {
function mutate_leaf (line 91) | fn mutate_leaf(&mut self, leaf_mutation: LeafMutation<H>) {
function batch_mutate_leaf_and_update_mps (line 107) | fn batch_mutate_leaf_and_update_mps(
function verify_batch_update (line 236) | fn verify_batch_update(
function to_accumulator (line 300) | fn to_accumulator(&self) -> MmrAccumulator<H> {
function bag_peaks (line 308) | pub(crate) fn bag_peaks<H: HashFunction>(peaks: &[Digest<H>], leaf_count...
function mmra_with_mps (line 329) | pub fn mmra_with_mps<H: HashFunction>(
function arbitrary (line 475) | fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<S...
FILE: tools/garaga_rs/src/crypto/mmr/mmr_membership_proof.rs
type MmrMembershipProof (line 25) | pub struct MmrMembershipProof<H: HashFunction> {
function new (line 30) | pub fn new(authentication_path: Vec<Digest<H>>) -> Self {
function verify (line 37) | pub fn verify(
function get_node_indices (line 82) | pub(crate) fn get_node_indices(&self, leaf_index: u64) -> Vec<u64> {
function get_direct_path_indices (line 107) | pub(crate) fn get_direct_path_indices(&self, leaf_index: u64) -> Vec<u64> {
function get_peak_index_and_height (line 120) | fn get_peak_index_and_height(&self, leaf_index: u64) -> (u64, u32) {
function update_from_append (line 129) | pub fn update_from_append(
function batch_update_from_append (line 227) | pub fn batch_update_from_append(
function update_from_leaf_mutation (line 341) | pub fn update_from_leaf_mutation(
function batch_update_from_leaf_mutation (line 425) | pub fn batch_update_from_leaf_mutation(
function batch_update_from_batch_leaf_mutation (line 527) | pub fn batch_update_from_batch_leaf_mutation(
FILE: tools/garaga_rs/src/crypto/mmr/mmr_successor_proof.rs
type MmrSuccessorProof (line 18) | pub struct MmrSuccessorProof<H: HashFunction> {
function new_from_batch_append (line 36) | pub fn new_from_batch_append(mmra: &MmrAccumulator<H>, new_leafs: &[Dige...
function verify (line 103) | pub fn verify(&self, old: &MmrAccumulator<H>, new: &MmrAccumulator<H>) -...
function verify_internal (line 151) | fn verify_internal(
type Error (line 247) | enum Error {
FILE: tools/garaga_rs/src/crypto/mmr/mmr_trait.rs
type LeafMutation (line 9) | pub struct LeafMutation<H: HashFunction> {
function new (line 26) | pub fn new(
function affected_node_indices (line 40) | pub fn affected_node_indices(&self) -> Vec<u64> {
type Mmr (line 131) | pub trait Mmr<H: HashFunction> {
method bag_peaks (line 133) | fn bag_peaks(&self) -> Digest<H>;
method peaks (line 137) | fn peaks(&self) -> Vec<Digest<H>>;
method is_empty (line 140) | fn is_empty(&self) -> bool;
method num_leafs (line 143) | fn num_leafs(&self) -> u64;
method append (line 146) | fn append(&mut self, new_leaf: Digest<H>) -> MmrMembershipProof<H>;
method mutate_leaf (line 151) | fn mutate_leaf(&mut self, leaf_mutation: LeafMutation<H>);
method batch_mutate_leaf_and_update_mps (line 156) | fn batch_mutate_leaf_and_update_mps(
method verify_batch_update (line 165) | fn verify_batch_update(
method to_accumulator (line 174) | fn to_accumulator(&self) -> MmrAccumulator<H>;
FILE: tools/garaga_rs/src/crypto/mmr/shared_advanced.rs
function leftmost_ancestor (line 8) | pub fn leftmost_ancestor(node_index: u64) -> (u64, u32) {
function right_lineage_length_and_own_height (line 21) | pub fn right_lineage_length_and_own_height(node_index: u64) -> (u32, u32) {
function right_lineage_length_from_node_index (line 46) | pub fn right_lineage_length_from_node_index(node_index: u64) -> u32 {
function leaf_index_to_node_index (line 62) | pub fn leaf_index_to_node_index(leaf_index: u64) -> u64 {
function parent (line 69) | pub fn parent(node_index: u64) -> u64 {
function left_sibling (line 82) | pub fn left_sibling(node_index: u64, height: u32) -> u64 {
function right_sibling (line 89) | pub fn right_sibling(node_index: u64, height: u32) -> u64 {
function num_leafs_to_num_nodes (line 94) | pub fn num_leafs_to_num_nodes(num_leafs: u64) -> u64 {
function node_indices_added_by_append (line 101) | pub fn node_indices_added_by_append(old_leaf_count: u64) -> Vec<u64> {
function auth_path_node_indices (line 121) | pub fn auth_path_node_indices(num_leafs: u64, leaf_index: u64) -> Vec<u6...
function get_authentication_path_node_indices (line 155) | pub fn get_authentication_path_node_indices(
function get_peak_heights (line 198) | pub fn get_peak_heights(leaf_count: u64) -> Vec<u32> {
function get_peak_heights_and_peak_node_indices (line 222) | pub fn get_peak_heights_and_peak_node_indices(leaf_count: u64) -> (Vec<u...
function node_index_to_leaf_index (line 256) | pub fn node_index_to_leaf_index(node_index: u64) -> Option<u64> {
FILE: tools/garaga_rs/src/crypto/mmr/shared_basic.rs
constant USIZE_TO_U64_ERR (line 7) | pub(crate) const USIZE_TO_U64_ERR: &str =
constant U32_TO_USIZE_ERR (line 9) | pub(crate) const U32_TO_USIZE_ERR: &str =
function left_child (line 13) | pub fn left_child(node_index: u64, height: u32) -> u64 {
function right_child (line 18) | pub fn right_child(node_index: u64) -> u64 {
function leaf_index_to_mt_index_and_peak_index (line 31) | pub fn leaf_index_to_mt_index_and_peak_index(leaf_index: u64, num_leafs:...
function right_lineage_length_from_leaf_index (line 72) | pub fn right_lineage_length_from_leaf_index(leaf_index: u64) -> u32 {
function calculate_new_peaks_from_append (line 82) | pub fn calculate_new_peaks_from_append<H: HashFunction>(
function calculate_new_peaks_from_leaf_mutation (line 117) | pub fn calculate_new_peaks_from_leaf_mutation<H: HashFunction>(
FILE: tools/garaga_rs/src/crypto/poseidon_bn254.rs
type F (line 4) | type F = GrumpkinPrimeField;
constant T (line 7) | const T: usize = 3;
constant N_ROUNDS_F (line 8) | const N_ROUNDS_F: usize = 8;
constant N_ROUNDS_P (line 9) | const N_ROUNDS_P: usize = 57;
function poseidon_hash_bn254 (line 42) | pub fn poseidon_hash_bn254(x: &FieldElement<F>, y: &FieldElement<F>) -> ...
function sigma (line 87) | fn sigma(value: &FieldElement<F>) -> FieldElement<F> {
function ark (line 94) | fn ark(
function mix (line 106) | fn mix(state: &[FieldElement<F>], matrix: &[Vec<FieldElement<F>>]) -> Ve...
function mix_last (line 117) | fn mix_last(state: &[FieldElement<F>], matrix: &[Vec<FieldElement<F>>]) ...
function mix_s (line 124) | fn mix_s(
constant POSEIDON_M (line 144) | const POSEIDON_M: [[&str; 3]; 3] = [
constant POSEIDON_P (line 162) | const POSEIDON_P: [[&str; 3]; 3] = [
constant POSEIDON_S (line 180) | const POSEIDON_S: [&str; 285] = [
constant POSEIDON_C (line 468) | const POSEIDON_C: [&str; 81] = [
function test_poseidon_bn254 (line 557) | fn test_poseidon_bn254() {
FILE: tools/garaga_rs/src/definitions.rs
type CurveID (line 21) | pub enum CurveID {
type Error (line 31) | type Error = String;
method try_from (line 33) | fn try_from(value: u8) -> Result<Self, Self::Error> {
type Error (line 47) | type Error = String;
method try_from (line 49) | fn try_from(value: usize) -> Result<Self, Self::Error> {
type FieldElement (line 61) | pub type FieldElement<F> = Felt<F>;
type BN254PrimeField (line 62) | pub type BN254PrimeField = BNPF;
method get_curve_params (line 331) | fn get_curve_params() -> CurveParams<BN254PrimeField> {
type BLS12381PrimeField (line 63) | pub type BLS12381PrimeField = BLSPF;
method get_curve_params (line 388) | fn get_curve_params() -> CurveParams<BLS12381PrimeField> {
type Stark252PrimeField (line 64) | pub type Stark252PrimeField = StrkPF;
constant SECP256K1_PRIME_FIELD_ORDER (line 66) | pub const SECP256K1_PRIME_FIELD_ORDER: U256 =
type SECP256K1FieldModulus (line 70) | pub struct SECP256K1FieldModulus;
constant MODULUS (line 72) | const MODULUS: U256 = SECP256K1_PRIME_FIELD_ORDER;
type SECP256K1PrimeField (line 75) | pub type SECP256K1PrimeField = MontgomeryBackendPrimeField<SECP256K1Fiel...
method get_curve_params (line 185) | fn get_curve_params() -> CurveParams<SECP256K1PrimeField> {
constant SECP256R1_PRIME_FIELD_ORDER (line 77) | pub const SECP256R1_PRIME_FIELD_ORDER: U256 =
type SECP256R1FieldModulus (line 81) | pub struct SECP256R1FieldModulus;
constant MODULUS (line 83) | const MODULUS: U256 = SECP256R1_PRIME_FIELD_ORDER;
type SECP256R1PrimeField (line 86) | pub type SECP256R1PrimeField = MontgomeryBackendPrimeField<SECP256R1Fiel...
method get_curve_params (line 224) | fn get_curve_params() -> CurveParams<SECP256R1PrimeField> {
constant X25519_PRIME_FIELD_ORDER (line 88) | pub const X25519_PRIME_FIELD_ORDER: U256 =
type X25519FieldModulus (line 92) | pub struct X25519FieldModulus;
constant MODULUS (line 94) | const MODULUS: U256 = X25519_PRIME_FIELD_ORDER;
type X25519PrimeField (line 97) | pub type X25519PrimeField = MontgomeryBackendPrimeField<X25519FieldModul...
method get_curve_params (line 261) | fn get_curve_params() -> CurveParams<X25519PrimeField> {
constant GRUMPKIN_PRIME_FIELD_ORDER (line 99) | pub const GRUMPKIN_PRIME_FIELD_ORDER: U256 =
type GrumpkinFieldModulus (line 103) | pub struct GrumpkinFieldModulus;
constant MODULUS (line 105) | const MODULUS: U256 = GRUMPKIN_PRIME_FIELD_ORDER;
type GrumpkinPrimeField (line 108) | pub type GrumpkinPrimeField = MontgomeryBackendPrimeField<GrumpkinFieldM...
method get_curve_params (line 298) | fn get_curve_params() -> CurveParams<GrumpkinPrimeField> {
type Random (line 111) | pub trait Random<F: IsPrimeField> {
method random (line 112) | fn random() -> Self;
function random (line 119) | fn random() -> Self {
type CurveParams (line 133) | pub struct CurveParams<F: IsPrimeField> {
type SWUParams (line 154) | pub struct SWUParams<F: IsPrimeField> {
function get_irreducible_poly (line 160) | pub fn get_irreducible_poly<F: IsPrimeField + CurveParamsProvider<F>>(
type CurveParamsProvider (line 175) | pub trait CurveParamsProvider<F: IsPrimeField> {
method get_curve_params (line 176) | fn get_curve_params() -> CurveParams<F>;
type FromBigUint (line 180) | pub trait FromBigUint<F: IsPrimeField> {
method from_biguint (line 181) | fn from_biguint(num: BigUint) -> FieldElement<F>;
type ToWeierstrassCurve (line 435) | pub trait ToWeierstrassCurve {
method to_weirstrass (line 436) | fn to_weirstrass(
method to_weirstrass (line 456) | fn to_weirstrass(
type ToTwistedEdwardsCurve (line 445) | pub trait ToTwistedEdwardsCurve {
method to_twistededwards (line 446) | fn to_twistededwards(
method to_twistededwards (line 488) | fn to_twistededwards(
function get_modulus_from_curve_id (line 519) | pub fn get_modulus_from_curve_id(curve_id: CurveID) -> BigUint {
function test_to_weierstrass_and_back (line 536) | fn test_to_weierstrass_and_back() {
FILE: tools/garaga_rs/src/ecip/core.rs
function zk_ecip_hint (line 20) | pub fn zk_ecip_hint(
function handle_curve (line 36) | fn handle_curve<F>(
function construct_digits_vectors (line 51) | fn construct_digits_vectors<F: IsPrimeField + CurveParamsProvider<F>>(
function neg_3_base_le (line 78) | pub fn neg_3_base_le(scalar: &BigUint) -> Vec<i8> {
function floor_division (line 107) | fn floor_division(a: BigInt, b: BigInt) -> BigInt {
function run_ecip (line 117) | pub fn run_ecip<F>(points: &[G1Point<F>], scalars: &[BigUint]) -> (G1Poi...
function prepare_result (line 141) | fn prepare_result<F>(q: &G1Point<F>, sum_dlog: &FunctionFelt<F>) -> [Vec...
function line_p_p_neg (
Copy disabled (too large)
Download .json
Condensed preview — 465 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (13,734K chars).
[
{
"path": ".cargo/config.toml",
"chars": 47,
"preview": "[build]\ntarget-dir = \".cargo/garaga_rs/target\"\n"
},
{
"path": ".claude/commands/bump-version.md",
"chars": 4325,
"preview": "# Bump Garaga Version\n\nBump the garaga version across the entire codebase (Python, Rust, Cairo, TypeScript, docs).\n\n## A"
},
{
"path": ".claude/commands/upgrade-cairo.md",
"chars": 8444,
"preview": "# Upgrade Cairo Version\n\nUpgrade the Cairo/Scarb version (and optionally the Starknet Foundry version) across the entire"
},
{
"path": ".claude/skills/benchmarking-cairo/SKILL.md",
"chars": 5528,
"preview": "---\nname: benchmarking-cairo\ndescription: Use when profiling Cairo functions, measuring step counts, analyzing resource "
},
{
"path": ".claude/skills/benchmarking-cairo/installation.md",
"chars": 1512,
"preview": "# Tool Installation for Cairo Benchmarking\n\n## Scarb (Cairo build tool & package manager)\n\n```bash\n# Via asdf (recommend"
},
{
"path": ".claude/skills/benchmarking-cairo/profile.py",
"chars": 15083,
"preview": "#!/usr/bin/env python3\n\"\"\"\nCairo profiling CLI — deterministic pipeline for generating profiles.\n\nUsage:\n # snforge m"
},
{
"path": ".claude/skills/cairo-coding/SKILL.md",
"chars": 17825,
"preview": "---\nname: cairo-coding\ndescription: Use when writing or optimizing Cairo functions — fixing slow loops, expensive arithm"
},
{
"path": ".claude/skills/cairo-coding/bounded_int_calc.py",
"chars": 8523,
"preview": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nBounded Integer Implementation Calculator\n\nComputes exact type bounds"
},
{
"path": ".github/.all-contributorsrc",
"chars": 3282,
"preview": "{\n \"projectName\": \"garaga\",\n \"projectOwner\": \"keep-starknet-strange\",\n \"repoType\": \"github\",\n \"repoHost\": \"https://g"
},
{
"path": ".github/CODEOWNERS",
"chars": 35,
"preview": "* @abdelhamidbakhta @feltroidprime\n"
},
{
"path": ".github/ISSUE_TEMPLATE/01_BUG_REPORT.md",
"chars": 850,
"preview": "---\nname: Bug Report\nabout: Create a report to help Garaga to improve\ntitle: \"bug: \"\nlabels: \"bug\"\nassignees: \"\"\n---\n\n# "
},
{
"path": ".github/ISSUE_TEMPLATE/02_FEATURE_REQUEST.md",
"chars": 1064,
"preview": "---\nname: Feature Request\nabout: Suggest an idea for this project\ntitle: \"feat: \"\nlabels: \"enhancement\"\nassignees: \"\"\n--"
},
{
"path": ".github/ISSUE_TEMPLATE/03_CODEBASE_IMPROVEMENT.md",
"chars": 208,
"preview": "---\nname: Codebase improvement\nabout: Provide your feedback for the existing codebase. Suggest a better solution for alg"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 200,
"preview": "---\nblank_issues_enabled: false\ncontact_links:\n - name: Garaga Community Support\n url: https://github.com/keep-stark"
},
{
"path": ".github/PULL_REQUEST_TEMPLATE.md",
"chars": 1119,
"preview": "<!--- Please provide a general summary of your changes in the title above -->\n\n# Pull Request type\n\n<!-- Please try to l"
},
{
"path": ".github/labels.yml",
"chars": 2612,
"preview": "---\n- name: \"breaking-change\"\n color: ee0701\n description: \"A change that changes the API or breaks backward compatibi"
},
{
"path": ".github/scripts/declare_maintained_contracts.py",
"chars": 2948,
"preview": "import asyncio\nimport os\nfrom enum import Enum\nfrom pathlib import Path\n\nimport dotenv\nfrom starknet_py.net.account.acco"
},
{
"path": ".github/scripts/verify_contracts.py",
"chars": 2973,
"preview": "import ast\nimport asyncio\nimport os\nimport sys\nfrom enum import Enum\nfrom pathlib import Path\n\nimport dotenv\nfrom starkn"
},
{
"path": ".github/workflows/cairo.yml",
"chars": 2358,
"preview": "name: Cairo Workflow / publish\n\non:\n push:\n branches: [main]\n pull_request:\n workflow_dispatch:\n\njobs:\n pre_job:\n"
},
{
"path": ".github/workflows/docs-sync.yml",
"chars": 6355,
"preview": "# .github/workflows/docs-sync.yml\n#\n# Keep GitBook docs (docs/gitbook) and source code in sync.\n# ├─ create-docs-pr : "
},
{
"path": ".github/workflows/e2e.yml",
"chars": 2087,
"preview": "name: E2E-devnet\n\non:\n push:\n branches: [main]\n pull_request:\n\njobs:\n pre_job:\n # continue-on-error: true # Unc"
},
{
"path": ".github/workflows/hydra.yml",
"chars": 2938,
"preview": "name: Hydra backend test\n\non:\n push:\n branches: [main]\n pull_request:\n\njobs:\n pre_job:\n # continue-on-error: tr"
},
{
"path": ".github/workflows/labels.yml",
"chars": 406,
"preview": "---\nname: Sync labels\n\non:\n push:\n branches:\n - main\n paths:\n - .github/labels.yml\n\njobs:\n labels:\n "
},
{
"path": ".github/workflows/maturin.yml",
"chars": 6222,
"preview": "name: Maturin\non:\n push:\n tags:\n - '*'\n workflow_dispatch:\n\npermissions:\n contents: read\n\njobs:\n pre_job:\n "
},
{
"path": ".github/workflows/node.yml",
"chars": 923,
"preview": "name: NODE tests\n\non:\n push:\n branches:\n - main\n - master\n tags:\n - '*'\n pull_request:\n workflow"
},
{
"path": ".github/workflows/setup.yml",
"chars": 2482,
"preview": "name: Test make setup (cross-platform)\n\non:\n push:\n branches: [main]\n paths:\n - 'tools/make/setup.sh'\n "
},
{
"path": ".github/workflows/wasm.yml",
"chars": 4177,
"preview": "name: WASM npm publish\n\non:\n push:\n branches:\n - main\n - master\n tags:\n - '*'\n pull_request:\n wo"
},
{
"path": ".gitignore",
"chars": 818,
"preview": "*.json\n!*_input.json\n!*Proof.json\n!frobenius_*.json\n!*test_vectors.json\n__pycache__\nvenv\n*.env\n*profiling*\n*.o\n*.c\n*.so\n"
},
{
"path": ".pre-commit-config.yaml",
"chars": 1177,
"preview": "repos:\n- repo: https://github.com/PyCQA/autoflake\n rev: v2.3.1\n hooks:\n - id: autoflake\n args: [\"--i"
},
{
"path": ".secrets.template",
"chars": 210,
"preview": "SEPOLIA_RPC_URL=\"https://rpc.starknet-testnet.lava.build:443\"\nSEPOLIA_ACCOUNT_PRIVATE_KEY=0x1\nSEPOLIA_ACCOUNT_ADDRESS=0x"
},
{
"path": ".tool-versions",
"chars": 81,
"preview": "scarb 2.16.1\nstarknet-foundry 0.57.0\nstarknet-devnet 0.5.1\ncairo-profiler 0.14.0\n"
},
{
"path": "CLAUDE.md",
"chars": 2041,
"preview": "# Garaga\n\n## Project layout\n- `src/` — Cairo contracts and library (Scarb workspace, `snforge test`)\n- `tools/garaga_rs/"
},
{
"path": "Cargo.toml",
"chars": 121,
"preview": "[workspace]\nresolver = \"2\"\nmembers = [\n \"tools/garaga_rs\"\n]\n\n[profile.release]\nlto = true\ndebug = false\nopt-level = 3"
},
{
"path": "LICENSE",
"chars": 1078,
"preview": "MIT License\n\nCopyright (c) 2023 Keep StarkNet Strange\n\nPermission is hereby granted, free of charge, to any person obtai"
},
{
"path": "Makefile",
"chars": 1759,
"preview": "SHELL := /bin/bash\nACTIVATE := source venv/bin/activate &&\n\n.PHONY: build test coverage run run-profile generate-constan"
},
{
"path": "README.md",
"chars": 37834,
"preview": "<div align=\"center\">\n <h1>Garaga</h1>\n <img src=\"docs/images/logo.png\" height=\"200\">\n <br />\n <a href=\"https://githu"
},
{
"path": "Scarb.toml",
"chars": 240,
"preview": "[workspace]\nmembers = [\n \"src/\",\n \"src/corelib_imports\",\n]\n\n[workspace.dependencies]\ncairo_test = \"2.16.1\"\nstarkne"
},
{
"path": "docs/CODE_OF_CONDUCT.md",
"chars": 3428,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
},
{
"path": "docs/CONTRIBUTING.md",
"chars": 2302,
"preview": "# Contributing\n\nWhen contributing to this repository, please first discuss the change you wish to make via issue, email,"
},
{
"path": "docs/PYPI_README.md",
"chars": 1525,
"preview": "# Garaga 🐺\n\nState-of-the-art Elliptic Curve operations and SNARKS verification for Cairo & Starknet.\n\n## Quick Start\n\n``"
},
{
"path": "docs/SECURITY.md",
"chars": 781,
"preview": "# Security Policy\n\n## Reporting a Vulnerability\n\nIf there are any vulnerabilities in **Garaga**, don't hesitate to _repo"
},
{
"path": "docs/benchmarks/test_summary.json",
"chars": 33601,
"preview": "{\n \"test_trailing_ones\": {\n \"last_updated\": \"2025-10-30T15:26:00.944704\",\n \"latest_metrics\": {\n \"test_name_h"
},
{
"path": "docs/gitbook/README.md",
"chars": 7984,
"preview": "# Garaga\n\n<figure><img src=\".gitbook/assets/logo.png\" alt=\"Garaga Logo\" width=\"200\"><figcaption></figcaption></figure>\n\n"
},
{
"path": "docs/gitbook/SUMMARY.md",
"chars": 2607,
"preview": "# Table of contents\n\n* [Garaga](README.md)\n* [Building Powerful Applications](building-powerful-applications.md)\n* [Secu"
},
{
"path": "docs/gitbook/building-powerful-applications.md",
"chars": 11639,
"preview": "---\nicon: rocket\n---\n\n# Building Powerful Applications\n\nGaraga's cryptographic primitives enable a wide range of powerfu"
},
{
"path": "docs/gitbook/developer-setup-and-guides/README.md",
"chars": 3338,
"preview": "---\nicon: wrench\n---\n\n# Developer setup & guides\n\n### Installation\n\nTo work with Garaga, you need the following dependen"
},
{
"path": "docs/gitbook/developer-setup-and-guides/garaga-rs-crate/README.md",
"chars": 4762,
"preview": "---\nicon: crab\n---\n\n# garaga-rs crate\n\nThe `garaga_rs` crate is the performance-critical Rust library that powers Garaga"
},
{
"path": "docs/gitbook/developer-setup-and-guides/garaga-rs-crate/rust-greater-than-python-bindings.md",
"chars": 4664,
"preview": "# Rust -> Python bindings\n\nThis guide explains how to add new Python bindings for Rust functions in the `garaga_rs` crat"
},
{
"path": "docs/gitbook/developer-setup-and-guides/garaga-rs-crate/rust-greater-than-wasm-bindings.md",
"chars": 5987,
"preview": "# Rust -> Wasm bindings\n\nThis guide explains how to add new WASM bindings for Rust functions in the `garaga_rs` crate.\n\n"
},
{
"path": "docs/gitbook/developer-setup-and-guides/working-with-auto-generated-cairo-code.md",
"chars": 11016,
"preview": "---\nicon: wand-sparkles\n---\n\n# Working with auto-generated Cairo Code\n\n### Developer workflow\n\nIf working with the pytho"
},
{
"path": "docs/gitbook/installation/README.md",
"chars": 1661,
"preview": "---\nicon: gear\n---\n\n# Installation\n\nGaraga is available in multiple formats for different use cases:\n\n| Package | Use Ca"
},
{
"path": "docs/gitbook/installation/cairo-library.md",
"chars": 2358,
"preview": "---\nicon: sparkles\n---\n\n# Cairo Library\n\nThe Garaga Cairo library is available on the [scarbs.xyz registry](https://scar"
},
{
"path": "docs/gitbook/installation/developer-setup.md",
"chars": 1373,
"preview": "---\nicon: wrench\n---\n\n# Developer setup\n\nTo work with Garaga, you need the following dependencies : \n\n* [Rust](http"
},
{
"path": "docs/gitbook/installation/npm-package.md",
"chars": 2674,
"preview": "---\nicon: js\n---\n\n# Npm package\n\nGaraga is available as an npm package, making it easy to integrate into your Node.js pr"
},
{
"path": "docs/gitbook/installation/python-package.md",
"chars": 2797,
"preview": "---\nicon: python\n---\n\n# Python package\n\n## Install the latest released version of the CLI\n\n{% hint style=\"info\" %}\nPyPi "
},
{
"path": "docs/gitbook/installation/rust-crate.md",
"chars": 1287,
"preview": "---\nicon: rust\n---\n\n# Rust Crate\n\nTo use the [`garaga_rs`](https://github.com/keep-starknet-strange/garaga/tree/main/too"
},
{
"path": "docs/gitbook/maintained-smart-contracts/README.md",
"chars": 3823,
"preview": "---\nicon: file-lock\n---\n\n# Maintained Smart Contracts\n\nWe declare & maintain Smart Contracts for the community so they c"
},
{
"path": "docs/gitbook/maintained-smart-contracts/drand.md",
"chars": 17334,
"preview": "---\nicon: dice\n---\n\n# Drand\n\nGaraga provides maintained contracts for the [drand](https://drand.love) distributed random"
},
{
"path": "docs/gitbook/maintained-smart-contracts/risczero.md",
"chars": 19243,
"preview": "---\nicon: microchip\n---\n\n# RiscZero\n\nRiscZero is a Zero-Knowledge Proof system designed to enable efficient and scalable"
},
{
"path": "docs/gitbook/maintained-smart-contracts/sp1.md",
"chars": 665,
"preview": "---\nicon: microchip\n---\n\n# SP1\n\nTo use the SP1 Groth16 verifier on Starknet, you can follow code snippets from the [SP1 "
},
{
"path": "docs/gitbook/security.md",
"chars": 5795,
"preview": "---\nicon: shield-check\n---\n\n# Security\n\nGaraga is designed with security as a primary concern. This page documents our s"
},
{
"path": "docs/gitbook/smart-contract-generators/README.md",
"chars": 153,
"preview": "---\nicon: monero\n---\n\n# Deploy your own SNARK verifier on Starknet\n\nSupported verifiers:\n\n* [groth16](groth16/ \"mention\""
},
{
"path": "docs/gitbook/smart-contract-generators/groth16/README.md",
"chars": 30,
"preview": "---\nicon: bat\n---\n\n# Groth16\n\n"
},
{
"path": "docs/gitbook/smart-contract-generators/groth16/generate-and-deploy-your-verifier-contract.md",
"chars": 13269,
"preview": "---\nicon: file-lock\n---\n\n# Generate and deploy your verifier contract\n\n## Prepare your Groth16 verifying key\n\n{% hint st"
},
{
"path": "docs/gitbook/smart-contract-generators/groth16/generating-calldata-from-a-proof-and-using-your-deployed-contract/README.md",
"chars": 4528,
"preview": "---\nicon: microchip\n---\n\n# Generating calldata from a proof and using your deployed contract\n\n{% hint style=\"warning\" %}"
},
{
"path": "docs/gitbook/smart-contract-generators/groth16/generating-calldata-from-a-proof-and-using-your-deployed-contract/using-python-garaga-cli.md",
"chars": 1851,
"preview": "# Using Python/Garaga CLI\n\nUsing the `garaga calldata` command from the CLI, you can generate the calldata needed to ver"
},
{
"path": "docs/gitbook/smart-contract-generators/groth16/generating-calldata-from-a-proof-and-using-your-deployed-contract/using-rust.md",
"chars": 2019,
"preview": "# Using Rust\n\nAdd the [rust-crate.md](../../../installation/rust-crate.md \"mention\") to your project.\n\n```rust\n// Versio"
},
{
"path": "docs/gitbook/smart-contract-generators/groth16/generating-calldata-from-a-proof-and-using-your-deployed-contract/using-typescript.md",
"chars": 1747,
"preview": "# Using Typescript\n\nUsing the `garaga` [npm-package.md](../../../installation/npm-package.md \"mention\")\n\n## Node.js (wit"
},
{
"path": "docs/gitbook/smart-contract-generators/noir.md",
"chars": 7874,
"preview": "---\nicon: octopus\n---\n\n# Noir\n\n## Requirements (read carefully to avoid 99% of issues!)\n\n* Garaga CLI [python-package.md"
},
{
"path": "docs/gitbook/support.md",
"chars": 447,
"preview": "---\nicon: message-question\n---\n\n# Support\n\n* Is something unclear ? \n* Spotted a bug ? \n* Need help on a speci"
},
{
"path": "docs/gitbook/updating-these-docs.md",
"chars": 1224,
"preview": "---\nicon: file-doc\n---\n\n# Updating these docs\n\n### Overview\n\nGitbook website is synced with the `docs` branch.\n\nDocument"
},
{
"path": "docs/gitbook/using-garaga-libraries-in-your-cairo-project/README.md",
"chars": 5772,
"preview": "---\nicon: arrow-down-to-bracket\n---\n\n# Using Garaga Libraries in Your Cairo Project\n\nGaraga provides a powerful Cairo li"
},
{
"path": "docs/gitbook/using-garaga-libraries-in-your-cairo-project/ec-multi-scalar-multiplication.md",
"chars": 6045,
"preview": "---\nhidden: true\nicon: florin-sign\n---\n\n# EC (Multi)-Scalar Multiplication\n\nFor a given elliptic curve, scalar multiplic"
},
{
"path": "docs/gitbook/using-garaga-libraries-in-your-cairo-project/ec-signatures.md",
"chars": 12795,
"preview": "---\nicon: pen-field\n---\n\n# ECDSA, Schnorr & EdDSA Signatures\n\nAll three signature schemes follow a similar pattern with "
},
{
"path": "docs/gitbook/using-garaga-libraries-in-your-cairo-project/hashing-functions.md",
"chars": 3708,
"preview": "---\nicon: binary-circle-check\n---\n\n# Hashing functions\n\nGaraga provides implementations of common hash functions optimiz"
},
{
"path": "docs/gitbook/using-garaga-libraries-in-your-cairo-project/rsa-signatures.md",
"chars": 8131,
"preview": "---\nicon: key\n---\n\n# RSA-2048 Signature Verification\n\nGaraga provides on-chain RSA-2048 signature verification using mul"
},
{
"path": "hydra/garaga/algebra.py",
"chars": 36782,
"preview": "from __future__ import annotations\n\nimport random\nfrom dataclasses import dataclass\nfrom typing import Generic, TypeVar\n"
},
{
"path": "hydra/garaga/curves.py",
"chars": 23082,
"preview": "from dataclasses import dataclass\nfrom enum import Enum\nfrom typing import TypeAlias\n\nfrom garaga.algebra import BaseFie"
},
{
"path": "hydra/garaga/drand/client.py",
"chars": 10657,
"preview": "import binascii\nimport functools\nimport hashlib\nimport random\nfrom dataclasses import dataclass\nfrom enum import Enum\nfr"
},
{
"path": "hydra/garaga/drand/tlock.py",
"chars": 7598,
"preview": "import hashlib\nimport secrets\nfrom dataclasses import dataclass\nfrom typing import Optional\n\nfrom garaga.curves import C"
},
{
"path": "hydra/garaga/extension_field_modulo_circuit.py",
"chars": 30007,
"preview": "from dataclasses import dataclass, field\nfrom enum import Enum\n\nfrom garaga.algebra import Polynomial, PyFelt\nfrom garag"
},
{
"path": "hydra/garaga/hints/bls.py",
"chars": 1921,
"preview": "from math import gcd\n\nfrom garaga.curves import CURVES, CurveID\nfrom garaga.hints.tower_backup import E12\n\n\"\"\"\nThe goal "
},
{
"path": "hydra/garaga/hints/ecip.py",
"chars": 24181,
"preview": "from __future__ import annotations\n\nimport functools\nfrom dataclasses import dataclass\n\nfrom garaga import garaga_rs\nfro"
},
{
"path": "hydra/garaga/hints/eisenstein.py",
"chars": 13026,
"preview": "\"\"\"\n-----------------------------------------------------------------------------\nε – Eisenstein integers in pure Python"
},
{
"path": "hydra/garaga/hints/extf_mul.py",
"chars": 3884,
"preview": "from garaga import garaga_rs\nfrom garaga.algebra import ModuloCircuitElement, Polynomial, PyFelt\nfrom garaga.hints.tower"
},
{
"path": "hydra/garaga/hints/fake_glv.py",
"chars": 31652,
"preview": "#!/usr/bin/env python3\n\nimport math\nfrom dataclasses import dataclass\nfrom typing import List, Tuple\n\nimport garaga.hint"
},
{
"path": "hydra/garaga/hints/frobenius.py",
"chars": 44091,
"preview": "from functools import lru_cache\n\nfrom garaga.algebra import BaseField, Polynomial, PyFelt\nfrom garaga.curves import CURV"
},
{
"path": "hydra/garaga/hints/io.py",
"chars": 11256,
"preview": "import functools\n\nfrom garaga.algebra import FunctionFelt, ModuloCircuitElement, PyFelt\n\nPRIME = 2**251 + 17 * 2**192 + "
},
{
"path": "hydra/garaga/hints/keccak256.py",
"chars": 8771,
"preview": "from copy import deepcopy\nfrom functools import reduce\nfrom math import log\nfrom operator import xor\n\n# The Keccak-f rou"
},
{
"path": "hydra/garaga/hints/multi_miller_witness.py",
"chars": 7473,
"preview": "import math\n\nfrom garaga import garaga_rs\nfrom garaga.algebra import PyFelt\nfrom garaga.curves import CURVES, CurveID\nfr"
},
{
"path": "hydra/garaga/hints/neg_3.py",
"chars": 2566,
"preview": "def neg_3_base_le(scalar: int) -> list[int]:\n \"\"\"\n Decomposes a scalar into base -3 representation.\n :param sca"
},
{
"path": "hydra/garaga/hints/tower_backup.py",
"chars": 15830,
"preview": "\"\"\"\nTower based arithmetic for BN254 and BLS12-381 on Fq2, Fq6, Fq12.\n\"\"\"\n\nimport random\nfrom dataclasses import datacla"
},
{
"path": "hydra/garaga/modulo_circuit.py",
"chars": 53201,
"preview": "from dataclasses import dataclass, field\nfrom enum import Enum, auto\nfrom typing import List, Union\n\nfrom garaga.algebra"
},
{
"path": "hydra/garaga/modulo_circuit_structs.py",
"chars": 47730,
"preview": "from __future__ import annotations\n\nfrom abc import ABC, abstractmethod\nfrom dataclasses import dataclass\nfrom typing im"
},
{
"path": "hydra/garaga/points.py",
"chars": 26594,
"preview": "import functools\nimport random\nfrom dataclasses import dataclass\n\nfrom fastecdsa import curvemath\n\nfrom garaga.algebra i"
},
{
"path": "hydra/garaga/poseidon_transcript.py",
"chars": 5998,
"preview": "from typing import Iterable\n\nfrom garaga import garaga_rs\nfrom garaga.algebra import ModuloCircuitElement, PyFelt\nfrom g"
},
{
"path": "hydra/garaga/precompiled_circuits/all_circuits.py",
"chars": 24985,
"preview": "from enum import Enum\nfrom pathlib import Path\n\nfrom garaga.curves import CurveID\nfrom garaga.precompiled_circuits.compi"
},
{
"path": "hydra/garaga/precompiled_circuits/cofactor_clearing.py",
"chars": 22559,
"preview": "from garaga.algebra import ModuloCircuitElement\nfrom garaga.curves import CurveID\nfrom garaga.precompiled_circuits.ec im"
},
{
"path": "hydra/garaga/precompiled_circuits/compilable_circuits/apply_isogeny.py",
"chars": 1170,
"preview": "import garaga.modulo_circuit_structs as structs\nfrom garaga.curves import CurveID\nfrom garaga.precompiled_circuits.compi"
},
{
"path": "hydra/garaga/precompiled_circuits/compilable_circuits/base.py",
"chars": 14984,
"preview": "import re\nimport subprocess\nfrom abc import ABC, abstractmethod\nfrom concurrent.futures import ProcessPoolExecutor\nfrom "
},
{
"path": "hydra/garaga/precompiled_circuits/compilable_circuits/cairo1_mpcheck_circuits.py",
"chars": 43120,
"preview": "from abc import ABC, abstractmethod\nfrom typing import Dict, List, Optional, Tuple, Type, Union\n\nimport garaga.modulo_ci"
},
{
"path": "hydra/garaga/precompiled_circuits/compilable_circuits/cairo1_tower_pairing.py",
"chars": 33128,
"preview": "from abc import ABC, abstractmethod\nfrom typing import Dict, List, Optional, Tuple, Type, Union\n\nimport garaga.modulo_ci"
},
{
"path": "hydra/garaga/precompiled_circuits/compilable_circuits/common_cairo_fustat_circuits.py",
"chars": 45671,
"preview": "from random import randint\n\nimport garaga.modulo_circuit_structs as structs\nfrom garaga.curves import CURVES, CurveID\nfr"
},
{
"path": "hydra/garaga/precompiled_circuits/compilable_circuits/rsa.py",
"chars": 4846,
"preview": "from random import randrange\n\nfrom garaga.modulo_circuit import ModuloCircuit, WriteOps\nfrom garaga.modulo_circuit_struc"
},
{
"path": "hydra/garaga/precompiled_circuits/compilable_circuits/ultra_honk.py",
"chars": 18758,
"preview": "from abc import abstractmethod\nfrom typing import Dict, Tuple, Type, Union\n\nimport garaga.modulo_circuit_structs as stru"
},
{
"path": "hydra/garaga/precompiled_circuits/ec.py",
"chars": 33861,
"preview": "import sympy\n\nfrom garaga.curves import CURVES\nfrom garaga.modulo_circuit import ModuloCircuit, ModuloCircuitElement, Py"
},
{
"path": "hydra/garaga/precompiled_circuits/final_exp.py",
"chars": 16829,
"preview": "\"\"\"\nDeprecated Final Exp Circuits since we now use the final exp witness.\nKept for reference/in case we need it in the f"
},
{
"path": "hydra/garaga/precompiled_circuits/fp2.py",
"chars": 10371,
"preview": "from garaga.algebra import Fp2, ModuloCircuitElement\nfrom garaga.hints.extf_mul import nondeterministic_extension_field_"
},
{
"path": "hydra/garaga/precompiled_circuits/isogeny.py",
"chars": 4134,
"preview": "from garaga.curves import CURVES, CurveID\nfrom garaga.extension_field_modulo_circuit import ModuloCircuitElement\nfrom ga"
},
{
"path": "hydra/garaga/precompiled_circuits/map_to_curve.py",
"chars": 24003,
"preview": "from garaga.algebra import PyFelt\nfrom garaga.curves import CURVES\nfrom garaga.extension_field_modulo_circuit import Mod"
},
{
"path": "hydra/garaga/precompiled_circuits/miller_tower.py",
"chars": 20658,
"preview": "from typing import Iterator\n\nfrom garaga.curves import BLS12_381_ID, BN254_ID, CURVES\nfrom garaga.extension_field_modulo"
},
{
"path": "hydra/garaga/precompiled_circuits/multi_miller_loop.py",
"chars": 29116,
"preview": "from typing import Iterator, Tuple\n\nfrom garaga.curves import BLS12_381_ID, BN254_ID, CURVES, CurveID\nfrom garaga.extens"
},
{
"path": "hydra/garaga/precompiled_circuits/multi_pairing_check.py",
"chars": 21914,
"preview": "from garaga.algebra import get_sparsity\nfrom garaga.curves import CURVES, CurveID, get_base_field\nfrom garaga.hints.frob"
},
{
"path": "hydra/garaga/precompiled_circuits/poseidon_bn254.py",
"chars": 34020,
"preview": "from garaga.curves import CurveID, get_base_field\nfrom garaga.modulo_circuit import ModuloCircuit, ModuloCircuitElement\n"
},
{
"path": "hydra/garaga/precompiled_circuits/zk_honk.py",
"chars": 91064,
"preview": "from abc import ABC, abstractmethod\nfrom dataclasses import dataclass, fields\nfrom enum import Enum, auto\n\nimport garaga"
},
{
"path": "hydra/garaga/rsa_rns.py",
"chars": 25857,
"preview": "\"\"\"RSA-2048 signature verification via RNS arithmetic and CRT exactness.\n\nImplements RSA-2048 modular exponentiation ver"
},
{
"path": "hydra/garaga/signature.py",
"chars": 23534,
"preview": "\"\"\"\nVarious tools for bls signatures or other signature schemes.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport hashlib"
},
{
"path": "hydra/garaga/starknet/cli/declare.py",
"chars": 2785,
"preview": "import asyncio\nimport os\nfrom pathlib import Path\nfrom typing import Annotated\n\nimport rich\nimport typer\nfrom dotenv imp"
},
{
"path": "hydra/garaga/starknet/cli/deploy.py",
"chars": 4829,
"preview": "import asyncio\nfrom pathlib import Path\nfrom typing import Annotated, Optional\n\nimport rich\nimport typer\nfrom dotenv imp"
},
{
"path": "hydra/garaga/starknet/cli/gen.py",
"chars": 9157,
"preview": "import subprocess\nfrom pathlib import Path\nfrom typing import Annotated\n\nimport typer\nfrom rich import print\nfrom rich.c"
},
{
"path": "hydra/garaga/starknet/cli/smart_contract_project.py",
"chars": 5565,
"preview": "import functools\nfrom dataclasses import dataclass\nfrom pathlib import Path\n\nimport filelock\nimport starknet_py\nfrom sta"
},
{
"path": "hydra/garaga/starknet/cli/starknet_cli.py",
"chars": 1153,
"preview": "from typing import Optional\n\nimport typer\n\nfrom garaga.starknet.cli.declare import declare\nfrom garaga.starknet.cli.depl"
},
{
"path": "hydra/garaga/starknet/cli/utils.py",
"chars": 8714,
"preview": "import asyncio\nimport glob\nimport json\nimport os\nimport shutil\nimport subprocess\nimport tempfile\nimport time\nfrom enum i"
},
{
"path": "hydra/garaga/starknet/cli/verify.py",
"chars": 7984,
"preview": "import asyncio\nfrom enum import Enum\nfrom pathlib import Path\nfrom typing import Annotated\n\nimport rich\nimport typer\nfro"
},
{
"path": "hydra/garaga/starknet/constants.py",
"chars": 1207,
"preview": "\"\"\"\nAuto-generated constants file from constants.json. Do not edit manually.\n\"\"\"\n\n# RISC0 Constants\n# https://github.com"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/calldata.py",
"chars": 3580,
"preview": "from garaga import garaga_rs\nfrom garaga.points import G1G2Pair, G1Point\nfrom garaga.starknet.groth16_contract_generator"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/gnark_proof_bn254.json",
"chars": 877,
"preview": "{\n \"Ar\": {\n \"X\": \"73845398786533896737633575350679623829088256804727703196883312716046720173\",\n \"Y\": \"39291264614"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/gnark_public_bn254.json",
"chars": 15,
"preview": "{\"Y\":35,\"A\":3}\n"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/gnark_vk_bn254.json",
"chars": 3541,
"preview": "{\n \"G1\": {\n \"Alpha\": {\n \"X\": \"14022946795448417392013625865802801176898886310466431149831115687134146367641\",\n "
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/proof_bls.json",
"chars": 1254,
"preview": "{\n \"elliptic_curve_id\": \"bls12_381\",\n \"proof\": {\n \"a\": {\n \"x\": \"0x10d63379d266db8045f5c728dfa7fc"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/proof_bn254.json",
"chars": 995,
"preview": "{\n \"elliptic_curve_id\": \"bn254\",\n \"proof\": {\n \"a\": {\n \"x\": \"0x2abaae3dd6e4c662f5e071bca525a26d21"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/proof_risc0.json",
"chars": 690,
"preview": "{\n \"seal\": \"0xbb001d441cb19c0439e5cb54ab7dd4d4e0cd8c4809abe8e19ba602b4ce8728dc9e2eafbe27eac14be5e561f6cd697429d0567a4"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/proof_sp1.json",
"chars": 886,
"preview": "{\n \"a\": 6765,\n \"b\": 10946,\n \"n\": 20,\n \"vkey\": \"0x00e00f8bf845ce217630ab77a3351d3f099d2856198792afcc16af2182c"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/snarkjs_proof_bls12381.json",
"chars": 1265,
"preview": "{\n \"pi_a\": [\n \"34851529544087417419268470898310595913839076302391167849954367381898659551208855561992364060384"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/snarkjs_proof_bn254.json",
"chars": 807,
"preview": "{\n \"pi_a\": [\n \"16867095230114469303111269582801754677348924111782514818746093562477643731718\",\n \"202127223355827189026"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/snarkjs_public_bls12381.json",
"chars": 11,
"preview": "[\n \"33\"\n]\n"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/snarkjs_public_bn254.json",
"chars": 48,
"preview": "[\n \"4949495449574848545353525153565755490000\"\n]\n"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/snarkjs_vk_bls12381.json",
"chars": 4767,
"preview": "{\n \"protocol\": \"groth16\",\n \"curve\": \"bls12381\",\n \"nPublic\": 1,\n \"vk_alpha_1\": [\n \"6177198943578227072"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/snarkjs_vk_bn254.json",
"chars": 3613,
"preview": "{\n \"protocol\": \"groth16\",\n \"curve\": \"bn128\",\n \"nPublic\": 1,\n \"vk_alpha_1\": [\n \"2049119280539048529915"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/vk_bls.json",
"chars": 2615,
"preview": "{\n \"elliptic_curve_id\": \"bls12_381\",\n \"verifying_key\": {\n \"alpha_g1\": {\n \"x\": \"0xfda482e4d7d7cfe"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/vk_bn254.json",
"chars": 2037,
"preview": "{\n \"elliptic_curve_id\": \"bn254\",\n \"verifying_key\": {\n \"alpha_g1\": {\n \"x\": \"0xef3cb41414ad20b4fc5"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/vk_risc0.json",
"chars": 3157,
"preview": "{\n \"elliptic_curve_id\": \"bn254\",\n \"verifying_key\": {\n \"alpha_g1\": {\n \"x\": \"204911928053904852991"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/examples/vk_sp1.json",
"chars": 2461,
"preview": "{\n \"elliptic_curve_id\": \"bn254\",\n \"verifying_key\": {\n \"alpha_g1\": {\n \"x\": \"204911928053904852991"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/generator.py",
"chars": 18266,
"preview": "import os\nimport subprocess\nfrom pathlib import Path\n\nfrom garaga.curves import CurveID, ProofSystem\nfrom garaga.modulo_"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/generator_risc0.py",
"chars": 8080,
"preview": "import os\n\nfrom garaga.curves import ProofSystem\nfrom garaga.modulo_circuit_structs import G1PointCircuit\nfrom garaga.st"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/generator_sp1.py",
"chars": 10066,
"preview": "import os\nfrom textwrap import dedent\n\nfrom garaga.curves import ProofSystem\nfrom garaga.starknet.groth16_contract_gener"
},
{
"path": "hydra/garaga/starknet/groth16_contract_generator/parsing_utils.py",
"chars": 26899,
"preview": "import codecs\nimport dataclasses\nimport hashlib\nimport json\nimport os\nfrom pathlib import Path\nfrom typing import Any, L"
},
{
"path": "hydra/garaga/starknet/honk_contract_generator/calldata.py",
"chars": 5806,
"preview": "from garaga import garaga_rs\nfrom garaga.curves import ProofSystem\nfrom garaga.points import G1G2Pair\nfrom garaga.precom"
},
{
"path": "hydra/garaga/starknet/honk_contract_generator/generator_honk.py",
"chars": 23610,
"preview": "import argparse\nimport os\nfrom pathlib import Path\n\nfrom garaga.curves import CurveID, ProofSystem\nfrom garaga.modulo_ci"
},
{
"path": "hydra/garaga/starknet/tests_and_calldata_generators/drand_calldata.py",
"chars": 3480,
"preview": "import secrets\nfrom pathlib import Path\nfrom typing import Optional\n\nimport garaga.hints.io as io\nfrom garaga import gar"
},
{
"path": "hydra/garaga/starknet/tests_and_calldata_generators/map_to_curve.py",
"chars": 3597,
"preview": "from dataclasses import dataclass\n\nfrom garaga.algebra import PyFelt\nfrom garaga.curves import CURVES, CurveID, get_base"
},
{
"path": "hydra/garaga/starknet/tests_and_calldata_generators/mpcheck.py",
"chars": 14912,
"preview": "import functools\nfrom dataclasses import dataclass\nfrom functools import lru_cache\n\nfrom garaga import garaga_rs\nfrom ga"
},
{
"path": "hydra/garaga/starknet/tests_and_calldata_generators/msm.py",
"chars": 6955,
"preview": "from dataclasses import dataclass\nfrom functools import lru_cache\n\nfrom garaga import garaga_rs\nfrom garaga import modul"
},
{
"path": "hydra/garaga/starknet/tests_and_calldata_generators/signatures.py",
"chars": 22607,
"preview": "import random\nfrom dataclasses import dataclass\nfrom functools import lru_cache\nfrom hashlib import sha512\n\nfrom garaga "
},
{
"path": "hydra/garaga/starknet/tests_and_calldata_generators/test_writer.py",
"chars": 16461,
"preview": "import concurrent.futures\nimport json\nimport random\nimport subprocess\nimport time\n\nimport garaga.modulo_circuit_structs "
},
{
"path": "pyproject.toml",
"chars": 2944,
"preview": "[build-system]\nrequires = [\"maturin>=1.7,<2.0\"]\nbuild-backend = \"maturin\"\n\n[project]\nname = \"garaga\"\nversion = \"1.1.0\"\nr"
},
{
"path": "src/.tool-versions",
"chars": 37,
"preview": "scarb 2.16.1\nstarknet-foundry 0.57.0\n"
},
{
"path": "src/Scarb.toml",
"chars": 932,
"preview": "[package]\nname = \"garaga\"\nversion = \"1.1.0\"\nedition = \"2024_07\"\nlicence = \"MIT\"\nkeywords = [\n \"zk\",\n \"snarks\",\n "
},
{
"path": "src/contracts/autogenerated/groth16_example_bls12_381/.tool-versions",
"chars": 37,
"preview": "scarb 2.16.1\nstarknet-foundry 0.57.0\n"
},
{
"path": "src/contracts/autogenerated/groth16_example_bls12_381/Scarb.toml",
"chars": 386,
"preview": "# Generated by Garaga version 1.1.0\n[package]\nname = \"groth16_example_bls12_381\"\nversion = \"0.1.0\"\nedition = \"2024_07\"\n\n"
},
{
"path": "src/contracts/autogenerated/groth16_example_bls12_381/src/groth16_verifier.cairo",
"chars": 4084,
"preview": "// Generated by Garaga version 1.1.0\n\nuse super::groth16_verifier_constants::{N_PUBLIC_INPUTS, ic, precomputed_lines, vk"
},
{
"path": "src/contracts/autogenerated/groth16_example_bls12_381/src/groth16_verifier_constants.cairo",
"chars": 127625,
"preview": "// Generated by Garaga version 1.1.0\n\nuse garaga::definitions::{E12D, G1Point, G2Line, G2Point, u384};\nuse garaga::groth"
},
{
"path": "src/contracts/autogenerated/groth16_example_bls12_381/src/lib.cairo",
"chars": 100,
"preview": "// Generated by Garaga version 1.1.0\n\npub mod groth16_verifier;\npub mod groth16_verifier_constants;\n"
},
{
"path": "src/contracts/autogenerated/groth16_example_bls12_381/tests/proof_calldata.txt",
"chars": 59057,
"preview": "0xfbf04de06661c03aa78411a8\n0xdd8cfcb8222f03b0e4b380fc\n0xdfa7fccf252d7a8b8f12403e\n0x10d63379d266db8045f5c728\n0x60db2dd06e"
},
{
"path": "src/contracts/autogenerated/groth16_example_bls12_381/tests/test_contract.cairo",
"chars": 3613,
"preview": "// Generated by Garaga version 1.1.0\n\n//! # Starknet Verification Contract Tests\n//!\n//! This module contains comprehens"
},
{
"path": "src/contracts/autogenerated/groth16_example_bn254/.tool-versions",
"chars": 37,
"preview": "scarb 2.16.1\nstarknet-foundry 0.57.0\n"
},
{
"path": "src/contracts/autogenerated/groth16_example_bn254/Scarb.toml",
"chars": 382,
"preview": "# Generated by Garaga version 1.1.0\n[package]\nname = \"groth16_example_bn254\"\nversion = \"0.1.0\"\nedition = \"2024_07\"\n\n[dep"
},
{
"path": "src/contracts/autogenerated/groth16_example_bn254/src/groth16_verifier.cairo",
"chars": 4040,
"preview": "// Generated by Garaga version 1.1.0\n\nuse super::groth16_verifier_constants::{N_PUBLIC_INPUTS, ic, precomputed_lines, vk"
},
{
"path": "src/contracts/autogenerated/groth16_example_bn254/src/groth16_verifier_constants.cairo",
"chars": 124023,
"preview": "// Generated by Garaga version 1.1.0\n\nuse garaga::definitions::{E12D, G1Point, G2Line, G2Point, u288, u384};\nuse garaga:"
},
{
"path": "src/contracts/autogenerated/groth16_example_bn254/src/lib.cairo",
"chars": 100,
"preview": "// Generated by Garaga version 1.1.0\n\npub mod groth16_verifier;\npub mod groth16_verifier_constants;\n"
},
{
"path": "src/contracts/autogenerated/groth16_example_bn254/tests/proof_calldata.txt",
"chars": 46366,
"preview": "0x1d02c87bce2e8363285990a\n0xf5e071bca525a26d21e2400d\n0x2abaae3dd6e4c662\n0x0\n0xde2cff83a6162de7c15674c2\n0x6dd1651aadce6f7"
},
{
"path": "src/contracts/autogenerated/groth16_example_bn254/tests/test_contract.cairo",
"chars": 3561,
"preview": "// Generated by Garaga version 1.1.0\n\n//! # Starknet Verification Contract Tests\n//!\n//! This module contains comprehens"
},
{
"path": "src/contracts/autogenerated/noir_ultra_keccak_zk_honk_example/.tool-versions",
"chars": 37,
"preview": "scarb 2.16.1\nstarknet-foundry 0.57.0\n"
},
{
"path": "src/contracts/autogenerated/noir_ultra_keccak_zk_honk_example/Scarb.toml",
"chars": 394,
"preview": "# Generated by Garaga version 1.1.0\n[package]\nname = \"noir_ultra_keccak_zk_honk_example\"\nversion = \"0.1.0\"\nedition = \"20"
},
{
"path": "src/contracts/autogenerated/noir_ultra_keccak_zk_honk_example/src/honk_verifier.cairo",
"chars": 13290,
"preview": "// Generated by Garaga version 1.1.0\n\nuse super::honk_verifier_circuits::{\n is_on_curve_excluding_infinity_bn254, run"
},
{
"path": "src/contracts/autogenerated/noir_ultra_keccak_zk_honk_example/src/honk_verifier_circuits.cairo",
"chars": 117165,
"preview": "// Generated by Garaga version 1.1.0\n\nuse core::circuit::{\n CircuitElement as CE, CircuitInput as CI, CircuitInputs, "
},
{
"path": "src/contracts/autogenerated/noir_ultra_keccak_zk_honk_example/src/honk_verifier_constants.cairo",
"chars": 130678,
"preview": "// Generated by Garaga version 1.1.0\n\nuse garaga::apps::noir::HonkVk;\nuse garaga::definitions::{G1Point, G2Line, u288, u"
},
{
"path": "src/contracts/autogenerated/noir_ultra_keccak_zk_honk_example/src/lib.cairo",
"chars": 126,
"preview": "// Generated by Garaga version 1.1.0\n\npub mod honk_verifier;\npub mod honk_verifier_circuits;\npub mod honk_verifier_const"
},
{
"path": "src/contracts/autogenerated/noir_ultra_keccak_zk_honk_example/tests/proof_calldata.txt",
"chars": 71686,
"preview": "0x1\n0x2\n0x0\n0x10\n0x42ab5d6d1986846cf\n0x0\n0xb75c020998797da78\n0x0\n0x5a107acb64952eca\n0x0\n0x31e97a575e9d\n0x0\n0xb5666547acf"
},
{
"path": "src/contracts/autogenerated/noir_ultra_keccak_zk_honk_example/tests/test_contract.cairo",
"chars": 3671,
"preview": "// Generated by Garaga version 1.1.0\n\n//! # Starknet Verification Contract Tests\n//!\n//! This module contains comprehens"
},
{
"path": "src/contracts/autogenerated/risc0_verifier_bn254/.tool-versions",
"chars": 37,
"preview": "scarb 2.16.1\nstarknet-foundry 0.57.0\n"
},
{
"path": "src/contracts/autogenerated/risc0_verifier_bn254/Scarb.toml",
"chars": 381,
"preview": "# Generated by Garaga version 1.1.0\n[package]\nname = \"risc0_verifier_bn254\"\nversion = \"0.1.0\"\nedition = \"2024_07\"\n\n[depe"
},
{
"path": "src/contracts/autogenerated/risc0_verifier_bn254/src/groth16_verifier.cairo",
"chars": 4273,
"preview": "// Generated by Garaga version 1.1.0\n\nuse super::groth16_verifier_constants::{N_FREE_PUBLIC_INPUTS, T, ic, precomputed_l"
},
{
"path": "src/contracts/autogenerated/risc0_verifier_bn254/src/groth16_verifier_constants.cairo",
"chars": 126382,
"preview": "// Generated by Garaga version 1.1.0\n\nuse garaga::definitions::{E12D, G1Point, G2Line, G2Point, u288, u384};\nuse garaga:"
},
{
"path": "src/contracts/autogenerated/risc0_verifier_bn254/src/lib.cairo",
"chars": 100,
"preview": "// Generated by Garaga version 1.1.0\n\npub mod groth16_verifier;\npub mod groth16_verifier_constants;\n"
},
{
"path": "src/contracts/autogenerated/risc0_verifier_bn254/tests/proof_calldata.txt",
"chars": 46588,
"preview": "0x9ba602b4ce8728dc9e2eafbe\n0xab7dd4d4e0cd8c4809abe8e1\n0x1cb19c0439e5cb54\n0x0\n0xb58f541c46fbf653dff67254\n0xcd697429d0567a"
},
{
"path": "src/contracts/autogenerated/risc0_verifier_bn254/tests/test_contract.cairo",
"chars": 3612,
"preview": "// Generated by Garaga version 1.1.0\n\n//! # Starknet Verification Contract Tests\n//!\n//! This module contains comprehens"
},
{
"path": "src/contracts/autogenerated/sp1_verifier_bn254/.tool-versions",
"chars": 37,
"preview": "scarb 2.16.1\nstarknet-foundry 0.57.0\n"
},
{
"path": "src/contracts/autogenerated/sp1_verifier_bn254/Scarb.toml",
"chars": 379,
"preview": "# Generated by Garaga version 1.1.0\n[package]\nname = \"sp1_verifier_bn254\"\nversion = \"0.1.0\"\nedition = \"2024_07\"\n\n[depend"
},
{
"path": "src/contracts/autogenerated/sp1_verifier_bn254/src/groth16_verifier.cairo",
"chars": 5348,
"preview": "// Generated by Garaga version 1.1.0\n#[starknet::interface]\npub trait ISP1Groth16VerifierBN254<TContractState> {\n fn "
},
{
"path": "src/contracts/autogenerated/sp1_verifier_bn254/src/lib.cairo",
"chars": 64,
"preview": "// Generated by Garaga version 1.1.0\n\npub mod groth16_verifier;\n"
},
{
"path": "src/contracts/autogenerated/sp1_verifier_bn254/tests/proof_calldata.txt",
"chars": 46574,
"preview": "0xf80739ea729635128f87c9db\n0x8bd62cf3413ae30ccb5cb124\n0x3a67b2b92ec8075\n0x0\n0xbada4d3959a1d0e421bd8617\n0xc89c329c8269544"
},
{
"path": "src/contracts/autogenerated/sp1_verifier_bn254/tests/test_contract.cairo",
"chars": 3598,
"preview": "// Generated by Garaga version 1.1.0\n\n//! # Starknet Verification Contract Tests\n//!\n//! This module contains comprehens"
},
{
"path": "src/contracts/drand_decrypt_quicknet/Scarb.toml",
"chars": 301,
"preview": "[package]\nname = \"drand_decrypt_quicknet\"\nversion = \"0.1.0\"\nedition = \"2024_07\"\n\n[dependencies]\ngaraga = { path = \"../.."
},
{
"path": "src/contracts/drand_decrypt_quicknet/src/drand_decrypt.cairo",
"chars": 3486,
"preview": "use garaga::definitions::G1Point;\n\n#[starknet::interface]\ntrait IDrandDecryptQuicknet<TContractState> {\n /// Verify a"
},
{
"path": "src/contracts/drand_decrypt_quicknet/src/drand_decrypt_constants.cairo",
"chars": 148,
"preview": "// Generated — do not edit manually.\npub const VERIFIER_CLASS_HASH: felt252 =\n 0x86bf4360e082cd786bd785d3345df32777db"
},
{
"path": "src/contracts/drand_decrypt_quicknet/src/lib.cairo",
"chars": 48,
"preview": "mod drand_decrypt;\nmod drand_decrypt_constants;\n"
},
{
"path": "src/contracts/drand_quicknet/.tool-versions",
"chars": 37,
"preview": "scarb 2.16.1\nstarknet-foundry 0.57.0\n"
},
{
"path": "src/contracts/drand_quicknet/Scarb.toml",
"chars": 252,
"preview": "[package]\nname = \"drand_quicknet\"\nversion = \"0.1.0\"\nedition = \"2024_07\"\n\n[dependencies]\ngaraga = { path = \"../..\" }\nstar"
},
{
"path": "src/contracts/drand_quicknet/src/drand_verifier.cairo",
"chars": 4091,
"preview": "use super::drand_verifier_constants::{G2_GEN, precomputed_lines};\n\n#[starknet::interface]\npub trait IDrandQuicknet<TCont"
}
]
// ... and 265 more files (download for full content)
About this extraction
This page contains the full source code of the keep-starknet-strange/garaga GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 465 files (12.8 MB), approximately 3.4M tokens, and a symbol index with 2854 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.