Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Nova structs become generic on their field type (+ update Nova) #556

Merged
merged 2 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 25 additions & 70 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ ff = "0.13"
log = "0.4.19"
metrics = "0.21.1"
neptune = { version = "10.0.0" }
nova = { package = "nova-snark", version = "0.22", default-features = false }
nova = { version = "0.23", default-features = false, package = "nova-snark" }
once_cell = "1.18.0"
pairing = { version = "0.23" }
pasta_curves = { version = "0.5.1" }
Expand Down
2 changes: 1 addition & 1 deletion examples/sha256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ fn main() {
println!("Setting up public parameters...");

let pp_start = Instant::now();
let pp = public_params::<Sha256Coproc<Fr>>(REDUCTION_COUNT, lang_rc.clone()).unwrap();
let pp = public_params::<_, Sha256Coproc<Fr>>(REDUCTION_COUNT, lang_rc.clone()).unwrap();
let pp_end = pp_start.elapsed();

println!("Public parameters took {:?}", pp_end);
Expand Down
3 changes: 2 additions & 1 deletion fcomm/src/bin/fcomm.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use log::info;
use lurk::proof::nova::CurveCycleEquipped;
use std::convert::TryFrom;
use std::env;
use std::fs::read_to_string;
Expand Down Expand Up @@ -492,7 +493,7 @@ fn opening_request<P: AsRef<Path>, F: LurkField + Serialize + DeserializeOwned>(
}

// Get proof from supplied path or else from stdin.
fn proof<'a, P: AsRef<Path>, F: LurkField>(
fn proof<'a, P: AsRef<Path>, F: CurveCycleEquipped>(
proof_path: Option<P>,
) -> Result<Proof<'a, F>, error::Error>
where
Expand Down
16 changes: 8 additions & 8 deletions fcomm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use proptest_derive::Arbitrary;

use ff::PrimeField;
use hex::FromHex;
use lurk::error::ReductionError;
#[cfg(not(target_arch = "wasm32"))]
use lurk::field::FWrap;
use lurk::{
Expand Down Expand Up @@ -38,6 +37,7 @@ use lurk_macros::serde_test;
#[cfg(not(target_arch = "wasm32"))]
use lurk::z_data;

use lurk::{error::ReductionError, proof::nova::CurveCycleEquipped};
use once_cell::sync::OnceCell;
use pasta_curves::pallas;
use rand::rngs::OsRng;
Expand Down Expand Up @@ -269,9 +269,9 @@ pub struct VerificationResult {
}

#[derive(Serialize, Deserialize)]
pub struct Proof<'a, F: LurkField> {
pub struct Proof<'a, F: CurveCycleEquipped> {
pub claim: Claim<F>,
pub proof: nova::Proof<'a, Coproc<S1>>,
pub proof: nova::Proof<'a, F, Coproc<F>>,
pub num_steps: usize,
pub reduction_count: ReductionCount,
}
Expand Down Expand Up @@ -632,7 +632,7 @@ impl<'a> Opening<S1> {
chain: bool,
only_use_cached_proofs: bool,
nova_prover: &'a NovaProver<S1, Coproc<S1>>,
pp: &'a PublicParams<'_, Coproc<S1>>,
pp: &'a PublicParams<'_, S1, Coproc<S1>>,
lang: Arc<Lang<S1, Coproc<S1>>>,
) -> Result<Proof<'a, S1>, Error> {
let claim = Self::apply(s, input, function, limit, chain, &lang)?;
Expand All @@ -653,7 +653,7 @@ impl<'a> Opening<S1> {
limit: usize,
only_use_cached_proofs: bool,
nova_prover: &'a NovaProver<S1, Coproc<S1>>,
pp: &'a PublicParams<'_, Coproc<S1>>,
pp: &'a PublicParams<'_, S1, Coproc<S1>>,
lang: Arc<Lang<S1, Coproc<S1>>>,
) -> Result<Proof<'a, S1>, Error> {
let input = request.input.expr.ptr(s, limit, &lang);
Expand Down Expand Up @@ -787,7 +787,7 @@ impl<'a> Proof<'a, S1> {
limit: usize,
only_use_cached_proofs: bool,
nova_prover: &'a NovaProver<S1, Coproc<S1>>,
pp: &'a PublicParams<'_, Coproc<S1>>,
pp: &'a PublicParams<'_, S1, Coproc<S1>>,
lang: Arc<Lang<S1, Coproc<S1>>>,
) -> Result<Self, Error> {
let env = supplied_env.unwrap_or_else(|| empty_sym_env(s));
Expand Down Expand Up @@ -825,7 +825,7 @@ impl<'a> Proof<'a, S1> {
limit: usize,
only_use_cached_proofs: bool,
nova_prover: &'a NovaProver<S1, Coproc<S1>>,
pp: &'a PublicParams<'_, Coproc<S1>>,
pp: &'a PublicParams<'_, S1, Coproc<S1>>,
lang: &Arc<Lang<S1, Coproc<S1>>>,
) -> Result<Self, Error> {
let reduction_count = nova_prover.reduction_count();
Expand Down Expand Up @@ -911,7 +911,7 @@ impl<'a> Proof<'a, S1> {

pub fn verify(
&self,
pp: &PublicParams<'_, Coproc<S1>>,
pp: &PublicParams<'_, S1, Coproc<S1>>,
lang: &Lang<S1, Coproc<S1>>,
) -> Result<VerificationResult, Error> {
let (public_inputs, public_outputs) = self.io_vecs(lang)?;
Expand Down
Loading
Loading