Skip to content

Commit

Permalink
Update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ConstanceBeguier committed Nov 23, 2023
1 parent 4c92c78 commit 77abf73
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
17 changes: 5 additions & 12 deletions halo2_gadgets/src/sinsemilla.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<C::Base>,
Expand All @@ -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<C::Base>,
Expand All @@ -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<C::Base>,
Expand Down
16 changes: 16 additions & 0 deletions halo2_gadgets/src/sinsemilla/chip/generator_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

Check failure on line 85 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `0`

Check failure on line 85 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `0`

Check failure on line 85 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `0`

Check failure on line 85 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `0`
/// | 1 | X(S[1]) | Y(S[1]) | 0 |

Check failure on line 86 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `1`

Check failure on line 86 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `1`

Check failure on line 86 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `1`

Check failure on line 86 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `1`
/// | ... | ... | ... | 0 |
/// | 2^10-1 | X(S[2^10-1]) | Y(S[2^10-1]) | 0 |
/// | 0 | X(S[0]) | Y(S[0]) | 4 |

Check failure on line 89 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `0`

Check failure on line 89 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `0`

Check failure on line 89 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `0`

Check failure on line 89 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `0`
/// | 1 | X(S[1]) | Y(S[1]) | 4 |

Check failure on line 90 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `1`

Check failure on line 90 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `1`

Check failure on line 90 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `1`

Check failure on line 90 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `1`
/// | ... | ... | ... | 4 |
/// | 2^4-1 | X(S[2^4-1]) | Y(S[2^4-1]) | 4 |
/// | 0 | X(S[0]) | Y(S[0]) | 5 |

Check failure on line 93 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `0`

Check failure on line 93 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `0`

Check failure on line 93 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `0`

Check failure on line 93 in halo2_gadgets/src/sinsemilla/chip/generator_table.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

unresolved link to `0`
/// | 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<pallas::Base>) -> Result<(), Error> {
layouter.assign_table(
|| "generator_table",
Expand Down
3 changes: 0 additions & 3 deletions halo2_gadgets/src/sinsemilla/chip/hash_to_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down
2 changes: 1 addition & 1 deletion halo2_gadgets/src/utilities/lookup_range_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl<F: PrimeFieldBits, const K: usize> LookupRangeCheckConfig<F, K> {
* 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()
Expand Down

0 comments on commit 77abf73

Please sign in to comment.