Document the consensus rules for note commitment trees (#3319)

Co-authored-by: teor <teor@riseup.net>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Marek 2022-01-14 02:28:35 +01:00 committed by GitHub
parent e9c2125e7e
commit ece2d0f09b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 0 deletions

View File

@ -221,7 +221,17 @@ pub struct NoteCommitmentTree {
/// It consists of nodes along the rightmost (newer) branch of the tree that
/// has non-empty nodes. Upper (near root) empty nodes of the branch are not
/// stored.
///
/// # Consensus
///
/// > [NU5 onward] A block MUST NOT add Orchard note commitments that would result in the Orchard note
/// > commitment tree exceeding its capacity of 2^(MerkleDepth^Orchard) leaf nodes.
///
/// <https://zips.z.cash/protocol/protocol.pdf#merkletree>
///
/// Note: MerkleDepth^Orchard = MERKLE_DEPTH = 32.
inner: bridgetree::Frontier<Node, { MERKLE_DEPTH as u8 }>,
/// A cached root of the tree.
///
/// Every time the root is computed by [`Self::root`] it is cached here,

View File

@ -184,7 +184,17 @@ pub struct NoteCommitmentTree {
/// It consists of nodes along the rightmost (newer) branch of the tree that
/// has non-empty nodes. Upper (near root) empty nodes of the branch are not
/// stored.
///
/// # Consensus
///
/// > [Sapling onward] A block MUST NOT add Sapling note commitments that would result in the Sapling note
/// > commitment tree exceeding its capacity of 2^(MerkleDepth^Sapling) leaf nodes.
///
/// <https://zips.z.cash/protocol/protocol.pdf#merkletree>
///
/// Note: MerkleDepth^Sapling = MERKLE_DEPTH = 32.
inner: bridgetree::Frontier<Node, { MERKLE_DEPTH as u8 }>,
/// A cached root of the tree.
///
/// Every time the root is computed by [`Self::root`] it is cached here,

View File

@ -209,6 +209,15 @@ pub struct NoteCommitmentTree {
/// consists of nodes along the rightmost (newer) branch of the tree that
/// has non-empty nodes. Upper (near root) empty nodes of the branch are not
/// stored.
///
/// # Consensus
///
/// > A block MUST NOT add Sprout note commitments that would result in the Sprout note commitment tree
/// > exceeding its capacity of 2^(MerkleDepth^Sprout) leaf nodes.
///
/// <https://zips.z.cash/protocol/protocol.pdf#merkletree>
///
/// Note: MerkleDepth^Sprout = MERKLE_DEPTH = 29.
inner: bridgetree::Frontier<Node, { MERKLE_DEPTH as u8 }>,
/// A cached root of the tree.