mirror of https://github.com/vacp2p/zerokit.git
chore(rln): infallible conversions (#229)
This commit is contained in:
parent
7669d72f9b
commit
ccd2ead847
|
@ -145,7 +145,7 @@ pub fn circom_from_folder(resources_folder: &str) -> Result<&'static Mutex<Witne
|
|||
|
||||
// Utilities to convert a json verification key in a groth16::VerificationKey
|
||||
fn fq_from_str(s: &str) -> Result<Fq> {
|
||||
Ok(Fq::try_from(BigUint::from_str(s)?)?)
|
||||
Ok(Fq::from(BigUint::from_str(s)?))
|
||||
}
|
||||
|
||||
// Extracts the element in G1 corresponding to its JSON serialization
|
||||
|
|
|
@ -8,7 +8,7 @@ use num_traits::Num;
|
|||
use std::iter::Extend;
|
||||
|
||||
pub fn to_bigint(el: &Fr) -> Result<BigInt> {
|
||||
let res: BigUint = (*el).try_into()?;
|
||||
let res: BigUint = (*el).into();
|
||||
Ok(res.into())
|
||||
}
|
||||
|
||||
|
@ -28,10 +28,10 @@ pub fn str_to_fr(input: &str, radix: u32) -> Result<Fr> {
|
|||
input_clean = input_clean.trim().to_string();
|
||||
|
||||
if radix == 10 {
|
||||
Ok(BigUint::from_str_radix(&input_clean, radix)?.try_into()?)
|
||||
Ok(BigUint::from_str_radix(&input_clean, radix)?.into())
|
||||
} else {
|
||||
input_clean = input_clean.replace("0x", "");
|
||||
Ok(BigUint::from_str_radix(&input_clean, radix)?.try_into()?)
|
||||
Ok(BigUint::from_str_radix(&input_clean, radix)?.into())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue