Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7254cbf

Browse files
committedMar 22, 2025·
update review content
1 parent 1d6ea73 commit 7254cbf

File tree

1 file changed

+4
-3
lines changed
  • crates/starknet-types-core/src/felt

1 file changed

+4
-3
lines changed
 

‎crates/starknet-types-core/src/felt/mod.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1076,10 +1076,11 @@ mod test {
10761076
// Helper function to generate a vector of bits for testing purposes
10771077
fn generate_be_bits(x: &Felt) -> Vec<bool> {
10781078
// Initialize an empty vector to store the expected bits
1079-
let mut bits = Vec::with_capacity(x.0.representative().limbs.len() * 8 * 8);
1079+
let representative = x.0.representative();
1080+
let mut bits = Vec::with_capacity(limbs.len() * 8 * 8);
10801081

10811082
// Iterate over each limb in the representative of x
1082-
for limb in x.0.representative().limbs {
1083+
for limb in bits.limbs {
10831084
// Convert the limb to a sequence of 8 bytes (u8) in big-endian
10841085
let bytes = limb.to_be_bytes();
10851086

@@ -1831,7 +1832,7 @@ mod test {
18311832
bytes[31 - (i >> 1)] |= 15 << (4 * (i & 1));
18321833
}
18331834
let h = Felt::from_bytes_be(&bytes);
1834-
let mut res = Vec::with_capacity(enc_len(n_nibbles));
1835+
let mut res = Vec::new();
18351836
assert!(h.serialize(&mut res).is_ok());
18361837
assert_eq!(res.len(), enc_len(n_nibbles));
18371838
let mut reader = &res[..];

0 commit comments

Comments
 (0)
Please sign in to comment.