Merge pull request #105 from zcash/constants-spend-auth-g

Add SpendAuthG fixed base
This commit is contained in:
str4d 2021-06-05 12:09:51 +01:00 committed by GitHub
commit d3da71a4fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2968 additions and 1 deletions

View File

@ -10,6 +10,7 @@ use halo2::{
pub mod commit_ivk_r; pub mod commit_ivk_r;
pub mod note_commit_r; pub mod note_commit_r;
pub mod nullifier_k; pub mod nullifier_k;
pub mod spend_auth_g;
pub mod value_commit_r; pub mod value_commit_r;
pub mod value_commit_v; pub mod value_commit_v;
@ -73,6 +74,9 @@ pub struct ValueCommitR<C: CurveAffine>(pub OrchardFixedBase<C>);
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
pub struct ValueCommitV<C: CurveAffine>(pub OrchardFixedBase<C>); pub struct ValueCommitV<C: CurveAffine>(pub OrchardFixedBase<C>);
#[derive(Copy, Clone, Debug)]
pub struct SpendAuthG<C: CurveAffine>(pub OrchardFixedBase<C>);
#[derive(Copy, Clone, Debug, Eq, PartialEq)] #[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct OrchardFixedBase<C: CurveAffine>(C); pub struct OrchardFixedBase<C: CurveAffine>(C);
@ -282,7 +286,7 @@ impl<C: CurveAffine> TestFixedBase<C> for OrchardFixedBase<C> {
for ((u, z), window_points) in u.iter().zip(z.iter()).zip(window_table) { for ((u, z), window_points) in u.iter().zip(z.iter()).zip(window_table) {
for (u, point) in u.iter().zip(window_points.iter()) { for (u, point) in u.iter().zip(window_points.iter()) {
let y = *point.coordinates().unwrap().y(); let y = *point.coordinates().unwrap().y();
let u = C::Base::from_bytes(&u).unwrap(); let u = C::Base::from_bytes(u).unwrap();
assert_eq!(C::Base::from_u64(*z) + y, u * u); // allow either square root assert_eq!(C::Base::from_u64(*z) + y, u * u); // allow either square root
assert!(bool::from((C::Base::from_u64(*z) - y).sqrt().is_none())); assert!(bool::from((C::Base::from_u64(*z) - y).sqrt().is_none()));
} }

File diff suppressed because it is too large Load Diff