Skip to content

Commit

Permalink
Cleanup docs (#153)
Browse files Browse the repository at this point in the history
* Cleanup docs

* Ignore multi_proof doctest
  • Loading branch information
rubdos authored Oct 21, 2024
1 parent bd97ccc commit 26a1514
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
12 changes: 7 additions & 5 deletions crypto-primitives/src/merkle_tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,13 @@ impl<P: Config> Path<P> {
/// [I]J L M
/// ```
/// Suppose we want to prove I and J, then:
/// `leaf_indexes` is: [2,3] (indexes in Merkle Tree leaves vector)
/// `leaf_siblings_hashes`: [J,I]
/// `auth_paths_prefix_lenghts`: [0,2]
/// `auth_paths_suffixes`: [ [C,D], []]
/// `leaf_indexes` is: `[2,3]` (indexes in Merkle Tree leaves vector)
/// `leaf_siblings_hashes`: `[J,I]`
/// `auth_paths_prefix_lenghts`: `[0,2]`
/// `auth_paths_suffixes`: `[ [C,D], []]`
/// We can reconstruct the paths incrementally:
/// First, we reconstruct the first path. The prefix length is 0, hence we do not have any prefix encoding.
/// The path is thus [C,D].
/// The path is thus `[C,D]`.
/// Once the first path is verified, we can reconstruct the second path.
/// The prefix length of 2 means that the path prefix will be `previous_path[:2] -> [C,D]`.
/// Since the Merkle Tree branch is the same, the authentication path is the same (which means in this case that there is no suffix).
Expand Down Expand Up @@ -586,7 +586,9 @@ impl<P: Config> MerkleTree<P> {
/// instead of
/// `num_leaves*(num_leaves.log2()-1)`
/// When verifying the proof, leaves hashes should be supplied in order, that is:
/// ```ignore
/// let ordered_leaves: Vec<_> = self.leaf_indexes.into_iter().map(|i| leaves[i]).collect();
/// ```
pub fn generate_multi_proof(
&self,
indexes: impl IntoIterator<Item = usize>,
Expand Down
4 changes: 2 additions & 2 deletions crypto-primitives/src/snark/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ pub trait SNARKGadget<F: PrimeField, ConstraintF: PrimeField, S: SNARK<F>> {

/// Information about the R1CS constraints required to check proofs relative
/// a given verification key. In the context of a LPCP-based pairing-based SNARK
/// like that of [[Groth16]](https://eprint.iacr.org/2016/260),
/// like that of [Groth16](https://eprint.iacr.org/2016/260),
/// this is independent of the R1CS matrices,
/// whereas for more "complex" SNARKs like [[Marlin]](https://eprint.iacr.org/2019/1047),
/// whereas for more "complex" SNARKs like [Marlin](https://eprint.iacr.org/2019/1047),
/// this can encode information about the highest degree of polynomials
/// required to verify proofs.
type VerifierSize: PartialOrd + Clone + fmt::Debug;
Expand Down
6 changes: 3 additions & 3 deletions crypto-primitives/src/sponge/constraints/absorb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ impl<F: PrimeField, A: AbsorbGadget<F>> AbsorbGadget<F> for &A {
}
}

/// Individually absorbs each element in a comma-separated list of [`Absorbable`]s into a sponge.
/// Individually absorbs each element in a comma-separated list of [`AbsorbGadget`]s into a sponge.
/// Format is `absorb!(s, a_0, a_1, ..., a_n)`, where `s` is a mutable reference to a sponge
/// and each `a_i` implements `AbsorbableVar`.
/// and each `a_i` implements [`AbsorbGadget`].
#[macro_export]
macro_rules! absorb_gadget {
($sponge:expr, $($absorbable:expr),+ ) => {
Expand All @@ -225,7 +225,7 @@ macro_rules! absorb_gadget {
};
}

/// Quickly convert a list of different [`Absorbable`]s into sponge field elements.
/// Quickly convert a list of different [`AbsorbGadget`]s into sponge field elements.
#[macro_export]
macro_rules! collect_sponge_field_elements_gadget {
($head:expr $(, $tail:expr)* ) => {
Expand Down

0 comments on commit 26a1514

Please sign in to comment.