use plonky2::field::extension::{Extendable, FieldExtension}; use plonky2::field::packed::PackedField; use plonky2::hash::hash_types::RichField; use plonky2::plonk::circuit_builder::CircuitBuilder; use crate::constraint_consumer::{ConstraintConsumer, RecursiveConstraintConsumer}; use crate::cross_table_lookup::{ eval_cross_table_lookup_checks, eval_cross_table_lookup_checks_circuit, CtlCheckVars, CtlCheckVarsTarget, }; use crate::lookup::{ eval_ext_lookups_circuit, eval_packed_lookups_generic, Lookup, LookupCheckVars, LookupCheckVarsTarget, }; use crate::stark::Stark; /// Evaluates all constraint, permutation and cross-table lookup polynomials /// of the current STARK at the local and next values. pub(crate) fn eval_vanishing_poly( stark: &S, vars: &S::EvaluationFrame, lookups: &[Lookup], lookup_vars: Option>, ctl_vars: &[CtlCheckVars], consumer: &mut ConstraintConsumer

, ) where F: RichField + Extendable, FE: FieldExtension, P: PackedField, S: Stark, { // Evaluate all of the STARK's table constraints. stark.eval_packed_generic(vars, consumer); if let Some(lookup_vars) = lookup_vars { // Evaluate the STARK constraints related to the permutation arguments. eval_packed_lookups_generic::( stark, lookups, vars, lookup_vars, consumer, ); } // Evaluate the STARK constraints related to the cross-table lookups. eval_cross_table_lookup_checks::(vars, ctl_vars, consumer); } /// Circuit version of `eval_vanishing_poly`. /// Evaluates all constraint, permutation and cross-table lookup polynomials /// of the current STARK at the local and next values. pub(crate) fn eval_vanishing_poly_circuit( builder: &mut CircuitBuilder, stark: &S, vars: &S::EvaluationFrameTarget, lookup_vars: Option>, ctl_vars: &[CtlCheckVarsTarget], consumer: &mut RecursiveConstraintConsumer, ) where F: RichField + Extendable, S: Stark, { // Evaluate all of the STARK's table constraints. stark.eval_ext_circuit(builder, vars, consumer); if let Some(lookup_vars) = lookup_vars { // Evaluate all of the STARK's constraints related to the permutation argument. eval_ext_lookups_circuit::(builder, stark, vars, lookup_vars, consumer); } // Evaluate all of the STARK's constraints related to the cross-table lookups. eval_cross_table_lookup_checks_circuit::(builder, vars, ctl_vars, consumer); }