From 84d9858ac5731735e7907b7f5a6787d39ea134dd Mon Sep 17 00:00:00 2001 From: feltroidprime Date: Fri, 13 Dec 2024 17:50:30 +0100 Subject: [PATCH] Flatten sumcheck univariate array. --- .../compilable_circuits/ultra_honk.py | 18 +- hydra/garaga/precompiled_circuits/honk.py | 23 +- .../honk_contract_generator/generator_honk.py | 11 +- .../src/honk_verifier.cairo | 25 +- .../src/honk_verifier_circuits.cairo | 32 +- src/src/core/circuit.cairo | 5 +- src/src/utils/noir.cairo | 304 +++++++++++++----- src/src/utils/noir/keccak_transcript.cairo | 6 +- tests/contracts_e2e/install_devnet.sh | 2 +- 9 files changed, 274 insertions(+), 152 deletions(-) diff --git a/hydra/garaga/precompiled_circuits/compilable_circuits/ultra_honk.py b/hydra/garaga/precompiled_circuits/compilable_circuits/ultra_honk.py index cf39341f..2cf7add1 100644 --- a/hydra/garaga/precompiled_circuits/compilable_circuits/ultra_honk.py +++ b/hydra/garaga/precompiled_circuits/compilable_circuits/ultra_honk.py @@ -168,11 +168,10 @@ def input_map(self) -> dict: imap["p_public_inputs"] = (structs.u256Span, self.vk.public_inputs_size) imap["p_public_inputs_offset"] = structs.u384 - for i in range(self.vk.log_circuit_size): - imap[f"sumcheck_univariate_{i}"] = ( - structs.u256Span, - hk.BATCHED_RELATION_PARTIAL_LENGTH, - ) + imap["sumcheck_univariates_flat"] = ( + structs.u256Span, + self.vk.log_circuit_size * hk.BATCHED_RELATION_PARTIAL_LENGTH, + ) imap["sumcheck_evaluations"] = ( structs.u256Span, @@ -208,9 +207,16 @@ def _execute_circuit_logic( vars["p_public_inputs_offset"], ) + sumcheck_univariates_flat = vars["sumcheck_univariates_flat"] sumcheck_univariates = [] for i in range(self.vk.log_circuit_size): - sumcheck_univariates.append(vars[f"sumcheck_univariate_{i}"]) + sumcheck_univariates.append( + sumcheck_univariates_flat[ + i + * hk.BATCHED_RELATION_PARTIAL_LENGTH : (i + 1) + * hk.BATCHED_RELATION_PARTIAL_LENGTH + ] + ) assert len(sumcheck_univariates) == self.vk.log_circuit_size assert len(sumcheck_univariates[0]) == hk.BATCHED_RELATION_PARTIAL_LENGTH diff --git a/hydra/garaga/precompiled_circuits/honk.py b/hydra/garaga/precompiled_circuits/honk.py index afbb6b40..0931d34a 100644 --- a/hydra/garaga/precompiled_circuits/honk.py +++ b/hydra/garaga/precompiled_circuits/honk.py @@ -243,14 +243,8 @@ def format_array(elements: list, span: bool = False) -> str: code += f"lookup_read_tags: {g1_to_g1point256(self.lookup_read_tags)},\n" code += f"lookup_inverses: {g1_to_g1point256(self.lookup_inverses)},\n" - # Format nested arrays for sumcheck_univariates - univariates_arrays = [ - format_array(univariate, span=True) - for univariate in self.sumcheck_univariates - ] - code += ( - f"sumcheck_univariates: array![{','.join(univariates_arrays)}].span(),\n" - ) + # Flatten sumcheck_univariates array + code += f"sumcheck_univariates: {format_array(io.flatten(self.sumcheck_univariates), span=True)},\n" code += f"sumcheck_evaluations: {format_array(self.sumcheck_evaluations, span=True)},\n" code += f"gemini_fold_comms: array![{', '.join(g1_to_g1point256(comm) for comm in self.gemini_fold_comms)}].span(),\n" @@ -283,13 +277,14 @@ def serialize_G1Point256(g1_point: G1Point) -> list[int]: cd.extend(serialize_G1Point256(self.lookup_read_counts)) cd.extend(serialize_G1Point256(self.lookup_read_tags)) cd.extend(serialize_G1Point256(self.lookup_inverses)) - cd.append(len(self.sumcheck_univariates)) - for univariate in self.sumcheck_univariates: - cd.extend( - io.bigint_split_array( - x=univariate, n_limbs=2, base=2**128, prepend_length=True - ) + cd.extend( + io.bigint_split_array( + x=io.flatten(self.sumcheck_univariates), + n_limbs=2, + base=2**128, + prepend_length=True, ) + ) cd.extend( io.bigint_split_array( diff --git a/hydra/garaga/starknet/honk_contract_generator/generator_honk.py b/hydra/garaga/starknet/honk_contract_generator/generator_honk.py index 1a563f99..6f22c840 100644 --- a/hydra/garaga/starknet/honk_contract_generator/generator_honk.py +++ b/hydra/garaga/starknet/honk_contract_generator/generator_honk.py @@ -165,7 +165,7 @@ def gen_honk_verifier( use garaga::utils::neg_3; use super::{{vk, precomputed_lines, {sumcheck_function_name}, {prepare_scalars_function_name}, {lhs_ecip_function_name}}}; use garaga::utils::noir::{{HonkProof, remove_unused_variables_sumcheck_evaluations, G2_POINT_KZG_1, G2_POINT_KZG_2}}; - use garaga::utils::noir::keccak_transcript::{{HonkTranscriptTrait, Point256IntoCircuitPoint}}; + use garaga::utils::noir::keccak_transcript::{{HonkTranscriptTrait, Point256IntoCircuitPoint, BATCHED_RELATION_PARTIAL_LENGTH}}; use garaga::core::circuit::U64IntoU384; use core::num::traits::Zero; use core::poseidon::hades_permutation; @@ -202,7 +202,7 @@ def gen_honk_verifier( let (sum_check_rlc, honk_check) = {sumcheck_function_name}( p_public_inputs: full_proof.proof.public_inputs, p_public_inputs_offset: full_proof.proof.public_inputs_offset.into(), - {', '.join([f'sumcheck_univariate_{i}: (*full_proof.proof.sumcheck_univariates.at({i}))' for i in range(vk.log_circuit_size)])}, + sumcheck_univariates_flat: full_proof.proof.sumcheck_univariates.slice(0, log_n * BATCHED_RELATION_PARTIAL_LENGTH), sumcheck_evaluations: remove_unused_variables_sumcheck_evaluations( full_proof.proof.sumcheck_evaluations ), @@ -383,7 +383,7 @@ def gen_honk_verifier( ); let mod_bn = get_modulus(0); - let zk_ecip_batched_rhs = batch_3_mod_p(rhs_low, rhs_high, rhs_high_shifted, c0, mod_bn); + let zk_ecip_batched_rhs = batch_3_mod_p(rhs_low, rhs_high, rhs_high_shifted, base_rlc_coeff.into(), mod_bn); let ecip_check = zk_ecip_batched_lhs == zk_ecip_batched_rhs; @@ -448,7 +448,9 @@ def gen_honk_verifier( VK_PATH = ( "hydra/garaga/starknet/honk_contract_generator/examples/vk_ultra_keccak.bin" ) - + VK_LARGE_PATH = ( + "hydra/garaga/starknet/honk_contract_generator/examples/vk_large.bin" + ) CONTRACTS_FOLDER = "src/contracts/" # Do not change this FOLDER_NAME = ( @@ -456,3 +458,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") diff --git a/src/contracts/noir_ultra_keccak_honk_example/src/honk_verifier.cairo b/src/contracts/noir_ultra_keccak_honk_example/src/honk_verifier.cairo index 7ca8a039..43024d10 100644 --- a/src/contracts/noir_ultra_keccak_honk_example/src/honk_verifier.cairo +++ b/src/contracts/noir_ultra_keccak_honk_example/src/honk_verifier.cairo @@ -21,7 +21,7 @@ mod UltraKeccakHonkVerifier { MSMHintBatched, compute_rhs_ecip, derive_ec_point_from_X, SlopeInterceptOutput, }; use garaga::ec_ops_g2::{G2PointTrait}; - use garaga::basic_field_ops::{add_mod_p, mul_mod_p}; + use garaga::basic_field_ops::{batch_3_mod_p}; use garaga::circuits::ec; use garaga::utils::neg_3; use super::{ @@ -32,7 +32,9 @@ mod UltraKeccakHonkVerifier { use garaga::utils::noir::{ HonkProof, remove_unused_variables_sumcheck_evaluations, G2_POINT_KZG_1, G2_POINT_KZG_2, }; - use garaga::utils::noir::keccak_transcript::{HonkTranscriptTrait, Point256IntoCircuitPoint}; + use garaga::utils::noir::keccak_transcript::{ + HonkTranscriptTrait, Point256IntoCircuitPoint, BATCHED_RELATION_PARTIAL_LENGTH, + }; use garaga::core::circuit::U64IntoU384; use core::num::traits::Zero; use core::poseidon::hades_permutation; @@ -69,11 +71,10 @@ mod UltraKeccakHonkVerifier { let (sum_check_rlc, honk_check) = run_GRUMPKIN_HONK_SUMCHECK_SIZE_5_PUB_1_circuit( p_public_inputs: full_proof.proof.public_inputs, p_public_inputs_offset: full_proof.proof.public_inputs_offset.into(), - sumcheck_univariate_0: (*full_proof.proof.sumcheck_univariates.at(0)), - sumcheck_univariate_1: (*full_proof.proof.sumcheck_univariates.at(1)), - sumcheck_univariate_2: (*full_proof.proof.sumcheck_univariates.at(2)), - sumcheck_univariate_3: (*full_proof.proof.sumcheck_univariates.at(3)), - sumcheck_univariate_4: (*full_proof.proof.sumcheck_univariates.at(4)), + sumcheck_univariates_flat: full_proof + .proof + .sumcheck_univariates + .slice(0, log_n * BATCHED_RELATION_PARTIAL_LENGTH), sumcheck_evaluations: remove_unused_variables_sumcheck_evaluations( full_proof.proof.sumcheck_evaluations, ), @@ -365,14 +366,8 @@ mod UltraKeccakHonkVerifier { ); let mod_bn = get_modulus(0); - let c0: u384 = base_rlc_coeff.into(); - let c1: u384 = mul_mod_p(c0, c0, mod_bn); - let c2 = mul_mod_p(c1, c0, mod_bn); - - let zk_ecip_batched_rhs = add_mod_p( - add_mod_p(mul_mod_p(rhs_low, c0, mod_bn), mul_mod_p(rhs_high, c1, mod_bn), mod_bn), - mul_mod_p(rhs_high_shifted, c2, mod_bn), - mod_bn, + let zk_ecip_batched_rhs = batch_3_mod_p( + rhs_low, rhs_high, rhs_high_shifted, base_rlc_coeff.into(), mod_bn, ); let ecip_check = zk_ecip_batched_lhs == zk_ecip_batched_rhs; diff --git a/src/contracts/noir_ultra_keccak_honk_example/src/honk_verifier_circuits.cairo b/src/contracts/noir_ultra_keccak_honk_example/src/honk_verifier_circuits.cairo index 2f5c956e..8df4c7d3 100644 --- a/src/contracts/noir_ultra_keccak_honk_example/src/honk_verifier_circuits.cairo +++ b/src/contracts/noir_ultra_keccak_honk_example/src/honk_verifier_circuits.cairo @@ -13,11 +13,7 @@ use core::option::Option; pub fn run_GRUMPKIN_HONK_SUMCHECK_SIZE_5_PUB_1_circuit( p_public_inputs: Span, p_public_inputs_offset: u384, - sumcheck_univariate_0: Span, - sumcheck_univariate_1: Span, - sumcheck_univariate_2: Span, - sumcheck_univariate_3: Span, - sumcheck_univariate_4: Span, + sumcheck_univariates_flat: Span, sumcheck_evaluations: Span, tp_sum_check_u_challenges: Span, tp_gate_challenges: Span, @@ -875,30 +871,10 @@ pub fn run_GRUMPKIN_HONK_SUMCHECK_SIZE_5_PUB_1_circuit( circuit_inputs = circuit_inputs.next_2(p_public_inputs_offset); // in30 - let mut sumcheck_univariate_0 = sumcheck_univariate_0; - while let Option::Some(val) = sumcheck_univariate_0.pop_front() { + let mut sumcheck_univariates_flat = sumcheck_univariates_flat; + while let Option::Some(val) = sumcheck_univariates_flat.pop_front() { circuit_inputs = circuit_inputs.next_u256(*val); - }; // in31 - in38 - - let mut sumcheck_univariate_1 = sumcheck_univariate_1; - while let Option::Some(val) = sumcheck_univariate_1.pop_front() { - circuit_inputs = circuit_inputs.next_u256(*val); - }; // in39 - in46 - - let mut sumcheck_univariate_2 = sumcheck_univariate_2; - while let Option::Some(val) = sumcheck_univariate_2.pop_front() { - circuit_inputs = circuit_inputs.next_u256(*val); - }; // in47 - in54 - - let mut sumcheck_univariate_3 = sumcheck_univariate_3; - while let Option::Some(val) = sumcheck_univariate_3.pop_front() { - circuit_inputs = circuit_inputs.next_u256(*val); - }; // in55 - in62 - - let mut sumcheck_univariate_4 = sumcheck_univariate_4; - while let Option::Some(val) = sumcheck_univariate_4.pop_front() { - circuit_inputs = circuit_inputs.next_u256(*val); - }; // in63 - in70 + }; // in31 - in70 let mut sumcheck_evaluations = sumcheck_evaluations; while let Option::Some(val) = sumcheck_evaluations.pop_front() { diff --git a/src/src/core/circuit.cairo b/src/src/core/circuit.cairo index 02dbeab9..b0794cfc 100644 --- a/src/src/core/circuit.cairo +++ b/src/src/core/circuit.cairo @@ -1,9 +1,9 @@ use core::circuit::{ add_circuit_input, AddInputResult, CircuitData, IntoCircuitInputValue, CircuitDefinition, - init_circuit_data, CircuitInputAccumulator, into_u96_guarantee, U96Guarantee, + init_circuit_data, CircuitInputAccumulator, into_u96_guarantee, U96Guarantee, u384, }; use core::panic_with_felt252; -use garaga::definitions::{E12D, G2Line, u384, u288}; +use garaga::definitions::{E12D, G2Line, u288}; use garaga::utils::hashing::{hades_permutation, PoseidonState}; // use core::panics::panic; @@ -23,7 +23,6 @@ impl u288IntoCircuitInputValue of IntoCircuitInputValue { } } - #[generate_trait] pub impl AddInputResultImpl2 of AddInputResultTrait2 { /// Adds an input to the accumulator. diff --git a/src/src/utils/noir.cairo b/src/src/utils/noir.cairo index e3b59966..36bebd2f 100644 --- a/src/src/utils/noir.cairo +++ b/src/src/utils/noir.cairo @@ -32,7 +32,7 @@ pub struct HonkProof { pub lookup_read_counts: G1Point256, pub lookup_read_tags: G1Point256, pub lookup_inverses: G1Point256, - pub sumcheck_univariates: Span>, + pub sumcheck_univariates: Span, pub sumcheck_evaluations: Span, pub gemini_fold_comms: Span, pub gemini_a_evaluations: Span, @@ -172,84 +172,230 @@ pub fn get_proof() -> HonkProof { y: 0x1067a4d8157c660c69e7022dd32ab0e30dd9987dae02f54e15edab896b9469a2, }, sumcheck_univariates: array![ - array![ - 0x285e5ff7d3c0d15f59c2761a965696bf749065fe4cac90b7c5310afb3df3b3b, - 0x2dde687363f59313c2b41e54d81beef130eae1e894eea785c78ee4e43c20c4c6, - 0x13c19d3e42c8b355492f1d756884dea3957b5bf6e2e8193ffb4e7fc3f158efc, - 0x1e4d71cffdc20a5a19dd68d4cfe2cdf067a2aa1f44b89cecab6caaf55dae3417, - 0x1907ec4e632967f4f16250f16fa97ec7c9e8d7b72fec50a60adf7f77e14fb1b5, - 0x125582c3c04f25ef9b7c841edc3a461f112e792fed4296f2bcc67372e41bfaa3, - 0x23f1075c04d207789c601197be8d38a22a11e5d035bce960f9dc69baa6af03c2, - 0x12895dcc211378d9eb6614866aa0bb1a8cf720ee34451efcd92dc82c43504c13, - ] - .span(), - array![ - 0x2280f8067080c8f83123f8d052b5a181c0a5f3baa905f42d4549057585e69821, - 0x78dc17e403e81e7abb5353b62a897955e9596f56744cd931e7063f7937418d9, - 0x1e2c998e66e78dbfb4bb9658d8637f618baf885995fbd76d7922cc4e26dba669, - 0x262cd1b8fdc741c2073c3c669b12e6deac6705f6214410306a8ecc6bdbec8d71, - 0x2228b8dca9925fee72e5587e58bafbd45947c386446f3bdb63c4e010d72a0e56, - 0x2bda190568fdecabb525a7745c2d7d5242f264daeef67f932268e72b5adcf6d1, - 0x4266918448a9ec8cac8f881c0bc1ba9c42959111b9f2991c93b169f38dca51a, - 0x1150a038bbadb896d080e0158f85e7b0df710c1910a6503774bdcf08ef39a393, - ] - .span(), - array![ - 0x92a9fd6fe59243760042ddcaf85dcf2c9268e52c5208d75cb9125b2daa42700, - 0x123d711e98a50c8eef600161bc486d62069e13ad4d12064603d30e8f2d6e5265, - 0x25b58d132934afdccc480a8c964e477b88cbafdf91370ee9b4b4a1cc2e4e1a8e, - 0x1537803983a0459d1e3ed61aa59cbf0856a2a510df7901046b79a4257a9fcb30, - 0x13c08cf9426d1e2f7e132e9c6e13e8b93b6905ccc539cb357e69e0f5d66ddfd7, - 0x1f1cc54b85b64db929daf476a572212d852ad2e7666921e603bb50a1097c870f, - 0x17cfeb6ab26a28116fe3d4b5156c1512223d86e3528cd667536f1c170a4cb755, - 0x1610c336fc031be68c629c990e755afcbb43e7630726af1dfb32ff7de2a1f903, - ] - .span(), - array![ - 0x78c2e9fcb11a9ff1dabdc022f77c29a52ff10e9bfc25a8e1c2f38eeb9a7b314, - 0x24df74453b540fc68c0a5bd1c618d3ccf49e7513983cd8fd4cf0899ad5cef4e2, - 0x252ed9cd7ef0d0e60aa1b3fed302a1314450edf6ebce5036cc81b5f21f166a35, - 0x27b4ef390baa1c9773a170ac64b0dea0dfd02fbe3a43d8061e77c487ef097245, - 0x25b39250035ebe1756ec1085919d0a90a973aafcdc1b4cc77844dc81c81f017e, - 0x28b32ee8f4dd8c62de8140dd3730fc52de4abc0cab9289bceeffb1469484b318, - 0x53b798117b11aee0c5bccfb2a8d926dd45c7b3f560f8d3133d42f4deab22d45, - 0x9eacab815d72783fdf291121be7af695260916f8f9bd74b980317f9c6ff4cea, - ] - .span(), - array![ - 0x22fd30a934d68c2b3d1763e038f5f41eaaefa2311abbe8e38f00a4edc500b322, - 0x62e1857e2ed5546ce6ec7b4e2210329eb169f5695e3a04d48acf52f5359e55d, - 0xba09b18683d296cf830d2da7515d381e431fe1ac792c3117007dd2e7ad8de35, - 0x16bf0a5f2abce1fdc44461687d611ef8b4a2b538249fec1d8d32f25c3325ae4f, - 0x90d1aabada01c6d1ef8e122169f88bc36d80462934ac786ed7f63568a815f72, - 0x263a15eb7a5d4da20cd74bda64acd6bfd515fd57e001f571ee7f25dbbc819935, - 0x1a6da135c8b1c95f0ebac3186421c4bf62c71f27fe9b2e34279afe65270e21a0, - 0x2d928d40bc62836da72eadced3c96f846cf0440b939d746db2a987e41f8b7356, - ] - .span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), - array![0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0].span(), + 0x285e5ff7d3c0d15f59c2761a965696bf749065fe4cac90b7c5310afb3df3b3b, + 0x2dde687363f59313c2b41e54d81beef130eae1e894eea785c78ee4e43c20c4c6, + 0x13c19d3e42c8b355492f1d756884dea3957b5bf6e2e8193ffb4e7fc3f158efc, + 0x1e4d71cffdc20a5a19dd68d4cfe2cdf067a2aa1f44b89cecab6caaf55dae3417, + 0x1907ec4e632967f4f16250f16fa97ec7c9e8d7b72fec50a60adf7f77e14fb1b5, + 0x125582c3c04f25ef9b7c841edc3a461f112e792fed4296f2bcc67372e41bfaa3, + 0x23f1075c04d207789c601197be8d38a22a11e5d035bce960f9dc69baa6af03c2, + 0x12895dcc211378d9eb6614866aa0bb1a8cf720ee34451efcd92dc82c43504c13, + 0x2280f8067080c8f83123f8d052b5a181c0a5f3baa905f42d4549057585e69821, + 0x78dc17e403e81e7abb5353b62a897955e9596f56744cd931e7063f7937418d9, + 0x1e2c998e66e78dbfb4bb9658d8637f618baf885995fbd76d7922cc4e26dba669, + 0x262cd1b8fdc741c2073c3c669b12e6deac6705f6214410306a8ecc6bdbec8d71, + 0x2228b8dca9925fee72e5587e58bafbd45947c386446f3bdb63c4e010d72a0e56, + 0x2bda190568fdecabb525a7745c2d7d5242f264daeef67f932268e72b5adcf6d1, + 0x4266918448a9ec8cac8f881c0bc1ba9c42959111b9f2991c93b169f38dca51a, + 0x1150a038bbadb896d080e0158f85e7b0df710c1910a6503774bdcf08ef39a393, + 0x92a9fd6fe59243760042ddcaf85dcf2c9268e52c5208d75cb9125b2daa42700, + 0x123d711e98a50c8eef600161bc486d62069e13ad4d12064603d30e8f2d6e5265, + 0x25b58d132934afdccc480a8c964e477b88cbafdf91370ee9b4b4a1cc2e4e1a8e, + 0x1537803983a0459d1e3ed61aa59cbf0856a2a510df7901046b79a4257a9fcb30, + 0x13c08cf9426d1e2f7e132e9c6e13e8b93b6905ccc539cb357e69e0f5d66ddfd7, + 0x1f1cc54b85b64db929daf476a572212d852ad2e7666921e603bb50a1097c870f, + 0x17cfeb6ab26a28116fe3d4b5156c1512223d86e3528cd667536f1c170a4cb755, + 0x1610c336fc031be68c629c990e755afcbb43e7630726af1dfb32ff7de2a1f903, + 0x78c2e9fcb11a9ff1dabdc022f77c29a52ff10e9bfc25a8e1c2f38eeb9a7b314, + 0x24df74453b540fc68c0a5bd1c618d3ccf49e7513983cd8fd4cf0899ad5cef4e2, + 0x252ed9cd7ef0d0e60aa1b3fed302a1314450edf6ebce5036cc81b5f21f166a35, + 0x27b4ef390baa1c9773a170ac64b0dea0dfd02fbe3a43d8061e77c487ef097245, + 0x25b39250035ebe1756ec1085919d0a90a973aafcdc1b4cc77844dc81c81f017e, + 0x28b32ee8f4dd8c62de8140dd3730fc52de4abc0cab9289bceeffb1469484b318, + 0x53b798117b11aee0c5bccfb2a8d926dd45c7b3f560f8d3133d42f4deab22d45, + 0x9eacab815d72783fdf291121be7af695260916f8f9bd74b980317f9c6ff4cea, + 0x22fd30a934d68c2b3d1763e038f5f41eaaefa2311abbe8e38f00a4edc500b322, + 0x62e1857e2ed5546ce6ec7b4e2210329eb169f5695e3a04d48acf52f5359e55d, + 0xba09b18683d296cf830d2da7515d381e431fe1ac792c3117007dd2e7ad8de35, + 0x16bf0a5f2abce1fdc44461687d611ef8b4a2b538249fec1d8d32f25c3325ae4f, + 0x90d1aabada01c6d1ef8e122169f88bc36d80462934ac786ed7f63568a815f72, + 0x263a15eb7a5d4da20cd74bda64acd6bfd515fd57e001f571ee7f25dbbc819935, + 0x1a6da135c8b1c95f0ebac3186421c4bf62c71f27fe9b2e34279afe65270e21a0, + 0x2d928d40bc62836da72eadced3c96f846cf0440b939d746db2a987e41f8b7356, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, ] .span(), sumcheck_evaluations: array![ diff --git a/src/src/utils/noir/keccak_transcript.cairo b/src/src/utils/noir/keccak_transcript.cairo index 38c65a21..3e63083f 100644 --- a/src/src/utils/noir/keccak_transcript.cairo +++ b/src/src/utils/noir/keccak_transcript.cairo @@ -416,14 +416,16 @@ pub fn generate_gate_challenges(prev_keccak_output: u256) -> (Array, u256) #[inline] pub fn generate_sumcheck_u_challenges( - prev_keccak_output: u256, sumcheck_univariates: Span>, + prev_keccak_output: u256, sumcheck_univariates: Span, ) -> (Array, u256) { let mut sum_check_u_challenges: Array = array![]; let mut challenge: u256 = prev_keccak_output; for i in 0..CONST_PROOF_SIZE_LOG_N { let mut k_input: Array = array![]; keccak::keccak_add_u256_be(ref k_input, challenge); - let sumcheck_univariates_i = *sumcheck_univariates.at(i); + let sumcheck_univariates_i = sumcheck_univariates + .slice(i * BATCHED_RELATION_PARTIAL_LENGTH, BATCHED_RELATION_PARTIAL_LENGTH); + for j in 0..BATCHED_RELATION_PARTIAL_LENGTH { keccak::keccak_add_u256_be(ref k_input, *sumcheck_univariates_i.at(j)); }; diff --git a/tests/contracts_e2e/install_devnet.sh b/tests/contracts_e2e/install_devnet.sh index 0b10807e..a00b5476 100755 --- a/tests/contracts_e2e/install_devnet.sh +++ b/tests/contracts_e2e/install_devnet.sh @@ -3,7 +3,7 @@ set -e DEVNET_INSTALL_DIR="$(git rev-parse --show-toplevel)/tests/contracts_e2e/devnet/bin" DEVNET_REPO="https://github.com/0xSpaceShard/starknet-devnet-rs" -DEVNET_VERSION="v0.2.2" +DEVNET_VERSION="v0.2.3" require_cmd() { if ! command -v "$1" >/dev/null 2>&1; then