Skip to content

Commit

Permalink
Merge pull request #2097 from eqlabs/bench-fix
Browse files Browse the repository at this point in the history
fix(crypto-bench) ensure valid representations
  • Loading branch information
kkovaacs authored Jun 25, 2024
2 parents 77085e2 + 9874b23 commit 9a6314a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions crates/crypto/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub struct Fp([u64; 4]);
// Arkworks
use ark_ff::fields::{Fp256, MontBackend};
use ark_ff::{BigInt, Field, MontConfig};
use rand::Rng;
#[derive(MontConfig)]
#[modulus = "3618502788666131213697322783095070105623107215331596699973092056135872020481"]
#[generator = "3"]
Expand Down Expand Up @@ -46,9 +45,8 @@ pub fn bench_field(c: &mut Criterion) {

let mut grp_alg = c.benchmark_group("field");

let rand: [u64; 4] = [rng.gen(), rng.gen(), rng.gen(), rng.gen()];
let ark_elm = Fq::new_unchecked(BigInt(rand));
let pf_elm = MontFelt::from_native_limbs(rand);
let pf_elm = MontFelt::random(rng);
let ark_elm = Fq::new_unchecked(BigInt(pf_elm.0));
let ff_elm = <Fp as ff::PrimeField>::from_repr(FpRepr(pf_elm.to_be_bytes())).unwrap();

// MUL
Expand Down

0 comments on commit 9a6314a

Please sign in to comment.