Skip to content

Commit

Permalink
s column last step assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
plafer committed Jun 25, 2024
1 parent 3eba944 commit c432df1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
18 changes: 17 additions & 1 deletion air/src/constraints/logup.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
use alloc::vec::Vec;
use winter_air::TransitionConstraintDegree;
use vm_core::{Felt, FieldElement};
use winter_air::{Assertion, TransitionConstraintDegree};

use crate::{gkr_proof::inner_product, trace::logup::S_COL_IDX};

/// The number of auxiliary assertions.
pub const NUM_AUX_ASSERTIONS: usize = 2;

pub fn get_aux_transition_constraint_degrees() -> Vec<TransitionConstraintDegree> {
todo!()
}

pub fn get_aux_assertions_last_step<E>(
result: &mut Vec<Assertion<E>>,
openings_combining_randomness: &[E],
openings: &[E],
step: usize,
) where
E: FieldElement<BaseField = Felt>,
{
let value = inner_product(openings_combining_randomness, openings);

result.push(Assertion::single(S_COL_IDX, step, value));
}
2 changes: 1 addition & 1 deletion air/src/gkr_verifier/sum_check_verifier/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ where
if openings_claim.eval_point != evaluation_point {
return Err(Error::WrongOpeningPoint);
}
let query = self.final_query_builder.build_query(&openings_claim, &evaluation_point);
let query = self.final_query_builder.build_query(openings_claim, &evaluation_point);

if self.composition_poly.evaluate(&query) != claimed_evaluation {
Err(Error::FinalEvaluationCheckFailed)
Expand Down
16 changes: 16 additions & 0 deletions air/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,22 @@ impl Air for ProcessorAir {
last_step,
);

// Add LogUp's "s" column assertions for the last step.
{
let openings_combining_randomness = aux_rand_elements
.gkr_openings_combining_randomness()
.expect("GKR openings combining randomness not present in AuxRandElements");
let openings =
gkr_proof.expect("GKR proof not present").get_final_opening_claim().openings;

logup::get_aux_assertions_last_step(
&mut result,
openings_combining_randomness,
&openings,
last_step,
);
}

result
}

Expand Down

0 comments on commit c432df1

Please sign in to comment.