diff --git a/zebra-chain/src/orchard/tree.rs b/zebra-chain/src/orchard/tree.rs index c8cab34b..a2c86a3e 100644 --- a/zebra-chain/src/orchard/tree.rs +++ b/zebra-chain/src/orchard/tree.rs @@ -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. + /// + /// + /// + /// Note: MerkleDepth^Orchard = MERKLE_DEPTH = 32. inner: bridgetree::Frontier, + /// A cached root of the tree. /// /// Every time the root is computed by [`Self::root`] it is cached here, diff --git a/zebra-chain/src/sapling/tree.rs b/zebra-chain/src/sapling/tree.rs index 1f02d6f4..15af1ba7 100644 --- a/zebra-chain/src/sapling/tree.rs +++ b/zebra-chain/src/sapling/tree.rs @@ -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. + /// + /// + /// + /// Note: MerkleDepth^Sapling = MERKLE_DEPTH = 32. inner: bridgetree::Frontier, + /// A cached root of the tree. /// /// Every time the root is computed by [`Self::root`] it is cached here, diff --git a/zebra-chain/src/sprout/tree.rs b/zebra-chain/src/sprout/tree.rs index 06fd59de..ffc2a0c2 100644 --- a/zebra-chain/src/sprout/tree.rs +++ b/zebra-chain/src/sprout/tree.rs @@ -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. + /// + /// + /// + /// Note: MerkleDepth^Sprout = MERKLE_DEPTH = 29. inner: bridgetree::Frontier, /// A cached root of the tree.