Skip to content

Commit

Permalink
Stop suppressing unused/dead warnings globally (0xPolygonZero#527)
Browse files Browse the repository at this point in the history
Most of them were trivial to address; for the remaining warnings I suppressed just the relevant line and added TODOs.
dlubarov authored Apr 1, 2022
1 parent b4d11c2 commit 4fc6fda
Showing 11 changed files with 9 additions and 23 deletions.
2 changes: 2 additions & 0 deletions starky/src/get_challenges.rs
Original file line number Diff line number Diff line change
@@ -75,6 +75,8 @@ where
F: RichField + Extendable<D>,
C: GenericConfig<D, F = F>,
{
// TODO: Should be used later in compression?
#![allow(dead_code)]
pub(crate) fn fri_query_indices<S: Stark<F, D>>(
&self,
stark: &S,
3 changes: 0 additions & 3 deletions starky/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// TODO: Remove these when crate is closer to being finished.
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(incomplete_features)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::type_complexity)]
1 change: 0 additions & 1 deletion starky/src/prover.rs
Original file line number Diff line number Diff line change
@@ -263,7 +263,6 @@ where
.map(|i_start| {
let i_next_start = (i_start + next_step) % size;
let i_range = i_start..i_start + P::WIDTH;
let i_next_range = i_next_start..i_next_start + P::WIDTH;

let x = *P::from_slice(&coset[i_range.clone()]);
let z_last = x - last;
3 changes: 1 addition & 2 deletions starky/src/recursive_verifier.rs
Original file line number Diff line number Diff line change
@@ -126,9 +126,8 @@ fn recursively_verify_stark_proof_with_challenges<
let vanishing_polys_zeta = consumer.accumulators();

// Check each polynomial identity, of the form `vanishing(x) = Z_H(x) quotient(x)`, at zeta.
let quotient_polys_zeta = &proof.openings.quotient_polys;
let mut scale = ReducingFactorTarget::new(zeta_pow_deg);
for (i, chunk) in quotient_polys_zeta
for (i, chunk) in quotient_polys
.chunks(stark.quotient_degree_factor())
.enumerate()
{
3 changes: 1 addition & 2 deletions starky/src/verifier.rs
Original file line number Diff line number Diff line change
@@ -106,15 +106,14 @@ where
let vanishing_polys_zeta = consumer.accumulators();

// Check each polynomial identity, of the form `vanishing(x) = Z_H(x) quotient(x)`, at zeta.
let quotient_polys_zeta = &proof.openings.quotient_polys;
let zeta_pow_deg = challenges.stark_zeta.exp_power_of_2(degree_bits);
let z_h_zeta = zeta_pow_deg - F::Extension::ONE;
// `quotient_polys_zeta` holds `num_challenges * quotient_degree_factor` evaluations.
// Each chunk of `quotient_degree_factor` holds the evaluations of `t_0(zeta),...,t_{quotient_degree_factor-1}(zeta)`
// where the "real" quotient polynomial is `t(X) = t_0(X) + t_1(X)*X^n + t_2(X)*X^{2n} + ...`.
// So to reconstruct `t(zeta)` we can compute `reduce_with_powers(chunk, zeta^n)` for each
// `quotient_degree_factor`-sized chunk of the original evaluations.
for (i, chunk) in quotient_polys_zeta
for (i, chunk) in quotient_polys
.chunks(stark.quotient_degree_factor())
.enumerate()
{
2 changes: 0 additions & 2 deletions system_zero/src/alu/division.rs
Original file line number Diff line number Diff line change
@@ -170,7 +170,6 @@ mod tests {

#[test]
fn generate_eval_consistency_not_div() {
const D: usize = 1;
type F = GoldilocksField;

let mut rng = ChaCha8Rng::seed_from_u64(0x6feb51b7ec230f25);
@@ -193,7 +192,6 @@ mod tests {

#[test]
fn generate_eval_consistency_div() {
const D: usize = 1;
type F = GoldilocksField;

let mut rng = ChaCha8Rng::seed_from_u64(0x6feb51b7ec230f25);
2 changes: 1 addition & 1 deletion system_zero/src/alu/mul_add.rs
Original file line number Diff line number Diff line change
@@ -87,5 +87,5 @@ pub(crate) fn eval_mul_add_recursively<F: RichField + Extendable<D>, const D: us
);
let diff = builder.sub_extension(computed_output, output);
let filtered_diff = builder.mul_extension(is_mul, diff);
yield_constr.constraint(builder, diff);
yield_constr.constraint(builder, filtered_diff);
}
6 changes: 2 additions & 4 deletions system_zero/src/alu/subtraction.rs
Original file line number Diff line number Diff line change
@@ -16,12 +16,9 @@ pub(crate) fn generate_subtraction<F: PrimeField64>(values: &mut [F; NUM_COLUMNS
// in_1 - in_2 == diff - br*2^32
let (diff, br) = in_1.overflowing_sub(in_2);

let diff_1 = F::from_canonical_u16(diff as u16);
let diff_2 = F::from_canonical_u16((diff >> 16) as u16);

values[COL_SUB_OUTPUT_0] = F::from_canonical_u16(diff as u16);
values[COL_SUB_OUTPUT_1] = F::from_canonical_u16((diff >> 16) as u16);
values[COL_SUB_OUTPUT_BORROW] = F::from_canonical_u16(br as u16);
values[COL_SUB_OUTPUT_BORROW] = F::from_bool(br);
}

pub(crate) fn eval_subtraction<F: Field, P: PackedField<Scalar = F>>(
@@ -61,6 +58,7 @@ pub(crate) fn eval_subtraction_recursively<F: RichField + Extendable<D>, const D
let out_br = local_values[COL_SUB_OUTPUT_BORROW];

let base = builder.constant_extension(F::Extension::from_canonical_u64(1 << 16));
#[allow(unused)] // TODO
let base_sqr = builder.constant_extension(F::Extension::from_canonical_u64(1 << 32));

// lhs = (out_br + in_1) - in_2
4 changes: 0 additions & 4 deletions system_zero/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// TODO: Remove these when crate is closer to being finished.
#![allow(dead_code)]
#![allow(unused_variables)]

mod alu;
mod core_registers;
pub mod lookup;
2 changes: 0 additions & 2 deletions system_zero/src/permutation_unit.rs
Original file line number Diff line number Diff line change
@@ -269,7 +269,6 @@ mod tests {

#[test]
fn generate_eval_consistency() {
const D: usize = 1;
type F = GoldilocksField;

let mut values = [F::default(); NUM_COLUMNS];
@@ -295,7 +294,6 @@ mod tests {

#[test]
fn poseidon_result() {
const D: usize = 1;
type F = GoldilocksField;

let mut rng = ChaCha8Rng::seed_from_u64(0x6feb51b7ec230f25);
4 changes: 2 additions & 2 deletions system_zero/src/system_zero.rs
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ impl<F: RichField + Extendable<D>, const D: usize> SystemZero<F, D> {
/// Generate the rows of the trace. Note that this does not generate the permuted columns used
/// in our lookup arguments, as those are computed after transposing to column-wise form.
fn generate_trace_rows(&self) -> Vec<[F; NUM_COLUMNS]> {
#[allow(unused)] // TODO
let memory = TransactionMemory::default();

let mut row = [F::ZERO; NUM_COLUMNS];
@@ -67,7 +68,7 @@ impl<F: RichField + Extendable<D>, const D: usize> SystemZero<F, D> {
trace
}

fn generate_trace(&self) -> Vec<PolynomialValues<F>> {
pub fn generate_trace(&self) -> Vec<PolynomialValues<F>> {
let mut timing = TimingTree::new("generate trace", log::Level::Debug);

// Generate the witness, except for permuted columns in the lookup argument.
@@ -209,7 +210,6 @@ mod tests {
#[test]
fn degree() -> Result<()> {
type F = GoldilocksField;
type C = PoseidonGoldilocksConfig;
const D: usize = 2;

type S = SystemZero<F, D>;

0 comments on commit 4fc6fda

Please sign in to comment.