Skip to content

Commit 1702486

Browse files
committed
Fix compile issues and some refactoring
Signed-off-by: lovesh <lovesh.bond@gmail.com>
1 parent 8b705f4 commit 1702486

File tree

16 files changed

+350
-369
lines changed

16 files changed

+350
-369
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ jobs:
7070
toolchain: stable
7171
override: true
7272
- name: Run tests
73-
run: cargo test --release --all
73+
run: RUST_MIN_STACK=8388608 cargo test --release --all --no-fail-fast

benches/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ version = "0.4.0"
44
edition.workspace = true
55
authors.workspace = true
66
license.workspace = true
7+
publish = false
78

89
[dependencies]
910
bbs_plus = { default-features = false, path = "../bbs_plus" }

benches/benches/bbs_plus_proof.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ use ark_std::{
66
UniformRand,
77
};
88
use bbs_plus::{
9-
proof::{MessageOrBlinding, PoKOfSignatureG1Protocol},
9+
proof::PoKOfSignatureG1Protocol,
1010
setup::{KeypairG2, SignatureParamsG1},
1111
signature::SignatureG1,
1212
};
1313
use benches::setup_bbs_plus;
1414
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
15+
use dock_crypto_utils::signature::MessageOrBlinding;
1516

1617
type Fr = <Bls12_381 as Pairing>::ScalarField;
1718

benches/benches/bbs_proof.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ use ark_std::{
66
UniformRand,
77
};
88
use bbs_plus::prelude::{
9-
KeypairG2, MessageOrBlinding, PoKOfSignature23G1Protocol, Signature23G1, SignatureParams23G1,
9+
KeypairG2, PoKOfSignature23G1Protocol, Signature23G1, SignatureParams23G1,
1010
};
1111

1212
use benches::setup_bbs_plus;
1313
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
14+
use dock_crypto_utils::signature::MessageOrBlinding;
1415

1516
type Fr = <Bls12_381 as Pairing>::ScalarField;
1617

kvac/src/bbs_sharp/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ In the former, the verifier is either the signer (has the secret key) or can ask
1010
In the latter, the user needs to communicate with the signer before creating a proof and get "some helper data"
1111
to create a proof which the verifier can check without needing the secret key or interacting with the issuer.
1212
For efficiency and avoiding correlation (when signer and verifier collude), the user gets a batch of
13-
"helper data" to let him create several proofs.
13+
"helper data" to let him create several proofs.
14+
Also, the proof of knowledge of MAC protocol specified in footnote 31 in the paper is modified to allow integration with other
15+
protocols, see the code comments in the relevant module.
1416

1517
Implements designated verifier proof for both issuer's signature (proof of validity of MAC) and user's proof of knowledge of MAC

kvac/src/bbs_sharp/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
//! In the latter, the user needs to communicate with the signer before creating a proof and get "some helper data"
1111
//! to create a proof which the verifier can check without needing the secret key or interacting with the issuer.
1212
//! For efficiency and avoiding correlation (when signer and verifier collude), the user gets a batch of
13-
//! "helper data" to let him create several proofs.
13+
//! "helper data" to let him create several proofs.
14+
//! Also, the proof of knowledge of MAC protocol specified in footnote 31 in the paper is modified to allow
15+
//! integration with other protocols, see the code comments in the relevant module.
1416
//!
1517
//! Implements designated verifier proof for both issuer's signature (proof of validity of MAC) and user's proof of
1618
//! knowledge of MAC

legogroth16/src/circom/tests.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use std::{
2020
collections::{BTreeSet, HashMap},
2121
ops::AddAssign,
2222
path::PathBuf,
23+
time::Instant,
2324
};
2425

2526
/// Given path relative to this crate, return absolute disk path
@@ -54,6 +55,7 @@ pub fn prove_and_verify_circuit<E: Pairing>(
5455
params: &ProvingKey<E>,
5556
commit_witness_count: u32,
5657
) -> Vec<E::ScalarField> {
58+
let start = Instant::now();
5759
let cs = ConstraintSystem::<E::ScalarField>::new_ref();
5860
circuit.clone().generate_constraints(cs.clone()).unwrap();
5961
assert!(cs.is_satisfied().unwrap());
@@ -71,9 +73,10 @@ pub fn prove_and_verify_circuit<E: Pairing>(
7173
let mut rng = StdRng::seed_from_u64(300u64);
7274
let v = E::ScalarField::rand(&mut rng);
7375
let proof = create_random_proof(circuit, v, params, &mut rng).unwrap();
74-
println!("Proof generated");
76+
println!("Proof generated in {:?}", start.elapsed());
7577

7678
let pvk = prepare_verifying_key::<E>(&params.vk);
79+
let start = Instant::now();
7780
// Prover verifies the openings of the commitments in proof.d
7881
verify_witness_commitment(
7982
&params.vk,
@@ -84,8 +87,8 @@ pub fn prove_and_verify_circuit<E: Pairing>(
8487
)
8588
.unwrap();
8689
verify_proof(&pvk, &proof, &public_inputs).unwrap();
87-
println!("Proof verified");
88-
return public_inputs;
90+
println!("Proof verified in {:?}", start.elapsed());
91+
public_inputs
8992
}
9093

9194
pub fn generate_params_prove_and_verify<

proof_system/src/sub_protocols/verifiable_encryption_tz_21.rs

+9-16
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ pub mod dkgith_decls {
3030
use super::BatchedHashedElgamalCiphertext;
3131
use verifiable_encryption::tz_21::dkgith::{CompressedCiphertext, DkgithProof};
3232

33-
// Very large values for repetitions cause stack overflow
34-
// pub const NUM_PARTIES: usize = 4;
35-
// pub const NUM_REPS: usize = 64;
36-
// pub const SUBSET_SIZE: usize = 48;
37-
// pub const DEPTH: usize = 2;
38-
// pub const NUM_NODES: usize = 7;
39-
4033
pub const NUM_PARTIES: usize = 16;
4134
pub const NUM_REPS: usize = 32;
4235
pub const SUBSET_SIZE: usize = 30;
@@ -64,16 +57,16 @@ pub mod rdkgith_decls {
6457
use dock_crypto_utils::elgamal::BatchedHashedElgamalCiphertext;
6558
use verifiable_encryption::tz_21::rdkgith::{CompressedCiphertext, RdkgithProof};
6659

67-
// Very large values cause stack overflow
68-
// pub const NUM_PARTIES: usize = 192;
69-
// pub const THRESHOLD: usize = 36;
70-
// pub const NUM_PARTIES_MINUS_THRESHOLD: usize = 156;
71-
// pub const SUBSET_SIZE: usize = 145;
60+
pub const NUM_PARTIES: usize = 192;
61+
pub const THRESHOLD: usize = 36;
62+
pub const NUM_PARTIES_MINUS_THRESHOLD: usize = 156;
63+
pub const SUBSET_SIZE: usize = 145;
7264

73-
pub const NUM_PARTIES: usize = 50;
74-
pub const THRESHOLD: usize = 35;
75-
pub const NUM_PARTIES_MINUS_THRESHOLD: usize = 15;
76-
pub const SUBSET_SIZE: usize = 10;
65+
// Very large values cause stack overflow so use them when testing on smaller stack
66+
// pub const NUM_PARTIES: usize = 50;
67+
// pub const THRESHOLD: usize = 35;
68+
// pub const NUM_PARTIES_MINUS_THRESHOLD: usize = 15;
69+
// pub const SUBSET_SIZE: usize = 10;
7770

7871
pub type Proof<G> = RdkgithProof<
7972
G,

0 commit comments

Comments
 (0)