From 541c84d5a7b6ddf771a084a3b0c9bf04f5934dbd Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Fri, 12 Jan 2024 10:05:08 +0100 Subject: [PATCH] stark-verify finalized --- src/air/traces.cairo | 4 ++-- src/stark.cairo | 2 +- src/stark/stark_verify.cairo | 20 ++++++++++++++++++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/air/traces.cairo b/src/air/traces.cairo index 57b8a3789..85271d14f 100644 --- a/src/air/traces.cairo +++ b/src/air/traces.cairo @@ -37,7 +37,7 @@ struct TracesCommitment { // Responses for queries to the AIR commitment. // The queries are usually generated by the next component down the line (e.g. FRI). -#[derive(Drop)] +#[derive(Drop, Copy)] struct TracesDecommitment { // Responses for queries to the original trace. original: TableDecommitment, @@ -46,7 +46,7 @@ struct TracesDecommitment { } // A witness for a decommitment of the AIR traces over queries. -#[derive(Drop)] +#[derive(Drop, Copy)] struct TracesWitness { original: TableCommitmentWitness, interaction: TableCommitmentWitness, diff --git a/src/stark.cairo b/src/stark.cairo index 0812c008c..bd78b0fa3 100644 --- a/src/stark.cairo +++ b/src/stark.cairo @@ -134,7 +134,7 @@ struct StarkCommitment { fri: FriCommitment, } -#[derive(Drop)] +#[derive(Drop, Copy)] struct StarkWitness { traces_decommitment: TracesDecommitment, traces_witness: TracesWitness, diff --git a/src/stark/stark_verify.cairo b/src/stark/stark_verify.cairo index 56d467abf..b8bbf2bf6 100644 --- a/src/stark/stark_verify.cairo +++ b/src/stark/stark_verify.cairo @@ -1,12 +1,16 @@ +use core::array::ArrayTrait; use cairo_verifier::{ queries::queries::queries_to_points, domains::StarkDomains, fri::fri::{FriDecommitment, fri_verify}, stark::{StarkUnsentCommitment, StarkWitness, StarkCommitment}, air::traces::traces_decommit, table_commitment::table_decommit, + oods::{OodsEvaluationInfo, eval_oods_boundary_poly_at_points}, }; // STARK decommitment phase. fn stark_verify( + n_original_columns: u32, + n_interaction_columns: u32, queries: Span, commitment: StarkCommitment, witness: StarkWitness, @@ -28,8 +32,20 @@ fn stark_verify( let points = queries_to_points(queries, @stark_domains); // Evaluate the FRI input layer at query points. - let eval_info = 0; - let oods_poly_evals = ArrayTrait::::new(); + let eval_info = OodsEvaluationInfo { + oods_values: commitment.oods_values, + oods_point: commitment.interaction_after_composition, + trace_generator: stark_domains.trace_generator, + constraint_coefficients: commitment.interaction_after_oods, + }; + let oods_poly_evals = eval_oods_boundary_poly_at_points( + n_original_columns, + n_interaction_columns, + eval_info, + points.span(), + witness.traces_decommitment, + witness.composition_decommitment, + ); // Decommit FRI. let fri_decommitment = FriDecommitment {