File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
crates/starknet-types-core/src/felt Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,7 @@ impl fmt::Display for QM31Error {
21
21
match self {
22
22
QM31Error :: FeltTooBig ( felt) => writeln ! (
23
23
f,
24
- "Number used as QM31 since it's more than 144 bits long: {}" ,
25
- felt
24
+ "Number used as QM31 since it's more than 144 bits long: {felt}"
26
25
) ,
27
26
QM31Error :: InvalidInversion => writeln ! ( f, "Attempt to invert a qm31 equal to zero" ) ,
28
27
}
@@ -239,7 +238,7 @@ impl TryFrom<Felt> for QM31Felt {
239
238
return Err ( QM31Error :: FeltTooBig ( value) ) ;
240
239
}
241
240
242
- Ok ( Self ( limbs) )
241
+ Ok ( Self :: from_raw ( limbs) )
243
242
}
244
243
}
245
244
@@ -256,7 +255,7 @@ impl TryFrom<&Felt> for QM31Felt {
256
255
return Err ( QM31Error :: FeltTooBig ( * value) ) ;
257
256
}
258
257
259
- Ok ( Self ( limbs) )
258
+ Ok ( Self :: from_raw ( limbs) )
260
259
}
261
260
}
262
261
@@ -274,8 +273,9 @@ mod test {
274
273
} ;
275
274
276
275
#[ test]
277
- fn from_qm31_to_felt ( ) {
276
+ fn from_positive_felt_to_qm31_to_felt ( ) {
278
277
let felt_expected = Felt :: from ( 2i128 . pow ( 126 ) ) ;
278
+
279
279
let qm31: QM31Felt = felt_expected. try_into ( ) . unwrap ( ) ;
280
280
let felt = qm31. into ( ) ;
281
281
You can’t perform that action at this time.
0 commit comments