diff --git a/.gitignore b/.gitignore index 2c0a711a8..b8d158d9e 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,6 @@ resources/ # Stone-prover repository -stone-prover \ No newline at end of file +stone-prover + +**/.DS_Store diff --git a/src/air/layouts/starknet_with_keccak.cairo b/src/air/layouts/starknet_with_keccak.cairo index b83ad85b8..8635aa21e 100644 --- a/src/air/layouts/starknet_with_keccak.cairo +++ b/src/air/layouts/starknet_with_keccak.cairo @@ -3,12 +3,16 @@ mod constants; mod global_values; mod public_input; mod traces; +mod contract; use cairo_verifier::{ air::{ constants::{SHIFT_POINT_X, SHIFT_POINT_Y, StarkCurve}, layouts::starknet_with_keccak::{ - autogenerated::{eval_composition_polynomial_inner, eval_oods_polynomial_inner}, + contract::{ + IStarknetWithKeccakLayoutContract1Dispatcher, IStarknetWithKeccakLayoutContract1DispatcherTrait, + IStarknetWithKeccakLayoutContract2Dispatcher, IStarknetWithKeccakLayoutContract2DispatcherTrait, + }, global_values::{ GlobalValues, InteractionElements, EcPoint, EcdsaSigConfig, CurveConfig }, @@ -32,6 +36,7 @@ use cairo_verifier::{ }, common::{math::{Felt252Div, Felt252PartialOrd, pow}, asserts::assert_range_u128} }; +use starknet::ContractAddress; impl StarknetWithKeccakAIRCompositionImpl of AIRComposition { fn eval_composition_polynomial( @@ -41,7 +46,8 @@ impl StarknetWithKeccakAIRCompositionImpl of AIRComposition, point: felt252, trace_domain_size: felt252, - trace_generator: felt252 + trace_generator: felt252, + contract_address_1: ContractAddress, ) -> felt252 { let memory_z = interaction_elements.memory_multi_column_perm_perm_interaction_elm; let memory_alpha = interaction_elements.memory_multi_column_perm_hash_interaction_elm0; @@ -161,7 +167,9 @@ impl StarknetWithKeccakAIRCompositionImpl of AIRComposition felt252 { - eval_oods_polynomial_inner( + IStarknetWithKeccakLayoutContract2Dispatcher { + contract_address: contract_address_2 + }.eval_oods_polynomial_inner( column_values, oods_values, constraint_coefficients, point, oods_point, trace_generator, ) } diff --git a/src/air/layouts/starknet_with_keccak/contract.cairo b/src/air/layouts/starknet_with_keccak/contract.cairo new file mode 100644 index 000000000..05e694cb2 --- /dev/null +++ b/src/air/layouts/starknet_with_keccak/contract.cairo @@ -0,0 +1,92 @@ +use cairo_verifier::air::layouts::starknet_with_keccak::global_values::GlobalValues; + +#[starknet::interface] +trait IStarknetWithKeccakLayoutContract1 { + fn eval_composition_polynomial_inner( + self: @ContractState, + mask_values: Span, + constraint_coefficients: Span, + point: felt252, + trace_generator: felt252, + global_values: GlobalValues + ) -> felt252; +} + +#[starknet::interface] +trait IStarknetWithKeccakLayoutContract2 { + fn eval_oods_polynomial_inner( + self: @ContractState, + column_values: Span, + oods_values: Span, + constraint_coefficients: Span, + point: felt252, + oods_point: felt252, + trace_generator: felt252, + ) -> felt252; +} + +// #[starknet::contract] +// mod StarknetWithKeccakLayoutContract1 { +// use super::IStarknetWithKeccakLayoutContract1; +// use cairo_verifier::air::layouts::starknet_with_keccak::{ +// global_values::GlobalValues, +// autogenerated::eval_composition_polynomial_inner, +// }; + +// #[storage] +// struct Storage {} + +// #[abi(embed_v0)] +// impl StarknetWithKeccakLayoutContract1 of IStarknetWithKeccakLayoutContract1 { +// fn eval_composition_polynomial_inner( +// self: @ContractState, +// mask_values: Span, +// constraint_coefficients: Span, +// point: felt252, +// trace_generator: felt252, +// global_values: GlobalValues +// ) -> felt252 { +// eval_composition_polynomial_inner( +// mask_values, +// constraint_coefficients, +// point, +// trace_generator, +// global_values +// ) +// } +// } +// } + +#[starknet::contract] +mod StarknetWithKeccakLayoutContract2 { + use super::IStarknetWithKeccakLayoutContract2; + use cairo_verifier::air::layouts::starknet_with_keccak::{ + global_values::GlobalValues, + autogenerated::eval_oods_polynomial_inner, + }; + + #[storage] + struct Storage {} + + #[abi(embed_v0)] + impl StarknetWithKeccakLayoutContract2 of IStarknetWithKeccakLayoutContract2 { + fn eval_oods_polynomial_inner( + self: @ContractState, + column_values: Span, + oods_values: Span, + constraint_coefficients: Span, + point: felt252, + oods_point: felt252, + trace_generator: felt252, + ) -> felt252 { + eval_oods_polynomial_inner( + column_values, + oods_values, + constraint_coefficients, + point, + oods_point, + trace_generator, + ) + } + } +} \ No newline at end of file