Skip to content

Commit 7bd2dbb

Browse files
committed
versioning
1 parent 74cafd4 commit 7bd2dbb

14 files changed

Lines changed: 75 additions & 30 deletions

File tree

Scarb.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ members = [
1515
"packages/utils",
1616
]
1717
name = "alexandria"
18-
version = "0.1.0"
18+
version = "0.4.0"
1919
description = "Community maintained Cairo and Starknet libraries"
2020
homepage = "https://github.com/keep-starknet-strange/alexandria/"
2121
cairo-version = "2.10.0"
@@ -27,5 +27,8 @@ cairo_test = "2.10.0"
2727
[workspace.tool.fmt]
2828
sort-module-level-items = true
2929

30+
[workspace.package]
31+
version = "0.4.0"
32+
3033
[scripts]
3134
all = "scarb build && scarb test"

packages/ascii/Scarb.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "alexandria_ascii"
3-
version = "0.1.0"
3+
version.workspace = true
44
description = "utilities for working with ascii values"
55
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/packages/ascii"
66
edition = "2023_11"
@@ -9,7 +9,7 @@ edition = "2023_11"
99
fmt.workspace = true
1010

1111
[dependencies]
12-
alexandria_data_structures = { path = "../data_structures" }
12+
alexandria_data_structures = { path = "../data_structures", version ="0.4.0" }
1313

1414
[dev-dependencies]
1515
cairo_test.workspace = true

packages/bytes/Scarb.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "alexandria_bytes"
3-
version = "0.1.0"
3+
version.workspace = true
44
description = "An implementation similar to Solidity bytes written in Cairo 1"
55
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/packages/bytes"
66
edition = "2023_11"
@@ -9,8 +9,8 @@ edition = "2023_11"
99
fmt.workspace = true
1010

1111
[dependencies]
12-
alexandria_math = { path = "../math" }
13-
alexandria_data_structures = { path = "../data_structures" }
12+
alexandria_math = { path = "../math", version ="0.4.0" }
13+
alexandria_data_structures = { path = "../data_structures", version ="0.4.0" }
1414
starknet.workspace = true
1515

1616
[dev-dependencies]
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
[package]
22
name = "alexandria_data_structures"
3-
version = "0.2.0"
3+
version.workspace = true
44
description = "A set of Cairo data structure libraries and algorithms"
55
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/packages/data_structures"
66
edition = "2023_11"
77

88
[tool]
99
fmt.workspace = true
1010

11-
[dependencies]
12-
alexandria_encoding = { path = "../encoding" }
13-
1411
[dev-dependencies]
1512
cairo_test.workspace = true

packages/data_structures/src/byte_appender.cairo

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use alexandria_encoding::reversible::reversing;
21
use core::byte_array::ByteArrayTrait;
32
use core::integer::u512;
3+
use core::num::traits::Zero;
4+
use core::ops::{AddAssign, MulAssign};
45
use super::bit_array::{one_shift_left_bytes_felt252, one_shift_left_bytes_u128};
56

67
/// Generic support trait for appending signed and unsigned integers onto byte storage.
@@ -284,3 +285,47 @@ impl ByteAppenderImpl<T, +Drop<T>, +ByteAppenderSupportTrait<T>> of ByteAppender
284285

285286
impl ArrayU8ByteAppenderImpl = ByteAppenderImpl<Array<u8>>;
286287
impl ByteArrayByteAppenderImpl = ByteAppenderImpl<ByteArray>;
288+
289+
// Duplicated functions from encoding. To fix dependency publish problem.
290+
291+
#[inline]
292+
pub fn reversing<
293+
T,
294+
+Copy<T>,
295+
+Zero<T>,
296+
+TryInto<T, NonZero<T>>,
297+
+DivRem<T>,
298+
+Drop<T>,
299+
+MulAssign<T, T>,
300+
+Rem<T>,
301+
+AddAssign<T, T>,
302+
>(
303+
word: T, size: usize, step: T,
304+
) -> (T, T) {
305+
let result = Zero::zero();
306+
reversing_partial_result(word, result, size, step)
307+
}
308+
309+
#[inline]
310+
pub fn reversing_partial_result<
311+
T,
312+
+Copy<T>,
313+
+DivRem<T>,
314+
+TryInto<T, NonZero<T>>,
315+
+Drop<T>,
316+
+MulAssign<T, T>,
317+
+Rem<T>,
318+
+AddAssign<T, T>,
319+
>(
320+
mut word: T, mut onto: T, size: usize, step: T,
321+
) -> (T, T) {
322+
let mut i: usize = 0;
323+
while i != size {
324+
let (new_word, remainder) = DivRem::div_rem(word, step.try_into().unwrap());
325+
word = new_word;
326+
onto *= step.into();
327+
onto += remainder;
328+
i += 1;
329+
};
330+
(onto, word)
331+
}

packages/encoding/Scarb.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "alexandria_encoding"
3-
version = "0.1.0"
3+
version.workspace = true
44
description = "Encoding utilities"
55
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/packages/encoding"
66
edition = "2023_11"
@@ -9,10 +9,10 @@ edition = "2023_11"
99
fmt.workspace = true
1010

1111
[dependencies]
12-
alexandria_math = { path = "../math" }
13-
alexandria_numeric = { path = "../numeric" }
14-
alexandria_bytes = { path = "../bytes" }
15-
alexandria_data_structures = { path = "../data_structures" }
12+
alexandria_math = { path = "../math", version ="0.4.0" }
13+
alexandria_numeric = { path = "../numeric", version ="0.4.0" }
14+
alexandria_bytes = { path = "../bytes", version ="0.4.0" }
15+
alexandria_data_structures = { path = "../data_structures", version ="0.4.0" }
1616

1717
[dev-dependencies]
1818
cairo_test.workspace = true

packages/linalg/Scarb.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "alexandria_linalg"
3-
version = "0.1.0"
3+
version.workspace = true
44
description = "A set of linear algebra libraries and algorithms"
55
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/packages/linalg"
66
edition = "2023_11"
@@ -9,7 +9,7 @@ edition = "2023_11"
99
fmt.workspace = true
1010

1111
[dependencies]
12-
alexandria_math = { path = "../math" }
12+
alexandria_math = { path = "../math", version ="0.4.0" }
1313

1414
[dev-dependencies]
1515
cairo_test.workspace = true

packages/macros/Scarb.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "alexandria_macros"
3-
version = "0.1.0"
3+
version.workspace = true
44
description = "A set of useful macros"
55
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/packages/macros"
66
edition = "2024_07"

packages/merkle_tree/Scarb.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "alexandria_merkle_tree"
3-
version = "0.1.0"
3+
version.workspace = true
44
description = "Merkle tree related stuff"
55
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/src/merkle_tree"
66
edition = "2023_11"
@@ -9,7 +9,7 @@ edition = "2023_11"
99
fmt.workspace = true
1010

1111
[dependencies]
12-
alexandria_math = { path = "../math" }
12+
alexandria_math = { path = "../math", version = "0.4.0" }
1313

1414
[dev-dependencies]
1515
cairo_test.workspace = true

packages/numeric/Scarb.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "alexandria_numeric"
3-
version = "0.1.0"
3+
version.workspace = true
44
description = "A set of numerical analysis libraries and algorithms"
55
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/packages/numeric"
66
edition = "2023_11"
@@ -9,8 +9,8 @@ edition = "2023_11"
99
fmt.workspace = true
1010

1111
[dependencies]
12-
alexandria_math = { path = "../math" }
13-
alexandria_searching = { path = "../searching" }
12+
alexandria_math = { path = "../math", version = "0.4.0" }
13+
alexandria_searching = { path = "../searching", version = "0.4.0" }
1414

1515
[dev-dependencies]
1616
cairo_test.workspace = true

0 commit comments

Comments
 (0)