Skip to content

Commit

Permalink
contract fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 committed Sep 12, 2024
1 parent 3ae439c commit 7c4c7ca
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 21 deletions.
5 changes: 1 addition & 4 deletions src/air/layouts/starknet.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@ mod constants;
mod global_values;
mod public_input;
mod traces;
#[cfg(feature: 'split')]
mod contract;

use cairo_verifier::{
air::{
constants::{SHIFT_POINT_X, SHIFT_POINT_Y, StarkCurve},
layouts::starknet::{
contract::{
IStarknetLayoutContract1Dispatcher, IStarknetLayoutContract1DispatcherTrait,
IStarknetLayoutContract2Dispatcher, IStarknetLayoutContract2DispatcherTrait,
},
global_values::{
GlobalValues, InteractionElements, EcPoint, EcdsaSigConfig, CurveConfig
},
Expand Down
12 changes: 8 additions & 4 deletions src/air/layouts/starknet/contract.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ trait ILayoutOodsContract<ContractState> {

#[starknet::contract]
mod LayoutCompositionContract {
use super::ILayoutCompositionContract;
use super::{ILayoutCompositionContract, ILayoutCompositionContractDispatcher};
use cairo_verifier::air::layouts::starknet::{
global_values::GlobalValues, autogenerated::eval_composition_polynomial_inner_part_1,
};
use starknet::ContractAddress;

#[storage]
struct Storage {
continuation_contracts: Array<ContractAddress>,
continuation_contracts: Span<ContractAddress>,
}

#[abi(embed_v0)]
Expand All @@ -48,8 +48,10 @@ mod LayoutCompositionContract {
trace_generator: felt252,
global_values: GlobalValues
) -> felt252 {
let mut continuation_contracts = self.continuation_contracts.read();

let mut total_sum = ILayoutCompositionContractDispatcher {
contract_address: continuation_contracts[0]
contract_address: continuation_contracts.pop_front().unwrap()
}
.eval_composition_polynomial_inner(
mask_values,
Expand All @@ -60,7 +62,9 @@ mod LayoutCompositionContract {
);

total_sum +=
ILayoutCompositionContractDispatcher { contract_address: continuation_contracts[1] }
ILayoutCompositionContractDispatcher {
contract_address: continuation_contracts.pop_front().unwrap()
}
.eval_composition_polynomial_inner(
mask_values,
constraint_coefficients.slice(99, 99),
Expand Down
7 changes: 1 addition & 6 deletions src/air/layouts/starknet_with_keccak.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ mod constants;
mod global_values;
mod public_input;
mod traces;
#[cfg(feature: 'split')]
mod contract;

use cairo_verifier::{
air::{
constants::{SHIFT_POINT_X, SHIFT_POINT_Y, StarkCurve},
layouts::starknet_with_keccak::{
contract::{
IStarknetWithKeccakLayoutContract1Dispatcher,
IStarknetWithKeccakLayoutContract1DispatcherTrait,
IStarknetWithKeccakLayoutContract2Dispatcher,
IStarknetWithKeccakLayoutContract2DispatcherTrait,
},
global_values::{
GlobalValues, InteractionElements, EcPoint, EcdsaSigConfig, CurveConfig
},
Expand Down
28 changes: 21 additions & 7 deletions src/air/layouts/starknet_with_keccak/contract.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ mod LayoutCompositionContract {
trace_generator: felt252,
global_values: GlobalValues
) -> felt252 {
let mut continuation_contracts = self.continuation_contracts.read();

let mut total_sum = ILayoutCompositionContractDispatcher {
contract_address: continuation_contracts[0]
contract_address: continuation_contracts.pop_front().unwrap()
}
.eval_composition_polynomial_inner(
mask_values,
Expand All @@ -58,7 +60,9 @@ mod LayoutCompositionContract {
);

total_sum +=
ILayoutCompositionContractDispatcher { contract_address: continuation_contracts[1] }
ILayoutCompositionContractDispatcher {
contract_address: continuation_contracts.pop_front().unwrap()
}
.eval_composition_polynomial_inner(
mask_values,
constraint_coefficients.slice(95, 100),
Expand All @@ -68,7 +72,9 @@ mod LayoutCompositionContract {
);

total_sum +=
ILayoutCompositionContractDispatcher { contract_address: continuation_contracts[2] }
ILayoutCompositionContractDispatcher {
contract_address: continuation_contracts.pop_front().unwrap()
}
.eval_composition_polynomial_inner(
mask_values,
constraint_coefficients.slice(195, 34),
Expand All @@ -78,7 +84,9 @@ mod LayoutCompositionContract {
);

total_sum +=
ILayoutCompositionContractDispatcher { contract_address: continuation_contracts[3] }
ILayoutCompositionContractDispatcher {
contract_address: continuation_contracts.pop_front().unwrap()
}
.eval_composition_polynomial_inner(
mask_values,
constraint_coefficients.slice(229, 31),
Expand All @@ -88,7 +96,9 @@ mod LayoutCompositionContract {
);

total_sum +=
ILayoutCompositionContractDispatcher { contract_address: continuation_contracts[4] }
ILayoutCompositionContractDispatcher {
contract_address: continuation_contracts.pop_front().unwrap()
}
.eval_composition_polynomial_inner(
mask_values,
constraint_coefficients.slice(260, 25),
Expand All @@ -98,7 +108,9 @@ mod LayoutCompositionContract {
);

total_sum +=
ILayoutCompositionContractDispatcher { contract_address: continuation_contracts[5] }
ILayoutCompositionContractDispatcher {
contract_address: continuation_contracts.pop_front().unwrap()
}
.eval_composition_polynomial_inner(
mask_values,
constraint_coefficients.slice(285, 25),
Expand All @@ -108,7 +120,9 @@ mod LayoutCompositionContract {
);

total_sum +=
ILayoutCompositionContractDispatcher { contract_address: continuation_contracts[6] }
ILayoutCompositionContractDispatcher {
contract_address: continuation_contracts.pop_front().unwrap()
}
.eval_composition_polynomial_inner(
mask_values,
constraint_coefficients.slice(310, 37),
Expand Down

0 comments on commit 7c4c7ca

Please sign in to comment.