diff --git a/halo2_gadgets/src/sinsemilla.rs b/halo2_gadgets/src/sinsemilla.rs index 2a9c92a79c..71f7d27a58 100644 --- a/halo2_gadgets/src/sinsemilla.rs +++ b/halo2_gadgets/src/sinsemilla.rs @@ -442,9 +442,8 @@ where } #[allow(clippy::type_complexity)] - /// $\mathsf{SinsemillaCommit}$ from [§ 5.4.8.4][concretesinsemillacommit]. - /// - /// [concretesinsemillacommit]: https://zips.z.cash/protocol/nu5.pdf#concretesinsemillacommit + /// Evaluates the Sinsemilla hash of `message` from the public initial point `Q` stored + /// into `CommitDomain`. pub fn hash( &self, layouter: impl Layouter, @@ -462,9 +461,7 @@ where #[allow(non_snake_case)] #[allow(clippy::type_complexity)] - /// $\mathsf{SinsemillaCommit}$ from [§ 5.4.8.4][concretesinsemillacommit]. - /// - /// [concretesinsemillacommit]: https://zips.z.cash/protocol/nu5.pdf#concretesinsemillacommit + /// Evaluates the Sinsemilla hash of `message` from the private initial point `Q`. pub fn hash_with_private_init( &self, layouter: impl Layouter, @@ -482,17 +479,13 @@ where } #[allow(clippy::type_complexity)] - /// $\mathsf{SinsemillaCommit}$ from [§ 5.4.8.4][concretesinsemillacommit]. - /// - /// [concretesinsemillacommit]: https://zips.z.cash/protocol/nu5.pdf#concretesinsemillacommit + /// Returns the public initial point `Q` stored into `CommitDomain`. pub fn q_init(&self) -> C { self.M.Q } #[allow(clippy::type_complexity)] - /// $\mathsf{SinsemillaCommit}$ from [§ 5.4.8.4][concretesinsemillacommit]. - /// - /// [concretesinsemillacommit]: https://zips.z.cash/protocol/nu5.pdf#concretesinsemillacommit + /// Evaluates the blinding factor equal to $[r] R$ where `r` is stored in the `CommitDomain`. pub fn blinding_factor( &self, mut layouter: impl Layouter, diff --git a/halo2_gadgets/src/sinsemilla/chip/generator_table.rs b/halo2_gadgets/src/sinsemilla/chip/generator_table.rs index 13773a4659..002045e751 100644 --- a/halo2_gadgets/src/sinsemilla/chip/generator_table.rs +++ b/halo2_gadgets/src/sinsemilla/chip/generator_table.rs @@ -78,6 +78,22 @@ impl GeneratorTableConfig { }); } + /// Load the generator table into the circuit. + /// + /// | table_idx | table_x | table_y | table_range_check_tag | + /// ------------------------------------------------------------------- + /// | 0 | X(S[0]) | Y(S[0]) | 0 | + /// | 1 | X(S[1]) | Y(S[1]) | 0 | + /// | ... | ... | ... | 0 | + /// | 2^10-1 | X(S[2^10-1]) | Y(S[2^10-1]) | 0 | + /// | 0 | X(S[0]) | Y(S[0]) | 4 | + /// | 1 | X(S[1]) | Y(S[1]) | 4 | + /// | ... | ... | ... | 4 | + /// | 2^4-1 | X(S[2^4-1]) | Y(S[2^4-1]) | 4 | + /// | 0 | X(S[0]) | Y(S[0]) | 5 | + /// | 1 | X(S[1]) | Y(S[1]) | 5 | + /// | ... | ... | ... | 5 | + /// | 2^5-1 | X(S[2^5-1]) | Y(S[2^5-1]) | 5 | pub fn load(&self, layouter: &mut impl Layouter) -> Result<(), Error> { layouter.assign_table( || "generator_table", diff --git a/halo2_gadgets/src/sinsemilla/chip/hash_to_point.rs b/halo2_gadgets/src/sinsemilla/chip/hash_to_point.rs index 771d2a9c5f..226e5e8a05 100644 --- a/halo2_gadgets/src/sinsemilla/chip/hash_to_point.rs +++ b/halo2_gadgets/src/sinsemilla/chip/hash_to_point.rs @@ -253,9 +253,6 @@ where #[allow(clippy::type_complexity)] /// Hash `message` from the initial point `Q`. - /// - /// Before this call to `hash_all_pieces()`, `x_Q` and `y_Q` MUST have been already assigned - /// within this region. fn hash_all_pieces( &self, region: &mut Region<'_, pallas::Base>, diff --git a/halo2_gadgets/src/utilities/lookup_range_check.rs b/halo2_gadgets/src/utilities/lookup_range_check.rs index d1173babbc..64b4ce4c90 100644 --- a/halo2_gadgets/src/utilities/lookup_range_check.rs +++ b/halo2_gadgets/src/utilities/lookup_range_check.rs @@ -150,7 +150,7 @@ impl LookupRangeCheckConfig { * q_range_check_4 * Expression::Constant(F::from(4_u64)); - // Combine the running sum and short lookups: + // Combine the running sum, short lookups and optimized range checks: vec![ ( q_lookup.clone()