diff --git a/kimchi/src/circuits/constraints.rs b/kimchi/src/circuits/constraints.rs index b53c925f20..c880d2cdcf 100644 --- a/kimchi/src/circuits/constraints.rs +++ b/kimchi/src/circuits/constraints.rs @@ -356,7 +356,7 @@ impl, OpeningProof: OpenProof> } // for public gates, only the left wire is toggled - if row < self.cs.public && gate.coeffs.get(0) != Some(&F::one()) { + if row < self.cs.public && gate.coeffs.first() != Some(&F::one()) { return Err(GateError::IncorrectPublic(row)); } diff --git a/msm/src/fec/interpreter.rs b/msm/src/fec/interpreter.rs index 7bc16698a1..37dd602444 100644 --- a/msm/src/fec/interpreter.rs +++ b/msm/src/fec/interpreter.rs @@ -427,7 +427,7 @@ pub fn ec_add_circuit< let xr: Ff = slope * slope - xp - xq; let yr: Ff = slope * (xp - xr) - yp; - let two_bi: BigInt = TryFrom::try_from(2).unwrap(); + let two_bi: BigInt = BigInt::from(2); let large_limb_size: F = From::from(1u128 << LIMB_BITSIZE_LARGE); diff --git a/msm/src/serialization/interpreter.rs b/msm/src/serialization/interpreter.rs index d4353a1863..7ad0637f30 100644 --- a/msm/src/serialization/interpreter.rs +++ b/msm/src/serialization/interpreter.rs @@ -542,7 +542,7 @@ pub fn multiplication_circuit< ) -> Ff { let coeff_result = chal * coeff_input; - let two_bi: BigInt = TryFrom::try_from(2).unwrap(); + let two_bi: BigInt = BigInt::from(2); let large_limb_size: F = From::from(1u128 << LIMB_BITSIZE_LARGE); diff --git a/o1vm/src/cannon.rs b/o1vm/src/cannon.rs index a888bf898d..2fd72c920a 100644 --- a/o1vm/src/cannon.rs +++ b/o1vm/src/cannon.rs @@ -307,6 +307,35 @@ impl Meta { } } +pub const HINT_CLIENT_READ_FD: i32 = 3; +pub const HINT_CLIENT_WRITE_FD: i32 = 4; +pub const PREIMAGE_CLIENT_READ_FD: i32 = 5; +pub const PREIMAGE_CLIENT_WRITE_FD: i32 = 6; + +pub struct Preimage(Vec); + +impl Preimage { + pub fn create(v: Vec) -> Self { + Preimage(v) + } + + pub fn get(self) -> Vec { + self.0 + } +} + +pub struct Hint(Vec); + +impl Hint { + pub fn create(v: Vec) -> Self { + Hint(v) + } + + pub fn get(self) -> Vec { + self.0 + } +} + #[cfg(test)] mod tests { @@ -480,32 +509,3 @@ mod tests { assert!(PreimageKey::from_str("0x01").is_err()); } } - -pub const HINT_CLIENT_READ_FD: i32 = 3; -pub const HINT_CLIENT_WRITE_FD: i32 = 4; -pub const PREIMAGE_CLIENT_READ_FD: i32 = 5; -pub const PREIMAGE_CLIENT_WRITE_FD: i32 = 6; - -pub struct Preimage(Vec); - -impl Preimage { - pub fn create(v: Vec) -> Self { - Preimage(v) - } - - pub fn get(self) -> Vec { - self.0 - } -} - -pub struct Hint(Vec); - -impl Hint { - pub fn create(v: Vec) -> Self { - Hint(v) - } - - pub fn get(self) -> Vec { - self.0 - } -} diff --git a/utils/src/field_helpers.rs b/utils/src/field_helpers.rs index 00f8827d06..5ceb7c1752 100644 --- a/utils/src/field_helpers.rs +++ b/utils/src/field_helpers.rs @@ -84,9 +84,7 @@ pub trait FieldHelpers { where F: PrimeField, { - big.clone() - .try_into() - .map_err(|_| FieldHelpersError::DeserializeBytes) + Ok(F::from(big.clone())) } /// Serialize to bytes