Skip to content

Commit

Permalink
chore: rebase and remove conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Al-Kindi-0 committed Aug 20, 2024
1 parent 87ced7a commit 18dd698
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion air/src/air/aux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl<E: FieldElement> GkrData<E> {
.fold(E::ZERO, |acc, (a, b)| acc + *a * *b)
}

pub fn compute_batched_query_<F>(&self, query: &[F]) -> E
pub fn compute_batched_query<F>(&self, query: &[F]) -> E
where
F: FieldElement<BaseField = E::BaseField>,
E: ExtensionOf<F>,
Expand Down
8 changes: 1 addition & 7 deletions air/src/air/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ use core::cmp;

use math::StarkField;

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

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

// AIR CONTEXT
// ================================================================================================
Expand Down Expand Up @@ -255,11 +254,6 @@ impl<B: StarkField> AirContext<B> {
self.logup_gkr
}

/// Returns true if the auxiliary trace segment contains a Lagrange kernel column
pub fn is_with_logup_gkr(&self) -> bool {
self.logup_gkr
}

/// Returns the total number of assertions defined for a computation, excluding the Lagrange
/// kernel assertion, which is managed separately.
///
Expand Down
9 changes: 6 additions & 3 deletions prover/src/constraints/evaluator/logup_gkr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
use alloc::vec::Vec;

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

Expand Down Expand Up @@ -79,6 +81,7 @@ where

let c = self.gkr_data.compute_batched_claim();
let mean = c / E::from(E::BaseField::from(trace.trace_info().length() as u32));
let mut query = vec![E::BaseField::ZERO; evaluator.get_oracles().len()];

for step in 0..domain.ce_domain_size() {
// compute Lagrange kernel frame
Expand Down Expand Up @@ -129,8 +132,8 @@ where
let s_cur = aux_frame.current()[s_col_idx];
let s_nxt = aux_frame.next()[s_col_idx];

let query = evaluator.build_query(&main_frame, &[]);
let batched_query = self.gkr_data.compute_batched_query_(&query);
evaluator.build_query(&main_frame, &[], &mut query);
let batched_query = self.gkr_data.compute_batched_query(&query);

let rhs = s_cur - mean + batched_query * l_cur;
let lhs = s_nxt;
Expand Down
16 changes: 9 additions & 7 deletions prover/src/logup_gkr/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,13 @@ pub fn prove_gkr<E: FieldElement>(
let mut main_trace_mls =
build_mls_from_main_trace_segment(evaluator.get_oracles(), main_trace.main_segment())?;

let final_layer_proof =
prove_input_layer(evaluator, logup_randomness, &mut main_trace_mls, gkr_claim, public_coin)?;
let final_layer_proof = prove_input_layer(
evaluator,
logup_randomness,
&mut main_trace_mls,
gkr_claim,
public_coin,
)?;

// include the circuit output as part of the final proof
let CircuitLayerPolys { numerators, denominators } = circuit.output_layer().clone();
Expand All @@ -97,7 +102,7 @@ fn prove_input_layer<
>(
evaluator: &impl LogUpGkrEvaluator<BaseField = E::BaseField>,
log_up_randomness: Vec<E>,
multi_linear_ext_polys: &mut[MultiLinearPoly<E>],
multi_linear_ext_polys: &mut [MultiLinearPoly<E>],
claim: GkrClaim<E>,
transcript: &mut C,
) -> Result<FinalLayerProof<E>, GkrProverError> {
Expand Down Expand Up @@ -236,10 +241,7 @@ fn prove_intermediate_layers<

Ok((
BeforeFinalLayerProof { proof: layer_proofs },
GkrClaim {
evaluation_point,
claimed_evaluation,
},
GkrClaim { evaluation_point, claimed_evaluation },
))
}

Expand Down
6 changes: 4 additions & 2 deletions verifier/src/evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,10 @@ pub fn evaluate_constraints<A: Air, E: FieldElement<BaseField = A::BaseField>>(
let mean = batched_claim
.mul_base(E::BaseField::ONE / E::BaseField::from(air.trace_length() as u32));

let query = air.get_logup_gkr_evaluator::<E>().build_query(main_trace_frame, &[]);
let batched_claim_at_query = gkr_data.compute_batched_query_::<E>(&query);
let mut query = vec![E::ZERO; air.get_logup_gkr_evaluator::<E>().get_oracles().len()];
air.get_logup_gkr_evaluator::<E>()
.build_query(main_trace_frame, &[], &mut query);
let batched_claim_at_query = gkr_data.compute_batched_query::<E>(&query);
let rhs = s_cur - mean + batched_claim_at_query * l_cur;
let lhs = s_nxt;

Expand Down

0 comments on commit 18dd698

Please sign in to comment.