Skip to content

Commit 389c389

Browse files
committed
updated lints
1 parent ce3ad67 commit 389c389

File tree

53 files changed

+440
-458
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+440
-458
lines changed

air/src/air/assertions/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ const NO_STRIDE: usize = 0;
3030
/// An assertion is always placed against a single column of an execution trace, but can cover
3131
/// multiple steps and multiple values. Specifically, there are three kinds of assertions:
3232
///
33-
/// 1. **Single** assertion - which requires that a value in a single cell of an execution trace
34-
/// is equal to the specified value.
35-
/// 2. **Periodic** assertion - which requires that values in multiple cells of a single column
36-
/// are equal to the specified value. The cells must be evenly spaced at intervals with lengths
37-
/// equal to powers of two. For example, we can specify that values in a column must be equal
38-
/// to 0 at steps 0, 8, 16, 24, 32 etc. Steps can also start at some offset - e.g., 1, 9, 17,
39-
/// 25, 33 is also a valid sequence of steps.
40-
/// 3. **Sequence** assertion - which requires that multiple cells in a single column are equal
41-
/// to the values from the provided list. The cells must be evenly spaced at intervals with
42-
/// lengths equal to powers of two. For example, we can specify that values in a column must
43-
/// be equal to a sequence 1, 2, 3, 4 at steps 0, 8, 16, 24. That is, value at step 0 should be
44-
/// equal to 1, value at step 8 should be equal to 2 etc.
33+
/// 1. **Single** assertion - which requires that a value in a single cell of an execution trace is
34+
/// equal to the specified value.
35+
/// 2. **Periodic** assertion - which requires that values in multiple cells of a single column are
36+
/// equal to the specified value. The cells must be evenly spaced at intervals with lengths equal
37+
/// to powers of two. For example, we can specify that values in a column must be equal to 0 at
38+
/// steps 0, 8, 16, 24, 32 etc. Steps can also start at some offset - e.g., 1, 9, 17, 25, 33 is
39+
/// also a valid sequence of steps.
40+
/// 3. **Sequence** assertion - which requires that multiple cells in a single column are equal to
41+
/// the values from the provided list. The cells must be evenly spaced at intervals with lengths
42+
/// equal to powers of two. For example, we can specify that values in a column must be equal to
43+
/// a sequence 1, 2, 3, 4 at steps 0, 8, 16, 24. That is, value at step 0 should be equal to 1,
44+
/// value at step 8 should be equal to 2 etc.
4545
///
4646
/// Note that single and periodic assertions are succinct. That is, a verifier can evaluate them
4747
/// very efficiently. However, sequence assertions have liner complexity in the number of

air/src/air/boundary/constraint_group.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ use super::{Assertion, BoundaryConstraint, ConstraintDivisor, ExtensionOf, Field
3131
/// segments of the execution trace. Specifically:
3232
/// * For the constraints against columns of the main execution trace, `F` is set to the base field
3333
/// of the protocol, and `E` is set to the extension field.
34-
/// * For the constraints against columns of the auxiliary trace segment, both `F` and `E` are set to
35-
/// the extension field.
34+
/// * For the constraints against columns of the auxiliary trace segment, both `F` and `E` are set
35+
/// to the extension field.
3636
#[derive(Debug, Clone)]
3737
pub struct BoundaryConstraintGroup<F, E>
3838
where
@@ -96,8 +96,8 @@ where
9696
/// $$
9797
/// where:
9898
/// * $C_i(x)$ is the evaluation of the $i$th constraint at `x` computed as $f(x) - b(x)$.
99-
/// * $\alpha_i$ are random field elements. In the interactive version of the
100-
/// protocol, these are provided by the verifier.
99+
/// * $\alpha_i$ are random field elements. In the interactive version of the protocol, these
100+
/// are provided by the verifier.
101101
pub fn evaluate_at(&self, state: &[E], x: E) -> E {
102102
let mut numerator = E::ZERO;
103103
for constraint in self.constraints().iter() {

air/src/air/boundary/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ impl<E: FieldElement> BoundaryConstraints<E> {
5252
///
5353
/// # Panics
5454
/// Panics if:
55-
/// * The number of provided assertions does not match the number of assertions described by
56-
/// the context.
55+
/// * The number of provided assertions does not match the number of assertions described by the
56+
/// context.
5757
/// * The number of assertions does not match the number of the provided composition
5858
/// coefficients.
5959
/// * The specified assertions are not valid in the context of the computation (e.g., assertion

air/src/air/coefficients.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ use math::{get_power_series, get_power_series_with_offset, FieldElement};
1414
///
1515
/// These coefficients are created by the
1616
/// [Air::get_constraint_composition_coefficients()](crate::Air::get_constraint_composition_coefficients)
17-
/// function. In the interactive version of the protocol, the verifier either draws these coefficients
18-
/// uniformly at random from the extension field of the protocol or draws a single random extension
19-
/// field element $\alpha$ and defines the coefficients as $\alpha_i = \alpha^i$. We call the former
20-
/// way way of generating the alpha-s, and hence of batching the constraints, linear/affine batching
21-
/// while we call the latter algebraic/curve batching.
17+
/// function. In the interactive version of the protocol, the verifier either draws these
18+
/// coefficients uniformly at random from the extension field of the protocol or draws a single
19+
/// random extension field element $\alpha$ and defines the coefficients as $\alpha_i = \alpha^i$.
20+
/// We call the former way way of generating the alpha-s, and hence of batching the constraints,
21+
/// linear/affine batching while we call the latter algebraic/curve batching.
2222
///
2323
/// There is one coefficient for each constraint so that we can compute a random linear
2424
/// combination of constraints as:
@@ -113,14 +113,14 @@ impl<E: FieldElement> ConstraintCompositionCoefficients<E> {
113113
/// )} + \sum_{j=0}^m{\beta_j \cdot \frac{H_j(x) - H_j(z)}{x - z}}
114114
/// $$
115115
/// where:
116-
/// * $z$ is an out-of-domain point drawn randomly from the entire field. In the interactive
117-
/// version of the protocol, $z$ is provided by the verifier.
118-
/// * $g$ is the generator of the trace domain. This is the $n$th root of unity where
119-
/// $n$ is the length of the execution trace.
120-
/// * $T_i(x)$ is an evaluation of the $i$th trace polynomial at $x$, and $k$ is the total
121-
/// number of trace polynomials (which is equal to the width of the execution trace).
122-
/// * $H_i(x)$ is an evaluation of the $j$th constraint composition column polynomial at $x$,
123-
/// and $m$ is the total number of column polynomials.
116+
/// * $z$ is an out-of-domain point drawn randomly from the entire field. In the interactive version
117+
/// of the protocol, $z$ is provided by the verifier.
118+
/// * $g$ is the generator of the trace domain. This is the $n$th root of unity where $n$ is the
119+
/// length of the execution trace.
120+
/// * $T_i(x)$ is an evaluation of the $i$th trace polynomial at $x$, and $k$ is the total number of
121+
/// trace polynomials (which is equal to the width of the execution trace).
122+
/// * $H_i(x)$ is an evaluation of the $j$th constraint composition column polynomial at $x$, and
123+
/// $m$ is the total number of column polynomials.
124124
/// * $\alpha_i$ is a composition coefficient for the $i$th trace polynomial.
125125
/// * $\beta_j$ is a composition coefficient for the $j$th constraint column polynomial.
126126
///

air/src/air/context.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ impl<B: StarkField> AirContext<B> {
4242
/// Panics if
4343
/// * `transition_constraint_degrees` is an empty vector.
4444
/// * `num_assertions` is zero.
45-
/// * Blowup factor specified by the provided `options` is too small to accommodate degrees
46-
/// of the specified transition constraints.
45+
/// * Blowup factor specified by the provided `options` is too small to accommodate degrees of
46+
/// the specified transition constraints.
4747
/// * `trace_info` describes a multi-segment execution trace.
4848
pub fn new(
4949
trace_info: TraceInfo,
@@ -85,8 +85,8 @@ impl<B: StarkField> AirContext<B> {
8585
/// * `trace_info.is_multi_segment() == false` but:
8686
/// - `aux_transition_constraint_degrees` is a non-empty vector.
8787
/// - `num_aux_assertions` is greater than zero.
88-
/// * Blowup factor specified by the provided `options` is too small to accommodate degrees
89-
/// of the specified transition constraints.
88+
/// * Blowup factor specified by the provided `options` is too small to accommodate degrees of
89+
/// the specified transition constraints.
9090
pub fn new_multi_segment(
9191
trace_info: TraceInfo,
9292
main_transition_constraint_degrees: Vec<TransitionConstraintDegree>,
@@ -309,9 +309,9 @@ impl<B: StarkField> AirContext<B> {
309309
// number of exemptions.
310310
// The `ce_blowup` factor puts a ceiling on the maximal degree of a constraint composition
311311
// polynomial we can accommodate. On the other hand, adding exemption points reduces the
312-
// degree of the divisor which results in an increase of the resulting constraint composition
313-
// polynomial.Thus we need to check that the number of exemption points is not too large
314-
// given the above.
312+
// degree of the divisor which results in an increase of the resulting constraint
313+
// composition polynomial.Thus we need to check that the number of exemption points
314+
// is not too large given the above.
315315
for degree in self
316316
.main_transition_constraint_degrees
317317
.iter()

air/src/air/mod.rs

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,17 @@ const MIN_CYCLE_LENGTH: usize = 2;
5353
/// [math::fields] for available field options).
5454
/// 2. Define a set of public inputs which are required for your computation via the
5555
/// [Air::PublicInputs] associated type.
56-
/// 3. Implement [Air::new()] function. As a part of this function you should create a
57-
/// [AirContext] struct which takes degrees for all transition constraints as one of
58-
/// the constructor parameters.
59-
/// 4. Implement [Air::context()] method which should return a reference to the
60-
/// [AirContext] struct created in [Air::new()] function.
61-
/// 5. Implement [Air::evaluate_transition()] method which should evaluate
62-
/// [transition constraints](#transition-constraints) over a given evaluation frame.
56+
/// 3. Implement [Air::new()] function. As a part of this function you should create a [AirContext]
57+
/// struct which takes degrees for all transition constraints as one of the constructor
58+
/// parameters.
59+
/// 4. Implement [Air::context()] method which should return a reference to the [AirContext] struct
60+
/// created in [Air::new()] function.
61+
/// 5. Implement [Air::evaluate_transition()] method which should evaluate [transition
62+
/// constraints](#transition-constraints) over a given evaluation frame.
6363
/// 6. Implement [Air::get_assertions()] method which should return a vector of
6464
/// [assertions](#trace-assertions) for a given instance of your computation.
65-
/// 7. If your computation requires [periodic values](#periodic-values), you can also override
66-
/// the default [Air::get_periodic_column_values()] method.
65+
/// 7. If your computation requires [periodic values](#periodic-values), you can also override the
66+
/// default [Air::get_periodic_column_values()] method.
6767
///
6868
/// If your computation uses [Randomized AIR](#randomized-air), you will also need to override
6969
/// [Air::evaluate_aux_transition()] and [Air::get_aux_assertions()] methods.
@@ -73,21 +73,20 @@ const MIN_CYCLE_LENGTH: usize = 2;
7373
/// computation. In Winterfell, transition constraints are evaluated inside
7474
/// [Air::evaluate_transition()] function which takes the following parameters:
7575
///
76-
/// - [EvaluationFrame] which contains vectors with current and next states of the
76+
/// - [EvaluationFrame] which contains vectors with current and next states of the computation.
77+
/// - A list of periodic values. When periodic columns are defined for a computation, this will
78+
/// contain values of periodic columns at the current step of the computation. Otherwise, this
79+
/// will be an empty list.
80+
/// - A mutable `result` slice. This is the slice where constraint evaluations should be written to.
81+
/// The length of this slice will be equal to the number of transition constraints defined for the
7782
/// computation.
78-
/// - A list of periodic values. When periodic columns are defined for a computation,
79-
/// this will contain values of periodic columns at the current step of the computation.
80-
/// Otherwise, this will be an empty list.
81-
/// - A mutable `result` slice. This is the slice where constraint evaluations should be
82-
/// written to. The length of this slice will be equal to the number of transition
83-
/// constraints defined for the computation.
8483
///
8584
/// The constraints are considered to be satisfied if and only if, after the function returns,
8685
/// the `result` slice contains all zeros. In general, it is important for the transition
8786
/// constraint evaluation function to work as follows:
8887
///
89-
/// * For all valid transitions between consecutive computation steps, transition constraints
90-
/// should evaluation to all zeros.
88+
/// * For all valid transitions between consecutive computation steps, transition constraints should
89+
/// evaluation to all zeros.
9190
/// * For any invalid transition, at least one constraint must evaluate to a non-zero value.
9291
///
9392
/// **Note:** since transition constraints define algebraic relations, they should be
@@ -102,16 +101,16 @@ const MIN_CYCLE_LENGTH: usize = 2;
102101
///
103102
/// * All trace columns have degree `1`.
104103
/// * When multiplying trace columns together, the degree increases by `1`. For example, if our
105-
/// constraint involves multiplication of two columns, the degree of this constraint will be
106-
/// `2`. We can describe this constraint using [TransitionConstraintDegree] struct as follows:
104+
/// constraint involves multiplication of two columns, the degree of this constraint will be `2`.
105+
/// We can describe this constraint using [TransitionConstraintDegree] struct as follows:
107106
/// `TransitionConstraintDegree::new(2)`.
108107
/// * Degrees of periodic columns depend on the length of their cycles, but in most cases, these
109108
/// degrees are very close to `1`.
110-
/// * To describe a degree of a constraint involving multiplication of trace columns and
111-
/// periodic columns, use the [TransitionConstraintDegree::with_cycles()] constructor. For
112-
/// example, if our constraint involves multiplication of one trace column and one periodic
113-
/// column with a cycle of 32 steps, the degree can be described as:
114-
/// `TransitionConstraintDegree::with_cycles(1, vec![32])`.
109+
/// * To describe a degree of a constraint involving multiplication of trace columns and periodic
110+
/// columns, use the [TransitionConstraintDegree::with_cycles()] constructor. For example, if our
111+
/// constraint involves multiplication of one trace column and one periodic column with a cycle of
112+
/// 32 steps, the degree can be described as: `TransitionConstraintDegree::with_cycles(1,
113+
/// vec![32])`.
115114
///
116115
/// In general, multiplications should be used judiciously - though, there are ways to ease this
117116
/// restriction a bit at the expense of wider execution trace.
@@ -126,16 +125,14 @@ const MIN_CYCLE_LENGTH: usize = 2;
126125
/// function which should return a vector of [Assertion] structs. Every computation must have at
127126
/// least one assertion. Assertions can be of the following types:
128127
///
129-
/// * A single assertion - such assertion specifies that a single cell of an execution trace must
130-
/// be equal to a specific value. For example: *value in column 0, at step 0, must be equal
131-
/// to 1*.
128+
/// * A single assertion - such assertion specifies that a single cell of an execution trace must be
129+
/// equal to a specific value. For example: *value in column 0, at step 0, must be equal to 1*.
132130
/// * A periodic assertion - such assertion specifies that values in a given column at specified
133-
/// intervals should be equal to some value. For example: *values in column 0, at steps 0, 8,
134-
/// 16, 24 etc. must be equal to 2*.
131+
/// intervals should be equal to some value. For example: *values in column 0, at steps 0, 8, 16,
132+
/// 24 etc. must be equal to 2*.
135133
/// * A sequence assertion - such assertion specifies that values in a given column at specific
136-
/// intervals must be equal to a sequence of provided values. For example: *values in column 0,
137-
/// at step 0 must be equal to 1, at step 8 must be equal to 2, at step 16 must be equal to 3
138-
/// etc.*
134+
/// intervals must be equal to a sequence of provided values. For example: *values in column 0, at
135+
/// step 0 must be equal to 1, at step 8 must be equal to 2, at step 16 must be equal to 3 etc.*
139136
///
140137
/// ### Periodic values
141138
/// Sometimes, it may be useful to define a column in an execution trace which contains a set of
@@ -164,8 +161,8 @@ const MIN_CYCLE_LENGTH: usize = 2;
164161
/// To describe Randomized AIR, you will need to do the following when implementing the [Air]
165162
/// trait:
166163
/// * The [AirContext] struct returned from [Air::context()] method must be instantiated using
167-
/// [AirContext::new_multi_segment()] constructor. When building AIR context in this way, you
168-
/// will need to provide a [`crate::TraceInfo`] which describes the shape of a multi-segment execution
164+
/// [AirContext::new_multi_segment()] constructor. When building AIR context in this way, you will
165+
/// need to provide a [`crate::TraceInfo`] which describes the shape of a multi-segment execution
169166
/// trace.
170167
/// * Override [Air::evaluate_aux_transition()] method. This method is similar to the
171168
/// [Air::evaluate_transition()] method but it also accepts two extra parameters:
@@ -193,8 +190,8 @@ pub trait Air: Send + Sync {
193190
/// described by this AIR, including trace width, trace length length, and optionally,
194191
/// additional custom parameters in `meta` field.
195192
/// - `public_inputs` specifies public inputs for this instance of the computation.
196-
/// - `options` defines proof generation options such as blowup factor, hash function etc.
197-
/// these options define security level of the proof and influence proof generation time.
193+
/// - `options` defines proof generation options such as blowup factor, hash function etc. these
194+
/// options define security level of the proof and influence proof generation time.
198195
fn new(trace_info: TraceInfo, pub_inputs: Self::PublicInputs, options: ProofOptions) -> Self;
199196

200197
/// Returns context for this instance of the computation.
@@ -235,10 +232,10 @@ pub trait Air: Send + Sync {
235232
/// describing computations which require multiple trace segments.
236233
///
237234
/// The types for main and auxiliary trace evaluation frames are defined as follows:
238-
/// * When the entire protocol is executed in a prime field, types `F` and `E` are the same,
239-
/// and thus, both the main and the auxiliary trace frames are defined over the base field.
240-
/// * When the protocol is executed in an extension field, the main trace frame is defined
241-
/// over the base field, while the auxiliary trace frame is defined over the extension field.
235+
/// * When the entire protocol is executed in a prime field, types `F` and `E` are the same, and
236+
/// thus, both the main and the auxiliary trace frames are defined over the base field.
237+
/// * When the protocol is executed in an extension field, the main trace frame is defined over
238+
/// the base field, while the auxiliary trace frame is defined over the extension field.
242239
///
243240
/// We define type `F` separately from `Self::BaseField` to allow evaluation of constraints
244241
/// over the out-of-domain evaluation frame, which may be defined over an extension field
@@ -410,7 +407,7 @@ pub trait Air: Send + Sync {
410407
/// Returns length of the execution trace for an instance of the computation described by
411408
/// this AIR.
412409
///
413-
// This is guaranteed to be a power of two greater than or equal to 8.
410+
/// This is guaranteed to be a power of two greater than or equal to 8.
414411
fn trace_length(&self) -> usize {
415412
self.context().trace_info.length()
416413
}

0 commit comments

Comments
 (0)