Преглед изворни кода

Use the new (in sigma-proofs 0.4.1) sigma_proofs::errors::Error

instead of Box<dyn std::error::Error> in the tests
Ian Goldberg пре 5 дана
родитељ
комит
e54e724454

+ 2 - 2
Cargo.lock

@@ -645,9 +645,9 @@ dependencies = [
 
 [[package]]
 name = "sigma-proofs"
-version = "0.4.0"
+version = "0.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f56543b5959a0226a4cf44501d9b531635135f88bb67d4be767cf6c861e3cbed"
+checksum = "1e40300550599f0585ff5f785126bdda1a136b1ca4e39c45de5c8a482aac2d5e"
 dependencies = [
  "bls12_381",
  "curve25519-dalek",

+ 1 - 1
Cargo.toml

@@ -10,7 +10,7 @@ description = "Crate for automatically generating code for sigma zero-knowledge
 group = "0.14"
 rand = "0.10"
 sigma-compiler-derive = "=0.2.3"
-sigma-proofs = "0.4.0"
+sigma-proofs = "0.4.1"
 subtle = "2.6"
 
 [dev-dependencies]

+ 1 - 1
tests/basic.rs

@@ -6,7 +6,7 @@ use sha2::Sha512;
 use sigma_compiler::*;
 
 #[test]
-fn basic_test() -> Result<(), Box<dyn std::error::Error>> {
+fn basic_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x, z, rand r, rand s),
         (C, D, const cind A, const cind B),

+ 1 - 1
tests/basic_sum.rs

@@ -5,7 +5,7 @@ use group::Group;
 use sha2::Sha512;
 use sigma_compiler::*;
 
-fn basic_sum_test_vecsize(vecsize: usize) -> Result<(), Box<dyn std::error::Error>> {
+fn basic_sum_test_vecsize(vecsize: usize) -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (vec x, y, rand vec r, rand s),
         (vec C, D, const cind A, const cind B),

+ 1 - 1
tests/basic_vec.rs

@@ -5,7 +5,7 @@ use group::Group;
 use sha2::Sha512;
 use sigma_compiler::*;
 
-fn basic_vec_test_vecsize(vecsize: usize) -> Result<(), Box<dyn std::error::Error>> {
+fn basic_vec_test_vecsize(vecsize: usize) -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (vec x, rand vec r),
         (vec C, const cind A, const cind B),

+ 1 - 1
tests/disj.rs

@@ -6,7 +6,7 @@ use sha2::Sha512;
 use sigma_compiler::*;
 
 #[test]
-fn disj_test() -> Result<(), Box<dyn std::error::Error>> {
+fn disj_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x, rand r),
         (C, const cind A, const cind B),

+ 1 - 1
tests/disj_vec.rs

@@ -5,7 +5,7 @@ use group::Group;
 use sha2::Sha512;
 use sigma_compiler::*;
 
-fn disj_vec_test_vecsize(vecsize: usize) -> Result<(), Box<dyn std::error::Error>> {
+fn disj_vec_test_vecsize(vecsize: usize) -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (vec x, vec y, pub vec a, rand vec r, rand vec s),
         (vec C, vec D, const cind A, const cind B),

+ 2 - 2
tests/dl.rs

@@ -4,7 +4,7 @@ use group::Group;
 use sigma_compiler::*;
 
 #[test]
-fn dl_zero_test() -> Result<(), Box<dyn std::error::Error>> {
+fn dl_zero_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x),
         (C, const B),
@@ -25,7 +25,7 @@ fn dl_zero_test() -> Result<(), Box<dyn std::error::Error>> {
 }
 
 #[test]
-fn dl_one_test() -> Result<(), Box<dyn std::error::Error>> {
+fn dl_one_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x),
         (C, const B),

+ 1 - 1
tests/dot_product.rs

@@ -3,7 +3,7 @@ use curve25519_dalek::ristretto::RistrettoPoint as G;
 use group::Group;
 use sigma_compiler::*;
 
-fn dot_product_test_vecsize(vecsize: usize) -> Result<(), Box<dyn std::error::Error>> {
+fn dot_product_test_vecsize(vecsize: usize) -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (vec x, pub vec a),
         (C, D, E, F, vec A, B),

+ 1 - 1
tests/emptystatement.rs

@@ -3,7 +3,7 @@ use curve25519_dalek::ristretto::RistrettoPoint as G;
 use sigma_compiler::*;
 
 #[test]
-fn emptystatement_test() -> Result<(), Box<dyn std::error::Error>> {
+fn emptystatement_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (),
         (),

+ 2 - 2
tests/left_expr.rs

@@ -6,7 +6,7 @@ use sha2::Sha512;
 use sigma_compiler::*;
 
 #[test]
-fn left_expr_test() -> Result<(), Box<dyn std::error::Error>> {
+fn left_expr_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x, y, pub a, rand r, rand s),
         (C, D, const cind A, const cind B),
@@ -34,7 +34,7 @@ fn left_expr_test() -> Result<(), Box<dyn std::error::Error>> {
 }
 
 #[test]
-fn left_expr_vec_test() -> Result<(), Box<dyn std::error::Error>> {
+fn left_expr_vec_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (vec x, vec y, z, pub vec a, pub b, rand vec r, rand vec s, rand t),
         (vec C, vec D, E, const cind A, const cind B),

+ 1 - 1
tests/notequals.rs

@@ -5,7 +5,7 @@ use group::Group;
 use sha2::Sha512;
 use sigma_compiler::*;
 
-fn do_test(x_u128: u128) -> Result<(), Box<dyn std::error::Error>> {
+fn do_test(x_u128: u128) -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x, rand r),
         (C, const cind A, const cind B),

+ 1 - 1
tests/pubscalars.rs

@@ -5,7 +5,7 @@ use group::Group;
 use sha2::Sha512;
 use sigma_compiler::*;
 
-fn pubscalars_test_val(b_val: u128) -> Result<(), Box<dyn std::error::Error>> {
+fn pubscalars_test_val(b_val: u128) -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x, z, rand r, rand s, pub a, pub b),
         (C, D, const cind A, const cind B),

+ 1 - 1
tests/pubscalars_or.rs

@@ -5,7 +5,7 @@ use group::Group;
 use sha2::Sha512;
 use sigma_compiler::*;
 
-fn pubscalars_or_test_val(b_val: u128) -> Result<(), Box<dyn std::error::Error>> {
+fn pubscalars_or_test_val(b_val: u128) -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x, rand r, pub a, pub b),
         (C, const cind A, const cind B),

+ 1 - 1
tests/pubscalars_or_and.rs

@@ -5,7 +5,7 @@ use group::Group;
 use sha2::Sha512;
 use sigma_compiler::*;
 
-fn pubscalars_or_and_test_val(x_val: u128, b_val: u128) -> Result<(), Box<dyn std::error::Error>> {
+fn pubscalars_or_and_test_val(x_val: u128, b_val: u128) -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x, rand r, pub a, pub b),
         (C, const cind A, const cind B),

+ 1 - 1
tests/pubscalars_or_and_vec.rs

@@ -9,7 +9,7 @@ fn pubscalars_or_vec_test_vecsize_val(
     vecsize: usize,
     b_val: u128,
     x_val: Option<u128>,
-) -> Result<(), Box<dyn std::error::Error>> {
+) -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (vec x, vec y, pub vec a, pub vec b, rand vec r, rand vec s),
         (vec C, vec D, const cind A, const cind B),

+ 1 - 1
tests/pubscalars_or_vec.rs

@@ -8,7 +8,7 @@ use sigma_compiler::*;
 fn pubscalars_or_vec_test_vecsize_val(
     vecsize: usize,
     b_val: u128,
-) -> Result<(), Box<dyn std::error::Error>> {
+) -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (vec x, pub vec a, pub vec b, rand vec r),
         (vec C, const cind A, const cind B),

+ 1 - 1
tests/pubscalars_vec.rs

@@ -5,7 +5,7 @@ use group::Group;
 use sha2::Sha512;
 use sigma_compiler::*;
 
-fn pubscalars_vec_test_vecsize(vecsize: usize) -> Result<(), Box<dyn std::error::Error>> {
+fn pubscalars_vec_test_vecsize(vecsize: usize) -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (vec x, vec y, pub vec a, pub vec b, rand vec r, rand vec s),
         (vec C, vec D, const cind A, const cind B),

+ 1 - 1
tests/pubstatements.rs

@@ -5,7 +5,7 @@ use group::Group;
 use sigma_compiler::*;
 
 #[test]
-fn pubstatements_test() -> Result<(), Box<dyn std::error::Error>> {
+fn pubstatements_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x, pub a),
         (C, D, const cind B),

+ 1 - 1
tests/pubstatements_vec.rs

@@ -4,7 +4,7 @@ use group::ff::PrimeField;
 use group::Group;
 use sigma_compiler::*;
 
-fn pubstatements_vec_test_vecsize(vecsize: usize) -> Result<(), Box<dyn std::error::Error>> {
+fn pubstatements_vec_test_vecsize(vecsize: usize) -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (vec x, pub vec a),
         (vec C, vec D, const cind B),

+ 1 - 1
tests/range.rs

@@ -6,7 +6,7 @@ use sha2::Sha512;
 use sigma_compiler::*;
 
 #[test]
-fn range_test() -> Result<(), Box<dyn std::error::Error>> {
+fn range_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x, y, pub a, rand r),
         (C, D, const cind A, const cind B),

+ 1 - 1
tests/range_dump.rs

@@ -7,7 +7,7 @@ use sha2::Sha512;
 use sigma_compiler::*;
 
 #[test]
-fn range_dump_test() -> Result<(), Box<dyn std::error::Error>> {
+fn range_dump_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x, y, pub a, rand r),
         (C, D, const cind A, const cind B),

+ 1 - 1
tests/simple_or.rs

@@ -5,7 +5,7 @@ use sha2::Sha512;
 use sigma_compiler::*;
 
 #[test]
-fn simple_or_test() -> Result<(), Box<dyn std::error::Error>> {
+fn simple_or_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x, y),
         (C, const cind A, const cind B),

+ 1 - 1
tests/substitution_or.rs

@@ -6,7 +6,7 @@ use sha2::Sha512;
 use sigma_compiler::*;
 
 #[test]
-fn substitution_or_test() -> Result<(), Box<dyn std::error::Error>> {
+fn substitution_or_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x, z, rand r, rand s),
         (C, D, const cind A, const cind B),

+ 1 - 1
tests/substitution_vec.rs

@@ -5,7 +5,7 @@ use group::Group;
 use sha2::Sha512;
 use sigma_compiler::*;
 
-fn substitution_vec_test_vecsize(vecsize: usize) -> Result<(), Box<dyn std::error::Error>> {
+fn substitution_vec_test_vecsize(vecsize: usize) -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (vec x, vec y, rand vec r, rand vec s),
         (vec C, vec D, const cind A, const cind B),

+ 1 - 1
tests/subtract.rs

@@ -4,7 +4,7 @@ use group::Group;
 use sigma_compiler::*;
 
 #[test]
-fn subtract_test() -> Result<(), Box<dyn std::error::Error>> {
+fn subtract_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x),
         (C, const cind B),

+ 1 - 1
tests/subtract_vec.rs

@@ -5,7 +5,7 @@ use group::Group;
 use sha2::Sha512;
 use sigma_compiler::*;
 
-fn subtract_vec_test_vecsize(vecsize: usize) -> Result<(), Box<dyn std::error::Error>> {
+fn subtract_vec_test_vecsize(vecsize: usize) -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (vec x),
         (vec C, vec D, vec E, const cind A, const cind B),

+ 1 - 1
tests/threshold.rs

@@ -5,7 +5,7 @@ use sha2::Sha512;
 use sigma_compiler::*;
 
 #[test]
-fn threshold_test() -> Result<(), Box<dyn std::error::Error>> {
+fn threshold_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { thresh3,
         (x1, x2, x3, x4, x5, rand r),
         (C, const cind G0, const cind G1, const cind G2, const cind G3,

+ 1 - 1
tests/threshold_pubscalars.rs

@@ -5,7 +5,7 @@ use sha2::Sha512;
 use sigma_compiler::*;
 
 #[test]
-fn threshold_pubscalars_test() -> Result<(), Box<dyn std::error::Error>> {
+fn threshold_pubscalars_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { thresh3,
         (pub x1, pub x2, pub x3, pub x4, pub x5, rand r),
         (C, const cind G0, const cind G1, const cind G2, const cind G3,

+ 1 - 1
tests/two_true.rs

@@ -5,7 +5,7 @@ use sha2::Sha512;
 use sigma_compiler::*;
 
 #[test]
-fn two_true_test() -> Result<(), Box<dyn std::error::Error>> {
+fn two_true_test() -> Result<(), sigma_proofs::errors::Error> {
     sigma_compiler! { proof,
         (x, y),
         (C, D, const cind A, const cind B),