Skip to content

Commit

Permalink
Merge pull request #43 from notV4l/update_to_0.6.0
Browse files Browse the repository at this point in the history
Update to 0.6.0
  • Loading branch information
tarrencev authored Feb 19, 2024
2 parents e344a43 + 2a0d43d commit 178cfe9
Show file tree
Hide file tree
Showing 38 changed files with 138 additions and 393 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Origami CI
on: [push, pull_request]

env:
DOJO_VERSION: v0.5.0
SCARB_VERSION: v2.4.0
DOJO_VERSION: v0.6.0-alpha.0
SCARB_VERSION: v2.5.4

jobs:
check:
Expand Down
6 changes: 3 additions & 3 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ dependencies = [
[[package]]
name = "cubit"
version = "1.3.0"
source = "git+https://github.com/influenceth/cubit.git#62756082bf2555d7ab25c69d9c7bc30574ff1ce8"
source = "git+https://github.com/notV4l/cubit.git?rev=5aa99005#5aa99005475012a04421e85c8fa3dc77f53c8ca3"

[[package]]
name = "dojo"
version = "0.5.1"
source = "git+https://github.com/dojoengine/dojo?tag=v0.5.1#4a6cad5f21d8da71714ae6ff48c9cc6ecaae642a"
source = "git+https://github.com/dojoengine/dojo?tag=v0.6.0-alpha.0#afa4e93688d3c75de0cf2469d226b06ca85dbdd4"
dependencies = [
"dojo_plugin",
]
Expand Down Expand Up @@ -45,7 +45,7 @@ dependencies = [

[[package]]
name = "origami"
version = "0.5.1"
version = "0.6.0-alpha.0"
dependencies = [
"cubit",
"dojo",
Expand Down
7 changes: 4 additions & 3 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
members = ["crates", "examples/*", "token"]

[workspace.package]
version = "0.5.1"
version = "0.6.0-alpha.0"
description = "Community-maintained libraries for Cairo"
homepage = "https://github.com/dojoengine/origami"
authors = ["bal7hazar@proton.me"]

[workspace.dependencies]
cubit = { git = "https://github.com/influenceth/cubit.git" }
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v0.5.1" }
# cubit = { git = "https://github.com/influenceth/cubit.git" }
cubit = { git = "https://github.com/notV4l/cubit.git", rev = "5aa99005" }
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v0.6.0-alpha.0" }
origami = { path = "crates" }
token = { path = "token" }
10 changes: 0 additions & 10 deletions crates/src/algebra/matrix.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ mod tests {
}

#[test]
#[available_gas(1_000_000)]
fn test_matrix_get() {
let rows: u8 = 3;
let cols: u8 = 4;
Expand All @@ -303,7 +302,6 @@ mod tests {
}

#[test]
#[available_gas(1_000_000)]
fn test_matrix_transpose() {
let rows: u8 = 2;
let cols: u8 = 3;
Expand All @@ -315,7 +313,6 @@ mod tests {
}

#[test]
#[available_gas(1_000_000)]
fn test_matrix_addition() {
let rows: u8 = 2;
let cols: u8 = 3;
Expand All @@ -328,7 +325,6 @@ mod tests {
}

#[test]
#[available_gas(1_000_000)]
fn test_matrix_subtraction() {
let rows: u8 = 2;
let cols: u8 = 3;
Expand All @@ -342,7 +338,6 @@ mod tests {
}

#[test]
#[available_gas(10_000_000)]
fn test_matrix_square_multiplication() {
let size: u8 = 2;
let values: Array<i128> = array![1, 2, 3, 4];
Expand All @@ -356,7 +351,6 @@ mod tests {
}

#[test]
#[available_gas(10_000_000)]
fn test_matrix_rectangle_multiplication() {
let values: Array<i128> = array![1, 2, 3, 4, 5, 6];
let mut matrix1 = MatrixTrait::new(values.span(), 2, 3);
Expand All @@ -369,23 +363,20 @@ mod tests {
}

#[test]
#[available_gas(5_000_000)]
fn test_matrix_determinant_2x2() {
let values: Array<i128> = array![4, 3, 1, 2];
let mut matrix = MatrixTrait::new(values.span(), 2, 2);
assert(matrix.det() == 5, 'Matrix: det computation failed');
}

#[test]
#[available_gas(10_000_000)]
fn test_matrix_determinant_3x3() {
let values: Array<i128> = array![6, 1, 1, 4, -2, 5, 2, 8, 7];
let mut matrix = MatrixTrait::new(values.span(), 3, 3);
assert(matrix.det() == -306, 'Matrix: det computation failed');
}

#[test]
#[available_gas(10_000_000)]
fn test_matrix_inverse_2x2() {
let values: Array<i128> = array![1, 2, 0, 1];
let mut matrix = MatrixTrait::new(values.span(), 2, 2);
Expand All @@ -397,7 +388,6 @@ mod tests {
}

#[test]
#[available_gas(10_000_000)]
fn test_matrix_inverse_3x3() {
let values: Array<i128> = array![1, 1, 0, 0, 1, 0, 0, 1, 1];
let mut matrix = MatrixTrait::new(values.span(), 3, 3);
Expand Down
9 changes: 0 additions & 9 deletions crates/src/algebra/vec2.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ mod tests {
use super::{FixedTrait, ONE_u128, Vec2Trait};

#[test]
#[available_gas(2000000)]
fn test_new() {
let var1_pos = FixedTrait::new(ONE_u128, false);
let var2_neg = FixedTrait::new(2 * ONE_u128, true);
Expand All @@ -124,7 +123,6 @@ mod tests {
}

#[test]
#[available_gas(2000000)]
fn test_splat() {
let var = FixedTrait::new(ONE_u128, false);

Expand All @@ -142,7 +140,6 @@ mod tests {
}

#[test]
#[available_gas(2000000)]
fn test_select() {
let var1_pos = FixedTrait::new(ONE_u128, false);
let var2_neg = FixedTrait::new(2 * ONE_u128, true);
Expand All @@ -168,7 +165,6 @@ mod tests {
}

#[test]
#[available_gas(2000000)]
fn test_dot() {
let var1_pos = FixedTrait::new(ONE_u128, false);
let var2_neg = FixedTrait::new(2 * ONE_u128, true);
Expand All @@ -188,7 +184,6 @@ mod tests {
}

#[test]
#[available_gas(2000000)]
fn test_dot_into_vec() {
let var1_pos = FixedTrait::new(ONE_u128, false);
let var2_neg = FixedTrait::new(2 * ONE_u128, true);
Expand All @@ -212,7 +207,6 @@ mod tests {
}

#[test]
#[available_gas(2000000)]
fn test_xx() {
let var1_pos = FixedTrait::new(ONE_u128, false);
let var2_neg = FixedTrait::new(2 * ONE_u128, true);
Expand All @@ -226,7 +220,6 @@ mod tests {
}

#[test]
#[available_gas(2000000)]
fn test_xy() {
let var1_pos = FixedTrait::new(ONE_u128, false);
let var2_neg = FixedTrait::new(2 * ONE_u128, true);
Expand All @@ -240,7 +233,6 @@ mod tests {
}

#[test]
#[available_gas(2000000)]
fn test_yx() {
let var1_pos = FixedTrait::new(ONE_u128, false);
let var2_neg = FixedTrait::new(2 * ONE_u128, true);
Expand All @@ -254,7 +246,6 @@ mod tests {
}

#[test]
#[available_gas(2000000)]
fn test_yy() {
let var1_pos = FixedTrait::new(ONE_u128, false);
let var2_neg = FixedTrait::new(2 * ONE_u128, true);
Expand Down
3 changes: 0 additions & 3 deletions crates/src/algebra/vector.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ impl VectorImpl<T, +Mul<T>, +AddEq<T>, +Zeroable<T>, +Copy<T>, +Drop<T>,> of Vec
// [Check] Dimesions are compatible
assert(self.size() == vector.size(), errors::INVALID_SIZE);
// [Compute] Dot product in a loop
let mut index = 0;
let mut value = Zeroable::zero();
loop {
match self.data.pop_front() {
Expand Down Expand Up @@ -112,15 +111,13 @@ mod tests {
}

#[test]
#[available_gas(1_000_000)]
fn test_vector_get() {
let mut vector: Vector = VectorTrait::new(array![1, 2, 3, 4].span());
assert(vector.get(0) == 1, 'Vector: get failed');
assert(vector.get(2) == 3, 'Vector: get failed');
}

#[test]
#[available_gas(1_000_000)]
fn test_vector_dot_product() {
let vector1: Vector = VectorTrait::new(array![1, 2, 3].span());
let vector2: Vector = VectorTrait::new(array![4, 5, 6].span());
Expand Down
9 changes: 0 additions & 9 deletions crates/src/defi/auction/gda.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ mod tests {

// ipynb with calculations at https://colab.research.google.com/drive/14elIFRXdG3_gyiI43tP47lUC_aClDHfB?usp=sharing
#[test]
#[available_gas(2000000)]
fn test_price_1() {
let auction = ContinuousGDA {
initial_price: FixedTrait::new_unscaled(1000, false),
Expand All @@ -110,7 +109,6 @@ mod tests {


#[test]
#[available_gas(2000000)]
fn test_price_2() {
let auction = ContinuousGDA {
initial_price: FixedTrait::new_unscaled(1000, false),
Expand All @@ -126,7 +124,6 @@ mod tests {
}

#[test]
#[available_gas(2000000)]
fn test_price_3() {
let auction = ContinuousGDA {
initial_price: FixedTrait::new_unscaled(1000, false),
Expand All @@ -142,7 +139,6 @@ mod tests {
}

#[test]
#[available_gas(2000000)]
fn test_price_4() {
let auction = ContinuousGDA {
initial_price: FixedTrait::new_unscaled(1000, false),
Expand All @@ -166,7 +162,6 @@ mod tests {
use super::super::{DiscreteGDA, DiscreteGDATrait};

#[test]
#[available_gas(2000000)]
fn test_initial_price() {
let auction = DiscreteGDA {
sold: FixedTrait::new_unscaled(0, false),
Expand All @@ -182,7 +177,6 @@ mod tests {

// ipynb with calculations at https://colab.research.google.com/drive/14elIFRXdG3_gyiI43tP47lUC_aClDHfB?usp=sharing
#[test]
#[available_gas(2000000)]
fn test_price_1() {
let auction = DiscreteGDA {
sold: FixedTrait::new_unscaled(1, false),
Expand All @@ -201,7 +195,6 @@ mod tests {
}

#[test]
#[available_gas(2000000)]
fn test_price_2() {
let auction = DiscreteGDA {
sold: FixedTrait::new_unscaled(2, false),
Expand All @@ -219,7 +212,6 @@ mod tests {
}

#[test]
#[available_gas(2000000)]
fn test_price_3() {
let auction = DiscreteGDA {
sold: FixedTrait::new_unscaled(4, false),
Expand All @@ -238,7 +230,6 @@ mod tests {
}

#[test]
#[available_gas(2000000)]
fn test_price_4() {
let auction = DiscreteGDA {
sold: FixedTrait::new_unscaled(20, false),
Expand Down
1 change: 0 additions & 1 deletion crates/src/defi/auction/helpers.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ mod tests {
const TOLERANCE: u128 = 18446744073709550; // 0.001

#[test]
#[available_gas(20000000)]
fn test_days_convertions() {
let days = FixedTrait::new(2, false);
let actual = to_days_fp(from_days_fp(days));
Expand Down
6 changes: 0 additions & 6 deletions crates/src/defi/auction/vrgda.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ mod tests {
const DELTA: u128 = 184467440737095;

#[test]
#[available_gas(2000000)]
fn test_target_price() {
let auction = LinearVRGDA {
target_price: FixedTrait::new(_69_42, false),
Expand All @@ -182,7 +181,6 @@ mod tests {
}

#[test]
#[available_gas(20000000)]
fn test_pricing_basic() {
let auction = LinearVRGDA {
target_price: FixedTrait::new(_69_42, false),
Expand All @@ -196,7 +194,6 @@ mod tests {
}

#[test]
#[available_gas(20000000)]
fn test_pricing_basic_reverse() {
let auction = LinearVRGDA {
target_price: FixedTrait::new(_69_42, false),
Expand Down Expand Up @@ -228,7 +225,6 @@ mod tests {
const _0_0023: u128 = 42427511369531970;

#[test]
#[available_gas(200000000)]
fn test_target_price() {
let auction = LogisticVRGDA {
target_price: FixedTrait::new(_69_42, false),
Expand All @@ -244,7 +240,6 @@ mod tests {
}

#[test]
#[available_gas(200000000)]
fn test_pricing_basic() {
let auction = LogisticVRGDA {
target_price: FixedTrait::new(_69_42, false),
Expand All @@ -260,7 +255,6 @@ mod tests {
}

#[test]
#[available_gas(200000000)]
fn test_pricing_basic_reverse() {
let auction = LogisticVRGDA {
target_price: FixedTrait::new(_69_42, false),
Expand Down
4 changes: 0 additions & 4 deletions crates/src/map/hex/hex.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ impl ImplHexTile of IHexTile {
mod tests {
use super::{IHexTile, ImplHexTile, Direction, HexTile};
#[test]
#[available_gas(500000)]
fn test_row_col() {
let mut hex_tile = ImplHexTile::new(5, 5);

Expand All @@ -146,7 +145,6 @@ mod tests {


#[test]
#[available_gas(500000)]
fn test_hex_tile_neighbors() {
let mut hex_tile = ImplHexTile::new(5, 5);

Expand Down Expand Up @@ -182,7 +180,6 @@ mod tests {
}

#[test]
#[available_gas(501230000)]
fn test_is_neighbor() {
let mut hex_tile = ImplHexTile::new(5, 5);

Expand All @@ -209,7 +206,6 @@ mod tests {
}

#[test]
#[available_gas(5012300000000000000)]
fn test_tiles_within_range() {
let mut hex_tile = ImplHexTile::new(5, 5);

Expand Down
Loading

0 comments on commit 178cfe9

Please sign in to comment.