()
| 704 | |
| 705 | #[test] |
| 706 | fn characteristic_poly() { |
| 707 | let mut rng = StdRng::seed_from_u64(0u64); |
| 708 | |
| 709 | let (srs, td) = SetCommitmentSRS::<Bls12_381>::generate_with_random_trapdoor::< |
| 710 | StdRng, |
| 711 | Blake2b512, |
| 712 | >(&mut rng, 3, None); |
| 713 | |
| 714 | // let set = (0..3).map(|_| Fr::rand(&mut rng)).collect::<BTreeSet<_>>(); |
| 715 | let ls = (0..3).map(|_| Fr::rand(&mut rng)).collect::<Vec<_>>(); |
| 716 | let poly = poly_from_roots(&ls); |
| 717 | let eval = poly.evaluate(&td); |
| 718 | |
| 719 | // let l = sp.P1.mul(eval.into_bigint()).into_affine(); |
| 720 | let l = srs.get_P1().mul_bigint(eval.into_bigint()).into_affine(); |
| 721 | |
| 722 | assert_eq!(poly.coeffs.len(), 4); |
| 723 | let r = <Bls12_381 as Pairing>::G1::msm_unchecked(&srs.P1, &poly.coeffs).into_affine(); |
| 724 | assert_eq!(l, r); |
| 725 | |
| 726 | let set = ls.iter().cloned().collect::<BTreeSet<_>>(); |
| 727 | assert_eq!( |
| 728 | srs.eval_P1(set).into_affine(), |
| 729 | srs.get_P1().mul_bigint(eval.into_bigint()).into_affine() |
| 730 | ); |
| 731 | } |
| 732 | |
| 733 | #[test] |
| 734 | fn commit_and_open_full() { |
nothing calls this directly
no test coverage detected