From fe67a783da07efa746081c329e91b119d7154a49 Mon Sep 17 00:00:00 2001 From: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com> Date: Tue, 30 Sep 2025 10:47:12 -0300 Subject: [PATCH] chore: bump Lambdaworks to 0.13.0 (#166) --- crates/starknet-types-core/Cargo.toml | 4 ++-- .../starknet-types-core/src/curve/affine_point.rs | 5 ++--- .../src/curve/projective_point.rs | 15 ++++++++------- crates/starknet-types-core/src/felt/mod.rs | 1 + ensure_no_std/rust-toolchain.toml | 2 +- rust-toolchain.toml | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/crates/starknet-types-core/Cargo.toml b/crates/starknet-types-core/Cargo.toml index 3e59bfa0..68159368 100644 --- a/crates/starknet-types-core/Cargo.toml +++ b/crates/starknet-types-core/Cargo.toml @@ -11,7 +11,7 @@ description = "Core types representation for Starknet" readme = "README.md" [dependencies] -lambdaworks-math = { version = "0.12.0", default-features = false } +lambdaworks-math = { version = "0.13.0", default-features = false } num-traits = { version = "0.2", default-features = false } num-bigint = { version = "0.4", default-features = false } num-integer = { version = "0.1", default-features = false } @@ -23,7 +23,7 @@ digest = { version = "0.10.7", optional = true } serde = { version = "1", optional = true, default-features = false, features = [ "alloc", "derive" ] } -lambdaworks-crypto = { version = "0.12.0", default-features = false, optional = true } +lambdaworks-crypto = { version = "0.13.0", default-features = false, optional = true } parity-scale-codec = { version = "3.6", default-features = false, optional = true } lazy_static = { version = "1.5", default-features = false, optional = true } zeroize = { version = "1.8.1", default-features = false, optional = true } diff --git a/crates/starknet-types-core/src/curve/affine_point.rs b/crates/starknet-types-core/src/curve/affine_point.rs index 2397e172..436c1944 100644 --- a/crates/starknet-types-core/src/curve/affine_point.rs +++ b/crates/starknet-types-core/src/curve/affine_point.rs @@ -2,7 +2,6 @@ use crate::{curve::curve_errors::CurveError, felt::Felt}; use lambdaworks_math::{ cyclic_group::IsGroup, elliptic_curve::{ - point::ProjectivePoint, short_weierstrass::{ curves::stark_curve::StarkCurve, point::ShortWeierstrassProjectivePoint, traits::IsShortWeierstrass, @@ -28,11 +27,11 @@ impl AffinePoint { /// This method should be used with caution, as it does not validate whether the provided coordinates /// correspond to a valid point on the curve. pub const fn new_unchecked(x: Felt, y: Felt) -> AffinePoint { - Self(ShortWeierstrassProjectivePoint(ProjectivePoint::new([ + Self(ShortWeierstrassProjectivePoint::new_unchecked([ x.0, y.0, Felt::ONE.0, - ]))) + ])) } /// Construct new affine point from the `x` coordinate and the parity bit `y_parity`. diff --git a/crates/starknet-types-core/src/curve/projective_point.rs b/crates/starknet-types-core/src/curve/projective_point.rs index 65414795..22eed386 100644 --- a/crates/starknet-types-core/src/curve/projective_point.rs +++ b/crates/starknet-types-core/src/curve/projective_point.rs @@ -3,7 +3,6 @@ use crate::curve::curve_errors::CurveError; use crate::felt::Felt; use core::ops; use lambdaworks_math::cyclic_group::IsGroup; -use lambdaworks_math::elliptic_curve::point::ProjectivePoint as LambdaworksProjectivePoint; use lambdaworks_math::elliptic_curve::short_weierstrass::curves::stark_curve::StarkCurve; use lambdaworks_math::elliptic_curve::short_weierstrass::point::ShortWeierstrassProjectivePoint; use lambdaworks_math::elliptic_curve::traits::EllipticCurveError::InvalidPoint; @@ -30,9 +29,9 @@ impl ProjectivePoint { /// SAFETY: Failing to guarantee this assumptions could lead to a runtime panic /// while operating with the value. pub const fn new_unchecked(x: Felt, y: Felt, z: Felt) -> ProjectivePoint { - Self(ShortWeierstrassProjectivePoint( - LambdaworksProjectivePoint::new([x.0, y.0, z.0]), - )) + Self(ShortWeierstrassProjectivePoint::new_unchecked([ + x.0, y.0, z.0, + ])) } /// The point at infinity. @@ -65,9 +64,11 @@ impl ProjectivePoint { /// This method should be used with caution, as it does not validate whether the provided coordinates /// correspond to a valid point on the curve. pub fn from_affine_unchecked(x: Felt, y: Felt) -> Self { - Self(ShortWeierstrassProjectivePoint( - LambdaworksProjectivePoint::new([x.0, y.0, Felt::ONE.0]), - )) + Self(ShortWeierstrassProjectivePoint::new_unchecked([ + x.0, + y.0, + Felt::ONE.0, + ])) } /// Returns the `x` coordinate of the point. diff --git a/crates/starknet-types-core/src/felt/mod.rs b/crates/starknet-types-core/src/felt/mod.rs index 60b86f7f..12b85640 100644 --- a/crates/starknet-types-core/src/felt/mod.rs +++ b/crates/starknet-types-core/src/felt/mod.rs @@ -61,6 +61,7 @@ impl core::fmt::Display for FromStrError { CreationError::InvalidHexString => write!(f, "invalid hex string"), CreationError::InvalidDecString => write!(f, "invalid dec string"), CreationError::HexStringIsTooBig => write!(f, "hex string too big"), + CreationError::RepresentativeOutOfRange => write!(f, "representative out of range"), CreationError::EmptyString => write!(f, "empty string"), } } diff --git a/ensure_no_std/rust-toolchain.toml b/ensure_no_std/rust-toolchain.toml index 276c8dc2..92770a15 100644 --- a/ensure_no_std/rust-toolchain.toml +++ b/ensure_no_std/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.84.1" +channel = "1.87.0" components = ["rustfmt", "clippy"] targets = ["wasm32-unknown-unknown"] profile = "minimal" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index d637558e..c2cd5f89 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.84.1" +channel = "1.87.0" components = ["rustfmt", "clippy", "rust-analyzer"] profile = "minimal"