#![allow(non_snake_case)] use curve25519_dalek::ristretto::RistrettoPoint as G; use group::ff::PrimeField; use group::Group; use sha2::Sha512; use sigma_compiler::*; #[test] fn pubscalars_test() -> Result<(), sigma_rs::errors::Error> { sigma_compiler! { proof, (x, z, rand r, rand s, pub a, pub b), (C, D, const cind A, const cind B), C = x*A + r*B, D = z*A + s*B, z = 2*x + a, b = 2*a - 3, } type Scalar = ::Scalar; let mut rng = rand::thread_rng(); let A = G::hash_from_bytes::(b"Generator A"); let B = G::generator(); let r = Scalar::random(&mut rng); let s = Scalar::random(&mut rng); let x = Scalar::from_u128(5); let z = Scalar::from_u128(17); let a = Scalar::from_u128(7); let b = Scalar::from_u128(11); let C = x * A + r * B; let D = z * A + s * B; let params = proof::Params { C, D, A, B, a, b }; let witness = proof::Witness { x, z, r, s }; let proof = proof::prove(¶ms, &witness, b"pubscalars_test", &mut rng)?; proof::verify(¶ms, &proof, b"pubscalars_test") }