From ac7a90d9ad28a4088b6b843f58a41712ab42a895 Mon Sep 17 00:00:00 2001 From: Constance Date: Tue, 28 Nov 2023 17:13:29 +0100 Subject: [PATCH] Some minor changes --- halo2_gadgets/src/ecc/chip/witness_point.rs | 4 ++-- halo2_gadgets/src/sinsemilla/primitives.rs | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/halo2_gadgets/src/ecc/chip/witness_point.rs b/halo2_gadgets/src/ecc/chip/witness_point.rs index 28e8aaf4..98f865a6 100644 --- a/halo2_gadgets/src/ecc/chip/witness_point.rs +++ b/halo2_gadgets/src/ecc/chip/witness_point.rs @@ -102,7 +102,7 @@ impl Config { Ok((x_var, y_var)) } - fn assign_xy_constant( + fn assign_xy_from_constant( &self, value: (Assigned, Assigned), offset: usize, @@ -159,7 +159,7 @@ impl Config { (value.x().into(), value.y().into()) }; - self.assign_xy_constant(value, offset, region) + self.assign_xy_from_constant(value, offset, region) .map(|(x, y)| EccPoint::from_coordinates_unchecked(x, y)) } diff --git a/halo2_gadgets/src/sinsemilla/primitives.rs b/halo2_gadgets/src/sinsemilla/primitives.rs index f90c63ac..ad9e397b 100644 --- a/halo2_gadgets/src/sinsemilla/primitives.rs +++ b/halo2_gadgets/src/sinsemilla/primitives.rs @@ -185,7 +185,7 @@ impl HashDomain { #[allow(non_snake_case)] pub struct CommitDomain { /// A domain in which $\mathsf{SinsemillaHashToPoint}$ and $\mathsf{SinsemillaHash}$ can be used - pub M: HashDomain, + M: HashDomain, R: pallas::Point, } @@ -226,6 +226,13 @@ impl CommitDomain { .map(|p| p + Wnaf::new().scalar(r).base(self.R)) } + /// $\mathsf{SinsemillaHashToPoint}$ from [ยง 5.4.1.9][concretesinsemillahash]. + /// + /// [concretesinsemillahash]: https://zips.z.cash/protocol/nu5.pdf#concretesinsemillahash + pub fn hash_to_point(&self, msg: impl Iterator) -> CtOption { + self.M.hash_to_point(msg) + } + /// Returns `SinsemillaCommit_r(personalization, msg) = hash_point + [r]R` /// where `SinsemillaHash(personalization, msg) = hash_point` /// and `R` is derived from the `personalization`.