diff --git a/src/circuit/gadget/sinsemilla/chip.rs b/src/circuit/gadget/sinsemilla/chip.rs index b907ea28..2612bfe4 100644 --- a/src/circuit/gadget/sinsemilla/chip.rs +++ b/src/circuit/gadget/sinsemilla/chip.rs @@ -35,36 +35,37 @@ mod hash_to_point; /// Configuration for the Sinsemilla hash chip #[derive(Eq, PartialEq, Clone, Debug)] pub struct SinsemillaConfig { - // Selector used in the lookup argument as well as Sinsemilla custom gates. + /// Selector used in the lookup argument as well as Sinsemilla custom gates. q_sinsemilla1: Selector, - // Fixed column used in Sinsemilla custom gates. + /// Fixed column used in Sinsemilla custom gates, to toggle behaviour at the ends of + /// message pieces. q_sinsemilla2: Column, - // Fixed column used to constrain hash initialization to be consistent with - // the y-coordinate of the domain Q. + /// Fixed column used to constrain hash initialization to be consistent with + /// the y-coordinate of the domain $Q$. fixed_y_q: Column, - // Advice column used to store the x-coordinate of the accumulator at each - // iteration of the hash. + /// Advice column used to store the x-coordinate of the accumulator at each + /// iteration of the hash. x_a: Column, - // Advice column used to store the x-coordinate of the generator corresponding - // to the message word at each iteration of the hash. This is looked up in the - // generator table. + /// Advice column used to store the x-coordinate of the generator corresponding + /// to the message word at each iteration of the hash. This is looked up in the + /// generator table. x_p: Column, - // Advice column used to load the message. + /// Advice column used to load the message. bits: Column, - // Advice column used to store the lambda_1 intermediate value at each - // iteration. + /// Advice column used to store the $\lambda_1$ intermediate value at each + /// iteration. lambda_1: Column, - // Advice column used to store the lambda_2 intermediate value at each - // iteration. + /// Advice column used to store the $\lambda_2$ intermediate value at each + /// iteration. lambda_2: Column, - // The lookup table where (idx, x_p, y_p) are loaded for the 2^K generators - // of the Sinsemilla hash. + /// The lookup table where $(\mathsf{idx}, x_p, y_p)$ are loaded for the $2^K$ + /// generators of the Sinsemilla hash. generator_table: GeneratorTableConfig, - // Fixed column shared by the whole circuit. This is used to load the - // x-coordinate of the domain Q, which is then constrained to equal the - // initial x_a. + /// Fixed column shared by the whole circuit. This is used to load the + /// x-coordinate of the domain $Q$, which is then constrained to equal the + /// initial $x_a$. constants: Column, - // Permutation over all advice columns and the `constants` fixed column. + /// Permutation over all advice columns and the `constants` fixed column. perm: Permutation, } diff --git a/src/circuit/gadget/sinsemilla/chip/hash_to_point.rs b/src/circuit/gadget/sinsemilla/chip/hash_to_point.rs index b02ae85a..7bc24031 100644 --- a/src/circuit/gadget/sinsemilla/chip/hash_to_point.rs +++ b/src/circuit/gadget/sinsemilla/chip/hash_to_point.rs @@ -161,11 +161,12 @@ impl SinsemillaChip { } #[allow(clippy::type_complexity)] - // Hash a message piece containing `piece.length` number of `K`-bit words. - // To avoid a duplicate assignment, the accumulator x-coordinate provided - // by the caller is not copied. This only works because `hash_piece()` is - // an internal API. Before this call to `hash_piece()`, x_a MUST have been - // already assigned within this region at the correct offset. + /// Hashes a message piece containing `piece.length` number of `K`-bit words. + /// + /// To avoid a duplicate assignment, the accumulator x-coordinate provided + /// by the caller is not copied. This only works because `hash_piece()` is + /// an internal API. Before this call to `hash_piece()`, x_a MUST have been + /// already assigned within this region at the correct offset. fn hash_piece( &self, region: &mut Region<'_, pallas::Base>, @@ -409,7 +410,7 @@ impl SinsemillaChip { } } -// The x-coordinate of the accumulator in a Sinsemilla hash instance. +/// The x-coordinate of the accumulator in a Sinsemilla hash instance. struct X(CellValue); impl From> for X { @@ -426,10 +427,11 @@ impl Deref for X { } } -// The y-coordinate of the accumulator in a Sinsemilla hash instance. -// This is never actually witnessed until the last round, since it -// can be derived from other variables. Thus it only exists as a field -// element, not a `CellValue`. +/// The y-coordinate of the accumulator in a Sinsemilla hash instance. +/// +/// This is never actually witnessed until the last round, since it +/// can be derived from other variables. Thus it only exists as a field +/// element, not a `CellValue`. struct Y(Option); impl From> for Y { diff --git a/src/circuit/gadget/sinsemilla/message.rs b/src/circuit/gadget/sinsemilla/message.rs index 63917bf3..20616123 100644 --- a/src/circuit/gadget/sinsemilla/message.rs +++ b/src/circuit/gadget/sinsemilla/message.rs @@ -36,7 +36,7 @@ impl std:: pub struct MessagePiece { cell: Cell, field_elem: Option, - // The number of K-bit words in this message piece. + /// The number of K-bit words in this message piece. num_words: usize, }