Skip to content

Commit

Permalink
Upd ECIP class & Remove unused imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
feltroidprime committed Dec 13, 2024
1 parent 84d9858 commit 097a9aa
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from garaga.starknet.cli.utils import create_directory, get_package_version
from garaga.starknet.groth16_contract_generator.parsing_utils import Groth16VerifyingKey

ECIP_OPS_CLASS_HASH = 0xC4B7AA28A27B5FB8D7D43928B2A3EE960CF5B4E06CB9AE1EE3F102400B1700
ECIP_OPS_CLASS_HASH = 0x684D2756A4440C190A5FE54E367C0ABE33AEFA75084DEC2FFFC791B620C80E3


def precompute_lines_from_vk(vk: Groth16VerifyingKey) -> StructArray:
Expand Down
16 changes: 7 additions & 9 deletions hydra/garaga/starknet/honk_contract_generator/generator_honk.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@ def gen_honk_circuits_code(vk: HonkVk) -> str:
"""
header = """
use core::circuit::{
RangeCheck96, AddMod, MulMod, u384, u96, circuit_add, circuit_sub, circuit_mul, circuit_inverse,
EvalCircuitTrait, CircuitOutputsTrait, CircuitModulus, AddInputResultTrait, CircuitInputs,
u384, circuit_add, circuit_sub, circuit_mul, circuit_inverse,
EvalCircuitTrait, CircuitOutputsTrait, CircuitInputs,
};
use garaga::core::circuit::AddInputResultTrait2;
use garaga::ec_ops::FunctionFelt;
use core::circuit::CircuitElement as CE;
use core::circuit::CircuitInput as CI;
use garaga::definitions::{
get_b, G1Point, u288, get_GRUMPKIN_modulus, get_BN254_modulus};
use garaga::definitions::{G1Point, get_GRUMPKIN_modulus, get_BN254_modulus};
use core::option::Option;\n
"""
code = header
Expand Down Expand Up @@ -121,7 +120,7 @@ def gen_honk_verifier(
precomputed_lines = precompute_lines_honk()

constants_code = f"""
use garaga::definitions::{{G1Point, G2Point, G2Line, u384, u288}};
use garaga::definitions::{{G1Point, G2Line, u384, u288}};
use garaga::utils::noir::HonkVk;
{vk.serialize_to_cairo()}\n
Expand Down Expand Up @@ -156,10 +155,9 @@ def gen_honk_verifier(
#[starknet::contract]
mod UltraKeccakHonkVerifier {{
use garaga::definitions::{{G1Point, G1G2Pair, BN254_G1_GENERATOR, get_a, get_modulus, u384}};
use garaga::definitions::{{G1Point, G1G2Pair, BN254_G1_GENERATOR, get_a, get_modulus}};
use garaga::pairing_check::{{multi_pairing_check_bn254_2P_2F, MPCheckHintBN254}};
use garaga::ec_ops::{{G1PointTrait, ec_safe_add, FunctionFelt,FunctionFeltTrait, DerivePointFromXHint, MSMHintBatched, compute_rhs_ecip, derive_ec_point_from_X, SlopeInterceptOutput}};
use garaga::ec_ops_g2::{{G2PointTrait}};
use garaga::ec_ops::{{G1PointTrait, ec_safe_add,FunctionFeltTrait, DerivePointFromXHint, MSMHintBatched, compute_rhs_ecip, derive_ec_point_from_X, SlopeInterceptOutput}};
use garaga::basic_field_ops::{{batch_3_mod_p}};
use garaga::circuits::ec;
use garaga::utils::neg_3;
Expand Down Expand Up @@ -458,4 +456,4 @@ def gen_honk_verifier(
)

gen_honk_verifier(VK_PATH, CONTRACTS_FOLDER, FOLDER_NAME)
gen_honk_verifier(VK_LARGE_PATH, CONTRACTS_FOLDER, FOLDER_NAME + "_large")
# gen_honk_verifier(VK_LARGE_PATH, CONTRACTS_FOLDER, FOLDER_NAME + "_large")
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod Groth16VerifierBLS12_381 {
use super::{N_PUBLIC_INPUTS, vk, ic, precomputed_lines};

const ECIP_OPS_CLASS_HASH: felt252 =
0xc4b7aa28a27b5fb8d7d43928b2a3ee960cf5b4e06cb9ae1ee3f102400b1700;
0x684d2756a4440c190a5fe54e367c0abe33aefa75084dec2fffc791b620c80e3;

#[storage]
struct Storage {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod Groth16VerifierBN254 {
use super::{N_PUBLIC_INPUTS, vk, ic, precomputed_lines};

const ECIP_OPS_CLASS_HASH: felt252 =
0xc4b7aa28a27b5fb8d7d43928b2a3ee960cf5b4e06cb9ae1ee3f102400b1700;
0x684d2756a4440c190a5fe54e367c0abe33aefa75084dec2fffc791b620c80e3;

#[storage]
struct Storage {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use core::circuit::{
RangeCheck96, AddMod, MulMod, u384, u96, circuit_add, circuit_sub, circuit_mul, circuit_inverse,
EvalCircuitTrait, CircuitOutputsTrait, CircuitModulus, AddInputResultTrait, CircuitInputs,
u384, circuit_add, circuit_sub, circuit_mul, circuit_inverse, EvalCircuitTrait,
CircuitOutputsTrait, CircuitInputs,
};
use garaga::core::circuit::AddInputResultTrait2;
use garaga::ec_ops::FunctionFelt;
use core::circuit::CircuitElement as CE;
use core::circuit::CircuitInput as CI;
use garaga::definitions::{get_b, G1Point, u288, get_GRUMPKIN_modulus, get_BN254_modulus};
use garaga::definitions::{G1Point, get_GRUMPKIN_modulus, get_BN254_modulus};
use core::option::Option;

#[inline(always)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use garaga::definitions::{G1Point, G2Point, G2Line, u384, u288};
use garaga::definitions::{G1Point, G2Line, u384, u288};
use garaga::utils::noir::HonkVk;

pub const vk: HonkVk = HonkVk {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod Risc0Groth16VerifierBN254 {
use super::{N_FREE_PUBLIC_INPUTS, vk, ic, precomputed_lines, T};

const ECIP_OPS_CLASS_HASH: felt252 =
0xc4b7aa28a27b5fb8d7d43928b2a3ee960cf5b4e06cb9ae1ee3f102400b1700;
0x684d2756a4440c190a5fe54e367c0abe33aefa75084dec2fffc791b620c80e3;

#[storage]
struct Storage {}
Expand Down

0 comments on commit 097a9aa

Please sign in to comment.