Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit cd8559dd3b08261121e4ac797bd364de317c9467
Author: Forpee <[email protected]>
Date:   Wed Nov 6 12:38:02 2024 +0200

    chore: restore cargo

commit f190e75d215b8a73d66c559d427b5e536ddb9c4e
Author: Forpee <[email protected]>
Date:   Wed Nov 6 12:32:32 2024 +0200

    chore: fix warnings, docs, clippy, fmt

commit b849a82e2d142c0fd1564721785295c67c4f2d34
Author: Forpee <[email protected]>
Date:   Wed Nov 6 11:56:28 2024 +0200

    chore: do some doc comments

commit 1fb584f14216f187a42b0eae9e5550042c08e31c
Author: Forpee <[email protected]>
Date:   Wed Nov 6 11:39:23 2024 +0200

    chore: clean up warnings

commit c68b709c53e812bac02bf09f43c08b0f8ce9f1bb
Author: Forpee <[email protected]>
Date:   Wed Nov 6 11:28:21 2024 +0200

    feat: add alloc_precommitted

commit 1642f15efb44c88a990f3e84e9c2a9d11b7bb735
Author: Forpee <[email protected]>
Date:   Wed Nov 6 11:18:36 2024 +0200

    feat: init precommitted var

commit 4aa27a7a32073bf6a3e87d5a9f9cafc2a305b853
Author: Forpee <[email protected]>
Date:   Wed Nov 6 10:53:59 2024 +0200

    chore: make poseidon folder

commit 110e782d888e56c9ea2fba75b807e201f97bc2c1
Author: Forpee <[email protected]>
Date:   Tue Nov 5 23:05:29 2024 +0200

    chore: rm doc tests

commit e9426b2d30078841c2b17492ce96e26e19d41d47
Author: Forpee <[email protected]>
Date:   Tue Nov 5 23:05:04 2024 +0200

    fix: poseidon in pp

commit aa12cbf04bdab6e5d18f45dceb0de6f33dd25dd5
Author: Forpee <[email protected]>
Date:   Tue Nov 5 22:04:57 2024 +0200

    feat: init new CS

commit 54cb3dfd0df2cc4bbde97b475daa4058680d14ff
Author: Forpee <[email protected]>
Date:   Tue Nov 5 20:38:43 2024 +0200

    feat: port poseidon sponge

commit e1368fdd74cd52cbcf65143e6e19d391a861ad66
Author: Forpee <[email protected]>
Date:   Tue Nov 5 20:34:12 2024 +0200

    feat: implement poseidon

commit 3d2e6fad71016afcec88f24c8219240e366f047e
Author: Forpee <[email protected]>
Date:   Tue Nov 5 18:41:20 2024 +0200

    feat: poseidon consts

commit f002464ab64933aa05667976ea9a2e3249ba552d
Author: Forpee <[email protected]>
Date:   Tue Nov 5 18:41:09 2024 +0200

    feat: init CS

commit 9ee87f60e2073ceb9031a93f1056ef10fb241ce2
Author: Forpee <[email protected]>
Date:   Tue Nov 5 14:40:46 2024 +0200

    fix: cargo
  • Loading branch information
Forpee committed Nov 6, 2024
1 parent ac8b057 commit 2112360
Show file tree
Hide file tree
Showing 55 changed files with 8,324 additions and 100 deletions.
7 changes: 1 addition & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ readme = "README.md"
repository = "https://github.com/Microsoft/Nova"
license-file = "LICENSE"
keywords = ["zkSNARKs", "cryptography", "proofs"]
rust-version="1.79.0"
rust-version = "1.79.0"

[dependencies]
bellpepper-core = { version="0.4.0", default-features = false }
bellpepper = { version="0.4.0", default-features = false }
ff = { version = "0.13.0", features = ["derive"] }
digest = "0.10"
sha3 = "0.10"
Expand All @@ -23,7 +21,6 @@ rand_chacha = "0.3"
subtle = "2.5"
pasta_curves = { version = "0.5", features = ["repr-c", "serde"] }
halo2curves = { version = "0.6.0", features = ["bits", "derive_serde"] }
neptune = { version = "13.0.0", default-features = false }
generic-array = "1.0.0"
num-bigint = { version = "0.4", features = ["serde", "rand"] }
num-traits = "0.2"
Expand Down Expand Up @@ -78,6 +75,4 @@ harness = false
default = ["halo2curves/asm"]
# Compiles in portable mode, w/o ISA extensions => binary can be executed on all systems.
portable = ["pasta-msm/portable"]
cuda = ["neptune/cuda", "neptune/pasta", "neptune/arity24"]
opencl = ["neptune/opencl", "neptune/pasta", "neptune/arity24"]
flamegraph = ["pprof/flamegraph", "pprof/criterion"]
2 changes: 1 addition & 1 deletion benches/compressed-snark.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![allow(non_snake_case)]

use bellpepper_core::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use core::marker::PhantomData;
use criterion::{measurement::WallTime, *};
use ff::PrimeField;
use nova_snark::frontend::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use nova_snark::{
provider::{Bn256EngineKZG, GrumpkinEngine},
traits::{
Expand Down
2 changes: 1 addition & 1 deletion benches/compute-digest.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::{marker::PhantomData, time::Duration};

use bellpepper_core::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use ff::PrimeField;
use nova_snark::frontend::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use nova_snark::{
provider::{Bn256EngineKZG, GrumpkinEngine},
traits::{
Expand Down
2 changes: 1 addition & 1 deletion benches/ppsnark.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![allow(non_snake_case)]

use bellpepper_core::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use core::marker::PhantomData;
use criterion::*;
use ff::PrimeField;
use nova_snark::frontend::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use nova_snark::{
provider::Bn256EngineKZG,
spartan::direct::DirectSNARK,
Expand Down
2 changes: 1 addition & 1 deletion benches/recursive-snark.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![allow(non_snake_case)]

use bellpepper_core::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use core::marker::PhantomData;
use criterion::*;
use ff::PrimeField;
use nova_snark::frontend::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use nova_snark::{
provider::{Bn256EngineKZG, GrumpkinEngine},
traits::{
Expand Down
12 changes: 6 additions & 6 deletions benches/sha256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
//! This code invokes a hand-written SHA-256 gadget from bellman/bellperson.
//! It also uses code from bellman/bellperson to compare circuit-generated digest with sha2 crate's output
#![allow(non_snake_case)]
use bellpepper::gadgets::{sha256::sha256, Assignment};
use bellpepper_core::{
boolean::{AllocatedBit, Boolean},
num::{AllocatedNum, Num},
ConstraintSystem, SynthesisError,
};
use core::marker::PhantomData;
use core::time::Duration;
use criterion::*;
use ff::{PrimeField, PrimeFieldBits};
use nova_snark::frontend::gadgets::{sha256::sha256, Assignment};
use nova_snark::frontend::{
boolean::{AllocatedBit, Boolean},
num::{AllocatedNum, Num},
ConstraintSystem, SynthesisError,
};
use nova_snark::{
provider::{Bn256EngineKZG, GrumpkinEngine},
traits::{
Expand Down
6 changes: 3 additions & 3 deletions examples/and.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//! This example executes a batch of 64-bit AND operations.
//! It performs the AND operation by first decomposing the operands into bits and then performing the operation bit-by-bit.
//! We execute a configurable number of AND operations per step of Nova's recursion.
use bellpepper_core::{
boolean::AllocatedBit, num::AllocatedNum, ConstraintSystem, LinearCombination, SynthesisError,
};
use core::marker::PhantomData;
use ff::Field;
use ff::{PrimeField, PrimeFieldBits};
use flate2::{write::ZlibEncoder, Compression};
use nova_snark::frontend::{
boolean::AllocatedBit, num::AllocatedNum, ConstraintSystem, LinearCombination, SynthesisError,
};
use nova_snark::{
provider::{Bn256EngineKZG, GrumpkinEngine},
traits::{
Expand Down
17 changes: 6 additions & 11 deletions examples/hashchain.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
//! This example proves the knowledge of preimage to a hash chain tail, with a configurable number of elements per hash chain node.
//! The output of each step tracks the current tail of the hash chain
use bellpepper_core::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use ff::Field;
use flate2::{write::ZlibEncoder, Compression};
use generic_array::typenum::U24;
use neptune::{
circuit2::Elt,
sponge::{
api::{IOPattern, SpongeAPI, SpongeOp},
circuit::SpongeCircuit,
vanilla::{Mode::Simplex, Sponge, SpongeTrait},
},
Strength,
use nova_snark::frontend::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use nova_snark::provider::poseidon::Elt;
use nova_snark::provider::poseidon::{
IOPattern, Simplex, Sponge, SpongeAPI, SpongeCircuit, SpongeOp, SpongeTrait, Strength,
};
use nova_snark::{
provider::{Bn256EngineKZG, GrumpkinEngine},
Expand Down Expand Up @@ -91,9 +86,9 @@ impl<G: Group> StepCircuit<G::Scalar> for HashChainCircuit<G> {
let acc = &mut ns;

sponge.start(parameter, None, acc);
neptune::sponge::api::SpongeAPI::absorb(&mut sponge, num_absorbs, &elt, acc);
SpongeAPI::absorb(&mut sponge, num_absorbs, &elt, acc);

let output = neptune::sponge::api::SpongeAPI::squeeze(&mut sponge, 1, acc);
let output = SpongeAPI::squeeze(&mut sponge, 1, acc);
sponge.finish(acc).unwrap();
Elt::ensure_allocated(&output[0], &mut ns.namespace(|| "ensure allocated"), true)?
};
Expand Down
2 changes: 1 addition & 1 deletion examples/minroot.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Demonstrates how to use Nova to produce a recursive proof of the correct execution of
//! iterations of the `MinRoot` function, thereby realizing a Nova-based verifiable delay function (VDF).
//! We execute a configurable number of iterations of the `MinRoot` function per step of Nova's recursion.
use bellpepper_core::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use ff::Field;
use flate2::{write::ZlibEncoder, Compression};
use nova_snark::frontend::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use nova_snark::{
provider::{Bn256EngineKZG, GrumpkinEngine},
traits::{
Expand Down
16 changes: 8 additions & 8 deletions src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
//! of the running instances. Each of these hashes is H(params = H(shape, ck), i, z0, zi, U).
//! Each circuit folds the last invocation of the other into the running instance

use crate::frontend::gadgets::Assignment;
use crate::frontend::{
boolean::{AllocatedBit, Boolean},
num::AllocatedNum,
ConstraintSystem, SynthesisError,
};
use crate::{
constants::{NUM_FE_WITHOUT_IO_FOR_CRHF, NUM_HASH_BITS},
gadgets::{
Expand All @@ -19,12 +25,6 @@ use crate::{
},
Commitment,
};
use bellpepper::gadgets::Assignment;
use bellpepper_core::{
boolean::{AllocatedBit, Boolean},
num::AllocatedNum,
ConstraintSystem, SynthesisError,
};
use ff::Field;
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -383,12 +383,12 @@ impl<'a, E: Engine, SC: StepCircuit<E::Base>> NovaAugmentedCircuit<'a, E, SC> {
mod tests {
use super::*;
use crate::{
bellpepper::{
constants::{BN_LIMB_WIDTH, BN_N_LIMBS},
frontend::{
r1cs::{NovaShape, NovaWitness},
solver::SatisfyingAssignment,
test_shape_cs::TestShapeCS,
},
constants::{BN_LIMB_WIDTH, BN_N_LIMBS},
gadgets::utils::scalar_as_base,
provider::{
poseidon::PoseidonConstantsCircuit,
Expand Down
4 changes: 2 additions & 2 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ pub enum NovaError {
InternalError,
}

impl From<bellpepper_core::SynthesisError> for NovaError {
fn from(err: bellpepper_core::SynthesisError) -> Self {
impl From<crate::frontend::SynthesisError> for NovaError {
fn from(err: crate::frontend::SynthesisError) -> Self {
Self::SynthesisError {
reason: err.to_string(),
}
Expand Down
Loading

0 comments on commit 2112360

Please sign in to comment.