Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0c1d31c
refactor(math): remove dead Deserializable trait and unreachable erro…
diegokingston May 20, 2026
4c94b8c
refactor(math): remove vestigial helpers module
diegokingston May 20, 2026
4d3bc3d
refactor(math): gate evaluate_fft_bit_reversed behind cfg(test)
diegokingston May 20, 2026
aa18296
refactor(math): gate test-only Polynomial::{truncate, reverse}
diegokingston May 20, 2026
5e45971
refactor(math): flatten fft/cpu/* up to fft/*
diegokingston May 20, 2026
e2986fc
refactor(math): collapse polynomial/ folder into one polynomial.rs
diegokingston May 20, 2026
08e5069
refactor(math): consolidate scattered tests into tests/ directory
diegokingston May 20, 2026
6b00045
Merge branch 'main' into cleanup/math-dead-code
diegokingston May 21, 2026
73c45d3
Merge branch 'main' into cleanup/math-dead-code
diegokingston May 21, 2026
2566886
Merge branch 'main' into cleanup/math-dead-code
diegokingston May 22, 2026
48762cf
refactor(math): drop redundant FFT cross-check code, relocate inline …
diegokingston May 22, 2026
ba6a43f
Merge branch 'main' into cleanup/math-dead-code
diegokingston May 22, 2026
58625a2
Merge branch 'main' into cleanup/math-dead-code
diegokingston May 22, 2026
0eb5747
Merge branch 'main' into cleanup/math-dead-code
diegokingston May 22, 2026
2c49cea
refactor(math): remove dead polynomial-division cluster, fix zero-off…
diegokingston May 22, 2026
481175c
Merge branch 'main' into cleanup/math-dead-code
diegokingston May 22, 2026
27bd36f
refactor(math): remove dead Polynomial APIs and self-referential tests
diegokingston May 22, 2026
ce5be16
Merge branch 'main' into cleanup/math-dead-code
diegokingston May 22, 2026
415eecf
Merge branch 'main' into cleanup/math-dead-code
diegokingston May 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions crypto/crypto/src/merkle_tree/proof.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use alloc::{collections::BTreeMap, vec::Vec};
#[cfg(feature = "alloc")]
use math::traits::Serializable;
use math::{errors::DeserializationError, traits::Deserializable};

use super::{
traits::IsMerkleTreeBackend,
Expand Down Expand Up @@ -41,36 +38,6 @@ impl<T: PartialEq + Eq> Proof<T> {
}
}

#[cfg(feature = "alloc")]
impl<T> Serializable for Proof<T>
where
T: Serializable + PartialEq + Eq,
{
fn serialize(&self) -> Vec<u8> {
self.merkle_path
.iter()
.flat_map(|node| node.serialize())
.collect()
}
}

impl<T> Deserializable for Proof<T>
where
T: Deserializable + PartialEq + Eq,
{
fn deserialize(bytes: &[u8]) -> Result<Self, DeserializationError>
where
Self: Sized,
{
let mut merkle_path = Vec::new();
for elem in bytes[0..].chunks(8) {
let node = T::deserialize(elem)?;
merkle_path.push(node);
}
Ok(Self { merkle_path })
}
}

/// Stores all the nodes needed to prove the inclusion of multiple leaves.
///
/// # Proof Ordering
Expand Down
2 changes: 1 addition & 1 deletion crypto/math-cuda/tests/bench_quick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use std::time::Instant;

use math::fft::cpu::bowers_fft::LayerTwiddles;
use math::fft::bowers_fft::LayerTwiddles;
use math::field::element::FieldElement;
use math::field::goldilocks::GoldilocksField;
use math::field::traits::IsField;
Expand Down
2 changes: 1 addition & 1 deletion crypto/math-cuda/tests/lde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! `Polynomial::coset_lde_full_expand` for a sweep of realistic sizes and
//! blowup factors.

use math::fft::cpu::bowers_fft::LayerTwiddles;
use math::fft::bowers_fft::LayerTwiddles;
use math::field::element::FieldElement;
use math::field::goldilocks::GoldilocksField;
use math::field::traits::{IsField, IsPrimeField};
Expand Down
2 changes: 1 addition & 1 deletion crypto/math-cuda/tests/lde_batch.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Batched coset LDE must agree with running the CPU single-column LDE on
//! each column independently. Sweeps a few realistic (n, blowup, m) tuples.
use math::fft::cpu::bowers_fft::LayerTwiddles;
use math::fft::bowers_fft::LayerTwiddles;
use math::field::element::FieldElement;
use math::field::goldilocks::GoldilocksField;
use math::field::traits::{IsField, IsPrimeField};
Expand Down
2 changes: 1 addition & 1 deletion crypto/math-cuda/tests/lde_batch_ext3.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Ext3 batched coset LDE must agree with the CPU `coset_lde_full_expand`
//! on each column independently when run over `FieldElement<Ext3>`.

use math::fft::cpu::bowers_fft::LayerTwiddles;
use math::fft::bowers_fft::LayerTwiddles;
use math::field::element::FieldElement;
use math::field::extensions_goldilocks::Degree3GoldilocksExtensionField;
use math::field::goldilocks::GoldilocksField;
Expand Down
28 changes: 0 additions & 28 deletions crypto/math/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,13 @@
pub enum ByteConversionError {
FromBEBytesError,
FromLEBytesError,
InvalidValue,
PointNotInSubgroup,
ValueNotCompressed,
ValueNotReduced,
}

#[derive(Debug, PartialEq, Eq)]
pub enum CreationError {
InvalidHexString,
InvalidDecString,
HexStringIsTooBig,
CanonicalOutOfRange,
EmptyString,
}

#[derive(Debug, PartialEq, Eq)]
pub enum DeserializationError {
InvalidAmountOfBytes,
FieldFromBytesError,
PointerSizeError,
InvalidValue,
}

#[derive(Debug, PartialEq, Eq)]
pub enum PairingError {
PointNotInSubgroup,
DivisionByZero,
}

impl From<ByteConversionError> for DeserializationError {
fn from(error: ByteConversionError) -> Self {
match error {
ByteConversionError::FromBEBytesError => DeserializationError::FieldFromBytesError,
ByteConversionError::FromLEBytesError => DeserializationError::FieldFromBytesError,
_ => DeserializationError::InvalidValue,
}
}
}
18 changes: 18 additions & 0 deletions crypto/math/src/fft/bit_reversing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/// In-place bit-reverse permutation algorithm. Requires input length to be a power of two.
pub fn in_place_bit_reverse_permute<E>(input: &mut [E]) {
for i in 0..input.len() {
let bit_reversed_index = reverse_index(i, input.len() as u64);
if bit_reversed_index > i {
input.swap(i, bit_reversed_index);
}
}
}

/// Reverses the `log2(size)` first bits of `i`
pub fn reverse_index(i: usize, size: u64) -> usize {
if size == 1 {
i
} else {
i.reverse_bits() >> (usize::BITS - size.trailing_zeros())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//! # Usage
//!
//! ```ignore
//! use math::fft::cpu::bowers_fft::{LayerTwiddles, bowers_fft_opt_fused};
//! use math::fft::bowers_fft::{LayerTwiddles, bowers_fft_opt_fused};
//!
//! let order = 10u64; // FFT size = 2^10 = 1024
//! let layer_twiddles = LayerTwiddles::<F>::new(order).unwrap();
Expand Down
51 changes: 0 additions & 51 deletions crypto/math/src/fft/cpu/bit_reversing.rs

This file was deleted.

156 changes: 0 additions & 156 deletions crypto/math/src/fft/cpu/fft.rs

This file was deleted.

8 changes: 0 additions & 8 deletions crypto/math/src/fft/cpu/mod.rs

This file was deleted.

5 changes: 5 additions & 0 deletions crypto/math/src/fft/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ pub enum FFTError {
InputError(usize),
OrderError(u64),
DomainSizeError(usize),
/// A coset offset of zero was supplied; it has no multiplicative inverse.
InvalidCosetOffset,
}

impl Display for FFTError {
Expand All @@ -23,6 +25,9 @@ impl Display for FFTError {
FFTError::DomainSizeError(_) => {
write!(f, "Domain size exceeds two adicity of the field")
}
FFTError::InvalidCosetOffset => {
write!(f, "Coset offset is zero, which is not invertible")
}
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions crypto/math/src/fft/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
pub mod cpu;
pub mod bit_reversing;
#[cfg(feature = "alloc")]
pub mod bowers_fft;
pub mod errors;
#[cfg(feature = "alloc")]
pub mod polynomial;
pub mod roots_of_unity;

#[cfg(all(test, feature = "alloc"))]
pub(crate) mod test_helpers;
Loading
Loading