Skip to content

Commit

Permalink
Merge pull request #2930 from o1-labs/dw/lint-for-1-75
Browse files Browse the repository at this point in the history
Make clippy happy for 1.75
  • Loading branch information
dannywillems authored Jan 8, 2025
2 parents 25a8372 + 40b39cf commit c61f2ff
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 35 deletions.
2 changes: 1 addition & 1 deletion kimchi/src/circuits/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl<F: PrimeField, G: KimchiCurve<ScalarField = F>, OpeningProof: OpenProof<G>>
}

// 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));
}

Expand Down
2 changes: 1 addition & 1 deletion msm/src/fec/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion msm/src/serialization/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
58 changes: 29 additions & 29 deletions o1vm/src/cannon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>);

impl Preimage {
pub fn create(v: Vec<u8>) -> Self {
Preimage(v)
}

pub fn get(self) -> Vec<u8> {
self.0
}
}

pub struct Hint(Vec<u8>);

impl Hint {
pub fn create(v: Vec<u8>) -> Self {
Hint(v)
}

pub fn get(self) -> Vec<u8> {
self.0
}
}

#[cfg(test)]
mod tests {

Expand Down Expand Up @@ -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<u8>);

impl Preimage {
pub fn create(v: Vec<u8>) -> Self {
Preimage(v)
}

pub fn get(self) -> Vec<u8> {
self.0
}
}

pub struct Hint(Vec<u8>);

impl Hint {
pub fn create(v: Vec<u8>) -> Self {
Hint(v)
}

pub fn get(self) -> Vec<u8> {
self.0
}
}
4 changes: 1 addition & 3 deletions utils/src/field_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ pub trait FieldHelpers<F> {
where
F: PrimeField,
{
big.clone()
.try_into()
.map_err(|_| FieldHelpersError::DeserializeBytes)
Ok(F::from(big.clone()))
}

/// Serialize to bytes
Expand Down

0 comments on commit c61f2ff

Please sign in to comment.