Skip to content

Commit 9d7aedd

Browse files
authored
Remove supernova feature (#3)
* Rename r1cs_shape_with_commitmentkey to r1cs_shape_and_key. * Remove supernova feature. * Replace commitmentkey with commitment_key. * Replace publicparams with public_params. * Clippy * Fix constraint counts in supernova test. --------- Co-authored-by: porcuquine <porcuquine@users.noreply.github.com>
1 parent e59041c commit 9d7aedd

File tree

12 files changed

+40
-42
lines changed

12 files changed

+40
-42
lines changed

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ group = "0.13.0"
3737
log = "0.4.17"
3838
abomonation = "0.7.3"
3939
abomonation_derive = { git = "https://github.com/lurk-lab/abomonation_derive.git" }
40+
tap = "1.0.1"
4041

4142
[target.'cfg(any(target_arch = "x86_64", target_arch = "aarch64"))'.dependencies]
4243
pasta-msm = { git="https://github.com/lurk-lab/pasta-msm", branch="dev", version = "0.1.4" }
@@ -74,7 +75,6 @@ harness = false
7475
[[bench]]
7576
name = "recursive-snark-supernova"
7677
harness = false
77-
required-features = ["supernova"]
7878

7979
[features]
8080
default = []
@@ -83,7 +83,6 @@ portable = ["pasta-msm/portable"]
8383
cuda = ["neptune/cuda", "neptune/pasta", "neptune/arity24"]
8484
opencl = ["neptune/opencl", "neptune/pasta", "neptune/arity24"]
8585
flamegraph = ["pprof/flamegraph", "pprof/criterion"]
86-
supernova = []
8786

8887
# This is needed to ensure halo2curves, which imports pasta-curves, uses the *same* traits in bn256_grumpkin
8988
[patch.crates-io]

benches/recursive-snark-supernova.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use ff::PrimeField;
77
use nova_snark::{
88
compute_digest,
99
supernova::RecursiveSNARK,
10-
supernova::{gen_commitmentkey_by_r1cs, PublicParams, RunningClaim},
10+
supernova::{gen_commitment_key_by_r1cs, PublicParams, RunningClaim},
1111
traits::{
1212
circuit_supernova::{StepCircuit, TrivialTestCircuit},
1313
Group,
@@ -66,12 +66,12 @@ fn bench_one_augmented_circuit_recursive_snark(c: &mut Criterion) {
6666
>::new(0, c_primary, c_secondary.clone(), 1);
6767

6868
let (r1cs_shape_primary, r1cs_shape_secondary) = running_claim1.get_r1cs_shape();
69-
let ck_primary = gen_commitmentkey_by_r1cs(r1cs_shape_primary);
70-
let ck_secondary = gen_commitmentkey_by_r1cs(r1cs_shape_secondary);
69+
let ck_primary = gen_commitment_key_by_r1cs(r1cs_shape_primary);
70+
let ck_secondary = gen_commitment_key_by_r1cs(r1cs_shape_secondary);
7171

7272
// set unified ck_primary, ck_secondary and update digest
73-
running_claim1.set_commitmentkey(ck_primary.clone(), ck_secondary.clone());
74-
let digest = compute_digest::<G1, PublicParams<G1, G2>>(&[running_claim1.get_publicparams()]);
73+
running_claim1.set_commitment_key(ck_primary.clone(), ck_secondary.clone());
74+
let digest = compute_digest::<G1, PublicParams<G1, G2>>(&[running_claim1.get_public_params()]);
7575

7676
// Bench time to produce a recursive SNARK;
7777
// we execute a certain number of warm-up steps since executing
@@ -182,16 +182,16 @@ fn bench_two_augmented_circuit_recursive_snark(c: &mut Criterion) {
182182
>::new(1, c_primary, c_secondary.clone(), 2);
183183

184184
let (r1cs_shape_primary, r1cs_shape_secondary) = running_claim1.get_r1cs_shape();
185-
let ck_primary = gen_commitmentkey_by_r1cs(r1cs_shape_primary);
186-
let ck_secondary = gen_commitmentkey_by_r1cs(r1cs_shape_secondary);
185+
let ck_primary = gen_commitment_key_by_r1cs(r1cs_shape_primary);
186+
let ck_secondary = gen_commitment_key_by_r1cs(r1cs_shape_secondary);
187187

188188
// set unified ck_primary, ck_secondary and update digest
189-
running_claim1.set_commitmentkey(ck_primary.clone(), ck_secondary.clone());
190-
running_claim2.set_commitmentkey(ck_primary.clone(), ck_secondary.clone());
189+
running_claim1.set_commitment_key(ck_primary.clone(), ck_secondary.clone());
190+
running_claim2.set_commitment_key(ck_primary.clone(), ck_secondary.clone());
191191

192192
let digest = compute_digest::<G1, PublicParams<G1, G2>>(&[
193-
running_claim1.get_publicparams(),
194-
running_claim2.get_publicparams(),
193+
running_claim1.get_public_params(),
194+
running_claim2.get_public_params(),
195195
]);
196196

197197
// Bench time to produce a recursive SNARK;

src/bellpepper/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ mod tests {
5050
// First create the shape
5151
let mut cs: ShapeCS<G> = ShapeCS::new();
5252
let _ = synthesize_alloc_bit(&mut cs);
53-
let (shape, ck) = cs.r1cs_shape_with_commitmentkey();
53+
let (shape, ck) = cs.r1cs_shape_and_key();
5454

5555
// Now get the assignment
5656
let mut cs: SatisfyingAssignment<G> = SatisfyingAssignment::new();

src/bellpepper/r1cs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub trait NovaWitness<G: Group> {
2525
/// `NovaShape` provides methods for acquiring `R1CSShape` and `CommitmentKey` from implementers.
2626
pub trait NovaShape<G: Group> {
2727
/// Return an appropriate `R1CSShape` and `CommitmentKey` structs.
28-
fn r1cs_shape_with_commitmentkey(&self) -> (R1CSShape<G>, CommitmentKey<G>) {
28+
fn r1cs_shape_and_key(&self) -> (R1CSShape<G>, CommitmentKey<G>) {
2929
let S = self.r1cs_shape();
3030
let ck = R1CS::<G>::commitment_key(&S);
3131

src/circuit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ mod tests {
400400
NovaAugmentedCircuit::new(primary_params, None, &ttc1, ro_consts1.clone());
401401
let mut cs: TestShapeCS<G1> = TestShapeCS::new();
402402
let _ = circuit1.synthesize(&mut cs);
403-
let (shape1, ck1) = cs.r1cs_shape_with_commitmentkey();
403+
let (shape1, ck1) = cs.r1cs_shape_and_key();
404404
assert_eq!(cs.num_constraints(), num_constraints_primary);
405405

406406
let ttc2 = TrivialTestCircuit::default();
@@ -409,7 +409,7 @@ mod tests {
409409
NovaAugmentedCircuit::new(secondary_params, None, &ttc2, ro_consts2.clone());
410410
let mut cs: TestShapeCS<G2> = TestShapeCS::new();
411411
let _ = circuit2.synthesize(&mut cs);
412-
let (shape2, ck2) = cs.r1cs_shape_with_commitmentkey();
412+
let (shape2, ck2) = cs.r1cs_shape_and_key();
413413
assert_eq!(cs.num_constraints(), num_constraints_secondary);
414414

415415
// Execute the base case for the primary

src/gadgets/ecc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ mod tests {
992992
let mut cs: TestShapeCS<G2> = TestShapeCS::new();
993993
let _ = synthesize_smul::<G1, _>(cs.namespace(|| "synthesize"));
994994
println!("Number of constraints: {}", cs.num_constraints());
995-
let (shape, ck) = cs.r1cs_shape_with_commitmentkey();
995+
let (shape, ck) = cs.r1cs_shape_and_key();
996996

997997
// Then the satisfying assignment
998998
let mut cs: SatisfyingAssignment<G2> = SatisfyingAssignment::new();
@@ -1045,7 +1045,7 @@ mod tests {
10451045
let mut cs: TestShapeCS<G2> = TestShapeCS::new();
10461046
let _ = synthesize_add_equal::<G1, _>(cs.namespace(|| "synthesize add equal"));
10471047
println!("Number of constraints: {}", cs.num_constraints());
1048-
let (shape, ck) = cs.r1cs_shape_with_commitmentkey();
1048+
let (shape, ck) = cs.r1cs_shape_and_key();
10491049

10501050
// Then the satisfying assignment
10511051
let mut cs: SatisfyingAssignment<G2> = SatisfyingAssignment::new();
@@ -1102,7 +1102,7 @@ mod tests {
11021102
let mut cs: TestShapeCS<G2> = TestShapeCS::new();
11031103
let _ = synthesize_add_negation::<G1, _>(cs.namespace(|| "synthesize add equal"));
11041104
println!("Number of constraints: {}", cs.num_constraints());
1105-
let (shape, ck) = cs.r1cs_shape_with_commitmentkey();
1105+
let (shape, ck) = cs.r1cs_shape_and_key();
11061106

11071107
// Then the satisfying assignment
11081108
let mut cs: SatisfyingAssignment<G2> = SatisfyingAssignment::new();

src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ pub mod provider;
2525
pub mod spartan;
2626
pub mod traits;
2727

28-
#[cfg(feature = "supernova")]
2928
pub mod supernova;
3029

3130
use crate::bellpepper::{
@@ -123,7 +122,7 @@ where
123122
);
124123
let mut cs: ShapeCS<G1> = ShapeCS::new();
125124
let _ = circuit_primary.synthesize(&mut cs);
126-
let (r1cs_shape_primary, ck_primary) = cs.r1cs_shape_with_commitmentkey();
125+
let (r1cs_shape_primary, ck_primary) = cs.r1cs_shape_and_key();
127126

128127
// Initialize ck for the secondary
129128
let circuit_secondary: NovaAugmentedCircuit<'_, G1, C2> = NovaAugmentedCircuit::new(
@@ -134,7 +133,7 @@ where
134133
);
135134
let mut cs: ShapeCS<G2> = ShapeCS::new();
136135
let _ = circuit_secondary.synthesize(&mut cs);
137-
let (r1cs_shape_secondary, ck_secondary) = cs.r1cs_shape_with_commitmentkey();
136+
let (r1cs_shape_secondary, ck_secondary) = cs.r1cs_shape_and_key();
138137

139138
let mut pp = Self {
140139
F_arity_primary,

src/nifs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ mod tests {
174174
// First create the shape
175175
let mut cs: TestShapeCS<G> = TestShapeCS::new();
176176
let _ = synthesize_tiny_r1cs_bellpepper(&mut cs, None);
177-
let (shape, ck) = cs.r1cs_shape_with_commitmentkey();
177+
let (shape, ck) = cs.r1cs_shape_and_key();
178178
let ro_consts =
179179
<<G as Group>::RO as ROTrait<<G as Group>::Base, <G as Group>::Scalar>>::Constants::new();
180180

src/spartan/direct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl<G: Group, S: RelaxedR1CSSNARKTrait<G>, C: StepCircuit<G::Scalar>> DirectSNA
9797

9898
let mut cs: ShapeCS<G> = ShapeCS::new();
9999
let _ = circuit.synthesize(&mut cs);
100-
let (shape, ck) = cs.r1cs_shape_with_commitmentkey();
100+
let (shape, ck) = cs.r1cs_shape_and_key();
101101

102102
let (pk, vk) = S::setup(&ck, &shape)?;
103103

src/supernova/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ where
201201
}
202202

203203
/// set primary/secondary commitment key
204-
pub fn set_commitmentkey(
204+
pub fn set_commitment_key(
205205
&mut self,
206206
ck_primary: CommitmentKey<G1>,
207207
ck_secondary: CommitmentKey<G2>,
@@ -219,7 +219,7 @@ where
219219
}
220220

221221
/// get augmented_circuit_index
222-
pub fn get_publicparams(&self) -> &PublicParams<G1, G2> {
222+
pub fn get_public_params(&self) -> &PublicParams<G1, G2> {
223223
&self.params
224224
}
225225
}
@@ -776,6 +776,6 @@ where
776776
}
777777

778778
/// genenate commitmentkey by r1cs shape
779-
pub fn gen_commitmentkey_by_r1cs<G: Group>(shape: &R1CSShape<G>) -> CommitmentKey<G> {
779+
pub fn gen_commitment_key_by_r1cs<G: Group>(shape: &R1CSShape<G>) -> CommitmentKey<G> {
780780
R1CS::<G>::commitment_key(shape)
781781
}

0 commit comments

Comments
 (0)