Skip to content

Commit 238865f

Browse files
committed
Fix hex decoding
1 parent 9f402f7 commit 238865f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

operator/mina/lib/src/verifier_index.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{array, sync::Arc};
22

3-
use ark_ff::Field;
3+
use ark_ff::{Field, PrimeField};
44
use ark_poly::{
55
univariate::DensePolynomial, EvaluationDomain, Radix2EvaluationDomain, UVPolynomial,
66
};
@@ -85,15 +85,17 @@ impl TryInto<Fp> for JSONFp {
8585
type Error = String;
8686

8787
fn try_into(self) -> Result<Fp, Self::Error> {
88-
Fp::from_hex(&self.0).map_err(|err| err.to_string())
88+
let bytes = hex::decode(self.0.trim_start_matches("0x")).map_err(|err| err.to_string())?;
89+
Ok(Fp::from_be_bytes_mod_order(&bytes))
8990
}
9091
}
9192

9293
impl TryInto<Fq> for JSONFq {
9394
type Error = String;
9495

9596
fn try_into(self) -> Result<Fq, Self::Error> {
96-
Fq::from_hex(&self.0).map_err(|err| err.to_string())
97+
let bytes = hex::decode(self.0.trim_start_matches("0x")).map_err(|err| err.to_string())?;
98+
Ok(Fq::from_be_bytes_mod_order(&bytes))
9799
}
98100
}
99101

0 commit comments

Comments
 (0)