File tree 1 file changed +4
-3
lines changed
crates/starknet-types-core/src/felt
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -1076,10 +1076,11 @@ mod test {
1076
1076
// Helper function to generate a vector of bits for testing purposes
1077
1077
fn generate_be_bits ( x : & Felt ) -> Vec < bool > {
1078
1078
// 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 ) ;
1080
1081
1081
1082
// Iterate over each limb in the representative of x
1082
- for limb in x . 0 . representative ( ) . limbs {
1083
+ for limb in bits . limbs {
1083
1084
// Convert the limb to a sequence of 8 bytes (u8) in big-endian
1084
1085
let bytes = limb. to_be_bytes ( ) ;
1085
1086
@@ -1831,7 +1832,7 @@ mod test {
1831
1832
bytes[ 31 - ( i >> 1 ) ] |= 15 << ( 4 * ( i & 1 ) ) ;
1832
1833
}
1833
1834
let h = Felt :: from_bytes_be ( & bytes) ;
1834
- let mut res = Vec :: with_capacity ( enc_len ( n_nibbles ) ) ;
1835
+ let mut res = Vec :: new ( ) ;
1835
1836
assert ! ( h. serialize( & mut res) . is_ok( ) ) ;
1836
1837
assert_eq ! ( res. len( ) , enc_len( n_nibbles) ) ;
1837
1838
let mut reader = & res[ ..] ;
You can’t perform that action at this time.
0 commit comments