From 338fb6dd744a1e3ab24dcbf553cfd8c222af886d Mon Sep 17 00:00:00 2001 From: seemenkina Date: Wed, 18 Sep 2024 12:43:09 +0700 Subject: [PATCH] chore(rln): update to uncompressed arkzkey --- rln/benches/circuit_loading_arkzkey_benchmark.rs | 6 +++--- rln/src/circuit.rs | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rln/benches/circuit_loading_arkzkey_benchmark.rs b/rln/benches/circuit_loading_arkzkey_benchmark.rs index 89985f8..0fe94c4 100644 --- a/rln/benches/circuit_loading_arkzkey_benchmark.rs +++ b/rln/benches/circuit_loading_arkzkey_benchmark.rs @@ -1,6 +1,6 @@ use criterion::{criterion_group, criterion_main, Criterion}; use rln::circuit::{ - arkzkey_from_raw_compressed, arkzkey_from_raw_uncompressed, ARKZKEY_BYTES, + read_arkzkey_from_bytes_compressed, read_arkzkey_from_bytes_uncompressed, ARKZKEY_BYTES, ARKZKEY_BYTES_UNCOMPR, }; @@ -14,7 +14,7 @@ pub fn uncompressed_bench(c: &mut Criterion) { c.bench_function("arkzkey::arkzkey_from_raw_uncompressed", |b| { b.iter(|| { - let r = arkzkey_from_raw_uncompressed(&arkzkey); + let r = read_arkzkey_from_bytes_uncompressed(&arkzkey); assert_eq!(r.is_ok(), true); }) }); @@ -29,7 +29,7 @@ pub fn compressed_bench(c: &mut Criterion) { c.bench_function("arkzkey::arkzkey_from_raw_compressed", |b| { b.iter(|| { - let r = arkzkey_from_raw_compressed(&arkzkey); + let r = read_arkzkey_from_bytes_compressed(&arkzkey); assert_eq!(r.is_ok(), true); }) }); diff --git a/rln/src/circuit.rs b/rln/src/circuit.rs index d187049..9cc2d7f 100644 --- a/rln/src/circuit.rs +++ b/rln/src/circuit.rs @@ -43,7 +43,7 @@ lazy_static! { static ref ZKEY: (ProvingKey, ConstraintMatrices) = { cfg_if! { if #[cfg(feature = "arkzkey")] { - read_arkzkey_from_bytes(ARKZKEY_BYTES).expect("Failed to read arkzkey") + read_arkzkey_from_bytes_uncompressed(ARKZKEY_BYTES_UNCOMPR).expect("Failed to read arkzkey") } else { let mut reader = Cursor::new(ZKEY_BYTES); read_zkey(&mut reader).expect("Failed to read zkey") @@ -151,11 +151,11 @@ pub fn check_vk_from_zkey(verifying_key: VerifyingKey) -> Result<()> { } //////////////////////////////////////////////////////// -// Function from [arkzkey](https://github.com/zkmopro/ark-zkey/blob/main/src/lib.rs#L106) for benchmark -// without print and using compressed and uncompressed data +// Functions from [arkz-key](https://github.com/zkmopro/ark-zkey/blob/main/src/lib.rs#L106) +// without print and allow to choose between compressed and uncompressed arkzkey //////////////////////////////////////////////////////// #[cfg(feature = "arkzkey")] -pub fn arkzkey_from_raw_uncompressed( +pub fn read_arkzkey_from_bytes_uncompressed( arkzkey_data: &[u8], ) -> Result<(ProvingKey, ConstraintMatrices)> { if arkzkey_data.is_empty() { @@ -190,7 +190,7 @@ pub fn arkzkey_from_raw_uncompressed( } #[cfg(feature = "arkzkey")] -pub fn arkzkey_from_raw_compressed( +pub fn read_arkzkey_from_bytes_compressed( arkzkey_data: &[u8], ) -> Result<(ProvingKey, ConstraintMatrices)> { if arkzkey_data.is_empty() {