Skip to content

Commit 219e52b

Browse files
committed
Add explicit test for empty string in test_validation_criteria
1 parent 098a162 commit 219e52b

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/linear_relation/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -681,12 +681,6 @@ impl<G: PrimeGroup> TryFrom<&LinearRelation<G>> for CanonicalLinearRelation<G> {
681681
));
682682
}
683683

684-
// if relation.linear_map.linear_combinations.is_empty() {
685-
// return Err(InvalidInstance::new(
686-
// "Empty relations cannot be proven"
687-
// ));
688-
// }
689-
690684
// If any linear combination is empty, the relation is invalid
691685
if relation
692686
.linear_map

src/tests/test_validation_criteria.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
#[cfg(test)]
77
mod instance_validation {
8-
use crate::{linear_relation::{CanonicalLinearRelation, LinearRelation}, tests::spec::rng};
8+
use crate::linear_relation::{CanonicalLinearRelation, LinearRelation};
99
use bls12_381::{G1Projective as G, Scalar};
1010

1111
#[test]
@@ -131,6 +131,16 @@ mod instance_validation {
131131
assert!(result.is_err());
132132
}
133133

134+
135+
#[test]
136+
fn test_empty_string() {
137+
let rng = &mut rand::thread_rng();
138+
let relation = LinearRelation::<G>::new();
139+
let nizk = relation.into_nizk(b"test_session").unwrap();
140+
let narg_string = nizk.prove_batchable(&vec![], rng).unwrap();
141+
assert!(narg_string.is_empty());
142+
}
143+
134144
#[test]
135145
fn without_witness() {
136146
let B = G::generator();

0 commit comments

Comments
 (0)