Skip to content

Commit c671e2d

Browse files
authored
Add constraints binding (#1679)
* Add constraints binding * Add ctl vars to constraint binding. Cleanup * Cleanup comments * Turn from_proof into from_opening_set for CtlCheckVars * Tiny cleanup * Fix poly_evals number of quotient targets * Fix no std * Apply comments * Address comments * Clippy * Simulate polynomial values for sontraint evaluation * Apply most comments * Make 50 modular * Apply comments * Apply comments
1 parent cd907f6 commit c671e2d

File tree

9 files changed

+714
-117
lines changed

9 files changed

+714
-117
lines changed

plonky2/src/iop/challenger.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,16 @@ impl<F: RichField + Extendable<D>, H: AlgebraicHasher<F>, const D: usize>
265265
self.get_n_challenges(builder, D).try_into().unwrap()
266266
}
267267

268+
pub fn get_n_extension_challenges(
269+
&mut self,
270+
builder: &mut CircuitBuilder<F, D>,
271+
n: usize,
272+
) -> Vec<ExtensionTarget<D>> {
273+
(0..n)
274+
.map(|_| self.get_extension_challenge(builder))
275+
.collect()
276+
}
277+
268278
/// Absorb any buffered inputs. After calling this, the input buffer will be empty, and the
269279
/// output buffer will be full.
270280
fn absorb_buffered_inputs(&mut self, builder: &mut CircuitBuilder<F, D>) {

starky/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl StarkConfig {
9999
}
100100

101101
/// Observes this [`StarkConfig`] for the given [`Challenger`].
102-
pub(crate) fn observe<F: RichField, H: Hasher<F>>(&self, challenger: &mut Challenger<F, H>) {
102+
pub fn observe<F: RichField, H: Hasher<F>>(&self, challenger: &mut Challenger<F, H>) {
103103
challenger.observe_element(F::from_canonical_usize(self.security_bits));
104104
challenger.observe_element(F::from_canonical_usize(self.num_challenges));
105105

starky/src/cross_table_lookup.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ impl<'a, F: RichField + Extendable<D>, const D: usize>
449449
total_num_helper_columns: usize,
450450
num_helper_ctl_columns: &[usize],
451451
) -> Vec<Self> {
452-
// Get all cross-table lookup polynomial openings for the provided STARK proof.
452+
// Get all cross-table lookup polynomial openings for the provided STARK opening set.
453453
let ctl_zs = {
454454
let auxiliary_polys = proof
455455
.openings
@@ -647,7 +647,7 @@ pub struct CtlCheckVarsTarget<F: Field, const D: usize> {
647647
}
648648

649649
impl<'a, F: Field, const D: usize> CtlCheckVarsTarget<F, D> {
650-
/// Circuit version of `from_proofs`, for a single STARK.
650+
/// Circuit version of `from_proof`, for a single STARK.
651651
pub fn from_proof(
652652
table: TableIdx,
653653
proof: &StarkProofTarget<D>,
@@ -657,19 +657,20 @@ impl<'a, F: Field, const D: usize> CtlCheckVarsTarget<F, D> {
657657
total_num_helper_columns: usize,
658658
num_helper_ctl_columns: &[usize],
659659
) -> Vec<Self> {
660-
// Get all cross-table lookup polynomial openings for each STARK proof.
660+
// Get all cross-table lookup polynomial openings.
661661
let ctl_zs = {
662-
let openings = &proof.openings;
663-
let ctl_zs = openings
662+
let ctl_zs = proof
663+
.openings
664664
.auxiliary_polys
665665
.as_ref()
666-
.expect("We cannot have CTls without auxiliary polynomials.")
666+
.expect("We cannot have CTLs without auxiliary polynomials.")
667667
.iter()
668668
.skip(num_lookup_columns);
669-
let ctl_zs_next = openings
669+
let ctl_zs_next = proof
670+
.openings
670671
.auxiliary_polys_next
671672
.as_ref()
672-
.expect("We cannot have CTls without auxiliary polynomials.")
673+
.expect("We cannot have CTLs without auxiliary polynomials.")
673674
.iter()
674675
.skip(num_lookup_columns);
675676
ctl_zs.zip(ctl_zs_next).collect::<Vec<_>>()

0 commit comments

Comments
 (0)