Skip to content

Commit

Permalink
fmt & clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lynxcs committed Jan 11, 2024
1 parent dd32072 commit d08d3f9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
17 changes: 8 additions & 9 deletions constantine/src/types/fr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ impl Fr for CtFr {
}

#[cfg(feature = "rand")]
fn rand() -> Self {
let val =
constantine_sys::big255 { limbs:[
fn rand() -> Self {
let val = constantine_sys::big255 {
limbs: [
rand::random(),
rand::random(),
rand::random(),
rand::random(),
]};
rand::random(),
],
};
let mut ret = Self::default();
unsafe {
constantine::ctt_bls12_381_fr_from_big255(&mut ret.0, &val);
Expand All @@ -98,10 +99,8 @@ impl Fr for CtFr {
let mut ret: Self = Self::default();
let mut scalar = constantine::big255::default();
unsafe {
let status = constantine::ctt_bls12_381_deserialize_scalar(
&mut scalar,
bytes.as_ptr(),
);
let status =
constantine::ctt_bls12_381_deserialize_scalar(&mut scalar, bytes.as_ptr());
if status == ctt_codec_scalar_status::cttCodecScalar_ScalarLargerThanCurveOrder
{
return Err("Invalid scalar".to_string());
Expand Down
4 changes: 1 addition & 3 deletions constantine/src/types/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ use core::fmt::{Debug, Formatter};
use crate::kzg_proofs::g1_linear_combination;
use crate::types::fp::CtFp;
use crate::types::fr::CtFr;
use crate::utils::ptr_transmute;
use crate::utils::ptr_transmute_mut;
use kzg::common_utils::log_2_byte;

use kzg::eip_4844::BYTES_PER_G1;
use kzg::G1Affine;
use kzg::G1GetFp;
Expand Down
2 changes: 0 additions & 2 deletions constantine/src/types/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ use kzg::{G2Mul, G2};

use crate::consts::{G2_GENERATOR, G2_NEGATIVE_GENERATOR};
use crate::types::fr::CtFr;
use crate::utils::ptr_transmute;
use crate::utils::ptr_transmute_mut;

use constantine_sys::{
bls12_381_fp, bls12_381_fp2, bls12_381_g2_aff, bls12_381_g2_jac,
Expand Down

0 comments on commit d08d3f9

Please sign in to comment.