Skip to content

Commit

Permalink
chore(rln): update to uncompressed arkzkey
Browse files Browse the repository at this point in the history
  • Loading branch information
seemenkina committed Sep 18, 2024
1 parent fbe8c99 commit 338fb6d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions rln/benches/circuit_loading_arkzkey_benchmark.rs
Original file line number Diff line number Diff line change
@@ -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,
};

Expand All @@ -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);
})
});
Expand All @@ -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);
})
});
Expand Down
10 changes: 5 additions & 5 deletions rln/src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ lazy_static! {
static ref ZKEY: (ProvingKey<Curve>, ConstraintMatrices<Fr>) = {
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")
Expand Down Expand Up @@ -151,11 +151,11 @@ pub fn check_vk_from_zkey(verifying_key: VerifyingKey<Curve>) -> 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<Curve>, ConstraintMatrices<Fr>)> {
if arkzkey_data.is_empty() {
Expand Down Expand Up @@ -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<Curve>, ConstraintMatrices<Fr>)> {
if arkzkey_data.is_empty() {
Expand Down

0 comments on commit 338fb6d

Please sign in to comment.