diff --git a/src/air/layouts/starknet.cairo b/src/air/layouts/starknet.cairo index 2ad62c447..e2bb2ea41 100644 --- a/src/air/layouts/starknet.cairo +++ b/src/air/layouts/starknet.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::{ - autogenerated::{eval_composition_polynomial_inner, eval_oods_polynomial_inner}, + contract::{ + IStarknetLayoutContract1Dispatcher, IStarknetLayoutContract1DispatcherTrait, + IStarknetLayoutContract2Dispatcher, IStarknetLayoutContract2DispatcherTrait, + }, global_values::{ GlobalValues, InteractionElements, EcPoint, EcdsaSigConfig, CurveConfig }, @@ -30,6 +34,7 @@ use cairo_verifier::{ }, common::{math::{Felt252Div, Felt252PartialOrd, pow}, asserts::assert_range_u128} }; +use starknet::ContractAddress; impl StarknetAIRCompositionImpl of AIRComposition { fn eval_composition_polynomial( @@ -39,7 +44,8 @@ impl StarknetAIRCompositionImpl 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; @@ -139,7 +145,9 @@ impl StarknetAIRCompositionImpl of AIRComposition felt252 { - eval_oods_polynomial_inner( + IStarknetLayoutContract2Dispatcher { + 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/contract.cairo b/src/air/layouts/starknet/contract.cairo new file mode 100644 index 000000000..66195298a --- /dev/null +++ b/src/air/layouts/starknet/contract.cairo @@ -0,0 +1,92 @@ +use cairo_verifier::air::layouts::starknet::global_values::GlobalValues; + +#[starknet::interface] +trait IStarknetLayoutContract1 { + 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 IStarknetLayoutContract2 { + 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 StarknetLayoutContract1 { + use super::IStarknetLayoutContract1; + use cairo_verifier::air::layouts::starknet::{ + global_values::GlobalValues, + autogenerated::eval_composition_polynomial_inner, + }; + + #[storage] + struct Storage {} + + #[abi(embed_v0)] + impl StarknetLayoutContract1 of IStarknetLayoutContract1 { + 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 StarknetLayoutContract2 { + use super::IStarknetLayoutContract2; + use cairo_verifier::air::layouts::starknet::{ + global_values::GlobalValues, + autogenerated::eval_oods_polynomial_inner, + }; + + #[storage] + struct Storage {} + + #[abi(embed_v0)] + impl StarknetLayoutContract2 of IStarknetLayoutContract2 { + 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