Skip to content

Commit

Permalink
addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
irakliyk committed Apr 13, 2022
1 parent 4200977 commit 336b0fa
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 35 deletions.
2 changes: 1 addition & 1 deletion air/src/air/boundary/constraint_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use super::{
/// * `F` could be the base field of the protocol, in which case `E` is the extension field used.
/// * `F` could be the extension field, in which case `F` and `E` are the same type.
///
/// The above arrangement allows use to describe boundary constraints for main and auxiliary
/// The above arrangement allows us to describe boundary constraints for main and auxiliary
/// segments of the execution trace. Specifically:
/// * For the constraints against columns of the main execution trace, `F` is set to the base field
/// of the protocol, and `E` is set to the extension field.
Expand Down
2 changes: 1 addition & 1 deletion air/src/air/boundary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl<E: FieldElement> BoundaryConstraints<E> {
let main_trace_width = context.trace_info.layout().main_trace_width();
let aux_trace_width = context.trace_info.layout().aux_trace_width();

// make sure the assertions are valid in he context of their respective trace segments;
// make sure the assertions are valid in the context of their respective trace segments;
// also, sort the assertions in the deterministic order so that changing the order of
// assertions does not change random coefficients that get assigned to them.
let main_assertions = prepare_assertions(main_assertions, main_trace_width, trace_length);
Expand Down
4 changes: 2 additions & 2 deletions air/src/air/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ impl<B: StarkField> AirContext<B> {
/// # Panics
/// Panics if
/// * `transition_constraint_degrees` is an empty vector.
/// * `num_main_assertions` is zero.
/// * `num_assertions` is zero.
/// * Blowup factor specified by the provided `options` is too small to accommodate degrees
/// of the specified transition constraints.
/// * `trace_info` describes an multi-segment execution trace.
/// * `trace_info` describes a multi-segment execution trace.
pub fn new(
trace_info: TraceInfo,
transition_constraint_degrees: Vec<TransitionConstraintDegree>,
Expand Down
15 changes: 7 additions & 8 deletions air/src/air/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,17 @@ pub trait Air: Send + Sync {
/// Evaluates transition constraints over the specified evaluation frames for the main and
/// auxiliary trace segments.
///
/// The evaluations should be written into the `results` slice in the same order as the
/// the order of auxiliary transition constraint degree descriptors used to instantiate
/// [AirContext] for this AIR. Thus, the length of the `result` slice will equal to the number
/// of auxiliary transition constraints defined for this computation.
/// The evaluations should be written into the `results` slice in the same order as the order
/// of auxiliary transition constraint degree descriptors used to instantiate [AirContext] for
/// this AIR. Thus, the length of the `result` slice will equal to the number of auxiliary
/// transition constraints defined for this computation.
///
/// The default implementation of this function panics. It must be overridden for AIRs
/// describing computations which require multiple trace segments.
///
/// The types for main and auxiliary trace evaluation frames are defined as follows:
/// * When the entire protocol is executed in a prime field, types `F` and `E` are the same,
/// and thus, both the main and the auxiliary trace frames are defined over the base filed.
/// and thus, both the main and the auxiliary trace frames are defined over the base field.
/// * When the protocol is executed in an extension field, the main trace frame is defined
/// over the base field, while the auxiliary trace frame is defined over the extension field.
///
Expand All @@ -227,8 +227,7 @@ pub trait Air: Send + Sync {
periodic_values: &[F],
aux_rand_elements: &AuxTraceRandElements<E>,
result: &mut [E],
) -> Vec<Assertion<F>>
where
) where
F: FieldElement<BaseField = Self::BaseField>,
E: FieldElement<BaseField = Self::BaseField> + ExtensionOf<F>,
{
Expand Down Expand Up @@ -325,7 +324,7 @@ pub trait Air: Send + Sync {
/// Convert assertions returned from [get_assertions()](Air::get_assertions) and
/// [get_aux_assertions()](Air::get_aux_assertions) methods into boundary constraints.
///
/// This function also assign composition coefficients to each constraint, and group the
/// This function also assigns composition coefficients to each constraint, and groups the
/// constraints by their divisors. The coefficients will be used to compute random linear
/// combination of boundary constraints during constraint merging.
fn get_boundary_constraints<E: FieldElement<BaseField = Self::BaseField>>(
Expand Down
2 changes: 1 addition & 1 deletion air/src/air/trace_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl TraceLayout {
// PUBLIC ACCESSORS
// --------------------------------------------------------------------------------------------

/// Returns the number of column in the main segment of an execution trace.
/// Returns the number of columns in the main segment of an execution trace.
///
/// This is guaranteed to be between 1 and 255.
pub fn main_trace_width(&self) -> usize {
Expand Down
3 changes: 1 addition & 2 deletions prover/src/constraints/boundary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,7 @@ where
.iter()
.rev()
.fold(F::ZERO, |acc, &coeff| acc.mul_base(x) + coeff);

//let assertion_value = polynom::eval(&self.poly, x);
// evaluate the constraint
let evaluation = state[self.column] - assertion_value;
(self.coefficients.0 + self.coefficients.1.mul_base(xp)).mul_base(evaluation)
}
Expand Down
2 changes: 1 addition & 1 deletion prover/src/constraints/evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl<'a, A: Air, E: FieldElement<BaseField = A::BaseField>> ConstraintEvaluator<

// allocate space for constraint evaluations; when we are in debug mode, we also allocate
// memory to hold all transition constraint evaluations (before they are merged into a
// single value) so that we can check their degrees late
// single value) so that we can check their degrees later
#[cfg(not(debug_assertions))]
let mut evaluation_table = ConstraintEvaluationTable::<E>::new(domain, divisors);
#[cfg(debug_assertions)]
Expand Down
2 changes: 1 addition & 1 deletion prover/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub use air::{
proof::StarkProof, Air, AirContext, Assertion, AuxTraceRandElements, BoundaryConstraint,
BoundaryConstraintGroup, ConstraintCompositionCoefficients, ConstraintDivisor,
DeepCompositionCoefficients, EvaluationFrame, FieldExtension, HashFunction, ProofOptions,
TraceInfo, TransitionConstraintDegree, TransitionConstraintGroup,
TraceInfo, TraceLayout, TransitionConstraintDegree, TransitionConstraintGroup,
};
pub use utils::{
iterators, ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable,
Expand Down
2 changes: 1 addition & 1 deletion prover/src/trace/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use super::TraceLde;

/// Execution trace commitment.
///
/// The described one or more trace segments, each consisting of the following components:
/// The describes one or more trace segments, each consisting of the following components:
/// * Evaluations of a trace segment's polynomials over the LDE domain.
/// * Merkle tree where each leaf in the tree corresponds to a row in the trace LDE matrix.
pub struct TraceCommitment<E: FieldElement, H: ElementHasher<BaseField = E::BaseField>> {
Expand Down
18 changes: 9 additions & 9 deletions prover/src/trace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ pub trait Trace: Sized {
where
E: FieldElement<BaseField = Self::BaseField>;

/// Reads an evaluation frame from the main trace segment at the specified row.
fn read_main_frame(&self, row_idx: usize, frame: &mut EvaluationFrame<Self::BaseField>);

/// Reads an evaluation frame from auxiliary trace segments at the specified row.
fn read_aux_frame<E>(&self, row_idx: usize, frame: &mut EvaluationFrame<E>)
where
E: FieldElement<BaseField = Self::BaseField>;

// PROVIDED METHODS
// --------------------------------------------------------------------------------------------

Expand All @@ -86,17 +94,9 @@ pub trait Trace: Sized {

/// Returns the number of columns in all auxiliary trace segments.
fn aux_trace_width(&self) -> usize {
self.layout().main_trace_width()
self.layout().aux_trace_width()
}

/// Reads an evaluation frame from the main trace segment at the specified row.
fn read_main_frame(&self, row_idx: usize, frame: &mut EvaluationFrame<Self::BaseField>);

/// Reads an evaluation frame from auxiliary trace segments at the specified row.
fn read_aux_frame<E>(&self, row_idx: usize, frame: &mut EvaluationFrame<E>)
where
E: FieldElement<BaseField = Self::BaseField>;

// VALIDATION
// --------------------------------------------------------------------------------------------
/// Checks if this trace is valid against the specified AIR, and panics if not.
Expand Down
8 changes: 4 additions & 4 deletions verifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ where
H: ElementHasher<BaseField = A::BaseField>,
{
// 1 ----- trace commitment -------------------------------------------------------------------
// read the commitments to evaluations of the trace polynomials over the LDE domain sent by the
// prover. the commitments are used to update the public coin, and draw sets of random elements
// Read the commitments to evaluations of the trace polynomials over the LDE domain sent by the
// prover. The commitments are used to update the public coin, and draw sets of random elements
// from the coin (in the interactive version of the protocol the verifier sends these random
// elements to the prover after each commitment is made). when there are multiple trace
// elements to the prover after each commitment is made). When there are multiple trace
// commitments (i.e., the trace consists of more than one segment), each previous commitment is
// used to draw random elements needed to construct the next trace segment. the last trace
// used to draw random elements needed to construct the next trace segment. The last trace
// commitment is used to draw a set of random coefficients which the prover uses to compute
// constraint composition polynomial.
let trace_commitments = channel.read_trace_commitments();
Expand Down
8 changes: 4 additions & 4 deletions winterfell/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,11 @@
#![cfg_attr(not(feature = "std"), no_std)]

pub use prover::{
crypto, iterators, math, Air, AirContext, Assertion, BoundaryConstraint,
crypto, iterators, math, Air, AirContext, Assertion, AuxTraceRandElements, BoundaryConstraint,
BoundaryConstraintGroup, ByteReader, ByteWriter, ConstraintCompositionCoefficients,
ConstraintDivisor, DeepCompositionCoefficients, Deserializable, DeserializationError,
EvaluationFrame, FieldExtension, HashFunction, ProofOptions, Prover, ProverError, Serializable,
StarkProof, Trace, TraceInfo, TraceTable, TraceTableFragment, TransitionConstraintDegree,
TransitionConstraintGroup,
EvaluationFrame, FieldExtension, HashFunction, Matrix, ProofOptions, Prover, ProverError,
Serializable, StarkProof, Trace, TraceInfo, TraceLayout, TraceTable, TraceTableFragment,
TransitionConstraintDegree, TransitionConstraintGroup,
};
pub use verifier::{verify, VerifierError};

0 comments on commit 336b0fa

Please sign in to comment.