Skip to content
Merged
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
4 changes: 2 additions & 2 deletions benches/benches/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
// arkworks-ff
{
c.bench_function(
&format!("{} 1M elements | ark-ff - ef8f758", BENCHMARK_NAME),
&format!("{BENCHMARK_NAME} 1M elements | ark-ff - ef8f758"),
|b| {
b.iter(|| {
let mut iter = arkworks_vec.iter();
Expand All @@ -35,7 +35,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
let lambdaworks_vec = to_lambdaworks_vec(&arkworks_vec);

c.bench_function(
&format!("{} 1M elements | lambdaworks", BENCHMARK_NAME,),
&format!("{BENCHMARK_NAME} 1M elements | lambdaworks",),
|b| {
b.iter(|| {
let mut iter = lambdaworks_vec.iter();
Expand Down
4 changes: 2 additions & 2 deletions benches/benches/invert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
// arkworks-ff
{
c.bench_function(
&format!("{} 10000 elements| ark-ff - ef8f758", BENCHMARK_NAME),
&format!("{BENCHMARK_NAME} 10000 elements| ark-ff - ef8f758"),
|b| {
b.iter_batched(
|| arkworks_vec.clone(),
Expand All @@ -34,7 +34,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
let lambdaworks_vec = to_lambdaworks_vec(&arkworks_vec);

c.bench_function(
&format!("{} 10000 elements | lambdaworks", BENCHMARK_NAME,),
&format!("{BENCHMARK_NAME} 10000 elements | lambdaworks",),
|b| {
b.iter(|| {
for elem in lambdaworks_vec.iter() {
Expand Down
7 changes: 2 additions & 5 deletions benches/benches/mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
// arkworks-ff
{
c.bench_function(
&format!(
"{} 10K elements | ark-ff - commit: ef8f758 ",
BENCHMARK_NAME
),
&format!("{BENCHMARK_NAME} 10K elements | ark-ff - commit: ef8f758 "),
|b| {
b.iter(|| {
let mut iter = arkworks_vec.iter();
Expand All @@ -37,7 +34,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
let lambdaworks_vec = to_lambdaworks_vec(&arkworks_vec);

c.bench_function(
&format!("{} 10K elements | lambdaworks", BENCHMARK_NAME,),
&format!("{BENCHMARK_NAME} 10K elements | lambdaworks",),
|b| {
b.iter(|| {
let mut iter = lambdaworks_vec.iter();
Expand Down
49 changes: 20 additions & 29 deletions benches/benches/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn point_double_projective(c: &mut Criterion) {

{
c.bench_function(
&format!("{} Projective Double | Starknet RS ", BENCHMARK_NAME),
&format!("{BENCHMARK_NAME} Projective Double | Starknet RS "),
|b| {
b.iter(|| {
let mut initial_point = starknet_rs_projective_generator;
Expand All @@ -41,7 +41,7 @@ pub fn point_double_projective(c: &mut Criterion) {

{
c.bench_function(
&format!("{} Projective Double | Lambdaworks", BENCHMARK_NAME),
&format!("{BENCHMARK_NAME} Projective Double | Lambdaworks"),
|b| {
b.iter(|| {
lambdaworks_affine_generator
Expand Down Expand Up @@ -71,10 +71,7 @@ pub fn point_add_projective_affine(c: &mut Criterion) {

{
c.bench_function(
&format!(
"{} 10k Add Projective-Affine | Starknet RS ",
BENCHMARK_NAME
),
&format!("{BENCHMARK_NAME} 10k Add Projective-Affine | Starknet RS "),
|b| {
b.iter(|| {
let mut projective_point_rs = starknet_rs_initial_projective;
Expand All @@ -93,9 +90,9 @@ pub fn point_add_projective_affine(c: &mut Criterion) {
}

let starknet_rs_x = AffinePoint::from(&projective_point_rs).x;
println!("Starknet RS result - X: {:#x} ", starknet_rs_x);
println!("Starknet RS result - X: {starknet_rs_x:#x} ");
let starknet_rs_y = AffinePoint::from(&projective_point_rs).y;
println!("Starknet RS result - Y: {:#x} \n", starknet_rs_y);
println!("Starknet RS result - Y: {starknet_rs_y:#x} \n");

let lambdaworks_affine_generator = StarkCurve::generator();

Expand All @@ -106,7 +103,7 @@ pub fn point_add_projective_affine(c: &mut Criterion) {

{
c.bench_function(
&format!("{} 10k Add Projective-Affine | Lambdaworks", BENCHMARK_NAME),
&format!("{BENCHMARK_NAME} 10k Add Projective-Affine | Lambdaworks"),
|b| {
b.iter(|| {
let mut projective_point = lambdaworks_rs_initial_projective.clone();
Expand All @@ -128,8 +125,8 @@ pub fn point_add_projective_affine(c: &mut Criterion) {

let lambdaworks_x = projective_point.to_affine().x().to_string();
let lambdaworks_y = projective_point.to_affine().y().to_string();
println!("Lambdaworks result - X: {}", lambdaworks_x);
println!("Lambdaworks result - Y: {}", lambdaworks_y);
println!("Lambdaworks result - X: {lambdaworks_x}");
println!("Lambdaworks result - Y: {lambdaworks_y}");
}

pub fn point_add_projective_projective(c: &mut Criterion) {
Expand All @@ -140,10 +137,7 @@ pub fn point_add_projective_projective(c: &mut Criterion) {

{
c.bench_function(
&format!(
"{} 10k Add Projective-Projective | Starknet RS ",
BENCHMARK_NAME
),
&format!("{BENCHMARK_NAME} 10k Add Projective-Projective | Starknet RS "),
|b| {
b.iter(|| {
let mut projective_point_rs = starknet_rs_initial_projective;
Expand All @@ -163,9 +157,9 @@ pub fn point_add_projective_projective(c: &mut Criterion) {
}

let starknet_rs_x = AffinePoint::from(&projective_point_rs).x;
println!("Starknet RS result - X: {:#x} ", starknet_rs_x);
println!("Starknet RS result - X: {starknet_rs_x:#x} ");
let starknet_rs_y = AffinePoint::from(&projective_point_rs).y;
println!("Starknet RS result - Y: {:#x} \n", starknet_rs_y);
println!("Starknet RS result - Y: {starknet_rs_y:#x} \n");

let lambdaworks_affine_generator = StarkCurve::generator();

Expand All @@ -174,10 +168,7 @@ pub fn point_add_projective_projective(c: &mut Criterion) {

{
c.bench_function(
&format!(
"{} 10k Add Projective-Projective | Lambdaworks",
BENCHMARK_NAME
),
&format!("{BENCHMARK_NAME} 10k Add Projective-Projective | Lambdaworks"),
|b| {
b.iter(|| {
let mut projective_point = lambdaworks_rs_initial_projective.clone();
Expand All @@ -199,8 +190,8 @@ pub fn point_add_projective_projective(c: &mut Criterion) {

let lambdaworks_x = projective_point.to_affine().x().to_string();
let lambdaworks_y = projective_point.to_affine().y().to_string();
println!("Lambdaworks result - X: {}", lambdaworks_x);
println!("Lambdaworks result - Y: {}", lambdaworks_y);
println!("Lambdaworks result - X: {lambdaworks_x}");
println!("Lambdaworks result - Y: {lambdaworks_y}");
}

pub fn point_add_affine_affine(c: &mut Criterion) {
Expand All @@ -210,7 +201,7 @@ pub fn point_add_affine_affine(c: &mut Criterion) {

{
c.bench_function(
&format!("{} 10k Add Affine-Affine | Starknet RS ", BENCHMARK_NAME),
&format!("{BENCHMARK_NAME} 10k Add Affine-Affine | Starknet RS "),
|b| {
b.iter(|| {
let mut point_rs = *starknet_rs_initial_point;
Expand All @@ -229,17 +220,17 @@ pub fn point_add_affine_affine(c: &mut Criterion) {
}

let starknet_rs_x = point_rs.x;
println!("Starknet RS result - X: {:#x} ", starknet_rs_x);
println!("Starknet RS result - X: {starknet_rs_x:#x} ");
let starknet_rs_y = &point_rs.y;
println!("Starknet RS result - Y: {:#x} \n", starknet_rs_y);
println!("Starknet RS result - Y: {starknet_rs_y:#x} \n");

let lambdaworks_affine_generator = StarkCurve::generator();

let lambdaworks_rs_initial_projective =
StarkCurve::generator().operate_with(&StarkCurve::generator());
{
c.bench_function(
&format!("{} 10k Add Affine-Affine | Lambdaworks", BENCHMARK_NAME),
&format!("{BENCHMARK_NAME} 10k Add Affine-Affine | Lambdaworks"),
|b| {
b.iter(|| {
let mut projective_point = lambdaworks_rs_initial_projective.clone();
Expand All @@ -261,8 +252,8 @@ pub fn point_add_affine_affine(c: &mut Criterion) {

let lambdaworks_x = projective_point.to_affine().x().to_string();
let lambdaworks_y = projective_point.to_affine().y().to_string();
println!("Lambdaworks result - X: {}", lambdaworks_x);
println!("Lambdaworks result - Y: {}", lambdaworks_y);
println!("Lambdaworks result - X: {lambdaworks_x}");
println!("Lambdaworks result - Y: {lambdaworks_y}");
}

criterion_group!(
Expand Down
4 changes: 2 additions & 2 deletions benches/benches/pow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
// arkworks-ff
{
c.bench_function(
&format!("{} 10K elements | ark-ff - ef8f758", BENCHMARK_NAME),
&format!("{BENCHMARK_NAME} 10K elements | ark-ff - ef8f758"),
|b| {
b.iter(|| {
let mut iter = arkworks_vec.iter();
Expand All @@ -43,7 +43,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
let lambdaworks_vec = to_lambdaworks_vec(&arkworks_vec);

c.bench_function(
&format!("{} 10K elements | lambdaworks", BENCHMARK_NAME,),
&format!("{BENCHMARK_NAME} 10K elements | lambdaworks",),
|b| {
b.iter(|| {
let mut iter = lambdaworks_vec.iter();
Expand Down
4 changes: 2 additions & 2 deletions benches/benches/sqrt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
// arkworks-ff
{
c.bench_function(
&format!("{} 100 elements | ark-ff - ef8f758", BENCHMARK_NAME),
&format!("{BENCHMARK_NAME} 100 elements | ark-ff - ef8f758"),
|b| {
b.iter(|| {
let mut iter = arkworks_vec.iter();
Expand All @@ -41,7 +41,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
let lambdaworks_vec = to_lambdaworks_vec(&arkworks_vec);

c.bench_function(
&format!("{} 100 elements | lambdaworks", BENCHMARK_NAME,),
&format!("{BENCHMARK_NAME} 100 elements | lambdaworks",),
|b| {
b.iter(|| {
let mut iter = lambdaworks_vec.iter();
Expand Down
4 changes: 2 additions & 2 deletions benches/benches/sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
// arkworks-ff
{
c.bench_function(
&format!("{} 1M elements | ark-ff - ef8f758", BENCHMARK_NAME),
&format!("{BENCHMARK_NAME} 1M elements | ark-ff - ef8f758"),
|b| {
b.iter(|| {
let mut iter = arkworks_vec.iter();
Expand All @@ -31,7 +31,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
{
let lambdaworks_vec = to_lambdaworks_vec(&arkworks_vec);
c.bench_function(
&format!("{} 1M elements | lambdaworks", BENCHMARK_NAME,),
&format!("{BENCHMARK_NAME} 1M elements | lambdaworks",),
|b| {
b.iter(|| {
let mut iter = lambdaworks_vec.iter();
Expand Down
2 changes: 1 addition & 1 deletion crates/crypto/src/hash/hash_to_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn os2ip<M: IsModulus<UnsignedInteger<N>> + Clone, const N: usize>(
let mut item_hex = String::with_capacity(N * 16);
let mut result = FieldElement::zero();
for item_u8 in aux_x.iter() {
item_hex += &format!("{:x}", item_u8);
item_hex += &format!("{item_u8:x}");
if item_hex.len() == item_hex.capacity() {
result += FieldElement::from_hex_unchecked(&item_hex) * two_to_the_nth.pow(j);
item_hex.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -799,10 +799,10 @@ mod tests {

let hash_result = rescue.hash_bytes(input);

println!("Input: {:?}", input);
println!("Input: {input:?}");
println!("Hash result:");
for (i, value) in hash_result.iter().enumerate() {
println!(" {}: {}", i, value);
println!(" {i}: {value}");
}

println!("Hash as u64 values:");
Expand Down
2 changes: 1 addition & 1 deletion crates/math/benches/elliptic_curves/bn_254.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub fn bn_254_elliptic_curve_benchmarks(c: &mut Criterion) {

// Batch Pairing
for num_pairs in 1..=10 {
group.bench_function(format!("Ate Pairing ({} pairs)", num_pairs), |bencher| {
group.bench_function(format!("Ate Pairing ({num_pairs} pairs)"), |bencher| {
let mut rng = StdRng::seed_from_u64(42);
let mut g1_points: Vec<G1> = Vec::new();
let mut g2_points: Vec<G2> = Vec::new();
Expand Down
6 changes: 3 additions & 3 deletions crates/math/src/field/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ where
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let value: UnsignedInteger<NUM_LIMBS> = self.representative();
write!(f, "{}", value)
write!(f, "{value}")
}
}

Expand Down Expand Up @@ -869,7 +869,7 @@ mod tests {
use alloc::format;

let zero_field_element = FieldElement::<Stark252PrimeField>::from(0);
assert_eq!(format!("{}", zero_field_element), "0x0");
assert_eq!(format!("{zero_field_element}"), "0x0");

let some_field_element =
FieldElement::<Stark252PrimeField>::from(&UnsignedInteger::from_limbs([
Expand All @@ -878,7 +878,7 @@ mod tests {

// it should start with the first non-zero digit. Each limb has 16 digits in hex.
assert_eq!(
format!("{}", some_field_element),
format!("{some_field_element}"),
format!("0x{}{}{}{}", "1", "0".repeat(16), "0".repeat(15), "1")
);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/math/src/field/fields/mersenne31/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl IsPrimeField for Mersenne31Field {

#[cfg(feature = "std")]
fn to_hex(x: &u32) -> String {
format!("{:X}", x)
format!("{x:X}")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ impl U56x8 {
pub fn to_hex(&self) -> String {
let mut hex_string = String::new();
for &limb in self.limbs.iter().rev() {
hex_string.push_str(&format!("{:014X}", limb));
hex_string.push_str(&format!("{limb:014X}"));
}
hex_string.trim_start_matches('0').to_string()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ impl<const MODULUS: u32> IsPrimeField for U32MontgomeryBackendPrimeField<MODULUS

#[cfg(feature = "std")]
fn to_hex(x: &Self::BaseType) -> String {
format!("{:x}", x)
format!("{x:x}")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/math/src/field/fields/u64_goldilocks_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl IsPrimeField for Goldilocks64Field {

#[cfg(feature = "std")]
fn to_hex(x: &u64) -> String {
format!("{:X}", x)
format!("{x:X}")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/math/src/field/fields/u64_prime_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl<const MODULUS: u64> IsPrimeField for U64PrimeField<MODULUS> {

#[cfg(feature = "std")]
fn to_hex(x: &u64) -> String {
format!("{:X}", x)
format!("{x:X}")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/math/src/field/test_fields/u32_test_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl<const MODULUS: u32> IsPrimeField for U32Field<MODULUS> {

#[cfg(feature = "std")]
fn to_hex(x: &u32) -> String {
format!("{:X}", x)
format!("{x:X}")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/math/src/field/test_fields/u64_test_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl<const MODULUS: u64> IsPrimeField for U64Field<MODULUS> {

#[cfg(feature = "std")]
fn to_hex(x: &u64) -> String {
format!("{:X}", x)
format!("{x:X}")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/math/src/polynomial/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ impl<F: IsPrimeField> Polynomial<FieldElement<F>> {
if i == self.coefficients.len() - 1 {
string.push_str(&coeff_str);
} else if i == self.coefficients.len() - 2 {
string.push_str(&format!("{}*{} + ", coeff_str, var_name));
string.push_str(&format!("{coeff_str}*{var_name} + "));
} else {
string.push_str(&format!(
"{}*{}^{} + ",
Expand Down
Loading
Loading