Skip to content

Commit

Permalink
Merge pull request #27 from akhercha/chore/cairo_upgrade
Browse files Browse the repository at this point in the history
chore: Update to Cairo and Scarb 2.4.0
  • Loading branch information
clexmond authored Jan 17, 2024
2 parents b459053 + d3869a3 commit 6275608
Show file tree
Hide file tree
Showing 28 changed files with 235 additions and 232 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Cairo toolchain
uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.3.0"
scarb-version: "2.4.0"

- name: Run tests
run: scarb test
2 changes: 1 addition & 1 deletion Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ version = 1

[[package]]
name = "cubit"
version = "1.2.0"
version = "1.3.0"
5 changes: 3 additions & 2 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[package]
name = "cubit"
version = "1.2.0"
cairo-version = "2.3.0"
version = "1.3.0"
cairo-version = "2.4.0"
edition = "2023_10"
description = "Math library in Cairo using a 64.64 fixed point representation"
homepage = "https://github.com/influenceth/cubit"

Expand Down
2 changes: 1 addition & 1 deletion src/f128.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ use types::vec2::{Vec2, Vec2Trait, Vec2Print};
use types::vec3::{Vec3, Vec3Trait, Vec3Print};
use types::vec4::{Vec4, Vec4Trait, Vec4Print};

use math::{comp, core, hyp, trig};
use math::{comp, ops, hyp, trig};
use procgen::{rand, simplex3};
2 changes: 1 addition & 1 deletion src/f128/math.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod comp;
mod core;
mod ops;
mod hyp;
mod lut;
mod trig;
4 changes: 2 additions & 2 deletions src/f128/math/hyp.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ fn atanh(a: Fixed) -> Fixed {

#[cfg(test)]
mod tests {
use option::OptionTrait;
use traits::Into;
use core::option::OptionTrait;
use core::traits::Into;

use cubit::f128::test::helpers::assert_precise;
use cubit::f128::types::fixed::{FixedInto, FixedPartialEq, ONE};
Expand Down
13 changes: 7 additions & 6 deletions src/f128/math/core.cairo → src/f128/math/ops.cairo
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use debug::PrintTrait;
use option::OptionTrait;
use result::{ResultTrait, ResultTraitImpl};
use traits::{Into, TryInto};
use integer::{u256_safe_div_rem, u256_as_non_zero, upcast};
use core::debug::PrintTrait;
use core::option::OptionTrait;
use core::result::{ResultTrait, ResultTraitImpl};
use core::traits::{Into, TryInto};
use core::integer;
use core::integer::{u256_safe_div_rem, u256_as_non_zero, upcast};

use cubit::f128::math::lut;
use cubit::f128::types::fixed::{
Expand Down Expand Up @@ -315,7 +316,7 @@ mod tests {
use cubit::f128::math::trig::HALF_PI_u128;
use cubit::f128::math::trig::PI_u128;

use super::{FixedTrait, ONE_u128, lut, exp2_int};
use super::{FixedTrait, ONE_u128, lut, exp2_int, integer};

#[test]
fn test_into() {
Expand Down
8 changes: 4 additions & 4 deletions src/f128/math/trig.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use debug::PrintTrait;
use integer::{u128_safe_divmod, u128_as_non_zero};
use option::OptionTrait;
use core::debug::PrintTrait;
use core::integer::{u128_safe_divmod, u128_as_non_zero};
use core::option::OptionTrait;

use cubit::f128::math::lut;
use cubit::f128::types::fixed::{
Expand Down Expand Up @@ -209,7 +209,7 @@ fn _sin_loop(a: Fixed, i: u128, acc: Fixed) -> Fixed {

#[cfg(test)]
mod tests {
use traits::Into;
use core::traits::Into;

use cubit::f128::test::helpers::{assert_precise, assert_relative};
use cubit::f128::types::fixed::{ONE, FixedInto, FixedPartialEq, FixedPrint};
Expand Down
8 changes: 4 additions & 4 deletions src/f128/procgen/rand.cairo
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use array::ArrayTrait;
use integer::{u128_safe_divmod, u128_as_non_zero, u256_from_felt252};
use traits::Into;
use core::array::ArrayTrait;
use core::integer::{u128_safe_divmod, u128_as_non_zero, u256_from_felt252};
use core::traits::Into;

use cubit::f128::types::fixed::{Fixed, FixedTrait, ONE_u128};

fn derive(seed: felt252, entropy: felt252) -> felt252 {
return hash::LegacyHash::hash(seed, entropy);
return core::hash::LegacyHash::hash(seed, entropy);
}

// Returns a psuedo-random value between two values based on a seed. The returned
Expand Down
2 changes: 1 addition & 1 deletion src/f128/procgen/simplex3.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fn noise(v: Vec3) -> Fixed {
let h = Vec4Trait::splat(one) - x.abs() - y.abs();

// Revoke AP tracking until handled by compiler
internal::revoke_ap_tracking();
core::internal::revoke_ap_tracking();

let b0 = Vec4Trait::new(x.x, x.y, y.x, y.y);
let b1 = Vec4Trait::new(x.z, x.w, y.z, y.w);
Expand Down
4 changes: 2 additions & 2 deletions src/f128/test/helpers.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use debug::PrintTrait;
use traits::Into;
use core::debug::PrintTrait;
use core::traits::Into;

use cubit::f128::types::fixed::{Fixed, FixedTrait, FixedSub, FixedPartialEq, FixedPrint};

Expand Down
Loading

0 comments on commit 6275608

Please sign in to comment.