Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
50 changes: 30 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ version = "0.1.1"
edition = "2021"

[workspace.dependencies]
blake2 = "0.10.6"
blake3 = "1.5.0"
blake2 = { version = "0.10.6", default-features = false }
blake3 = { version = "1.5.0", default-features = false }
educe = "0.5.0"
hex = "0.4.3"
itertools = "0.12.0"
num-traits = "0.2.17"
thiserror = "1.0.56"
bytemuck = "1.14.3"
tracing = "0.1.40"
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
itertools = { version = "0.14.0", default-features = false, features = ["use_alloc"] }
num-traits = { version = "0.2.17", default-features = false }
thiserror = { version = "2.0.12", default-features = false }
bytemuck = { version = "1.14.3", default-features = false }
tracing = { version = "0.1.40", default-features = false, features = ["attributes"] }
starknet-ff = { version = "0.3.7", default-features = false, features=["alloc", "serde"] }
starknet-crypto = { version = "0.6.2", default-features = false }

[profile.bench]
codegen-units = 1
Expand Down
18 changes: 12 additions & 6 deletions crates/air_utils_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
[package]
name = "stwo-air-utils-derive"
version = "0.1.0"
edition = "2021"
version.workspace = true
edition.workspace = true

[lib]
proc-macro = true

[features]
default = ["std"]
std = [
"itertools/use_std"
]

[dependencies]
syn = "2.0.90"
quote = "1.0.37"
itertools = "0.13.0"
proc-macro2 = "1.0.92"
syn = { version = "2.0.90" }
quote = { version = "1.0.37", default-features = false }
itertools.workspace = true
proc-macro2 = { version = "1.0.92", default-features = false }
1 change: 1 addition & 0 deletions crates/air_utils_derive/src/allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use quote::quote;
use syn::Ident;

use crate::iterable_field::IterableField;
use crate::prelude::*;

/// Implements an "Uninitialized" function for the struct.
/// Allocates 2^`log_size` slots for every Vector.
Expand Down
7 changes: 4 additions & 3 deletions crates/air_utils_derive/src/iter_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use quote::{format_ident, quote};
use syn::{Ident, Lifetime};

use crate::iterable_field::IterableField;
use crate::prelude::*;

pub fn expand_iter_mut_structs(
struct_name: &Ident,
Expand Down Expand Up @@ -31,7 +32,7 @@ fn expand_impl_struct_name(struct_name: &Ident, iterable_fields: &[IterableField
let as_mut_slice = iterable_fields
.iter()
.map(|f| f.as_mut_slice())
.collect_vec();
.collect::<Vec<_>>();
quote! {
impl #struct_name {
pub fn iter_mut(&mut self) -> #iter_mut_name<'_> {
Expand Down Expand Up @@ -81,15 +82,15 @@ fn expand_iter_mut_struct(struct_name: &Ident, iterable_fields: &[IterableField]
quote! {
pub struct #iter_mut_name<#lifetime> {
#(#field_names: #mut_ptr_types,)*
phantom: std::marker::PhantomData<&#lifetime ()>,
phantom: core::marker::PhantomData<&#lifetime ()>,
}
impl<#lifetime> #iter_mut_name<#lifetime> {
pub fn new(
#(#field_names: #mut_slice_types,)*
) -> Self {
Self {
#(#field_names: #as_mut_ptr,)*
phantom: std::marker::PhantomData,
phantom: core::marker::PhantomData,
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion crates/air_utils_derive/src/iterable_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use proc_macro2::TokenStream;
use quote::{format_ident, quote};
use syn::{Data, DeriveInput, Expr, Field, Fields, Ident, Lifetime, Type};

use crate::prelude::*;

/// Each variant represents a field that can be iterated over.
/// Used to derive implementations of `Uninitialized`, `MutIter`, and `ParIterMut`.
/// Currently supports `Vec<T>` and `[Vec<T>; N]` fields only.
Expand Down Expand Up @@ -242,7 +244,7 @@ impl IterableField {
let (
mut #head,
mut #tail
):([_; #array_size],[_; #array_size]) = unsafe { (std::mem::zeroed(), std::mem::zeroed()) };
):([_; #array_size],[_; #array_size]) = unsafe { (core::mem::zeroed(), core::mem::zeroed()) };
self.#name.into_iter().enumerate().for_each(|(i, v)| {
let (head, tail) = v.split_at_mut(#index);
#head[i] = head;
Expand Down
11 changes: 11 additions & 0 deletions crates/air_utils_derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
#![cfg_attr(not(feature = "std"), no_std)]

#[cfg(not(feature = "std"))]
extern crate alloc;
mod prelude {
#[cfg(not(feature = "std"))]
pub use alloc::vec::Vec;
#[cfg(feature = "std")]
pub use std::vec::Vec;
}

mod allocation;
mod iter_mut;
mod iterable_field;
Expand Down
1 change: 1 addition & 0 deletions crates/air_utils_derive/src/par_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use quote::{format_ident, quote};
use syn::{Ident, Lifetime};

use crate::iterable_field::IterableField;
use crate::prelude::*;

pub fn expand_par_iter_mut_structs(
struct_name: &Ident,
Expand Down
24 changes: 19 additions & 5 deletions crates/prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@ version.workspace = true
edition.workspace = true

[features]
parallel = ["rayon"]
default = ["std"]
std = [
"blake2/std",
"blake3/std",
"hex/std",
"itertools/use_std",
"num-traits/std",
"rand/std",
"serde/std",
"tracing/std",
"starknet-crypto/std",
"starknet-ff/std"
]
parallel = ["rayon", "std"]
slow-tests = []

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -19,12 +32,13 @@ hex.workspace = true
itertools.workspace = true
num-traits.workspace = true
rand = { version = "0.8.5", default-features = false, features = ["small_rng"] }
starknet-crypto = "0.6.2"
starknet-ff = "0.3.7"
starknet-crypto.workspace = true
starknet-ff.workspace = true
thiserror.workspace = true
tracing.workspace = true
rayon = { version = "1.10.0", optional = true }
serde = { version = "1.0", features = ["derive"] }
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] }
hashbrown = { version = "0.15.2", default-features = false, features = ["default-hasher"] }

[dev-dependencies]
aligned = "0.4.2"
Expand All @@ -46,7 +60,7 @@ version = "0.5.1"

[lib]
bench = false
crate-type = ["cdylib", "lib"]
crate-type = ["lib"]

[lints.rust]
warnings = "deny"
Expand Down
Loading