Skip to content

Commit

Permalink
Add Nova Public Parameter benchmark for SDK (#267)
Browse files Browse the repository at this point in the history
Summary:

Test Plan:

Co-authored-by: duc-nx <>
  • Loading branch information
duc-nx authored Aug 21, 2024
1 parent 7c74a0f commit c703c59
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,13 @@ jobs:
run: |
cargo bench --bench riscv_machine
bench-nova-public-params:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'benchmark')
steps:
- uses: actions/checkout@v4
- name: Run benchmarks
run: |
cd nova-benches/
cargo bench --bench nova_public_parameter_generation
4 changes: 4 additions & 0 deletions nova-benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ parallel = ["nexus-nova/parallel"]
name = "nova"
harness = false

[[bench]]
name = "nova_public_parameter_generation"
harness = false

[[bench]]
name = "hypernova"
harness = false
Expand Down
36 changes: 36 additions & 0 deletions nova-benches/benches/nova_public_parameter_generation.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use ark_crypto_primitives::sponge::poseidon::PoseidonSponge;
use ark_pallas::{Fr as CF, PallasConfig as G1};
use ark_vesta::VestaConfig as G2;
use criterion::{criterion_group, criterion_main, Criterion};
use nexus_nova::{nova::sequential::PublicParams, pedersen::PedersenCommitment, poseidon_config};

mod shared;
use shared::NonTrivialTestCircuit;

type C1 = PedersenCommitment<ark_pallas::Projective>;
type C2 = PedersenCommitment<ark_vesta::Projective>;

fn nova_public_parameter_generation() {
let step_circuit = NonTrivialTestCircuit::new(0);
PublicParams::<G1, G2, C1, C2, PoseidonSponge<CF>, NonTrivialTestCircuit<CF>>::setup(
poseidon_config(),
&step_circuit,
&(),
&(),
)
.unwrap();
}

fn bench_nova_public_parameter(c: &mut Criterion) {
c.bench_function("nova_public_parameter", |b| {
b.iter(nova_public_parameter_generation)
});
}

criterion_group! {
name = benches;
config = Criterion::default().significance_level(0.1).sample_size(10);
targets = bench_nova_public_parameter
}

criterion_main!(benches);
1 change: 1 addition & 0 deletions nova-benches/benches/shared/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use ark_relations::r1cs::{ConstraintSystemRef, SynthesisError};
use nexus_nova::StepCircuit;
use std::marker::PhantomData;

#[allow(dead_code)]
pub const NUM_WARMUP_STEPS: usize = 10;

pub struct NonTrivialTestCircuit<F> {
Expand Down

0 comments on commit c703c59

Please sign in to comment.