Skip to content

Commit

Permalink
feat: add support for s-col and merge it with the that of Lagrange ke…
Browse files Browse the repository at this point in the history
…rnel under LogUp-GKR
  • Loading branch information
Al-Kindi-0 committed Aug 27, 2024
1 parent 3a186f2 commit f4034ff
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 2 additions & 0 deletions air/src/air/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use math::StarkField;

use crate::{air::TransitionConstraintDegree, ProofOptions, TraceInfo};

use super::LAGRANGE_KERNEL_OFFSET;

// AIR CONTEXT
// ================================================================================================
/// STARK parameters and trace properties for a specific execution of a computation.
Expand Down
2 changes: 1 addition & 1 deletion air/src/air/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub use lagrange::{
};

mod logup_gkr;
pub use logup_gkr::{LogUpGkrEvaluator, LogUpGkrOracle, PhantomLogUpGkrEval};
pub use logup_gkr::{LogUpGkrEvaluator, LogUpGkrOracle, PhantomLogUpGkrEval, LAGRANGE_KERNEL_OFFSET, S_COLUMN_OFFSET};

mod coefficients;
pub use coefficients::{
Expand Down
2 changes: 1 addition & 1 deletion prover/src/constraints/evaluator/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use utils::iter_mut;
use utils::{iterators::*, rayon};

use super::{
super::EvaluationTableFragment, lagrange::LogUpGkrConstraintsEvaluator, BoundaryConstraints,
super::EvaluationTableFragment, logup_gkr::LogUpGkrConstraintsEvaluator, BoundaryConstraints,
CompositionPolyTrace, ConstraintEvaluationTable, ConstraintEvaluator, PeriodicValueTable,
StarkDomain, TraceLde,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
use alloc::vec::Vec;

use air::{
Air, EvaluationFrame, GkrData, LagrangeConstraintsCompositionCoefficients,
LagrangeKernelConstraints, LagrangeKernelEvaluationFrame, LogUpGkrEvaluator,
Air, EvaluationFrame, GkrData, LagrangeConstraintsCompositionCoefficients, LagrangeKernelConstraints, LagrangeKernelEvaluationFrame, LogUpGkrEvaluator, LAGRANGE_KERNEL_OFFSET, S_COLUMN_OFFSET
};
use math::{batch_inversion, FieldElement};

Expand Down Expand Up @@ -49,7 +48,7 @@ where

/// Evaluates the transition and boundary constraints. Specifically, the constraint evaluations
/// are divided by their corresponding divisors, and the resulting terms are linearly combined
/// using the composition coefficients.
/// using the constraint composition coefficients.
///
/// Writes the evaluations in `combined_evaluations_acc` at the corresponding (constraint
/// evaluation) domain index.
Expand All @@ -73,8 +72,8 @@ where
let evaluator = self.air.get_logup_gkr_evaluator::<E>();
let s_col_constraint_divisor =
compute_s_col_divisor::<E>(domain.ce_domain_size(), domain, self.air.trace_length());
let s_col_idx = trace.trace_info().aux_segment_width() - 2;
let l_col_idx = trace.trace_info().aux_segment_width() - 1;
let s_col_idx = trace.trace_info().aux_segment_width() - S_COLUMN_OFFSET;
let l_col_idx = trace.trace_info().aux_segment_width() - LAGRANGE_KERNEL_OFFSET;
let mut main_frame = EvaluationFrame::new(trace.trace_info().main_trace_width());
let mut aux_frame = EvaluationFrame::new(trace.trace_info().aux_segment_width());

Expand Down
2 changes: 1 addition & 1 deletion prover/src/constraints/evaluator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub use default::DefaultConstraintEvaluator;
mod boundary;
use boundary::BoundaryConstraints;

mod lagrange;
mod logup_gkr;

mod periodic_table;
use periodic_table::PeriodicValueTable;
Expand Down
4 changes: 2 additions & 2 deletions verifier/src/evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use alloc::vec::Vec;

use air::{
Air, AuxRandElements, ConstraintCompositionCoefficients, EvaluationFrame,
LagrangeKernelEvaluationFrame, LogUpGkrEvaluator,
LagrangeKernelEvaluationFrame, LogUpGkrEvaluator, S_COLUMN_OFFSET,
};
use math::{polynom, FieldElement};

Expand Down Expand Up @@ -116,7 +116,7 @@ pub fn evaluate_constraints<A: Air, E: FieldElement<BaseField = A::BaseField>>(

// s-column constraints

let s_col_idx = air.trace_info().aux_segment_width() - 2;
let s_col_idx = air.trace_info().aux_segment_width() - S_COLUMN_OFFSET;
let s_cur = aux_trace_frame
.as_ref()
.expect("expected aux rand elements to be present")
Expand Down

0 comments on commit f4034ff

Please sign in to comment.