emptystatement.rs 797 B

12345678910111213141516171819202122232425
  1. #![allow(non_snake_case)]
  2. use curve25519_dalek::ristretto::RistrettoPoint as G;
  3. use sigma_compiler::*;
  4. /// A statement with no variables and no equations binds nothing, so it is
  5. /// satisfied by the empty witness. sigma-proofs refuses to compile one: as a
  6. /// branch of a disjunction it would make the whole proof forgeable.
  7. ///
  8. /// The generated prover unwraps `compile`, so the refusal arrives as a panic
  9. /// rather than an `Err`.
  10. #[test]
  11. #[should_panic(expected = "the statement has no content")]
  12. fn emptystatement_test() {
  13. sigma_compiler! { proof,
  14. (),
  15. (),
  16. }
  17. let mut rng = rand::thread_rng();
  18. let instance = proof::Instance {};
  19. let witness = proof::Witness {};
  20. assert!(proof::prove(&instance, &witness, b"emptystatement_test", &mut rng).is_err());
  21. }