Skip to content

Commit

Permalink
Check cargo fmt everywhere (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasgoergens authored Oct 14, 2024
1 parent 9d07ff9 commit 353858e
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
run: |
cargo make --version || cargo install cargo-make
- name: Check code format
run: cargo make fmt
run: cargo make fmt-all-check

- name: Run clippy
env:
Expand Down
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,3 @@ option 1
option 2
- use F_q^2/3 extension field, do not repeat
- rule of thumb: n rounds, soundness ~ (64-n) bits





2 changes: 1 addition & 1 deletion ff_ext/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pub use ff;
use ff::FromUniformBytes;
use goldilocks::SmallField;
use poseidon::poseidon::Poseidon;
use serde::Serialize;
use std::ops::{Add, AddAssign, Mul, MulAssign, Sub, SubAssign};
use poseidon::poseidon::Poseidon;

pub trait ExtensionField:
Serialize
Expand Down
8 changes: 4 additions & 4 deletions mpcs/benches/basecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,23 @@ fn bench_encoding(c: &mut Criterion, is_base: bool) {
// Switch to coefficient form
let mut coeffs = poly.evaluations.clone();
interpolate_field_type_over_boolean_hypercube(&mut coeffs);

let mut codeword =
<<BasefoldBasecodeParams as BasefoldSpec<E>>::EncodingScheme as EncodingScheme<E>>::encode(
&pp.encoding_params,
&coeffs,
);

// If using repetition code as basecode, it may be faster to use the following line of code to create the commitment and comment out the two lines above
// let mut codeword = evaluate_over_foldable_domain(pp.log_rate, coeffs, &pp.table);

// The sum-check protocol starts from the first variable, but the FRI part
// will eventually produce the evaluation at (alpha_k, ..., alpha_1), so apply
// the bit-reversion to reverse the variable indices of the polynomial.
// In short: store the poly and codeword in big endian
reverse_index_bits_in_place_field_type(&mut coeffs);
reverse_index_bits_in_place_field_type(&mut codeword);

(coeffs, codeword)
})
.collect::<(Vec<FieldType<E>>, Vec<FieldType<E>>)>();
Expand Down
8 changes: 4 additions & 4 deletions mpcs/benches/rscode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,23 @@ fn bench_encoding(c: &mut Criterion, is_base: bool) {
// Switch to coefficient form
let mut coeffs = poly.evaluations.clone();
interpolate_field_type_over_boolean_hypercube(&mut coeffs);

let mut codeword =
<<BasefoldRSParams as BasefoldSpec<E>>::EncodingScheme as EncodingScheme<E>>::encode(
&pp.encoding_params,
&coeffs,
);

// If using repetition code as basecode, it may be faster to use the following line of code to create the commitment and comment out the two lines above
// let mut codeword = evaluate_over_foldable_domain(pp.log_rate, coeffs, &pp.table);

// The sum-check protocol starts from the first variable, but the FRI part
// will eventually produce the evaluation at (alpha_k, ..., alpha_1), so apply
// the bit-reversion to reverse the variable indices of the polynomial.
// In short: store the poly and codeword in big endian
reverse_index_bits_in_place_field_type(&mut coeffs);
reverse_index_bits_in_place_field_type(&mut codeword);

(coeffs, codeword)
})
.collect::<(Vec<FieldType<E>>, Vec<FieldType<E>>)>();
Expand Down
3 changes: 2 additions & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
edition = "2024"
version = "Two"
style_edition = "2024"
# TODO(Matthias): enable this once the rustfmt version is updated.
# style_edition = "2024"
wrap_comments = false
comment_width = 300
imports_granularity = "Crate"
Expand Down
8 changes: 3 additions & 5 deletions transcript/src/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use ff_ext::ExtensionField;
use goldilocks::SmallField;
use poseidon::poseidon_permutation::PoseidonPermutation;


use crate::Challenge;

#[derive(Clone)]
Expand All @@ -18,9 +17,7 @@ impl<E: ExtensionField> Transcript<E> {
let label_f = E::BaseField::bytes_to_field_elements(label);
perm.set_from_slice(label_f.as_slice(), 0);
perm.permute();
Self {
permutation: perm,
}
Self { permutation: perm }
}
}

Expand Down Expand Up @@ -63,7 +60,8 @@ impl<E: ExtensionField> Transcript<E> {

// Append the challenge to the transcript.
pub fn append_challenge(&mut self, challenge: Challenge<E>) {
self.permutation.set_from_slice(challenge.elements.as_bases(), 0);
self.permutation
.set_from_slice(challenge.elements.as_bases(), 0);
self.permutation.permute();
}

Expand Down

0 comments on commit 353858e

Please sign in to comment.